@heroku-cli/plugin-mtls 1.0.2 → 2.0.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 (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 +33 -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,84 +1,75 @@
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
- const is_error_http_1 = require("../../../utils/is-error-http");
10
- const is_error_message_1 = require("../../../utils/is-error-message");
11
- const table_1 = require("../../../utils/table");
12
- class MTLSIndex extends base_1.default {
1
+ import { flags } from '@heroku-cli/command';
2
+ import { styledHeader, 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
+ import { isErrorHttp } from '../../../utils/is-error-http.js';
8
+ import { isErrorMessage } from '../../../utils/is-error-message.js';
9
+ import { certificatesTable, ipRulesTable } from '../../../utils/table.js';
10
+ export default class MTLSIndex extends Command {
13
11
  static args = {
14
- addon: core_1.Args.string({ required: true, description: 'addon' })
12
+ addon: Args.string({ required: true, description: 'addon' }),
15
13
  };
16
14
  static description = 'get the status of mTLS for your add-on';
17
15
  static examples = [
18
16
  '$ heroku data:mtls postgresql-sushi-12345 -a example-app',
19
17
  ];
20
18
  static flags = {
21
- app: command_1.flags.app({ required: true })
19
+ app: flags.app({ required: true }),
22
20
  };
23
21
  async run() {
24
22
  try {
25
23
  const { args, flags } = await this.parse(MTLSIndex);
26
- const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
24
+ const addon = await fetcher(this.heroku, args.addon, flags.app);
27
25
  if (addon.kind === 'kafka') {
28
26
  const { body: ipRules } = await this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults);
29
- core_1.ux.styledObject({
27
+ styledObject({
30
28
  addon: addon.name,
31
- 'TLS-status': 'Available'
29
+ 'TLS-status': 'Available',
32
30
  });
33
31
  if (ipRules.length > 0) {
34
- this.log();
35
- this.log(color_1.color.underline('IP Rules'));
36
- this.log();
37
- (0, table_1.ipRulesTable)(ipRules);
32
+ styledHeader('IP Rules');
33
+ ipRulesTable(ipRules);
38
34
  }
39
35
  }
40
36
  else {
41
37
  const [{ body: mtls }, { body: certs }, { body: ipRules }] = await Promise.all([
42
38
  this.shogun.get(addon.endpoint, this.shogun.defaults),
43
39
  this.shogun.get(`${addon.endpoint}/certificates`, this.shogun.defaults),
44
- this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults)
40
+ this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults),
45
41
  ]);
46
42
  delete mtls.certificate_authority_chain;
47
- core_1.ux.styledObject({
43
+ styledObject({
48
44
  addon: mtls.addon,
49
45
  app: mtls.app,
50
- 'TLS-status': mtls.status
46
+ 'TLS-status': mtls.status,
51
47
  });
52
48
  if (certs.length > 0) {
53
- this.log();
54
- this.log(color_1.color.underline('Certificates'));
55
- this.log();
56
- (0, table_1.certificatesTable)(certs);
49
+ styledHeader('Certificates');
50
+ certificatesTable(certs);
57
51
  }
58
52
  if (ipRules.length > 0) {
59
- this.log();
60
- this.log(color_1.color.underline('IP Rules'));
61
- this.log();
62
- (0, table_1.ipRulesTable)(ipRules);
53
+ styledHeader('IP Rules');
54
+ ipRulesTable(ipRules);
63
55
  }
64
56
  }
65
57
  }
66
- catch (err) {
67
- if (!(0, is_error_message_1.isErrorMessage)(err)) {
58
+ catch (error) {
59
+ if (!isErrorMessage(error)) {
68
60
  return;
69
61
  }
70
- if ((0, is_error_http_1.isErrorHttp)(err) && err.http && err.http.statusCode === 404) {
71
- if (err.http.body.resource === 'add_on') {
72
- this.error(err.message);
62
+ if (isErrorHttp(error) && error.http && error.http.statusCode === 404) {
63
+ if (error.http.body.resource === 'add_on') {
64
+ ux.error(error.message);
73
65
  }
74
66
  else {
75
- this.warn('mTLS is not set up yet for this add-on');
67
+ ux.warn('mTLS is not set up yet for this add-on');
76
68
  }
77
69
  }
78
70
  else {
79
- this.error(err.message);
71
+ ux.error(error.message);
80
72
  }
81
73
  }
82
74
  }
83
75
  }
84
- exports.default = MTLSIndex;
@@ -1,14 +1,14 @@
1
- import Command from '../../../../base';
1
+ import Command from '../../../../base.js';
2
2
  export default class MTLSIPCreate 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
- cidr: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
- description: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ cidr: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
+ description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
12
  };
13
13
  run(): Promise<void>;
14
14
  }
@@ -1,37 +1,35 @@
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 MTLSIPCreate extends base_1.default {
1
+ import { flags } from '@heroku-cli/command';
2
+ import * as color from '@heroku/heroku-cli-util/color';
3
+ import { 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 MTLSIPCreate 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 = 'create a new IP Rule for your mTLS enabled add-on';
14
13
  static examples = [
15
- '$ heroku data:mtls:ip-rules:create postgresql-sushi-12345 --cidr "1.2.3.4/32" --description "home IP address" -a example-app'
14
+ '$ heroku data:mtls:ip-rules:create postgresql-sushi-12345 --cidr "1.2.3.4/32" --description "home IP address" -a example-app',
16
15
  ];
17
16
  static flags = {
18
- app: command_1.flags.app({ required: true }),
19
- cidr: command_1.flags.string({ required: true }),
20
- description: command_1.flags.string({ required: false })
17
+ app: flags.app({ required: true }),
18
+ cidr: flags.string({ description: 'CIDR block to allow', required: true }),
19
+ description: flags.string({ description: 'description of the IP rule' }),
21
20
  };
22
21
  async run() {
23
22
  const { args, flags } = await this.parse(MTLSIPCreate);
24
- const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
25
- core_1.ux.action.start(`Creating IP Rule for ${color_1.color.cyan(addon.name)}`);
23
+ const addon = await fetcher(this.heroku, args.addon, flags.app);
24
+ ux.action.start(`Creating IP Rule for ${color.addon(addon.name)}`);
26
25
  const { body: res } = await this.shogun.post(`${addon.endpoint}/ip-rules`, {
27
26
  ...this.shogun.defaults,
28
27
  body: {
29
28
  cidr: flags.cidr,
30
- description: flags.description
31
- }
29
+ description: flags.description,
30
+ },
32
31
  });
33
- core_1.ux.action.stop();
34
- core_1.ux.styledObject(res);
32
+ ux.action.stop();
33
+ styledObject(res);
35
34
  }
36
35
  }
37
- exports.default = MTLSIPCreate;
@@ -1,14 +1,14 @@
1
- import Command from '../../../../base';
1
+ import Command from '../../../../base.js';
2
2
  export default class MTLSIPDelete 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
- cidr: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
- id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ cidr: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ id: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
12
  };
13
13
  run(): Promise<void>;
14
14
  }
@@ -1,49 +1,46 @@
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 MTLSIPDelete 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 MTLSIPDelete extends Command {
10
8
  static args = {
11
- addon: core_1.Args.string({ required: true, description: 'addon' })
9
+ addon: Args.string({ required: true, description: 'addon' }),
12
10
  };
13
11
  static description = 'delete a specific IP Rule for your mTLS enabled add-on';
14
12
  static examples = [
15
- '$ heroku data:mtls:ip-rules:delete postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app'
13
+ '$ heroku data:mtls:ip-rules:delete postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app',
16
14
  ];
17
15
  static flags = {
18
- app: command_1.flags.app({ required: true }),
19
- cidr: command_1.flags.string({ description: 'cidr of IP Rule' }),
20
- id: command_1.flags.string({ description: 'id of IP Rule' })
16
+ app: flags.app({ required: true }),
17
+ cidr: flags.string({ description: 'cidr of IP Rule' }),
18
+ id: flags.string({ description: 'id of IP Rule' }),
21
19
  };
22
20
  async run() {
23
21
  const { args, flags } = await this.parse(MTLSIPDelete);
24
22
  if (!flags.cidr && !flags.id) {
25
- core_1.ux.error('You need to provide the id or cidr of the IP Rule');
23
+ ux.error('You need to provide the id or cidr of the IP Rule');
26
24
  }
27
25
  else {
28
- const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
29
- core_1.ux.action.start(`Deleting IP Rule for ${color_1.color.cyan(addon.name)}`);
26
+ const addon = await fetcher(this.heroku, args.addon, flags.app);
27
+ ux.action.start(`Deleting IP Rule for ${color.addon(addon.name)}`);
30
28
  let id = '';
31
29
  if (flags.id) {
32
30
  id = flags.id;
33
31
  }
34
32
  else {
35
33
  const { body: ipRules } = await this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults);
36
- const ipRule = ipRules.find(ipRule => ipRule.cidr === flags.cidr);
34
+ const ipRule = ipRules.find(rule => rule.cidr === flags.cidr);
37
35
  if (ipRule) {
38
36
  id = ipRule.id;
39
37
  }
40
38
  else {
41
- core_1.ux.error('No IP Rule found with that cidr');
39
+ ux.error('No IP Rule found with that cidr');
42
40
  }
43
41
  }
44
42
  await this.shogun.delete(`${addon.endpoint}/ip-rules/${id}`, this.shogun.defaults);
45
- core_1.ux.action.stop();
43
+ ux.action.stop();
46
44
  }
47
45
  }
48
46
  }
49
- exports.default = MTLSIPDelete;
@@ -1,13 +1,13 @@
1
- import Command from '../../../../base';
1
+ import Command from '../../../../base.js';
2
2
  export default class MTLSIPGet 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,27 +1,24 @@
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 MTLSIPGet 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 Command from '../../../../base.js';
5
+ import { fetcher } from '../../../../lib/addon-fetcher.js';
6
+ export default class MTLSIPGet extends Command {
9
7
  static args = {
10
- addon: core_1.Args.string({ required: true, description: 'addon' })
8
+ addon: Args.string({ required: true, description: 'addon' }),
11
9
  };
12
10
  static description = 'get the a specific IP Rule for your mTLS enabled add-on';
13
11
  static examples = [
14
- '$ heroku data:mtls:ip-rules:get postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app'
12
+ '$ heroku data:mtls:ip-rules:get postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app',
15
13
  ];
16
14
  static flags = {
17
- app: command_1.flags.app({ required: true }),
18
- id: command_1.flags.string({ required: true, description: 'id of IP Rule' })
15
+ app: flags.app({ required: true }),
16
+ id: flags.string({ required: true, description: 'id of IP Rule' }),
19
17
  };
20
18
  async run() {
21
19
  const { args, flags } = await this.parse(MTLSIPGet);
22
- const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
20
+ const addon = await fetcher(this.heroku, args.addon, flags.app);
23
21
  const { body: res } = await this.shogun.get(`${addon.endpoint}/ip-rules/${flags.id}`, this.shogun.defaults);
24
- core_1.ux.styledObject(res);
22
+ styledObject(res);
25
23
  }
26
24
  }
27
- exports.default = MTLSIPGet;
@@ -1,12 +1,12 @@
1
- import Command from '../../../../base';
1
+ import Command from '../../../../base.js';
2
2
  export default class MTLSIPIndex 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,32 +1,29 @@
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 table_1 = require("../../../../utils/table");
9
- class MTLSIPIndex 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 { ipRulesTable } from '../../../../utils/table.js';
7
+ export default class MTLSIPIndex extends Command {
10
8
  static args = {
11
- addon: core_1.Args.string({ required: true, description: 'addon' })
9
+ addon: Args.string({ required: true, description: 'addon' }),
12
10
  };
13
11
  static description = 'get the IP Rules for your mTLS enabled add-on';
14
12
  static examples = [
15
13
  '$ heroku data:mtls:ip-rules postgresql-sushi-12345 -a example-app',
16
14
  ];
17
15
  static flags = {
18
- app: command_1.flags.app({ required: true })
16
+ app: flags.app({ required: true }),
19
17
  };
20
18
  async run() {
21
19
  const { args, flags } = await this.parse(MTLSIPIndex);
22
- const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
20
+ const addon = await fetcher(this.heroku, args.addon, flags.app);
23
21
  const { body: res } = await this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults);
24
22
  if (res.length === 0) {
25
- core_1.ux.log('You currently have no IP Rules set up');
23
+ ux.stdout('You currently have no IP Rules set up');
26
24
  }
27
25
  else {
28
- (0, table_1.ipRulesTable)(res);
26
+ ipRulesTable(res);
29
27
  }
30
28
  }
31
29
  }
32
- exports.default = MTLSIPIndex;
package/dist/index.d.ts CHANGED
@@ -1,2 +1 @@
1
- declare const _default: {};
2
- export default _default;
1
+ export { run } from '@oclif/core';
package/dist/index.js CHANGED
@@ -1,3 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {};
1
+ export { run } from '@oclif/core';
@@ -0,0 +1,7 @@
1
+ import { APIClient } from '@heroku-cli/command';
2
+ export type ResolvedAddon = {
3
+ endpoint: string;
4
+ kind: 'kafka' | 'postgresql';
5
+ name: string;
6
+ };
7
+ export declare function fetcher(heroku: APIClient, addon: string, app: string): Promise<ResolvedAddon>;
@@ -0,0 +1,23 @@
1
+ import { AddonResolver, isPostgresAddon } from '@heroku/heroku-cli-util/utils/addons';
2
+ import { ux } from '@oclif/core/ux';
3
+ // Resolves an add-on argument into the concrete mTLS resource the data API ("shogun") operates on.
4
+ // Replaces the legacy src/lib/fetcher.ts, which is now backed by the shared AddonResolver. The
5
+ // Postgres-vs-Kafka endpoint/kind branching used to live in the fetcher and is reintroduced here.
6
+ export async function fetcher(heroku, addon, app) {
7
+ const resolved = await new AddonResolver(heroku).resolve(addon, app);
8
+ if (isPostgresAddon(resolved)) {
9
+ return {
10
+ endpoint: `/postgres/v0/databases/${resolved.id}/tls-endpoint`,
11
+ kind: 'postgresql',
12
+ name: resolved.name,
13
+ };
14
+ }
15
+ if (resolved.addon_service.name.startsWith('heroku-kafka') && /private|shield/.test(resolved.plan.name)) {
16
+ return {
17
+ endpoint: `/data/kafka/v0/clusters/${resolved.id}`,
18
+ kind: 'kafka',
19
+ name: resolved.name,
20
+ };
21
+ }
22
+ ux.error('No addons found');
23
+ }
@@ -1,4 +1,4 @@
1
1
  import * as fs from 'node:fs';
2
2
  export declare const existsSync: (path: string) => boolean;
3
3
  export declare const mkdirSync: (path: string) => void;
4
- export declare const writeFile: (path: string, data: string, options: fs.WriteFileOptions | undefined, err: any) => void;
4
+ export declare const writeFile: (path: string, data: string, options: fs.WriteFileOptions, callback: fs.NoParamCallback) => void;
@@ -1,11 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.writeFile = exports.mkdirSync = exports.existsSync = void 0;
4
- const tslib_1 = require("tslib");
5
- const fs = tslib_1.__importStar(require("node:fs"));
6
- const existsSync = (path) => fs.existsSync(path);
7
- exports.existsSync = existsSync;
8
- const mkdirSync = (path) => fs.mkdirSync(path);
9
- exports.mkdirSync = mkdirSync;
10
- const writeFile = (path, data, options = null, err) => fs.writeFile(path, data, options, err);
11
- exports.writeFile = writeFile;
1
+ import * as fs from 'node:fs';
2
+ export const existsSync = (path) => fs.existsSync(path);
3
+ export const mkdirSync = (path) => fs.mkdirSync(path);
4
+ export const writeFile = (path, data, options, callback) => fs.writeFile(path, data, options, callback);
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isErrorHttp = isErrorHttp;
4
- function isErrorHttp(error) {
1
+ export function isErrorHttp(error) {
5
2
  return error !== null && typeof error === 'object' && Reflect.has(error, 'http');
6
3
  }
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isErrorMessage = isErrorMessage;
4
- function isErrorMessage(error) {
1
+ export function isErrorMessage(error) {
5
2
  return error !== null && typeof error === 'object' && Reflect.has(error, 'message');
6
3
  }
@@ -1,3 +1,3 @@
1
- import { MTLSCertificate, MTLSIPRule } from '../base';
1
+ import { MTLSCertificate, MTLSIPRule } from '../base.js';
2
2
  export declare const certificatesTable: (data: Array<MTLSCertificate>) => void;
3
3
  export declare const ipRulesTable: (data: Array<MTLSIPRule>) => void;
@@ -1,42 +1,37 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ipRulesTable = exports.certificatesTable = void 0;
4
- const core_1 = require("@oclif/core");
5
- const certificatesTable = (data) => core_1.ux.table(data, {
1
+ import { table } from '@heroku/heroku-cli-util/hux';
2
+ export const certificatesTable = (data) => table(data, {
6
3
  id: {
7
4
  header: 'ID',
8
- get: ({ id }) => id
5
+ get: ({ id }) => id,
9
6
  },
10
7
  created_at: {
11
8
  header: 'Created At',
12
- get: ({ created_at }) => created_at
9
+ get: ({ created_at }) => created_at,
13
10
  },
14
11
  status: {
15
12
  header: 'Status',
16
- get: ({ status }) => status
13
+ get: ({ status }) => status,
17
14
  },
18
15
  });
19
- exports.certificatesTable = certificatesTable;
20
- const ipRulesTable = (data) => core_1.ux.table(data, {
16
+ export const ipRulesTable = (data) => table(data, {
21
17
  id: {
22
18
  header: 'ID',
23
- get: ({ id }) => id
19
+ get: ({ id }) => id,
24
20
  },
25
21
  cidr: {
26
22
  header: 'CIDR',
27
- get: ({ cidr }) => cidr
23
+ get: ({ cidr }) => cidr,
28
24
  },
29
25
  description: {
30
26
  header: 'Description',
31
- get: ({ description }) => description
27
+ get: ({ description }) => description,
32
28
  },
33
29
  created_at: {
34
30
  header: 'Created At',
35
- get: ({ created_at }) => created_at
31
+ get: ({ created_at }) => created_at,
36
32
  },
37
33
  status: {
38
34
  header: 'Status',
39
- get: ({ status }) => status
35
+ get: ({ status }) => status,
40
36
  },
41
37
  });
42
- exports.ipRulesTable = ipRulesTable;