11import { APIClient } from '@heroku-cli/command'
22
3+ import type * as DataApiTypes from './types/pg/data-api.js'
4+ import type * as TunnelTypes from './types/pg/tunnel.js'
5+
36import { AmbiguousError } from './errors/ambiguous.js'
47import { NotFound } from './errors/not-found.js'
5- import { AddOnWithRelatedData , ExtendedAddonAttachment , Link } from './types/pg/data-api.js'
6- import { ConnectionDetails , ConnectionDetailsWithAttachment , TunnelConfig } from './types/pg/tunnel.js'
78import { getPsqlConfigs , sshTunnel } from './utils/pg/bastion.js'
89import { getConfigVarNameFromAttachment } from './utils/pg/config-vars.js'
910import DatabaseResolver from './utils/pg/databases.js'
@@ -17,15 +18,14 @@ import {styledObject} from './ux/styled-object.js'
1718import { table } from './ux/table.js'
1819import { wait } from './ux/wait.js'
1920
20- export const types = {
21- pg : {
22- AddOnWithRelatedData : { } as AddOnWithRelatedData ,
23- ConnectionDetails : { } as ConnectionDetails ,
24- ConnectionDetailsWithAttachment : { } as ConnectionDetailsWithAttachment ,
25- ExtendedAddonAttachment : { } as ExtendedAddonAttachment ,
26- Link : { } as Link ,
27- TunnelConfig : { } as TunnelConfig ,
28- } ,
21+ // eslint-disable-next-line @typescript-eslint/no-namespace
22+ export namespace pg {
23+ export type AddOnWithRelatedData = DataApiTypes . AddOnWithRelatedData
24+ export type ExtendedAddonAttachment = DataApiTypes . ExtendedAddonAttachment
25+ export type Link = DataApiTypes . Link
26+ export type ConnectionDetails = TunnelTypes . ConnectionDetails
27+ export type ConnectionDetailsWithAttachment = TunnelTypes . ConnectionDetailsWithAttachment
28+ export type TunnelConfig = TunnelTypes . TunnelConfig
2929}
3030
3131export const utils = {
@@ -42,15 +42,15 @@ export const utils = {
4242 appId : string ,
4343 attachmentId ?: string ,
4444 namespace ?: string ,
45- ) : Promise < ConnectionDetailsWithAttachment > {
45+ ) : Promise < TunnelTypes . ConnectionDetailsWithAttachment > {
4646 const databaseResolver = new DatabaseResolver ( heroku )
4747 return databaseResolver . getDatabase ( appId , attachmentId , namespace )
4848 } ,
4949 } ,
5050 host : getHost ,
5151 psql : {
5252 exec (
53- connectionDetails : ConnectionDetailsWithAttachment ,
53+ connectionDetails : TunnelTypes . ConnectionDetailsWithAttachment ,
5454 query : string ,
5555 psqlCmdArgs : string [ ] = [ ] ,
5656 ) : Promise < string > {
0 commit comments