@heroku/heroku-cli-util 9.1.3-beta.6 → 9.1.3-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import type { APIClient } from '@heroku-cli/command';
2
2
  import { Server } from 'node:net';
3
3
  import { ExtendedAddonAttachment } from '../../types/pg/data-api';
4
- import { BastionConfig, ConnectionDetailsWithAttachment, TunnelConfig } from '../../types/pg/tunnel';
4
+ import { BastionConfig, ConnectionDetails, TunnelConfig } from '../../types/pg/tunnel';
5
5
  /**
6
6
  * Determines whether the attachment belongs to an add-on installed onto a non-shield Private Space.
7
7
  * If true, the bastion information needs to be fetched from the Data API.
@@ -43,7 +43,7 @@ export declare const getBastionConfig: (config: Record<string, string>, baseName
43
43
  * @param connectionDetails - The database connection details with attachment information
44
44
  * @returns Object containing database environment variables and tunnel configuration
45
45
  */
46
- export declare function getPsqlConfigs(connectionDetails: ConnectionDetailsWithAttachment): {
46
+ export declare function getPsqlConfigs(connectionDetails: ConnectionDetails): {
47
47
  dbEnv: NodeJS.ProcessEnv;
48
48
  dbTunnelConfig: TunnelConfig;
49
49
  };
@@ -58,7 +58,7 @@ export type PsqlConfigs = ReturnType<typeof getPsqlConfigs>;
58
58
  * @returns Promise that resolves to the tunnel server or null if no bastion key is provided
59
59
  * @throws Error if unable to establish the tunnel
60
60
  */
61
- export declare function sshTunnel(connectionDetails: ConnectionDetailsWithAttachment, dbTunnelConfig: TunnelConfig, timeout?: number, createSSHTunnel?: typeof createSSHTunnelAdapter): Promise<Server | void>;
61
+ export declare function sshTunnel(connectionDetails: ConnectionDetails, dbTunnelConfig: TunnelConfig, timeout?: number, createSSHTunnel?: typeof createSSHTunnelAdapter): Promise<Server | void>;
62
62
  /**
63
63
  * Adapter for tunnel-ssh v5 API. Translates our TunnelConfig into the v5
64
64
  * createTunnel(tunnelOptions, serverOptions, sshOptions, forwardOptions) call
@@ -57,7 +57,7 @@ export default class DatabaseResolver {
57
57
  * @param config - The record of app config vars with their values
58
58
  * @returns Connection details with attachment information
59
59
  */
60
- private getConnectionDetails;
60
+ getConnectionDetails(attachment: ExtendedAddonAttachment, config?: Record<string, string>): ConnectionDetailsWithAttachment;
61
61
  /**
62
62
  * Helper function that attempts to find a single addon attachment matching the given database identifier
63
63
  * (attachment name, id, or config var name).
@@ -130,6 +130,7 @@ class DatabaseResolver {
130
130
  * @param config - The record of app config vars with their values
131
131
  * @returns Connection details with attachment information
132
132
  */
133
+ // eslint-disable-next-line perfectionist/sort-classes
133
134
  getConnectionDetails(attachment, config = {}) {
134
135
  const connStringVar = (0, config_vars_1.getConfigVarNameFromAttachment)(attachment, config);
135
136
  // build the default payload for non-bastion dbs
@@ -1,6 +1,6 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { Server } from 'node:net';
3
- import { ConnectionDetailsWithAttachment, TunnelConfig } from '../../types/pg/tunnel';
3
+ import { ConnectionDetails, TunnelConfig } from '../../types/pg/tunnel';
4
4
  import { getPsqlConfigs, sshTunnel } from './bastion';
5
5
  /**
6
6
  * A small wrapper around tunnel-ssh so that other code doesn't have to worry about whether there is or is not a tunnel.
@@ -22,7 +22,7 @@ export declare class Tunnel {
22
22
  * @param tunnelFn - The function to create the SSH tunnel (default: sshTunnel)
23
23
  * @returns Promise that resolves to a new Tunnel instance
24
24
  */
25
- static connect(connectionDetails: ConnectionDetailsWithAttachment, tunnelConfig: TunnelConfig, tunnelFn: typeof sshTunnel): Promise<Tunnel>;
25
+ static connect(connectionDetails: ConnectionDetails, tunnelConfig: TunnelConfig, tunnelFn: typeof sshTunnel): Promise<Tunnel>;
26
26
  /**
27
27
  * Closes the tunnel if it exists, or emits a fake close event if no tunnel is needed.
28
28
  *
@@ -42,7 +42,7 @@ export default class PsqlService {
42
42
  private readonly getPsqlConfigsFn;
43
43
  private readonly spawnFn;
44
44
  private readonly tunnelFn;
45
- constructor(connectionDetails: ConnectionDetailsWithAttachment, getPsqlConfigsFn?: typeof getPsqlConfigs, spawnFn?: typeof spawn, tunnelFn?: typeof sshTunnel);
45
+ constructor(connectionDetails: ConnectionDetails, getPsqlConfigsFn?: typeof getPsqlConfigs, spawnFn?: typeof spawn, tunnelFn?: typeof sshTunnel);
46
46
  /**
47
47
  * Executes a PostgreSQL query using the instance's database connection details.
48
48
  * It uses the `getPsqlConfigs` function to get the configuration for the database and the tunnel,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heroku/heroku-cli-util",
3
- "version": "9.1.3-beta.6",
3
+ "version": "9.1.3-beta.8",
4
4
  "description": "Set of helpful CLI utilities",
5
5
  "author": "Heroku",
6
6
  "license": "ISC",