heroku 10.13.2 → 10.14.0

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.
Files changed (79) hide show
  1. package/lib/commands/pg/backups/cancel.js +4 -4
  2. package/lib/commands/pg/backups/capture.js +5 -5
  3. package/lib/commands/pg/backups/delete.js +2 -2
  4. package/lib/commands/pg/backups/download.js +3 -3
  5. package/lib/commands/pg/backups/index.js +2 -2
  6. package/lib/commands/pg/backups/info.js +3 -3
  7. package/lib/commands/pg/backups/restore.js +5 -5
  8. package/lib/commands/pg/backups/schedule.js +7 -7
  9. package/lib/commands/pg/backups/schedules.js +2 -2
  10. package/lib/commands/pg/backups/unschedule.js +6 -5
  11. package/lib/commands/pg/backups/url.js +3 -3
  12. package/lib/commands/pg/bloat.js +5 -4
  13. package/lib/commands/pg/blocking.js +5 -4
  14. package/lib/commands/pg/connection-pooling/attach.js +5 -6
  15. package/lib/commands/pg/copy.js +6 -7
  16. package/lib/commands/pg/credentials/create.js +4 -4
  17. package/lib/commands/pg/credentials/destroy.js +4 -4
  18. package/lib/commands/pg/credentials/repair-default.js +4 -4
  19. package/lib/commands/pg/credentials/rotate.js +4 -4
  20. package/lib/commands/pg/credentials/url.js +4 -4
  21. package/lib/commands/pg/credentials.js +4 -4
  22. package/lib/commands/pg/diagnose.js +6 -5
  23. package/lib/commands/pg/info.js +5 -3
  24. package/lib/commands/pg/kill.js +6 -5
  25. package/lib/commands/pg/killall.js +4 -4
  26. package/lib/commands/pg/links/create.js +10 -8
  27. package/lib/commands/pg/links/destroy.js +4 -4
  28. package/lib/commands/pg/links/index.js +14 -8
  29. package/lib/commands/pg/locks.js +5 -4
  30. package/lib/commands/pg/maintenance/index.js +4 -4
  31. package/lib/commands/pg/maintenance/run.js +4 -4
  32. package/lib/commands/pg/maintenance/window.js +4 -4
  33. package/lib/commands/pg/outliers.d.ts +2 -2
  34. package/lib/commands/pg/outliers.js +9 -7
  35. package/lib/commands/pg/promote.js +5 -4
  36. package/lib/commands/pg/ps.js +6 -5
  37. package/lib/commands/pg/psql.js +6 -4
  38. package/lib/commands/pg/pull.d.ts +1 -1
  39. package/lib/commands/pg/pull.js +4 -4
  40. package/lib/commands/pg/push.d.ts +1 -1
  41. package/lib/commands/pg/push.js +4 -4
  42. package/lib/commands/pg/reset.js +4 -4
  43. package/lib/commands/pg/settings/index.js +2 -2
  44. package/lib/commands/pg/unfollow.js +5 -5
  45. package/lib/commands/pg/upgrade/cancel.js +5 -5
  46. package/lib/commands/pg/upgrade/dryrun.js +5 -5
  47. package/lib/commands/pg/upgrade/index.js +5 -5
  48. package/lib/commands/pg/upgrade/prepare.js +5 -5
  49. package/lib/commands/pg/upgrade/run.js +5 -5
  50. package/lib/commands/pg/upgrade/wait.js +9 -4
  51. package/lib/commands/pg/vacuum-stats.js +5 -4
  52. package/lib/commands/pg/wait.js +6 -4
  53. package/lib/commands/run/detached.d.ts +1 -0
  54. package/lib/commands/run/detached.js +5 -1
  55. package/lib/commands/run/index.d.ts +1 -0
  56. package/lib/commands/run/index.js +7 -2
  57. package/lib/commands/run/inside.js +1 -6
  58. package/lib/lib/addons/resolve.d.ts +6 -7
  59. package/lib/lib/pg/backups.js +4 -4
  60. package/lib/lib/pg/fetcher.d.ts +3 -34
  61. package/lib/lib/pg/fetcher.js +3 -92
  62. package/lib/lib/pg/psql.d.ts +5 -36
  63. package/lib/lib/pg/psql.js +17 -195
  64. package/lib/lib/pg/push_pull.d.ts +2 -7
  65. package/lib/lib/pg/push_pull.js +9 -7
  66. package/lib/lib/pg/setter.js +3 -3
  67. package/lib/lib/pg/types.d.ts +10 -15
  68. package/lib/lib/pg/util.d.ts +6 -32
  69. package/lib/lib/pg/util.js +3 -70
  70. package/lib/lib/run/helpers.d.ts +10 -0
  71. package/lib/lib/run/helpers.js +22 -1
  72. package/oclif.manifest.json +430 -418
  73. package/package.json +4 -6
  74. package/lib/lib/pg/bastion.d.ts +0 -29
  75. package/lib/lib/pg/bastion.js +0 -121
  76. package/lib/lib/pg/config.d.ts +0 -2
  77. package/lib/lib/pg/config.js +0 -13
  78. package/lib/lib/pg/host.d.ts +0 -1
  79. package/lib/lib/pg/host.js +0 -6
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "heroku",
3
3
  "description": "CLI to interact with Heroku",
