Skip to content

Commit 576145f

Browse files
committed
Update how types are exported
1 parent 6aa96cc commit 576145f

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/index.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import {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+
36
import {AmbiguousError} from './errors/ambiguous.js'
47
import {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'
78
import {getPsqlConfigs, sshTunnel} from './utils/pg/bastion.js'
89
import {getConfigVarNameFromAttachment} from './utils/pg/config-vars.js'
910
import DatabaseResolver from './utils/pg/databases.js'
@@ -17,15 +18,14 @@ import {styledObject} from './ux/styled-object.js'
1718
import {table} from './ux/table.js'
1819
import {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

3131
export 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

Comments
 (0)