@heroku-cli/plugin-data 2.0.0 → 3.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 (59) hide show
  1. package/README.md +76 -31
  2. package/dist/commands/data/connectors/create.d.ts +15 -0
  3. package/{lib → dist}/commands/data/connectors/create.js +23 -25
  4. package/dist/commands/data/connectors/destroy.d.ts +12 -0
  5. package/dist/commands/data/connectors/destroy.js +39 -0
  6. package/dist/commands/data/connectors/index.d.ts +14 -0
  7. package/{lib → dist}/commands/data/connectors/index.js +23 -24
  8. package/dist/commands/data/connectors/info.d.ts +12 -0
  9. package/{lib → dist}/commands/data/connectors/info.js +22 -23
  10. package/{lib → dist}/commands/data/connectors/pause.d.ts +2 -2
  11. package/dist/commands/data/connectors/pause.js +27 -0
  12. package/{lib → dist}/commands/data/connectors/resume.d.ts +2 -2
  13. package/dist/commands/data/connectors/resume.js +27 -0
  14. package/dist/commands/data/connectors/update.d.ts +17 -0
  15. package/{lib → dist}/commands/data/connectors/update.js +19 -21
  16. package/{lib → dist}/commands/data/connectors/wait.d.ts +2 -2
  17. package/{lib → dist}/commands/data/connectors/wait.js +11 -10
  18. package/dist/commands/data/enhanced-certificates/disable.d.ts +11 -0
  19. package/dist/commands/data/enhanced-certificates/disable.js +31 -0
  20. package/dist/commands/data/enhanced-certificates/enable.d.ts +12 -0
  21. package/dist/commands/data/enhanced-certificates/enable.js +34 -0
  22. package/dist/commands/data/enhanced-certificates/status.d.ts +12 -0
  23. package/dist/commands/data/enhanced-certificates/status.js +30 -0
  24. package/dist/commands/data/labs/disable.d.ts +13 -0
  25. package/dist/commands/data/labs/disable.js +44 -0
  26. package/dist/commands/data/labs/enable.d.ts +13 -0
  27. package/dist/commands/data/labs/enable.js +44 -0
  28. package/{lib → dist}/commands/data/labs/list.d.ts +3 -3
  29. package/{lib → dist}/commands/data/labs/list.js +18 -19
  30. package/dist/index.d.ts +1 -0
  31. package/dist/index.js +1 -0
  32. package/dist/lib/base.js +25 -0
  33. package/oclif.manifest.json +215 -114
  34. package/package.json +33 -30
  35. package/lib/commands/data/connectors/create.d.ts +0 -15
  36. package/lib/commands/data/connectors/destroy.d.ts +0 -12
  37. package/lib/commands/data/connectors/destroy.js +0 -41
  38. package/lib/commands/data/connectors/index.d.ts +0 -14
  39. package/lib/commands/data/connectors/info.d.ts +0 -12
  40. package/lib/commands/data/connectors/pause.js +0 -28
  41. package/lib/commands/data/connectors/resume.js +0 -28
  42. package/lib/commands/data/connectors/update.d.ts +0 -17
  43. package/lib/commands/data/enhanced-certificates/disable.d.ts +0 -11
  44. package/lib/commands/data/enhanced-certificates/disable.js +0 -31
  45. package/lib/commands/data/enhanced-certificates/enable.d.ts +0 -12
  46. package/lib/commands/data/enhanced-certificates/enable.js +0 -34
  47. package/lib/commands/data/enhanced-certificates/status.d.ts +0 -12
  48. package/lib/commands/data/enhanced-certificates/status.js +0 -31
  49. package/lib/commands/data/labs/disable.d.ts +0 -13
  50. package/lib/commands/data/labs/disable.js +0 -44
  51. package/lib/commands/data/labs/enable.d.ts +0 -13
  52. package/lib/commands/data/labs/enable.js +0 -44
  53. package/lib/fetcher.d.ts +0 -3
  54. package/lib/fetcher.js +0 -16
  55. package/lib/index.d.ts +0 -2
  56. package/lib/index.js +0 -3
  57. package/lib/lib/base.js +0 -28
  58. package/lib/tsconfig.tsbuildinfo +0 -1
  59. /package/{lib → dist}/lib/base.d.ts +0 -0
