@heroku-cli/plugin-mtls 1.0.2 → 2.0.1

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 (43) hide show
  1. package/README.md +66 -27
  2. package/dist/base.d.ts +8 -8
  3. package/dist/base.js +4 -7
  4. package/dist/commands/data/mtls/certificates/create.d.ts +3 -3
  5. package/dist/commands/data/mtls/certificates/create.js +16 -18
  6. package/dist/commands/data/mtls/certificates/delete.d.ts +4 -4
  7. package/dist/commands/data/mtls/certificates/delete.js +15 -18
  8. package/dist/commands/data/mtls/certificates/download.d.ts +6 -6
  9. package/dist/commands/data/mtls/certificates/download.js +58 -62
  10. package/dist/commands/data/mtls/certificates/get.d.ts +4 -4
  11. package/dist/commands/data/mtls/certificates/get.js +14 -16
  12. package/dist/commands/data/mtls/certificates/index.d.ts +3 -3
  13. package/dist/commands/data/mtls/certificates/index.js +22 -25
  14. package/dist/commands/data/mtls/create.d.ts +3 -3
  15. package/dist/commands/data/mtls/create.js +21 -23
  16. package/dist/commands/data/mtls/destroy.d.ts +3 -3
  17. package/dist/commands/data/mtls/destroy.js +14 -17
  18. package/dist/commands/data/mtls/index.d.ts +3 -3
  19. package/dist/commands/data/mtls/index.js +31 -40
  20. package/dist/commands/data/mtls/ip-rules/create.d.ts +5 -5
  21. package/dist/commands/data/mtls/ip-rules/create.js +19 -21
  22. package/dist/commands/data/mtls/ip-rules/delete.d.ts +5 -5
  23. package/dist/commands/data/mtls/ip-rules/delete.js +18 -21
  24. package/dist/commands/data/mtls/ip-rules/get.d.ts +4 -4
  25. package/dist/commands/data/mtls/ip-rules/get.js +12 -15
  26. package/dist/commands/data/mtls/ip-rules/index.d.ts +3 -3
  27. package/dist/commands/data/mtls/ip-rules/index.js +12 -15
  28. package/dist/index.d.ts +1 -2
  29. package/dist/index.js +1 -3
  30. package/dist/lib/addon-fetcher.d.ts +7 -0
  31. package/dist/lib/addon-fetcher.js +23 -0
  32. package/dist/utils/file-helper.d.ts +1 -1
  33. package/dist/utils/file-helper.js +4 -11
  34. package/dist/utils/is-error-http.js +1 -4
  35. package/dist/utils/is-error-message.js +1 -4
  36. package/dist/utils/table.d.ts +1 -1
  37. package/dist/utils/table.js +11 -16
  38. package/oclif.manifest.json +123 -38
  39. package/package.json +34 -39
  40. package/CHANGELOG.md +0 -1
  41. package/dist/lib/fetcher.d.ts +0 -1
  42. package/dist/lib/fetcher.js +0 -70
  43. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,120 +1,116 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
1
  /* eslint-disable complexity */
