@heroku/heroku-cli-util 9.1.3-beta.4 → 9.1.3-beta.6
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.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/utils/pg/databases.d.ts +1 -1
- package/dist/utils/pg/databases.js +3 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { AmbiguousError } from './errors/ambiguous';
|
|
|
3
3
|
import { NotFound } from './errors/not-found';
|
|
4
4
|
import { AddOnWithRelatedData, ExtendedAddonAttachment, Link } from './types/pg/data-api';
|
|
5
5
|
import { ConnectionDetails, ConnectionDetailsWithAttachment, TunnelConfig } from './types/pg/tunnel';
|
|
6
|
-
import { getPsqlConfigs } from './utils/pg/bastion';
|
|
6
|
+
import { getPsqlConfigs, sshTunnel } from './utils/pg/bastion';
|
|
7
7
|
import DatabaseResolver from './utils/pg/databases';
|
|
8
8
|
import getHost from './utils/pg/host';
|
|
9
9
|
import PsqlService from './utils/pg/psql';
|
|
@@ -42,6 +42,7 @@ export declare const utils: {
|
|
|
42
42
|
psql: {
|
|
43
43
|
exec(connectionDetails: ConnectionDetailsWithAttachment, query: string, psqlCmdArgs?: string[]): Promise<string>;
|
|
44
44
|
getPsqlConfigs: typeof getPsqlConfigs;
|
|
45
|
+
sshTunnel: typeof sshTunnel;
|
|
45
46
|
};
|
|
46
47
|
};
|
|
47
48
|
};
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@ export default class DatabaseResolver {
|
|
|
38
38
|
* @param connStringOrDbName - PostgreSQL connection string or local database name
|
|
39
39
|
* @returns Connection details object with parsed connection information
|
|
40
40
|
*/
|
|
41
|
-
parsePostgresConnectionString(connStringOrDbName: string): ConnectionDetails;
|
|
41
|
+
static parsePostgresConnectionString(connStringOrDbName: string): ConnectionDetails;
|
|
42
42
|
/**
|
|
43
43
|
* Fetches all Heroku PostgreSQL add-on attachments for a given app.
|
|
44
44
|
*
|
|
@@ -91,7 +91,8 @@ class DatabaseResolver {
|
|
|
91
91
|
* @param connStringOrDbName - PostgreSQL connection string or local database name
|
|
92
92
|
* @returns Connection details object with parsed connection information
|
|
93
93
|
*/
|
|
94
|
-
|
|
94
|
+
// eslint-disable-next-line perfectionist/sort-classes
|
|
95
|
+
static parsePostgresConnectionString(connStringOrDbName) {
|
|
95
96
|
const dbPath = /:\/\//.test(connStringOrDbName) ? connStringOrDbName : `postgres:///${connStringOrDbName}`;
|
|
96
97
|
const url = new URL(dbPath);
|
|
97
98
|
const { hostname, password, pathname, port, username } = url;
|
|
@@ -133,7 +134,7 @@ class DatabaseResolver {
|
|
|
133
134
|
const connStringVar = (0, config_vars_1.getConfigVarNameFromAttachment)(attachment, config);
|
|
134
135
|
// build the default payload for non-bastion dbs
|
|
135
136
|
pgDebug(`Using "${connStringVar}" to connect to your database…`);
|
|
136
|
-
const conn =
|
|
137
|
+
const conn = DatabaseResolver.parsePostgresConnectionString(config[connStringVar]);
|
|
137
138
|
const payload = {
|
|
138
139
|
attachment,
|
|
139
140
|
database: conn.database,
|