heroku 10.7.1-alpha.1 → 10.8.0-beta.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.
package/README.md CHANGED
@@ -36,7 +36,6 @@ For other issues, [submit a support ticket](https://help.heroku.com/).
36
36
  * [`heroku access`](docs/access.md) - manage user access to apps
37
37
  * [`heroku accounts`](docs/accounts.md) - list the Heroku accounts in your cache
38
38
  * [`heroku addons`](docs/addons.md) - tools and services for developing, extending, and operating your app
39
- * [`heroku ai`](docs/ai.md) - manage Heroku AI models
40
39
  * [`heroku apps`](docs/apps.md) - manage apps on Heroku
41
40
  * [`heroku auth`](docs/auth.md) - manage authentication for your Heroku account
42
41
  * [`heroku authorizations`](docs/authorizations.md) - OAuth authorizations
package/bin/run CHANGED
@@ -1,15 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const {Config} = require('@oclif/core')
4
- const root = require.resolve('../package.json')
5
- const config = new Config({root})
6
-
7
3
  process.env.HEROKU_UPDATE_INSTRUCTIONS = process.env.HEROKU_UPDATE_INSTRUCTIONS || 'update with: "npm update -g heroku"'
8
4
 
9
5
  const now = new Date()
10
6
  const cliStartTime = now.getTime()
11
7
  const globalTelemetry = require('../lib/global_telemetry')
12
- const yargs = require('yargs-parser')(process.argv.slice(2))
13
8
 
14
9
  process.once('beforeExit', async code => {
15
10
  // capture as successful exit
@@ -43,37 +38,13 @@ process.on('SIGTERM', async () => {
43
38
  globalTelemetry.initializeInstrumentation()
44
39
 
45
40
  const oclif = require('@oclif/core')
46
- const oclifFlush = require('@oclif/core/flush')
47
- const oclifError = require('@oclif/core/handle')
48
- const {promptUser} = require('./heroku-prompts')
49
- const {herokuRepl} = require('./heroku-repl')
50
-
51
- const main = async () => {
52
- try {
53
- await config.load()
54
- const {_: [commandName, ...args], ...flags} = yargs
55
- if (!commandName && args.length === 0 && Object.keys(flags).length === 0) {
56
- await herokuRepl(config)
57
- return
58
- }
59
-
60
- if (flags.prompt) {
61
- delete flags.prompt
62
- await promptUser(config, commandName, args, flags)
63
- await oclif.run([commandName, ...args], config)
64
- } else {
65
- await oclif.run(undefined, config)
66
- }
67
41
 
68
- await oclifFlush()
69
- } catch (error) {
70
- // capture any errors raised by oclif
71
- const cliError = error
72
- cliError.cliRunDuration = globalTelemetry.computeDuration(cliStartTime)
73
- await globalTelemetry.sendTelemetry(cliError)
42
+ oclif.run().then(require('@oclif/core/flush')).catch(async error => {
43
+ // capture any errors raised by oclif
44
+ const cliError = error
45
+ cliError.cliRunDuration = globalTelemetry.computeDuration(cliStartTime)
46
+ await globalTelemetry.sendTelemetry(cliError)
74
47
 
75
- oclifError(error)
76
- }
77
- }
48
+ return require('@oclif/core/handle')(error)
49
+ })
78
50
 
79
- main()
package/lib/analytics.js CHANGED
@@ -15,8 +15,6 @@ class AnalyticsCommand {
15
15
  }
16
16
  async record(opts) {
17
17
  await this.initialize;
18
- const mcpMode = process.env.HEROKU_MCP_MODE === 'true';
19
- const mcpServerVersion = process.env.HEROKU_MCP_SERVER_VERSION || 'unknown';
20
18
  const plugin = opts.Command.plugin;
21
19
  if (!plugin) {
22
20
  debug('no plugin found for analytics');
@@ -31,7 +29,7 @@ class AnalyticsCommand {
31
29
  cli: this.config.name,
32
30
  command: opts.Command.id,
33
31
  completion: await this._acAnalytics(opts.Command.id),
34
- version: `${this.config.version}${mcpMode ? ` (MCP ${mcpServerVersion})` : ''}`,
32
+ version: this.config.version,
35
33
  plugin: plugin.name,
36
34
  plugin_version: plugin.version,
37
35
  os: this.config.platform,
@@ -0,0 +1,13 @@
1
+ import { Command } from '@heroku-cli/command';
2
+ export default class Upgrade extends Command {
3
+ static topic: string;
4
+ static description: string;
5
+ static flags: {
6
+ confirm: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ };
9
+ static args: {
10
+ database: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const color_1 = require("@heroku-cli/color");
4
+ const command_1 = require("@heroku-cli/command");
5
+ const core_1 = require("@oclif/core");
6
+ const tsheredoc_1 = require("tsheredoc");
7
+ const fetcher_1 = require("../../../lib/pg/fetcher");
8
+ const host_1 = require("../../../lib/pg/host");
9
+ const util_1 = require("../../../lib/pg/util");
10
+ const confirmCommand_1 = require("../../../lib/confirmCommand");
11
+ const nls_1 = require("../../../nls");
12
+ class Upgrade extends command_1.Command {
13
+ async run() {
14
+ const { flags, args } = await this.parse(Upgrade);
15
+ const { app, confirm } = flags;
16
+ const { database } = args;
17
+ const db = await (0, fetcher_1.getAddon)(this.heroku, app, database);
18
+ if ((0, util_1.legacyEssentialPlan)(db))
19
+ core_1.ux.error(`You can only use ${color_1.default.cmd('pg:upgrade:*')} commands on Essential-* and higher plans.`);
20
+ if ((0, util_1.essentialNumPlan)(db))
21
+ core_1.ux.error(`You can't use ${color_1.default.cmd('pg:upgrade:cancel')} on Essential-tier databases. You can only use this command on Standard-tier and higher leader databases.`);
22
+ const { body: replica } = await this.heroku.get(`/client/v11/databases/${db.id}`, { hostname: (0, host_1.default)() });
23
+ if (replica.following)
24
+ core_1.ux.error(`You can't use ${color_1.default.cmd('pg:upgrade:cancel')} on follower databases. You can only use this command on Standard-tier and higher leader databases.`);
25
+ await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
26
+ Destructive action
27
+ You're canceling the scheduled version upgrade for ${color_1.default.addon(db.name)}.
28
+
29
+ You can't undo this action.
30
+ `));
31
+ try {
32
+ core_1.ux.action.start(`Cancelling upgrade on ${color_1.default.addon(db.name)}`);
33
+ const response = await this.heroku.post(`/client/v11/databases/${db.id}/upgrade/cancel`, { hostname: (0, host_1.default)(), body: {} });
34
+ core_1.ux.action.stop('done\n' + (0, util_1.formatResponseWithCommands)(response.body.message));
35
+ }
36
+ catch (error) {
37
+ const response = error;
38
+ core_1.ux.error((0, util_1.formatResponseWithCommands)(response.body.message) + `\n\nError ID: ${response.body.id}`);
39
+ }
40
+ }
41
+ }
42
+ exports.default = Upgrade;
43
+ Upgrade.topic = 'pg';
44
+ Upgrade.description = (0, tsheredoc_1.default)(`
45
+ cancels a scheduled upgrade. You can't cancel a version upgrade that's in progress.
46
+ `);
47
+ Upgrade.flags = {
48
+ confirm: command_1.flags.string({ char: 'c' }),
49
+ app: command_1.flags.app({ required: true }),
50
+ };
51
+ Upgrade.args = {
52
+ database: core_1.Args.string({ description: `${(0, nls_1.nls)('pg:database:arg:description')} ${(0, nls_1.nls)('pg:database:arg:description:default:suffix')}` }),
53
+ };
@@ -0,0 +1,14 @@
1
+ import { Command } from '@heroku-cli/command';
2
+ export default class Upgrade extends Command {
3
+ static topic: string;
4
+ static description: string;
5
+ static flags: {
6
+ confirm: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ version: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ };
10
+ static args: {
11
+ database: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const color_1 = require("@heroku-cli/color");
4
+ const command_1 = require("@heroku-cli/command");
5
+ const core_1 = require("@oclif/core");
6
+ const tsheredoc_1 = require("tsheredoc");
7
+ const fetcher_1 = require("../../../lib/pg/fetcher");
8
+ const host_1 = require("../../../lib/pg/host");
9
+ const util_1 = require("../../../lib/pg/util");
10
+ const confirmCommand_1 = require("../../../lib/confirmCommand");
11
+ const nls_1 = require("../../../nls");
12
+ class Upgrade extends command_1.Command {
13
+ async run() {
14
+ const { flags, args } = await this.parse(Upgrade);
15
+ const { app, version, confirm } = flags;
16
+ const { database } = args;
17
+ const db = await (0, fetcher_1.getAddon)(this.heroku, app, database);
18
+ if ((0, util_1.legacyEssentialPlan)(db))
19
+ core_1.ux.error(`You can only use ${color_1.default.cmd('pg:upgrade:*')} commands on Essential-* and higher plans.`);
20
+ if ((0, util_1.essentialNumPlan)(db))
21
+ core_1.ux.error(`You can't use ${color_1.default.cmd('pg:upgrade:dryrun')} on Essential-tier databases. You can only use this command on Standard-tier and higher leader databases.`);
22
+ const versionPhrase = version ? (0, tsheredoc_1.default)(`Postgres version ${version}`) : (0, tsheredoc_1.default)('the latest supported Postgres version');
23
+ const { body: replica } = await this.heroku.get(`/client/v11/databases/${db.id}`, { hostname: (0, host_1.default)() });
24
+ if (replica.following)
25
+ core_1.ux.error(`You can't use ${color_1.default.cmd('pg:upgrade:dryrun')} on follower databases. You can only use this command on Standard-tier and higher leader databases.`);
26
+ await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
27
+ Destructive action
28
+ This command starts a test upgrade for ${color_1.default.addon(db.name)} to ${versionPhrase}.
29
+ `));
30
+ try {
31
+ const data = { version };
32
+ core_1.ux.action.start(`Starting a test upgrade on ${color_1.default.addon(db.name)}`);
33
+ const response = await this.heroku.post(`/client/v11/databases/${db.id}/upgrade/dry_run`, { hostname: (0, host_1.default)(), body: data });
34
+ core_1.ux.action.stop('done\n' + (0, util_1.formatResponseWithCommands)(response.body.message));
35
+ }
36
+ catch (error) {
37
+ const response = error;
38
+ core_1.ux.error((0, util_1.formatResponseWithCommands)(response.body.message) + `\n\nError ID: ${response.body.id}`);
39
+ }
40
+ }
41
+ }
42
+ exports.default = Upgrade;
43
+ Upgrade.topic = 'pg';
44
+ Upgrade.description = (0, tsheredoc_1.default)(`
45
+ simulates a Postgres version upgrade on a Standard-tier and higher leader database by creating and upgrading a follower database. Heroku sends the results of the test upgrade via email.
46
+ `);
47
+ Upgrade.flags = {
48
+ confirm: command_1.flags.string({ char: 'c' }),
49
+ version: command_1.flags.string({ char: 'v', description: 'Postgres version to upgrade to' }),
50
+ app: command_1.flags.app({ required: true }),
51
+ };
52
+ Upgrade.args = {
53
+ database: core_1.Args.string({ description: `${(0, nls_1.nls)('pg:database:arg:description')} ${(0, nls_1.nls)('pg:database:arg:description:default:suffix')}` }),
54
+ };
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const color_1 = require("@heroku-cli/color");
4
+ const command_1 = require("@heroku-cli/command");
5
+ const core_1 = require("@oclif/core");
6
+ const tsheredoc_1 = require("tsheredoc");
7
+ const fetcher_1 = require("../../../lib/pg/fetcher");
8
+ const host_1 = require("../../../lib/pg/host");
9
+ const util_1 = require("../../../lib/pg/util");
10
+ const confirmCommand_1 = require("../../../lib/confirmCommand");
11
+ const nls_1 = require("../../../nls");
12
+ class Upgrade extends command_1.Command {
13
+ async run() {
14
+ const { flags, args } = await this.parse(Upgrade);
15
+ const { app, version, confirm } = flags;
16
+ const { database } = args;
17
+ const db = await (0, fetcher_1.getAddon)(this.heroku, app, database);
18
+ if ((0, util_1.legacyEssentialPlan)(db))
19
+ core_1.ux.error(`You can only use ${color_1.default.cmd('heroku pg:upgrade')} on Essential-tier databases and follower databases on Standard-tier and higher plans.`);
20
+ const versionPhrase = version ? (0, tsheredoc_1.default)(`Postgres version ${version}`) : (0, tsheredoc_1.default)('the latest supported Postgres version');
21
+ const { body: replica } = await this.heroku.get(`/client/v11/databases/${db.id}`, { hostname: (0, host_1.default)() });
22
+ if (replica.following) {
23
+ const { body: configVars } = await this.heroku.get(`/apps/${app}/config-vars`);
24
+ const origin = (0, util_1.databaseNameFromUrl)(replica.following, configVars);
25
+ await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
26
+ We're deprecating this command. To upgrade your database's Postgres version, use the new ${color_1.default.cmd('pg:upgrade:*')} subcommands. See https://devcenter.heroku.com/changelog-items/3179.
27
+
28
+ Destructive action
29
+ You're upgrading ${color_1.default.addon(db.name)} to ${versionPhrase}. The database will stop following ${origin} and become writable.
30
+
31
+ You can't undo this action.
32
+ `));
33
+ }
34
+ else if ((0, util_1.essentialNumPlan)(db)) {
35
+ await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
36
+ We're deprecating this command. To upgrade your database's Postgres version, use the new ${color_1.default.cmd('pg:upgrade:*')} subcommands. See https://devcenter.heroku.com/changelog-items/3179.
37
+
38
+ Destructive action
39
+ You're upgrading ${color_1.default.addon(db.name)} to ${versionPhrase}.
40
+
41
+ You can't undo this action.
42
+ `));
43
+ }
44
+ else {
45
+ core_1.ux.warn((0, tsheredoc_1.default)(`
46
+ We're deprecating this command. To upgrade your database's Postgres version, use the new ${color_1.default.cmd('pg:upgrade:*')} subcommands. See https://devcenter.heroku.com/changelog-items/3179.`));
47
+ core_1.ux.error(`You can only use ${color_1.default.cmd('heroku pg:upgrade')} on Essential-tier databases and follower databases on Standard-tier and higher plans.`);
48
+ }
49
+ try {
50
+ const data = { version };
51
+ core_1.ux.action.start(`Starting upgrade on ${color_1.default.addon(db.name)}`);
52
+ const response = await this.heroku.post(`/client/v11/databases/${db.id}/upgrade`, { hostname: (0, host_1.default)(), body: data });
53
+ core_1.ux.action.stop((0, tsheredoc_1.default)(`done\n${(0, util_1.formatResponseWithCommands)(response.body.message)}`));
54
+ }
55
+ catch (error) {
56
+ const response = error;
57
+ core_1.ux.error((0, tsheredoc_1.default)(`${(0, util_1.formatResponseWithCommands)(response.body.message)}\n\nError ID: ${response.body.id}`));
58
+ }
59
+ }
60
+ }
61
+ exports.default = Upgrade;
62
+ Upgrade.topic = 'pg';
63
+ Upgrade.description = (0, tsheredoc_1.default)(`
64
+ We're deprecating this command. To upgrade your database's Postgres version, use the new ${color_1.default.cmd('pg:upgrade:*')} subcommands. See https://devcenter.heroku.com/changelog-items/3179.
65
+
66
+ For an Essential-tier plan, this command upgrades the database's Postgres version. For a Standard-tier and higher plan, this command unfollows the leader database before upgrading the Postgres version.
67
+ `);
68
+ Upgrade.flags = {
69
+ confirm: command_1.flags.string({ char: 'c' }),
70
+ version: command_1.flags.string({ char: 'v', description: 'Postgres version to upgrade to' }),
71
+ app: command_1.flags.app({ required: true }),
72
+ remote: command_1.flags.remote(),
73
+ };
74
+ Upgrade.args = {
75
+ database: core_1.Args.string({ description: `${(0, nls_1.nls)('pg:database:arg:description')} ${(0, nls_1.nls)('pg:database:arg:description:default:suffix')}` }),
76
+ };
@@ -0,0 +1,14 @@
1
+ import { Command } from '@heroku-cli/command';
2
+ export default class Upgrade extends Command {
3
+ static topic: string;
4
+ static description: string;
5
+ static flags: {
6
+ confirm: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ version: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ };
10
+ static args: {
11
+ database: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const color_1 = require("@heroku-cli/color");
4
+ const command_1 = require("@heroku-cli/command");
5
+ const core_1 = require("@oclif/core");
6
+ const tsheredoc_1 = require("tsheredoc");
7
+ const fetcher_1 = require("../../../lib/pg/fetcher");
8
+ const host_1 = require("../../../lib/pg/host");
9
+ const util_1 = require("../../../lib/pg/util");
10
+ const confirmCommand_1 = require("../../../lib/confirmCommand");
11
+ const nls_1 = require("../../../nls");
12
+ class Upgrade extends command_1.Command {
13
+ async run() {
14
+ const { flags, args } = await this.parse(Upgrade);
15
+ const { app, version, confirm } = flags;
16
+ const { database } = args;
17
+ const db = await (0, fetcher_1.getAddon)(this.heroku, app, database);
18
+ if ((0, util_1.legacyEssentialPlan)(db))
19
+ core_1.ux.error(`You can only use ${color_1.default.cmd('pg:upgrade:*')} commands on Essential-* and higher plans.`);
20
+ if ((0, util_1.essentialNumPlan)(db))
21
+ core_1.ux.error(`You can only use ${color_1.default.cmd('heroku pg:upgrade:prepare')} on Standard-tier and higher leader databases. For Essential-tier databases, use ${color_1.default.cmd('heroku pg:upgrade:run')} instead.`);
22
+ const versionPhrase = version ? (0, tsheredoc_1.default)(`Postgres version ${version}`) : (0, tsheredoc_1.default)('the latest supported Postgres version');
23
+ const { body: replica } = await this.heroku.get(`/client/v11/databases/${db.id}`, { hostname: (0, host_1.default)() });
24
+ if (replica.following)
25
+ core_1.ux.error(`You can only use ${color_1.default.cmd('heroku pg:upgrade:prepare')} on Standard-tier and higher leader databases. For follower databases, use ${color_1.default.cmd('heroku pg:upgrade:run')} instead.`);
26
+ await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
27
+ Destructive action
28
+ This command prepares the upgrade for ${color_1.default.addon(db.name)} to ${versionPhrase} and schedules to upgrade it during the next available maintenance window.
29
+ `));
30
+ try {
31
+ const data = { version };
32
+ core_1.ux.action.start(`Preparing upgrade on ${color_1.default.addon(db.name)}`);
33
+ const response = await this.heroku.post(`/client/v11/databases/${db.id}/upgrade/prepare`, { hostname: (0, host_1.default)(), body: data });
34
+ core_1.ux.action.stop((0, tsheredoc_1.default)(`done\n${(0, util_1.formatResponseWithCommands)(response.body.message)}`));
35
+ }
36
+ catch (error) {
37
+ const response = error;
38
+ core_1.ux.error((0, tsheredoc_1.default)(`${(0, util_1.formatResponseWithCommands)(response.body.message)}\n\nError ID: ${response.body.id}`));
39
+ }
40
+ }
41
+ }
42
+ exports.default = Upgrade;
43
+ Upgrade.topic = 'pg';
44
+ Upgrade.description = (0, tsheredoc_1.default)(`
45
+ prepares the upgrade for Standard-tier and higher leader databases and schedules it for the next available maintenance window. To start a version upgrade on Essential-tier and follower databases, use ${color_1.default.cmd('heroku pg:upgrade:run')} instead.
46
+ `);
47
+ Upgrade.flags = {
48
+ confirm: command_1.flags.string({ char: 'c' }),
49
+ version: command_1.flags.string({ char: 'v', description: 'Postgres version to upgrade to' }),
50
+ app: command_1.flags.app({ required: true }),
51
+ };
52
+ Upgrade.args = {
53
+ database: core_1.Args.string({ description: `${(0, nls_1.nls)('pg:database:arg:description')} ${(0, nls_1.nls)('pg:database:arg:description:default:suffix')}` }),
54
+ };
@@ -0,0 +1,16 @@
1
+ import { Command } from '@heroku-cli/command';
2
+ export default class Upgrade extends Command {
3
+ static topic: string;
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ confirm: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ version: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ };
12
+ static args: {
13
+ database: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
14
+ };
15
+ run(): Promise<void>;
16
+ }
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const color_1 = require("@heroku-cli/color");
4
+ const command_1 = require("@heroku-cli/command");
5
+ const core_1 = require("@oclif/core");
6
+ const tsheredoc_1 = require("tsheredoc");
7
+ const fetcher_1 = require("../../../lib/pg/fetcher");
8
+ const host_1 = require("../../../lib/pg/host");
9
+ const util_1 = require("../../../lib/pg/util");
10
+ const confirmCommand_1 = require("../../../lib/confirmCommand");
11
+ const nls_1 = require("../../../nls");
12
+ class Upgrade extends command_1.Command {
13
+ async run() {
14
+ const { flags, args } = await this.parse(Upgrade);
15
+ const { app, version, confirm } = flags;
16
+ const { database } = args;
17
+ const db = await (0, fetcher_1.getAddon)(this.heroku, app, database);
18
+ if ((0, util_1.legacyEssentialPlan)(db))
19
+ core_1.ux.error(`You can only use ${color_1.default.cmd('pg:upgrade:*')} commands on Essential-* and higher plans.`);
20
+ const versionPhrase = version ? (0, tsheredoc_1.default)(`Postgres version ${version}`) : (0, tsheredoc_1.default)('the latest supported Postgres version');
21
+ const { body: replica } = await this.heroku.get(`/client/v11/databases/${db.id}`, { hostname: (0, host_1.default)() });
22
+ if ((0, util_1.essentialNumPlan)(db)) {
23
+ await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
24
+ Destructive action
25
+ You're upgrading ${color_1.default.addon(db.name)} to ${versionPhrase}.
26
+
27
+ You can't undo this action.
28
+ `));
29
+ }
30
+ else if (replica.following) {
31
+ const { body: configVars } = await this.heroku.get(`/apps/${app}/config-vars`);
32
+ const origin = (0, util_1.databaseNameFromUrl)(replica.following, configVars);
33
+ await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
34
+ Destructive action
35
+ You're upgrading ${color_1.default.addon(db.name)} to ${versionPhrase}. The database will stop following ${origin} and become writable.
36
+
37
+ You can't undo this action.
38
+ `));
39
+ }
40
+ else {
41
+ await (0, confirmCommand_1.default)(app, confirm, (0, tsheredoc_1.default)(`
42
+ Destructive action
43
+ You're upgrading the Postgres version on ${color_1.default.addon(db.name)}. This action also upgrades any followers on the database.
44
+
45
+ You can't undo this action.
46
+ `));
47
+ }
48
+ try {
49
+ const data = { version };
50
+ core_1.ux.action.start(`Starting upgrade on ${color_1.default.addon(db.name)}`);
51
+ const response = await this.heroku.post(`/client/v11/databases/${db.id}/upgrade/run`, { hostname: (0, host_1.default)(), body: data });
52
+ core_1.ux.action.stop((0, tsheredoc_1.default)(`done\n${(0, util_1.formatResponseWithCommands)(response.body.message)}`));
53
+ }
54
+ catch (error) {
55
+ if (error instanceof Error && 'body' in error) {
56
+ const response = error;
57
+ core_1.ux.error((0, tsheredoc_1.default)(`${(0, util_1.formatResponseWithCommands)(response.body.message)}\n\nError ID: ${response.body.id}`));
58
+ }
59
+ else {
60
+ throw error;
61
+ }
62
+ }
63
+ }
64
+ }
65
+ exports.default = Upgrade;
66
+ Upgrade.topic = 'pg';
67
+ Upgrade.description = (0, tsheredoc_1.default)(`
68
+ starts a Postgres version upgrade
69
+
70
+ On Essential-tier databases, this command upgrades the database's Postgres version.
71
+
72
+ On Standard-tier and higher leader databases, this command runs a previously scheduled Postgres version upgrade. You must run ${color_1.default.cmd('pg:upgrade:prepare')} before this command to schedule a version upgrade.
73
+
74
+ On follower databases, this command unfollows the leader database before upgrading the follower's Postgres version.
75
+ `);
76
+ Upgrade.examples = [
77
+ (0, tsheredoc_1.default) `
78
+ # Upgrade an Essential-tier database to a specific version
79
+ $ heroku pg:upgrade:run postgresql-curved-12345 --version 14 --app myapp
80
+ `,
81
+ (0, tsheredoc_1.default) `
82
+ # Upgrade a Standard-tier follower database to the latest supported version
83
+ $ heroku pg:upgrade:run HEROKU_POSTGRESQL_BLUE_URL --app myapp
84
+ `,
85
+ (0, tsheredoc_1.default) `
86
+ # Run a previously scheduled upgrade on a Standard-tier leader database
87
+ $ heroku pg:upgrade:run DATABASE_URL --app myapp
88
+ `,
89
+ ];
90
+ Upgrade.flags = {
91
+ confirm: command_1.flags.string({ char: 'c' }),
92
+ version: command_1.flags.string({ char: 'v', description: 'Postgres version to upgrade to' }),
93
+ app: command_1.flags.app({ required: true }),
94
+ remote: command_1.flags.remote({ char: 'r' }),
95
+ };
96
+ Upgrade.args = {
97
+ database: core_1.Args.string({ description: `${(0, nls_1.nls)('pg:database:arg:description')} ${(0, nls_1.nls)('pg:database:arg:description:default:suffix')}` }),
98
+ };
@@ -0,0 +1,16 @@
1
+ import { Command } from '@heroku-cli/command';
2
+ export default class Wait extends Command {
3
+ static topic: string;
4
+ static description: string;
5
+ static flags: {
6
+ 'wait-interval': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ 'no-notify': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ };
11
+ static examples: string[];
12
+ static args: {
13
+ database: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
14
+ };
15
+ run(): Promise<void>;
16
+ }
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const color_1 = require("@heroku-cli/color");
4
+ const command_1 = require("@heroku-cli/command");
5
+ const core_1 = require("@oclif/core");
6
+ const debug_1 = require("debug");
7
+ const tsheredoc_1 = require("tsheredoc");
8
+ const fetcher_1 = require("../../../lib/pg/fetcher");
9
+ const host_1 = require("../../../lib/pg/host");
10
+ const notify_1 = require("../../../lib/notify");
11
+ const http_call_1 = require("@heroku/http-call");
12
+ const nls_1 = require("../../../nls");
13
+ const util_1 = require("../../../lib/pg/util");
14
+ const wait = (ms) => new Promise(resolve => {
15
+ setTimeout(resolve, ms);
16
+ });
17
+ class Wait extends command_1.Command {
18
+ async run() {
19
+ const { flags, args } = await this.parse(Wait);
20
+ const { app, 'wait-interval': waitInterval } = flags;
21
+ const dbName = args.database;
22
+ const pgDebug = (0, debug_1.default)('pg');
23
+ const waitFor = async (db) => {
24
+ const interval = (!waitInterval || waitInterval < 0) ? 5 : waitInterval;
25
+ let status;
26
+ let waiting = false;
27
+ let retries = 20;
28
+ const notFoundMessage = 'Waiting to provision...';
29
+ while (true) {
30
+ try {
31
+ ({ body: status } = await this.heroku.get(`/client/v11/databases/${db.id}/upgrade/wait_status`, { hostname: (0, host_1.default)() }));
32
+ }
33
+ catch (error) {
34
+ if (error instanceof http_call_1.HTTPError && (!retries || error.statusCode !== 404)) {
35
+ const httpError = error;
36
+ pgDebug(httpError);
37
+ throw httpError;
38
+ }
39
+ retries--;
40
+ status = { 'waiting?': true, message: notFoundMessage };
41
+ }
42
+ let message = (0, util_1.formatResponseWithCommands)(status.message);
43
+ if (status.step)
44
+ message = (0, tsheredoc_1.default)(`(${status.step}) ${message}`);
45
+ if (status['error?']) {
46
+ (0, notify_1.default)('error', `${db.name} ${message}`, false);
47
+ core_1.ux.error(message || '', { exit: 1 });
48
+ }
49
+ if (!status['waiting?']) {
50
+ if (waiting) {
51
+ core_1.ux.action.stop(message);
52
+ }
53
+ else {
54
+ core_1.ux.log((0, tsheredoc_1.default)(`Waiting for database ${color_1.default.yellow(db.name)}... ${message}`));
55
+ }
56
+ return;
57
+ }
58
+ if (!waiting) {
59
+ waiting = true;
60
+ core_1.ux.action.start(`Waiting for database ${color_1.default.yellow(db.name)}`, message);
61
+ }
62
+ core_1.ux.action.status = message;
63
+ await wait(interval * 1000);
64
+ }
65
+ };
66
+ let dbs = [];
67
+ if (dbName) {
68
+ dbs = [await (0, fetcher_1.getAddon)(this.heroku, app, dbName)];
69
+ }
70
+ else {
71
+ core_1.ux.error((0, tsheredoc_1.default)('You must provide a database. Run `--help` for more information on the command.'));
72
+ }
73
+ for (const db of dbs) {
74
+ await waitFor(db);
75
+ }
76
+ }
77
+ }
78
+ exports.default = Wait;
79
+ Wait.topic = 'pg';
80
+ Wait.description = 'provides the status of an upgrade and blocks it until the operation is complete';
81
+ Wait.flags = {
82
+ 'wait-interval': command_1.flags.integer({ description: 'how frequently to poll in seconds (to avoid rate limiting)' }),
83
+ 'no-notify': command_1.flags.boolean({ description: 'do not show OS notification' }),
84
+ app: command_1.flags.app({ required: true }),
85
+ remote: command_1.flags.remote(),
86
+ };
87
+ Wait.examples = [
88
+ (0, tsheredoc_1.default)(`
89
+ # Wait for upgrade to complete with default settings
90
+ $ heroku pg:upgrade:wait postgresql-curved-12345 --app myapp
91
+ `),
92
+ (0, tsheredoc_1.default)(`
93
+ # Wait with custom polling interval
94
+ $ heroku pg:upgrade:wait postgresql-curved-12345 --app myapp --wait-interval 10
95
+ `),
96
+ (0, tsheredoc_1.default)(`
97
+ # Wait without showing OS notifications
98
+ $ heroku pg:upgrade:wait postgresql-curved-12345 --app myapp --no-notify
99
+ `),
100
+ ];
101
+ Wait.args = {
102
+ database: core_1.Args.string({ description: `${(0, nls_1.nls)('pg:database:arg:description')}` }),
103
+ };
@@ -25,7 +25,7 @@ export declare function initializeInstrumentation(): void;
25
25
  export declare function setupTelemetry(config: any, opts: any): {
26
26
  command: any;
27
27
  os: any;
28
- version: string;
28
+ version: any;
29
29
  exitCode: number;
30
30
  exitState: string;
31
31
  cliRunDuration: number;
@@ -57,12 +57,10 @@ function setupTelemetry(config, opts) {
57
57
  const now = new Date();
58
58
  const cmdStartTime = now.getTime();
59
59
  const isRegularCmd = Boolean(opts.Command);
60
- const mcpMode = process.env.HEROKU_MCP_MODE === 'true';
61
- const mcpServerVersion = process.env.HEROKU_MCP_SERVER_VERSION || 'unknown';
62
60
  const irregularTelemetryObject = {
63
61
  command: opts.id,
64
62
  os: config.platform,
65
- version: `${config.version}${mcpMode ? ` (MCP ${mcpServerVersion})` : ''}`,
63
+ version: config.version,
66
64
  exitCode: 0,
67
65
  exitState: 'successful',
68
66
  cliRunDuration: 0,