5
- const color_1 = require("@heroku-cli/color");
6
- const command_1 = require("@heroku-cli/command");
7
- const core_1 = require("@oclif/core");
8
- const inquirer = tslib_1.__importStar(require("inquirer"));
9
- const node_os_1 = require("node:os");
10
- const base_1 = tslib_1.__importDefault(require("../../../../base"));
11
- const fetcher_1 = tslib_1.__importDefault(require("../../../../lib/fetcher"));
12
- const file_helper_1 = require("../../../../utils/file-helper");
13
- const is_error_http_1 = require("../../../../utils/is-error-http");
14
- const is_error_message_1 = require("../../../../utils/is-error-message");
2
+ import { flags } from '@heroku-cli/command';
3
+ import * as color from '@heroku/heroku-cli-util/color';
4
+ import { confirm } from '@heroku/heroku-cli-util/hux';
5
+ import { select } from '@inquirer/prompts';
6
+ import { Args } from '@oclif/core';
7
+ import { ux } from '@oclif/core/ux';
8
+ import { homedir } from 'node:os';
9
+ import { join } from 'node:path';
10
+ import Command from '../../../../base.js';
11
+ import { fetcher } from '../../../../lib/addon-fetcher.js';
12
+ import { existsSync, mkdirSync, writeFile } from '../../../../utils/file-helper.js';
13
+ import { isErrorHttp } from '../../../../utils/is-error-http.js';
14
+ import { isErrorMessage } from '../../../../utils/is-error-message.js';
15
15
  const write = (path, data, options = null) => new Promise((resolve, reject) => {
16
- (0, file_helper_1.writeFile)(path, data, options, (err) => {
16
+ writeFile(path, data, options, (err) => {
17
17
  if (err)
18
18
  reject(err);
19
19
  resolve();
20
20
  });
21
21
  });
22
- class MTLSCertificateDownload extends base_1.default {
22
+ export default class MTLSCertificateDownload extends Command {
23
23
  static args = {
24
- addon: core_1.Args.string({ required: true, description: 'addon' })
24
+ addon: Args.string({ required: true, description: 'addon' }),
25
25
  };
26
26
  static description = 'download your certificate bundle for your mTLS add-on';
27
27
  static examples = [
28
28
  '$ heroku data:mtls:certificates:download postgresql-sushi-12345 --id "3559a4df-2c82-4473-86cf-181310a6ef4f" -a example-app',
29
29
  '$ heroku data:mtls:certificates:download postgresql-sushi-12345 --id "3559a4df-2c82-4473-86cf-181310a6ef4f" --dir "./folder" -a example-app',
30
- '$ heroku data:mtls:certificates:download postgresql-sushi-12345 --id "3559a4df-2c82-4473-86cf-181310a6ef4f --prefix "prefix_" -a example-app'
30
+ '$ heroku data:mtls:certificates:download postgresql-sushi-12345 --id "3559a4df-2c82-4473-86cf-181310a6ef4f --prefix "prefix_" -a example-app',
31
31
  ];
32
32
  static flags = {
33
- app: command_1.flags.app({ required: true }),
34
- dir: command_1.flags.string({ required: false, description: 'directory to download files to. defaults to HOME:/.postgresql' }),
35
- id: command_1.flags.string({ required: false, description: 'ID of certificate to download' }),
36
- prefix: command_1.flags.string({ required: true, description: 'prefix to put in front of downloaded file names', default: '' })
33
+ app: flags.app({ required: true }),
34
+ dir: flags.string({ required: false, description: 'directory to download files to. defaults to HOME:/.postgresql' }),
35
+ id: flags.string({ required: false, description: 'ID of certificate to download' }),
36
+ prefix: flags.string({ required: true, description: 'prefix to put in front of downloaded file names', default: '' }),
37
37
  };
38
38
  async run() {
39
39
  try {
40
40
  const { args, flags } = await this.parse(MTLSCertificateDownload);
41
- const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
41
+ const addon = await fetcher(this.heroku, args.addon, flags.app);
42
42
  if (addon.kind === 'kafka') {
43
- core_1.ux.error('Kafka certificates are available in your app\'s config vars');
43
+ ux.error('Kafka certificates are available in your app\'s config vars');
44
44
  }
45
- core_1.ux.action.start(`Downloading certificates for ${color_1.color.cyan(addon.name)}`);
45
+ ux.action.start(`Downloading certificates for ${color.addon(addon.name)}`);
46
46
  const [{ body: mtls }, { body: certs }] = await Promise.all([
47
47
  this.shogun.get(addon.endpoint, this.shogun.defaults),
48
- this.shogun.get(`${addon.endpoint}/certificates`, this.shogun.defaults)
48
+ this.shogun.get(`${addon.endpoint}/certificates`, this.shogun.defaults),
49
49
  ]);
50
50
  let baseCert = certs[0];
51
51
  const readyCerts = certs.filter(cert => cert.status === 'ready');
52
52
  if (flags.id) {
53
53
  const certById = certs.find(cert => cert.id === flags.id);
54
54
  if (!certById) {
55
- core_1.ux.action.stop();
56
- core_1.ux.error(`No Certificate found with id ${color_1.color.cyan(flags.id)}`, { exit: 0 });
55
+ ux.action.stop();
56
+ ux.error(`No Certificate found with id ${color.cyan(flags.id)}`, { exit: 0 });
57
57
  }
58
58
  else if (certById.status === 'ready') {
59
59
  baseCert = certById;
60
60
  }
61
61
  else {
62
- core_1.ux.action.stop();
63
- core_1.ux.error('This certificate is not ready to download', { exit: 0 });
62
+ ux.action.stop();
63
+ ux.error('This certificate is not ready to download', { exit: 0 });
64
64
  }
65
65
  }
66
66
  else if (readyCerts.length === 0) {
67
- core_1.ux.action.stop();
68
- core_1.ux.error('There are no certificates to download', { exit: 0 });
67
+ ux.action.stop();
68
+ ux.error('There are no certificates to download', { exit: 0 });
69
69
  }
70
70
  else if (readyCerts.length > 1) {
71
- await core_1.ux.action.pauseAsync(async () => {
72
- const answers = await inquirer.prompt([
73
- {
74
- choices: readyCerts.map(cert => ({
75
- name: `${cert.id} (expires ${cert.expires_at})`,
76
- value: cert.id
77
- })),
78
- message: 'There is more than one certificate available to download, which would you like to download?',
79
- name: 'cert',
80
- type: 'list'
81
- }
82
- ]);
83
- baseCert = readyCerts.find(cert => cert.id === answers.cert);
71
+ await ux.action.pauseAsync(async () => {
72
+ const certId = await select({
73
+ choices: readyCerts.map(cert => ({
74
+ name: `${cert.id} (expires ${cert.expires_at})`,
75
+ value: cert.id,
76
+ })),
77
+ message: 'There is more than one certificate available to download, which would you like to download?',
78
+ });
79
+ baseCert = readyCerts.find(cert => cert.id === certId);
84
80
  });
85
81
  }
86
82
  const { body: cert } = await this.shogun.get(`${addon.endpoint}/certificates/${baseCert.id}`, this.shogun.defaults);
87
- const path = flags.dir || `${node_os_1.homedir}/.postgresql`;
88
- !(0, file_helper_1.existsSync)(path) && (0, file_helper_1.mkdirSync)(path);
89
- const key = `${path}/${flags.prefix}postgresql.key`;
90
- const crt = `${path}/${flags.prefix}postgresql.crt`;
91
- const root = `${path}/${flags.prefix}root.crt`;
83
+ const dir = flags.dir || join(homedir(), '.postgresql');
84
+ if (!existsSync(dir))
85
+ mkdirSync(dir);
86
+ const key = join(dir, `${flags.prefix}postgresql.key`);
87
+ const crt = join(dir, `${flags.prefix}postgresql.crt`);
88
+ const root = join(dir, `${flags.prefix}root.crt`);
92
89
  let download = true;
93
- if ((0, file_helper_1.existsSync)(root) || (0, file_helper_1.existsSync)(key) || (0, file_helper_1.existsSync)(crt)) {
94
- download = await core_1.ux.confirm('One of these files already exists. Would you like to overwrite them? (yes/no)');
90
+ if (existsSync(root) || existsSync(key) || existsSync(crt)) {
91
+ download = await confirm('One of these files already exists. Would you like to overwrite them? (yes/no)');
95
92
  }
96
93
  if (download) {
97
94
  await Promise.all([
98
95
  write(root, mtls?.certificate_authority_chain ?? ''),
99
96
  write(key, cert?.private_key ?? '', { mode: '0600' }),
100
- write(crt, cert?.certificate_with_chain ?? '')
97
+ write(crt, cert?.certificate_with_chain ?? ''),
101
98
  ]);
102
- core_1.ux.action.stop();
103
- this.log(`your certs are now located in ${color_1.color.cyan(path)}`);
99
+ ux.action.stop();
100
+ ux.stdout(`your certs are now located in ${color.cyan(dir)}`);
104
101
  }
105
102
  else {
106
- core_1.ux.action.stop();
107
- this.log('you did not download the certs');
103
+ ux.action.stop();
104
+ ux.stdout('you did not download the certs');
108
105
  }
109
106
  }
110
- catch (err) {
111
- if ((0, is_error_http_1.isErrorHttp)(err) && err.http && err.http.statusCode === 404) {
112
- this.warn('mTLS is not setup yet for this add-on');
107
+ catch (error) {
108
+ if (isErrorHttp(error) && error.http && error.http.statusCode === 404) {
109
+ ux.warn('mTLS is not setup yet for this add-on');
113
110
  }
114
- else if ((0, is_error_message_1.isErrorMessage)(err)) {
115
- this.error(err.message);
111
+ else if (isErrorMessage(error)) {
112
+ ux.error(error.message);
116
113
  }
117
114
  }
118
115
  }
119
116
  }
120
- exports.default = MTLSCertificateDownload;
@@ -1,13 +1,13 @@
1
- import Command from '../../../../base';
1
+ import Command from '../../../../base.js';
2
2
  export default class MTLSCertificateGet extends Command {
3
3
  static args: {
4
- addon: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
4
+ addon: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
5
  };
6
6
  static description: string;
7
7
  static examples: string[];
8
8
  static flags: {
9
- app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
- id: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ id: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
11
  };
12
12
  run(): Promise<void>;
13
13
  }
@@ -1,32 +1,30 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const command_1 = require("@heroku-cli/command");
5
- const core_1 = require("@oclif/core");
6
- const base_1 = tslib_1.__importDefault(require("../../../../base"));
7
- const fetcher_1 = tslib_1.__importDefault(require("../../../../lib/fetcher"));
8
- class MTLSCertificateGet extends base_1.default {
1
+ import { flags } from '@heroku-cli/command';
2
+ import { styledObject } from '@heroku/heroku-cli-util/hux';
3
+ import { Args } from '@oclif/core';
4
+ import { ux } from '@oclif/core/ux';
5
+ import Command from '../../../../base.js';
6
+ import { fetcher } from '../../../../lib/addon-fetcher.js';
7
+ export default class MTLSCertificateGet extends Command {
9
8
  static args = {
10
- addon: core_1.Args.string({ required: true, description: 'addon' })
9
+ addon: Args.string({ required: true, description: 'addon' }),
11
10
  };
12
11
  static description = 'get a specific certificate for your mTLS enabled add-on';
13
12
  static examples = [
14
- '$ heroku data:mtls:certificates:get postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app'
13
+ '$ heroku data:mtls:certificates:get postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app',
15
14
  ];
16
15
  static flags = {
17
- app: command_1.flags.app({ required: true }),
18
- id: command_1.flags.string({ required: true, description: 'id of IP Rule' })
16
+ app: flags.app({ required: true }),
17
+ id: flags.string({ required: true, description: 'id of IP Rule' }),
19
18
  };
20
19
  async run() {
21
20
  const { args, flags } = await this.parse(MTLSCertificateGet);
22
- const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
21
+ const addon = await fetcher(this.heroku, args.addon, flags.app);
23
22
  if (addon.kind === 'kafka') {
24
- core_1.ux.error('Kafka certificates are available in your app\'s config vars');
23
+ ux.error('Kafka certificates are available in your app\'s config vars');
25
24
  }
26
25
  const { body: res } = await this.shogun.get(`${addon.endpoint}/certificates/${flags.id}`, this.shogun.defaults);
27
26
  delete res.private_key;
28
27
  delete res.certificate_with_chain;
29
- core_1.ux.styledObject(res);
28
+ styledObject(res);
30
29
  }
31
30
  }
32
- exports.default = MTLSCertificateGet;
@@ -1,12 +1,12 @@
1
- import Command from '../../../../base';
1
+ import Command from '../../../../base.js';
2
2
  export default class MTLSCertificatesIndex extends Command {
3
3
  static args: {
4
- addon: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
4
+ addon: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
5
  };
6
6
  static description: string;
7
7
  static examples: string[];
8
8
  static flags: {
9
- app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
10
  };
11
11
  run(): Promise<void>;
12
12
  }
@@ -1,55 +1,52 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const command_1 = require("@heroku-cli/command");
5
- const core_1 = require("@oclif/core");
6
- const base_1 = tslib_1.__importDefault(require("../../../../base"));
7
- const fetcher_1 = tslib_1.__importDefault(require("../../../../lib/fetcher"));
8
- const is_error_http_1 = require("../../../../utils/is-error-http");
9
- const is_error_message_1 = require("../../../../utils/is-error-message");
10
- const table_1 = require("../../../../utils/table");
11
- class MTLSCertificatesIndex extends base_1.default {
1
+ import { flags } from '@heroku-cli/command';
2
+ import { Args } from '@oclif/core';
3
+ import { ux } from '@oclif/core/ux';
4
+ import Command from '../../../../base.js';
5
+ import { fetcher } from '../../../../lib/addon-fetcher.js';
6
+ import { isErrorHttp } from '../../../../utils/is-error-http.js';
7
+ import { isErrorMessage } from '../../../../utils/is-error-message.js';
8
+ import { certificatesTable } from '../../../../utils/table.js';
9
+ export default class MTLSCertificatesIndex extends Command {
12
10
  static args = {
13
- addon: core_1.Args.string({ required: true, description: 'addon' })
11
+ addon: Args.string({ required: true, description: 'addon' }),
14
12
  };
15
13
  static description = 'get the certificates for your mTLS enabled add-on';
16
14
  static examples = [
17
15
  '$ heroku data:mtls:certificates postgresql-sushi-12345 -a example-app',
18
16
  ];
19
17
  static flags = {
20
- app: command_1.flags.app({ required: true })
18
+ app: flags.app({ required: true }),
21
19
  };
22
20
  async run() {
23
21
  try {
24
22
  const { args, flags } = await this.parse(MTLSCertificatesIndex);
25
- const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
23
+ const addon = await fetcher(this.heroku, args.addon, flags.app);
26
24
  if (addon.kind === 'kafka') {
27
- core_1.ux.error('Kafka certificates are available in your app\'s config vars');
25
+ ux.error('Kafka certificates are available in your app\'s config vars');
28
26
  }
29
27
  const { body: res } = await this.shogun.get(`${addon.endpoint}/certificates`, this.shogun.defaults);
30
28
  if (res.length === 0) {
31
- core_1.ux.log('You currently have no certificates setup');
29
+ ux.stdout('You currently have no certificates setup');
32
30
  }
33
31
  else {
34
- (0, table_1.certificatesTable)(res);
32
+ certificatesTable(res);
35
33
  }
36
34
  }
37
- catch (err) {
38
- if (!(0, is_error_message_1.isErrorMessage)(err)) {
35
+ catch (error) {
36
+ if (!isErrorMessage(error)) {
39
37
  return;
40
38
  }
41
- if ((0, is_error_http_1.isErrorHttp)(err) && err.http && err.http.statusCode === 404) {
42
- if (err.http.body.resource === 'add_on') {
43
- this.error(err.message);
39
+ if (isErrorHttp(error) && error.http && error.http.statusCode === 404) {
40
+ if (error.http.body.resource === 'add_on') {
41
+ ux.error(error.message);
44
42
  }
45
43
  else {
46
- this.warn('mTLS is not set up yet for this add-on');
44
+ ux.warn('mTLS is not set up yet for this add-on');
47
45
  }
48
46
  }
49
47
  else {
50
- this.error(err.message);
48
+ ux.error(error.message);
51
49
  }
52
50
  }
53
51
  }
54
52
  }
55
- exports.default = MTLSCertificatesIndex;
@@ -1,12 +1,12 @@
1
- import Command from '../../../base';
1
+ import Command from '../../../base.js';
2
2
  export default class MTLSCreate extends Command {
3
3
  static args: {
4
- addon: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
4
+ addon: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
5
  };
6
6
  static description: string;
7
7
  static examples: string[];
8
8
  static flags: {
9
- app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
10
  };
11
11
  run(): Promise<void>;
12
12
  }
@@ -1,43 +1,41 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const color_1 = require("@heroku-cli/color");
5
- const command_1 = require("@heroku-cli/command");
6
- const core_1 = require("@oclif/core");
7
- const base_1 = tslib_1.__importDefault(require("../../../base"));
8
- const fetcher_1 = tslib_1.__importDefault(require("../../../lib/fetcher"));
9
- class MTLSCreate extends base_1.default {
1
+ import { flags } from '@heroku-cli/command';
2
+ import * as color from '@heroku/heroku-cli-util/color';
3
+ import { confirm, styledObject } from '@heroku/heroku-cli-util/hux';
4
+ import { Args } from '@oclif/core';
5
+ import { ux } from '@oclif/core/ux';
6
+ import Command from '../../../base.js';
7
+ import { fetcher } from '../../../lib/addon-fetcher.js';
8
+ export default class MTLSCreate extends Command {
10
9
  static args = {
11
- addon: core_1.Args.string({ required: true, description: 'addon' })
10
+ addon: Args.string({ required: true, description: 'addon' }),
12
11
  };
13
12
  static description = 'enable MTLS for your addon';
14
13
  static examples = [
15
- '$ heroku data:mtls:create postgresql-sushi-12345 -a example-app'
14
+ '$ heroku data:mtls:create postgresql-sushi-12345 -a example-app',
16
15
  ];
17
16
  static flags = {
18
- app: command_1.flags.app({ required: true })
17
+ app: flags.app({ required: true }),
19
18
  };
20
19
  async run() {
21
20
  const { args, flags } = await this.parse(MTLSCreate);
22
- const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
21
+ const addon = await fetcher(this.heroku, args.addon, flags.app);
23
22
  if (addon.kind === 'kafka') {
24
- core_1.ux.error('Kafka has mTLS enabled by default');
23
+ ux.error('Kafka has mTLS enabled by default');
25
24
  }
26
- if (await core_1.ux.confirm('Enabling Mutual TLS will allow external access to this restricted data service. This action will be logged. Continue?')) {
27
- core_1.ux.action.start(`Enabling MTLS on ${color_1.color.cyan(addon.name)}`);
25
+ if (await confirm('Enabling Mutual TLS will allow external access to this restricted data service. This action will be logged. Continue?')) {
26
+ ux.action.start(`Enabling MTLS on ${color.addon(addon.name)}`);
28
27
  try {
29
28
  const { body: res } = await this.shogun.post(addon.endpoint, { ...this.shogun.defaults, body: {} });
30
- core_1.ux.styledObject(res);
31
- core_1.ux.action.stop();
29
+ styledObject(res);
30
+ ux.action.stop();
32
31
  }
33
- catch (err) {
34
- core_1.ux.action.stop('failed!');
35
- core_1.ux.log(err.body.message);
32
+ catch (error) {
33
+ ux.action.stop('failed!');
34
+ ux.stdout(error.body.message);
36
35
  }
37
36
  }
38
37
  else {
39
- core_1.ux.warn('You did not enable mTLS');
38
+ ux.warn('You did not enable mTLS');
40
39
  }
41
40
  }
42
41
  }
43
- exports.default = MTLSCreate;
@@ -1,13 +1,13 @@
1
- import Command from '../../../base';
1
+ import Command from '../../../base.js';
2
2
  export default class MTLSDestroy extends Command {
3
3
  static aliases: string[];
4
4
  static args: {
5
- addon: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
5
+ addon: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
6
  };
7
7
  static description: string;
8
8
  static examples: string[];
9
9
  static flags: {
10
- app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
11
  };
12
12
  run(): Promise<void>;
13
13
  }
@@ -1,32 +1,29 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const color_1 = require("@heroku-cli/color");
5
- const command_1 = require("@heroku-cli/command");
6
- const core_1 = require("@oclif/core");
7
- const base_1 = tslib_1.__importDefault(require("../../../base"));
8
- const fetcher_1 = tslib_1.__importDefault(require("../../../lib/fetcher"));
9
- class MTLSDestroy extends base_1.default {
1
+ import { flags } from '@heroku-cli/command';
2
+ import * as color from '@heroku/heroku-cli-util/color';
3
+ import { Args } from '@oclif/core';
4
+ import { ux } from '@oclif/core/ux';
5
+ import Command from '../../../base.js';
6
+ import { fetcher } from '../../../lib/addon-fetcher.js';
7
+ export default class MTLSDestroy extends Command {
10
8
  static aliases = ['data:mtls:delete'];
11
9
  static args = {
12
- addon: core_1.Args.string({ required: true, description: 'addon' })
10
+ addon: Args.string({ required: true, description: 'addon' }),
13
11
  };
14
12
  static description = 'disable mTLS for your add-on';
15
13
  static examples = [
16
- '$ heroku data:mtls:destroy postgresql-sushi-12345 -a example-app'
14
+ '$ heroku data:mtls:destroy postgresql-sushi-12345 -a example-app',
17
15
  ];
18
16
  static flags = {
19
- app: command_1.flags.app({ required: true })
17
+ app: flags.app({ required: true }),
20
18
  };
21
19
  async run() {
22
20
  const { args, flags } = await this.parse(MTLSDestroy);
23
- const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
21
+ const addon = await fetcher(this.heroku, args.addon, flags.app);
24
22
  if (addon.kind === 'kafka') {
25
- core_1.ux.error('Kafka has mTLS enabled by default and you cannot disable it');
23
+ ux.error('Kafka has mTLS enabled by default and you cannot disable it');
26
24
  }
27
- core_1.ux.action.start(`Disabling MTLS on ${color_1.color.cyan(addon.name)}`);
25
+ ux.action.start(`Disabling MTLS on ${color.addon(addon.name)}`);
28
26
  await this.shogun.delete(addon.endpoint, this.shogun.defaults);
29
- core_1.ux.action.stop();
27
+ ux.action.stop();
30
28
  }
31
29
  }
32
- exports.default = MTLSDestroy;
@@ -1,12 +1,12 @@
1
- import Command from '../../../base';
1
+ import Command from '../../../base.js';
2
2
  export default class MTLSIndex extends Command {
3
3
  static args: {
4
- addon: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
4
+ addon: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
5
  };
6
6
  static description: string;
7
7
  static examples: string[];
8
8
  static flags: {
9
- app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
10
  };
11
11
  run(): Promise<void>;
12
12
  }