@heroku/heroku-cli-util 9.1.3-beta.3 → 9.1.3-beta.5

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 CHANGED
@@ -3,6 +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
7
  import DatabaseResolver from './utils/pg/databases';
7
8
  import getHost from './utils/pg/host';
8
9
  import PsqlService from './utils/pg/psql';
@@ -40,6 +41,7 @@ export declare const utils: {
40
41
  host: typeof getHost;
41
42
  psql: {
42
43
  exec(connectionDetails: ConnectionDetailsWithAttachment, query: string, psqlCmdArgs?: string[]): Promise<string>;
44
+ getPsqlConfigs: typeof getPsqlConfigs;
43
45
  };
44
46
  };
45
47
  };
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ exports.hux = exports.utils = exports.types = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ambiguous_1 = require("./errors/ambiguous");
6
6
  const not_found_1 = require("./errors/not-found");
7
+ const bastion_1 = require("./utils/pg/bastion");
7
8
  const databases_1 = tslib_1.__importDefault(require("./utils/pg/databases"));
8
9
  const host_1 = tslib_1.__importDefault(require("./utils/pg/host"));
9
10
  const psql_1 = tslib_1.__importDefault(require("./utils/pg/psql"));
@@ -46,6 +47,7 @@ exports.utils = {
46
47
  const psqlService = new psql_1.default(connectionDetails);
47
48
  return psqlService.execQuery(query, psqlCmdArgs);
48
49
  },
50
+ getPsqlConfigs: bastion_1.getPsqlConfigs,
49
51
  },
50
52
  },
51
53
  };
@@ -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
- parsePostgresConnectionString(connStringOrDbName) {
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 = this.parsePostgresConnectionString(config[connStringVar]);
137
+ const conn = DatabaseResolver.parsePostgresConnectionString(config[connStringVar]);
137
138
  const payload = {
138
139
  attachment,
139
140
  database: conn.database,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heroku/heroku-cli-util",
3
- "version": "9.1.3-beta.3",
3
+ "version": "9.1.3-beta.5",
4
4
  "description": "Set of helpful CLI utilities",
5
5
  "author": "Heroku",
6
6
  "license": "ISC",