4
- "version": "10.13.2",
4
+ "version": "10.14.0",
5
5
  "author": "Heroku",
6
6
  "bin": "./bin/run",
7
7
  "bugs": "https://github.com/heroku/cli/issues",
@@ -13,7 +13,7 @@
13
13
  "@heroku-cli/schema": "^1.0.25",
14
14
  "@heroku/buildpack-registry": "^1.0.1",
15
15
  "@heroku/eventsource": "^1.0.7",
16
- "@heroku/heroku-cli-util": "^9.0.2",
16
+ "@heroku/heroku-cli-util": "^9.1.3",
17
17
  "@heroku/http-call": "^5.5.0",
18
18
  "@heroku/mcp-server": "1.0.7-alpha.1",
19
19
  "@heroku/plugin-ai": "^1.0.1",
@@ -36,7 +36,6 @@
36
36
  "@opentelemetry/sdk-trace-node": "^1.15.1",
37
37
  "@opentelemetry/semantic-conventions": "^1.24.1",
38
38
  "@types/js-yaml": "^3.12.5",
39
- "@types/tunnel-ssh": "4.1.1",
40
39
  "ansi-escapes": "3.2.0",
41
40
  "async-file": "^2.0.2",
42
41
  "bytes": "^3.1.2",
@@ -62,7 +61,7 @@
62
61
  "printf": "0.6.1",
63
62
  "psl": "^1.9.0",
64
63
  "redis-parser": "^3.0.0",
65
- "rollbar": "^2.26.2",
64
+ "rollbar": "^2.26.4",
66
65
  "semver": "7.6.1",
67
66
  "shell-escape": "^0.2.0",
68
67
  "shell-quote": "^1.8.1",
@@ -76,7 +75,6 @@
76
75
  "true-myth": "2.2.3",
77
76
  "tsheredoc": "^1.0.1",
78
77
  "tslib": "1.14.1",
79
- "tunnel-ssh": "4.1.6",
80
78
  "urijs": "^1.19.11",
81
79
  "validator": "^13.7.0",
82
80
  "word-wrap": "^1.2.5",
@@ -400,5 +398,5 @@
400
398
  "version": "oclif readme --multi && git add README.md ../../docs"
401
399
  },
402
400
  "types": "lib/index.d.ts",
403
- "gitHead": "82c0564fc0683341fc4591d60135b3772ecc3526"
401
+ "gitHead": "c0d7800f947ef8f1a1836a8d735a0cd05795eac4"
404
402
  }