@@ -1,49 +1,48 @@
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 fetcher_1 = require("../../../fetcher");
7
- const base_1 = require("../../../lib/base");
8
- class LabsList extends base_1.default {
1
+ import { flags } from '@heroku-cli/command';
2
+ import * as color from '@heroku/heroku-cli-util/color';
3
+ import { styledHeader } from '@heroku/heroku-cli-util/hux';
4
+ import { AddonResolver } from '@heroku/heroku-cli-util/utils/addons';
5
+ import { Args } from '@oclif/core';
6
+ import { ux } from '@oclif/core/ux';
7
+ import BaseCommand from '../../../lib/base.js';
8
+ export default class LabsList extends BaseCommand {
9
9
  static args = {
10
- addon: core_1.Args.string({ description: 'name of the addon', required: true }),
10
+ addon: Args.string({ description: 'name of the addon', required: true }),
11
11
  };
12
12
  static description = 'List available experimental features on an addon and their statuses';
13
13
  static examples = [
14
14
  '$ heroku data:labs:list happy-postgres-1234',
15
15
  ];
16
16
  static flags = {
17
- app: command_1.flags.app(),
17
+ app: flags.app(),
18
18
  };
19
19
  printFeatures(features, addonName) {
20
20
  features.sort((a, b) => a.name < b.name ? -1 : 1);
21
21
  const longest = Math.max.apply(null, features.map(f => f.name.length));
22
- core_1.ux.styledHeader(`Experimental Features Available for ${color_1.default.cyan(addonName)}:`);
22
+ styledHeader(`Experimental Features Available for ${color.addon(addonName)}:`);
23
23
  for (const f of features) {
24
24
  const pref = f.status.enabled ? '[+]' : (f.status.message ? '[-]' : '[ ]');
25
25
  let line = `${pref} ${f.name.padEnd(longest)}`;
26
26
  if (f.status.enabled)
27
- line = color_1.default.green(line);
27
+ line = color.green(line);
28
28
  if (f.status.message)
29
- line = color_1.default.yellow(line);
29
+ line = color.yellow(line);
30
30
  let statusMessage = f.status.message ? `(STATUS: ${f.status.message})` : '';
31
- statusMessage = color_1.default.yellow(statusMessage);
31
+ statusMessage = color.yellow(statusMessage);
32
32
  line = `${line} ${statusMessage} ${f.description}`;
33
- core_1.ux.log(line);
33
+ ux.stdout(line);
34
34
  }
35
35
  }
36
36
  async run() {
37
37
  const { args, flags } = await this.parse(LabsList);
38
- const addon = await (0, fetcher_1.fetchAddon)(this.heroku, args.addon, flags.app);
38
+ const addonResolver = new AddonResolver(this.heroku);
39
+ const addon = await addonResolver.resolve(args.addon, flags.app);
39
40
  try {
40
41
  const { body: res } = await this.shogun.get(`/client/v11/labs/${addon.id}/list`, this.shogun.defaults);
41
42
  this.printFeatures(res.message, addon.name);
42
43
  }
43
44
  catch (error) {
44
- core_1.ux.error(error);
45
+ ux.error(error);
45
46
  }
46
- core_1.ux.action.stop();
47
47
  }
48
48
  }
49
- exports.default = LabsList;
@@ -0,0 +1 @@
1
+ export { run } from '@oclif/core';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { run } from '@oclif/core';
@@ -0,0 +1,25 @@
1
+ import { APIClient, Command } from '@heroku-cli/command';
2
+ import * as color from '@heroku/heroku-cli-util/color';
3
+ import { prompt } from '@heroku/heroku-cli-util/hux';
4
+ import { ux } from '@oclif/core/ux';
5
+ export default class Base extends Command {
6
+ shogun;
7
+ constructor(argv, config) {
8
+ super(argv, config);
9
+ const client = new APIClient(this.config, {});
10
+ client.defaults.host = process.env.HEROKU_DATA_HOST || 'api.data.heroku.com';
11
+ client.defaults.headers = {
12
+ ...this.heroku.defaults.headers,
13
+ authorization: `Basic ${Buffer.from(':' + this.heroku.auth).toString('base64')}`,
14
+ };
15
+ this.shogun = client;
16
+ }
17
+ }
18
+ export async function confirmConnector(connector, confirm) {
19
+ if (!confirm) {
20
+ confirm = await prompt(`To proceed, type ${color.red(connector)} or re-run this command with ${color.command(`--confirm ${connector}`)}`);
21
+ }
22
+ if (confirm !== connector) {
23
+ ux.error(`Confirmation ${color.red(confirm)} did not match ${color.red(connector)}. Aborted.`);
24
+ }
25
+ }