@@ -1,29 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { APIClient } from '@heroku-cli/command';
4
- import * as createTunnel from 'tunnel-ssh';
5
- import { ConnectionDetails } from './util';
6
- export declare const getBastion: (config: Record<string, string>, baseName: string) => {
7
- bastionHost: string;
8
- bastionKey: string;
9
- } | {
10
- bastionHost?: undefined;
11
- bastionKey?: undefined;
12
- };
13
- export declare const env: (db: ConnectionDetails) => {
14
- PGAPPNAME: string;
15
- PGSSLMODE: string;
16
- } & NodeJS.ProcessEnv;
17
- export declare type TunnelConfig = createTunnel.Config;
18
- export declare function tunnelConfig(db: ConnectionDetails): TunnelConfig;
19
- export declare function getConfigs(db: ConnectionDetails): {
20
- dbEnv: NodeJS.ProcessEnv;
21
- dbTunnelConfig: createTunnel.Config;
22
- };
23
- export declare function sshTunnel(db: ConnectionDetails, dbTunnelConfig: TunnelConfig, timeout?: number): Promise<void | import("net").Server | null>;
24
- export declare function fetchConfig(heroku: APIClient, db: {
25
- id: string;
26
- }): Promise<import("@heroku/http-call").HTTP<{
27
- host: string;
28
- private_key: string;
29
- }>>;
@@ -1,121 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchConfig = exports.sshTunnel = exports.getConfigs = exports.tunnelConfig = exports.env = exports.getBastion = void 0;
4
- const debug = require('debug')('pg');
5
- const EventEmitter = require("node:events");
6
- const createTunnel = require("tunnel-ssh");
7
- const util_1 = require("util");
8
- const host_1 = require("./host");
9
- const core_1 = require("@oclif/core");
10
- const getBastion = function (config, baseName) {
11
- // If there are bastions, extract a host and a key
12
- // otherwise, return an empty Object
13
- // If there are bastions:
14
- // * there should be one *_BASTION_KEY
15
- // * pick one host from the comma-separated list in *_BASTIONS
16
- // We assert that _BASTIONS and _BASTION_KEY always exist together
17
- // If either is falsy, pretend neither exist
18
- const bastionKey = config[`${baseName}_BASTION_KEY`];
19
- const bastions = (config[`${baseName}_BASTIONS`] || '').split(',');
20
- const bastionHost = bastions[Math.floor(Math.random() * bastions.length)];
21
- return (bastionKey && bastionHost) ? { bastionHost, bastionKey } : {};
22
- };
23
- exports.getBastion = getBastion;
24
- const env = (db) => {
25
- const baseEnv = Object.assign({
26
- PGAPPNAME: 'psql non-interactive',
27
- PGSSLMODE: (!db.host || db.host === 'localhost') ? 'prefer' : 'require',
28
- }, process.env);
29
- const mapping = {
30
- PGUSER: 'user',
31
- PGPASSWORD: 'password',
32
- PGDATABASE: 'database',
33
- PGPORT: 'port',
34
- PGHOST: 'host',
35
- };
36
- Object.keys(mapping).forEach(envVar => {
37
- const val = db[mapping[envVar]];
38
- if (val) {
39
- baseEnv[envVar] = val;
40
- }
41
- });
42
- return baseEnv;
43
- };
44
- exports.env = env;
45
- function tunnelConfig(db) {
46
- const localHost = '127.0.0.1';
47
- const localPort = Math.floor((Math.random() * (65535 - 49152)) + 49152);
48
- return {
49
- username: 'bastion',
50
- host: db.bastionHost,
51
- privateKey: db.bastionKey,
52
- dstHost: db.host || undefined,
53
- dstPort: (db.port && Number.parseInt(db.port, 10)) || undefined,
54
- localHost,
55
- localPort,
56
- };
57
- }
58
- exports.tunnelConfig = tunnelConfig;
59
- function getConfigs(db) {
60
- const dbEnv = (0, exports.env)(db);
61
- const dbTunnelConfig = tunnelConfig(db);
62
- if (db.bastionKey) {
63
- Object.assign(dbEnv, {
64
- PGPORT: dbTunnelConfig.localPort,
65
- PGHOST: dbTunnelConfig.localHost,
66
- });
67
- }
68
- return {
69
- dbEnv,
70
- dbTunnelConfig,
71
- };
72
- }
73
- exports.getConfigs = getConfigs;
74
- class Timeout {
75
- constructor(timeout, message) {
76
- this.events = new EventEmitter();
77
- this.timeout = timeout;
78
- this.message = message;
79
- }
80
- async promise() {
81
- this.timer = setTimeout(() => {
82
- this.events.emit('error', new Error(this.message));
83
- }, this.timeout);
84
- try {
85
- await EventEmitter.once(this.events, 'cancelled');
86
- }
87
- finally {
88
- clearTimeout(this.timer);
89
- }
90
- }
91
- cancel() {
92
- this.events.emit('cancelled');
93
- }
94
- }
95
- async function sshTunnel(db, dbTunnelConfig, timeout = 10000) {
96
- if (!db.bastionKey) {
97
- return null;
98
- }
99
- const timeoutInstance = new Timeout(timeout, 'Establishing a secure tunnel timed out');
100
- const createSSHTunnel = (0, util_1.promisify)(createTunnel);
101
- try {
102
- return await Promise.race([
103
- timeoutInstance.promise(),
104
- createSSHTunnel(dbTunnelConfig),
105
- ]);
106
- }
107
- catch (error) {
108
- debug(error);
109
- core_1.ux.error('Unable to establish a secure tunnel to your database.');
110
- }
111
- finally {
112
- timeoutInstance.cancel();
113
- }
114
- }
115
- exports.sshTunnel = sshTunnel;
116
- async function fetchConfig(heroku, db) {
117
- return heroku.get(`/client/v11/databases/${encodeURIComponent(db.id)}/bastion`, {
118
- hostname: (0, host_1.default)(),
119
- });
120
- }
121
- exports.fetchConfig = fetchConfig;
@@ -1,2 +0,0 @@
1
- import type { APIClient } from '@heroku-cli/command';
2
- export declare function getConfig(heroku: APIClient, app: string): Promise<Record<string, string> | undefined>;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConfig = void 0;
4
- const responseByAppId = new Map();
5
- async function getConfig(heroku, app) {
6
- if (!responseByAppId.has(app)) {
7
- const promise = heroku.get(`/apps/${app}/config-vars`);
8
- responseByAppId.set(app, promise);
9
- }
10
- const result = await responseByAppId.get(app);
11
- return result === null || result === void 0 ? void 0 : result.body;
12
- }
13
- exports.getConfig = getConfig;
@@ -1 +0,0 @@
1
- export default function (): string;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function default_1() {
4
- return process.env.HEROKU_DATA_HOST || 'api.data.heroku.com';
5
- }
6
- exports.default = default_1;