@heroku-cli/plugin-data 1.3.2 → 2.0.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.
Files changed (37) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +197 -107
  3. package/lib/commands/data/connectors/create.d.ts +8 -9
  4. package/lib/commands/data/connectors/create.js +52 -49
  5. package/lib/commands/data/connectors/destroy.d.ts +5 -6
  6. package/lib/commands/data/connectors/destroy.js +22 -24
  7. package/lib/commands/data/connectors/index.d.ts +6 -7
  8. package/lib/commands/data/connectors/index.js +38 -38
  9. package/lib/commands/data/connectors/info.d.ts +4 -4
  10. package/lib/commands/data/connectors/info.js +31 -32
  11. package/lib/commands/data/connectors/pause.d.ts +3 -3
  12. package/lib/commands/data/connectors/pause.js +16 -15
  13. package/lib/commands/data/connectors/resume.d.ts +3 -3
  14. package/lib/commands/data/connectors/resume.js +16 -15
  15. package/lib/commands/data/connectors/update.d.ts +9 -9
  16. package/lib/commands/data/connectors/update.js +60 -57
  17. package/lib/commands/data/connectors/wait.d.ts +3 -3
  18. package/lib/commands/data/connectors/wait.js +13 -13
  19. package/lib/commands/data/enhanced-certificates/disable.d.ts +4 -5
  20. package/lib/commands/data/enhanced-certificates/disable.js +16 -11
  21. package/lib/commands/data/enhanced-certificates/enable.d.ts +4 -5
  22. package/lib/commands/data/enhanced-certificates/enable.js +19 -14
  23. package/lib/commands/data/enhanced-certificates/status.d.ts +5 -6
  24. package/lib/commands/data/enhanced-certificates/status.js +14 -12
  25. package/lib/commands/data/labs/disable.d.ts +5 -6
  26. package/lib/commands/data/labs/disable.js +28 -20
  27. package/lib/commands/data/labs/enable.d.ts +5 -6
  28. package/lib/commands/data/labs/enable.js +28 -20
  29. package/lib/commands/data/labs/list.d.ts +14 -6
  30. package/lib/commands/data/labs/list.js +18 -16
  31. package/lib/fetcher.d.ts +1 -1
  32. package/lib/fetcher.js +5 -10
  33. package/lib/lib/base.d.ts +5 -5
  34. package/lib/lib/base.js +10 -7
  35. package/lib/tsconfig.tsbuildinfo +1 -0
  36. package/oclif.manifest.json +646 -1
  37. package/package.json +28 -30
@@ -1,13 +1,12 @@
1
- import { flags } from '@heroku-cli/command';
2
1
  import BaseCommand from '../../../lib/base';
3
2
  export default class ConnectorsDestroy extends BaseCommand {
4
- static description: string;
5
3
  static args: {
6
- name: string;
7
- }[];
8
- static flags: {
9
- confirm: flags.IOptionFlag<string | undefined>;
4
+ connector: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
10
5
  };
6
+ static description: string;
11
7
  static examples: string[];
8
+ static flags: {
9
+ confirm: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ };
12
11
  run(): Promise<void>;
13
12
  }
@@ -1,43 +1,41 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const cli_ux_1 = require("cli-ux");
4
3
  const command_1 = require("@heroku-cli/command");
4
+ const core_1 = require("@oclif/core");
5
5
  const base_1 = require("../../../lib/base");
6
6
  class ConnectorsDestroy extends base_1.default {
7
+ static args = {
8
+ connector: core_1.Args.string({ description: 'name of the connector', required: true }),
9
+ };
10
+ static description = 'Destroy a Data Connector\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
11
+ static examples = [
12
+ '$ heroku data:connectors:destroy gentle-connector-1234',
13
+ '$ heroku data:connectors:destroy gentle-connector-1234 --confirm gentle-connector-1234',
14
+ ];
15
+ static flags = {
16
+ confirm: command_1.flags.string({
17
+ description: 'confirms destroying the connector if passed in',
18
+ required: false,
19
+ }),
20
+ };
7
21
  async run() {
8
- const { args, flags } = this.parse(ConnectorsDestroy);
9
- const connector = args.connector;
22
+ const { args, flags } = await this.parse(ConnectorsDestroy);
23
+ const { connector } = args;
10
24
  const confirm = flags.confirm || '';
11
25
  await (0, base_1.confirmConnector)(connector, confirm);
12
- cli_ux_1.cli.action.start('Destroying Data Connector');
26
+ core_1.ux.action.start('Destroying Data Connector');
13
27
  try {
14
28
  await this.shogun.delete(`/data/cdc/v0/connectors/${connector}`, this.shogun.defaults);
15
- this.log(`Data Connector ${connector} deleted successfully.`);
16
- this.log('Note: We do not delete your Kafka topics automatically, because they could still contain messages which you haven\'t consumed. Please delete the topics manually. See heroku kafka:topics:destroy --help');
29
+ core_1.ux.log(`Data Connector ${connector} deleted successfully.`);
30
+ core_1.ux.log('Note: We do not delete your Kafka topics automatically, because they could still contain messages which you haven\'t consumed. Please delete the topics manually. See heroku kafka:topics:destroy --help');
17
31
  }
18
32
  catch (error) {
19
- this.warn('There was an issue deleting your Data Connector.');
33
+ core_1.ux.warn('There was an issue deleting your Data Connector.');
20
34
  throw error;
21
35
  }
22
36
  finally {
23
- cli_ux_1.cli.action.stop();
37
+ core_1.ux.action.stop();
24
38
  }
25
39
  }
26
40
  }
27
41
  exports.default = ConnectorsDestroy;
28
- ConnectorsDestroy.description = 'Destroy a Data Connector\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
29
- ConnectorsDestroy.args = [
30
- {
31
- name: 'connector',
32
- },
33
- ];
34
- ConnectorsDestroy.flags = {
35
- confirm: command_1.flags.string({
36
- description: 'confirms destroying the connector if passed in',
37
- required: false,
38
- }),
39
- };
40
- ConnectorsDestroy.examples = [
41
- '$ heroku data:connectors:destroy gentle-connector-1234',
42
- '$ heroku data:connectors:destroy gentle-connector-1234 --confirm gentle-connector-1234',
43
- ];
@@ -1,15 +1,14 @@
1
- import { flags } from '@heroku-cli/command';
2
1
  import BaseCommand from '../../../lib/base';
3
2
  export default class ConnectorsList extends BaseCommand {
4
- static description: string;
5
3
  static aliases: string[];
4
+ static description: string;
6
5
  static examples: string[];
7
6
  static flags: {
8
- app: flags.IOptionFlag<string | undefined>;
9
- remote: flags.IOptionFlag<string | undefined>;
10
- addon: flags.IOptionFlag<string | undefined>;
11
- table: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
12
- json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
7
+ addon: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ table: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
12
  };
14
13
  run(): Promise<void>;
15
14
  }
@@ -1,12 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const command_1 = require("@heroku-cli/command");
4
- const cli_ux_1 = require("cli-ux");
4
+ const core_1 = require("@oclif/core");
5
5
  const fetcher_1 = require("../../../fetcher");
6
6
  const base_1 = require("../../../lib/base");
7
7
  class ConnectorsList extends base_1.default {
8
+ static aliases = [
9
+ 'data:connectors:list',
10
+ ];
11
+ static description = 'List all Data Connectors for a particular app or addon\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
12
+ static examples = [
13
+ 'heroku data:connectors -a your-app',
14
+ 'heroku data:connectors --app=your-app --json',
15
+ 'heroku data:connectors --addon=your-postgres-addon --table',
16
+ ];
17
+ static flags = {
18
+ addon: command_1.flags.string({
19
+ description: 'The ID or name for the addon your connector is attached to',
20
+ }),
21
+ app: command_1.flags.app(),
22
+ json: command_1.flags.boolean({
23
+ description: 'Return the results as JSON',
24
+ exclusive: ['table'],
25
+ }),
26
+ remote: command_1.flags.remote(),
27
+ table: command_1.flags.boolean({
28
+ description: 'Return the results as a table',
29
+ exclusive: ['json'],
30
+ }),
31
+ };
8
32
  async run() {
9
- const { flags } = this.parse(ConnectorsList);
33
+ const { flags } = await this.parse(ConnectorsList);
10
34
  let connectorInfo;
11
35
  if (flags.addon) {
12
36
  const addon = await (0, fetcher_1.fetchAddon)(this.heroku, flags.addon, flags.app);
@@ -20,18 +44,18 @@ class ConnectorsList extends base_1.default {
20
44
  connectorInfo = response.body;
21
45
  }
22
46
  else {
23
- cli_ux_1.cli.error('You must pass either the --app or --addon flag');
47
+ core_1.ux.error('You must pass either the --app or --addon flag');
24
48
  }
25
49
  if (flags.json) {
26
- connectorInfo.forEach(v => {
27
- cli_ux_1.cli.styledJSON(v);
28
- this.log();
29
- });
50
+ for (const v of connectorInfo) {
51
+ core_1.ux.styledJSON(v);
52
+ core_1.ux.log();
53
+ }
30
54
  return;
31
55
  }
32
- cli_ux_1.cli.styledHeader(`Data Connector info for ${flags.app || flags.addon}`);
56
+ core_1.ux.styledHeader(`Data Connector info for ${flags.app || flags.addon}`);
33
57
  if (flags.table) {
34
- cli_ux_1.cli.table(connectorInfo, {
58
+ core_1.ux.table(connectorInfo, {
35
59
  name: { header: 'Connector Name' },
36
60
  kafka_addon: {
37
61
  header: 'Kafka Add-On',
@@ -46,42 +70,18 @@ class ConnectorsList extends base_1.default {
46
70
  });
47
71
  }
48
72
  else {
49
- connectorInfo.forEach(c => {
50
- cli_ux_1.cli.styledObject({
73
+ for (const c of connectorInfo) {
74
+ core_1.ux.styledObject({
51
75
  'Connector Name': c.name,
52
76
  'Kafka Add-On': c.kafka_addon.name,
53
77
  'Postgres Add-On': c.postgres_addon.name,
54
78
  Tables: c.tables,
55
79
  'Excluded Columns': c.excluded_columns,
56
80
  });
57
- this.log();
58
- });
81
+ core_1.ux.log();
82
+ }
59
83
  }
60
- this.log();
84
+ core_1.ux.log();
61
85
  }
62
86
  }
63
87
  exports.default = ConnectorsList;
64
- ConnectorsList.description = 'List all Data Connectors for a particular app or addon\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
65
- ConnectorsList.aliases = [
66
- 'data:connectors:list',
67
- ];
68
- ConnectorsList.examples = [
69
- 'heroku data:connectors -a your-app',
70
- 'heroku data:connectors --app=your-app --json',
71
- 'heroku data:connectors --addon=your-postgres-addon --table',
72
- ];
73
- ConnectorsList.flags = {
74
- app: command_1.flags.app(),
75
- remote: command_1.flags.remote(),
76
- addon: command_1.flags.string({
77
- description: 'The ID or name for the addon your connector is attached to',
78
- }),
79
- table: command_1.flags.boolean({
80
- description: 'Return the results as a table',
81
- exclusive: ['json'],
82
- }),
83
- json: command_1.flags.boolean({
84
- description: 'Return the results as JSON',
85
- exclusive: ['table'],
86
- }),
87
- };
@@ -1,12 +1,12 @@
1
1
  import BaseCommand from '../../../lib/base';
2
2
  export default class ConnectorsInfo extends BaseCommand {
3
+ static args: {
4
+ connector: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
5
+ };
3
6
  static description: string;
4
7
  static examples: string[];
5
8
  static flags: {
6
- json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
9
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
10
  };
8
- static args: {
9
- name: string;
10
- }[];
11
11
  run(): Promise<void>;
12
12
  }
@@ -1,61 +1,60 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@heroku-cli/command");
4
3
  const color_1 = require("@heroku-cli/color");
5
- const cli_ux_1 = require("cli-ux");
4
+ const command_1 = require("@heroku-cli/command");
5
+ const core_1 = require("@oclif/core");
6
6
  const base_1 = require("../../../lib/base");
7
7
  class ConnectorsInfo extends base_1.default {
8
+ static args = {
9
+ connector: core_1.Args.string({ description: 'name of the connector', required: true }),
10
+ };
11
+ static description = 'Get information about a Data Connector\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
12
+ static examples = [
13
+ '$ heroku data:connectors:info gentle-connector-1234',
14
+ '$ heroku data:connectors:info gentle-connector-1234 --json',
15
+ ];
16
+ static flags = {
17
+ json: command_1.flags.boolean({
18
+ description: 'Return the results as JSON',
19
+ }),
20
+ };
8
21
  async run() {
9
- const { args, flags } = this.parse(ConnectorsInfo);
10
- const connector = args.connector;
22
+ const { args, flags } = await this.parse(ConnectorsInfo);
23
+ const { connector } = args;
11
24
  const { body: res } = await this.shogun.get(`/data/cdc/v0/connectors/${connector}`, this.shogun.defaults);
12
25
  if (flags.json) {
13
- cli_ux_1.default.styledJSON(res);
26
+ core_1.ux.styledJSON(res);
14
27
  return;
15
28
  }
16
29
  if (res.status === 'creating') {
17
- this.log(`The Data Connector is now being provisioned for ${color_1.default.cyan(connector)}.`);
18
- this.log(`Run ${color_1.default.cyan(`heroku data:connectors:wait ${res.name}`)} to check the creation process.`);
30
+ core_1.ux.log(`The Data Connector is now being provisioned for ${color_1.default.cyan(connector)}.`);
31
+ core_1.ux.log(`Run ${color_1.default.cmd(`heroku data:connectors:wait ${res.name}`)} to check the creation process.`);
19
32
  return;
20
33
  }
21
- cli_ux_1.default.styledHeader(`Data Connector status for ${color_1.default.cyan(connector)}`);
22
- cli_ux_1.default.styledObject({
34
+ core_1.ux.styledHeader(`Data Connector status for ${color_1.default.cyan(connector)}`);
35
+ core_1.ux.styledObject({
23
36
  Lag: res.lag,
24
37
  Status: res.status,
25
38
  'Service Name': res.uuid || 'Provisioning',
26
39
  });
27
40
  if (res.topics && res.topics.length > 0) {
28
- this.log();
29
- cli_ux_1.default.styledHeader('Configuration');
30
- cli_ux_1.default.table(res.topics, {
41
+ core_1.ux.log();
42
+ core_1.ux.styledHeader('Configuration');
43
+ core_1.ux.table(res.topics, {
31
44
  table_name: { header: 'Table Name' },
32
45
  topic_name: { header: 'Topic Name' },
33
46
  });
34
47
  }
35
48
  if (res.excluded_columns && res.excluded_columns.length > 0) {
36
- this.log();
37
- this.log(color_1.default.bold('Excluded Columns'));
38
- res.excluded_columns.forEach(column => this.log(column));
49
+ core_1.ux.log();
50
+ core_1.ux.log(color_1.default.bold('Excluded Columns'));
51
+ for (const column of res.excluded_columns)
52
+ this.log(column);
39
53
  }
40
- this.log();
54
+ core_1.ux.log();
41
55
  if (res.status === 'available') {
42
- this.log(`Your Data Connector is now ${color_1.default.green('available')}.`);
56
+ core_1.ux.log(`Your Data Connector is now ${color_1.default.green('available')}.`);
43
57
  }
44
58
  }
45
59
  }
46
60
  exports.default = ConnectorsInfo;
47
- ConnectorsInfo.description = 'Get information about a Data Connector\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
48
- ConnectorsInfo.examples = [
49
- '$ heroku data:connectors:info gentle-connector-1234',
50
- '$ heroku data:connectors:info gentle-connector-1234 --json',
51
- ];
52
- ConnectorsInfo.flags = {
53
- json: command_1.flags.boolean({
54
- description: 'Return the results as JSON',
55
- }),
56
- };
57
- ConnectorsInfo.args = [
58
- {
59
- name: 'connector',
60
- },
61
- ];
@@ -1,9 +1,9 @@
1
1
  import BaseCommand from '../../../lib/base';
2
2
  export default class ConnectorsPause extends BaseCommand {
3
+ static args: {
4
+ connector: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
5
+ };
3
6
  static description: string;
4
7
  static examples: string[];
5
- static args: {
6
- name: string;
7
- }[];
8
8
  run(): Promise<void>;
9
9
  }
@@ -1,27 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const cli_ux_1 = require("cli-ux");
3
+ const core_1 = require("@oclif/core");
4
4
  const base_1 = require("../../../lib/base");
5
5
  class ConnectorsPause extends base_1.default {
6
+ static args = {
7
+ connector: core_1.Args.string({ description: 'name of the connector', required: true }),
8
+ };
9
+ static description = 'Pause change event creation on a Data Connector\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
10
+ static examples = [
11
+ '$ heroku data:connectors:pause gentle-connector-1234',
12
+ ];
6
13
  async run() {
7
- const { args } = this.parse(ConnectorsPause);
8
- cli_ux_1.cli.action.start(`Pausing Data Connector ${args.connector}`);
14
+ const { args } = await this.parse(ConnectorsPause);
15
+ core_1.ux.action.start(`Pausing Data Connector ${args.connector}`);
9
16
  try {
10
- await this.shogun.put(`/data/cdc/v0/connectors/${args.connector}/pause`, Object.assign(Object.assign({}, this.shogun.defaults), { raw: true }));
17
+ await this.shogun.put(`/data/cdc/v0/connectors/${args.connector}/pause`, {
18
+ ...this.shogun.defaults,
19
+ raw: true,
20
+ });
11
21
  }
12
22
  catch (error) {
13
- cli_ux_1.cli.error(error);
23
+ core_1.ux.error(error);
14
24
  }
15
- cli_ux_1.cli.action.stop();
25
+ core_1.ux.action.stop();
16
26
  }
17
27
  }
18
28
  exports.default = ConnectorsPause;
19
- ConnectorsPause.description = 'Pause change event creation on a Data Connector\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
20
- ConnectorsPause.examples = [
21
- '$ heroku data:connectors:pause gentle-connector-1234',
22
- ];
23
- ConnectorsPause.args = [
24
- {
25
- name: 'connector',
26
- },
27
- ];
@@ -1,9 +1,9 @@
1
1
  import BaseCommand from '../../../lib/base';
2
2
  export default class ConnectorsResume extends BaseCommand {
3
+ static args: {
4
+ connector: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
5
+ };
3
6
  static description: string;
4
7
  static examples: string[];
5
- static args: {
6
- name: string;
7
- }[];
8
8
  run(): Promise<void>;
9
9
  }
@@ -1,27 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const cli_ux_1 = require("cli-ux");
3
+ const core_1 = require("@oclif/core");
4
4
  const base_1 = require("../../../lib/base");
5
5
  class ConnectorsResume extends base_1.default {
6
+ static args = {
7
+ connector: core_1.Args.string({ description: 'name of the connector', required: true }),
8
+ };
9
+ static description = 'Resume change event creation on a Data Connector\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
10
+ static examples = [
11
+ '$ heroku data:connectors:resume gentle-connector-1234',
12
+ ];
6
13
  async run() {
7
- const { args } = this.parse(ConnectorsResume);
8
- cli_ux_1.cli.action.start(`Resuming Data Connector ${args.connector}`);
14
+ const { args } = await this.parse(ConnectorsResume);
15
+ core_1.ux.action.start(`Resuming Data Connector ${args.connector}`);
9
16
  try {
10
- await this.shogun.put(`/data/cdc/v0/connectors/${args.connector}/resume`, Object.assign(Object.assign({}, this.shogun.defaults), { raw: true }));
17
+ await this.shogun.put(`/data/cdc/v0/connectors/${args.connector}/resume`, {
18
+ ...this.shogun.defaults,
19
+ raw: true,
20
+ });
11
21
  }
12
22
  catch (error) {
13
- cli_ux_1.cli.error(error);
23
+ core_1.ux.error(error);
14
24
  }
15
- cli_ux_1.cli.action.stop();
25
+ core_1.ux.action.stop();
16
26
  }
17
27
  }
18
28
  exports.default = ConnectorsResume;
19
- ConnectorsResume.description = 'Resume change event creation on a Data Connector\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
20
- ConnectorsResume.examples = [
21
- '$ heroku data:connectors:resume gentle-connector-1234',
22
- ];
23
- ConnectorsResume.args = [
24
- {
25
- name: 'connector',
26
- },
27
- ];
@@ -1,17 +1,17 @@
1
- import { flags } from '@heroku-cli/command';
2
1
  import BaseCommand from '../../../lib/base';
3
2
  export default class ConnectorsUpdate extends BaseCommand {
3
+ static args: {
4
+ connector: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
5
+ };
4
6
  static description: string;
5
7
  static examples: string[];
6
- static args: {
7
- name: string;
8
- }[];
9
8
  static flags: {
10
- setting: flags.IOptionFlag<string[]>;
11
- 'add-table': flags.IOptionFlag<string[]>;
12
- 'remove-table': flags.IOptionFlag<string[]>;
13
- 'exclude-column': flags.IOptionFlag<string[]>;
14
- 'remove-excluded-column': flags.IOptionFlag<string[]>;
9
+ setting: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ 'add-table': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ 'remove-table': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
+ 'exclude-column': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
13
+ 'remove-excluded-column': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
15
14
  };
16
15
  run(): Promise<void>;
16
+ private parseSettings;
17
17
  }
@@ -1,81 +1,84 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@heroku-cli/command");
4
3
  const color_1 = require("@heroku-cli/color");
5
- const cli_ux_1 = require("cli-ux");
4
+ const command_1 = require("@heroku-cli/command");
5
+ const core_1 = require("@oclif/core");
6
6
  const base_1 = require("../../../lib/base");
7
7
  class ConnectorsUpdate extends base_1.default {
8
+ static args = {
9
+ connector: core_1.Args.string({ description: 'name of the connector', required: true }),
10
+ };
11
+ static description = 'Update the settings, tables, and columns to exclude for a Data Connector\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors#update-configuration';
12
+ static examples = [
13
+ '$ heroku data:connectors:update gentle-connector-1234 --setting key=value --setting otherKey=otherValue --add-table public.posts --add-table public.people --remove-table public.messages --exclude-column public.posts.key --remove-excluded-column public.parcels.key',
14
+ ];
15
+ static flags = {
16
+ setting: command_1.flags.string({
17
+ multiple: true,
18
+ required: false,
19
+ }),
20
+ 'add-table': command_1.flags.string({
21
+ description: 'Tables to add',
22
+ multiple: true,
23
+ required: false,
24
+ }),
25
+ 'remove-table': command_1.flags.string({
26
+ description: 'Tables to remove',
27
+ multiple: true,
28
+ required: false,
29
+ }),
30
+ 'exclude-column': command_1.flags.string({
31
+ description: 'Columns to exclude',
32
+ multiple: true,
33
+ required: false,
34
+ }),
35
+ 'remove-excluded-column': command_1.flags.string({
36
+ description: 'Columns to no longer exclude',
37
+ multiple: true,
38
+ required: false,
39
+ }),
40
+ };
8
41
  async run() {
9
- const { args, flags } = this.parse(ConnectorsUpdate);
42
+ const { args, flags } = await this.parse(ConnectorsUpdate);
10
43
  const setting = flags.setting || [];
11
44
  const tablesToAdd = flags['add-table'] || [];
12
45
  const tablesToRemove = flags['remove-table'] || [];
13
46
  const excludedColumnsToAdd = flags['exclude-column'] || [];
14
47
  const excludedColumnsToRemove = flags['remove-excluded-column'] || [];
15
- const params = setting.reduce((acc, [key, value]) => {
16
- acc[key] = value;
17
- return acc;
18
- }, {});
19
- cli_ux_1.default.action.start(`Updating Data Connector ${args.connector}`);
48
+ const params = this.parseSettings(setting);
49
+ core_1.ux.action.start(`Updating Data Connector ${args.connector}`);
20
50
  try {
21
51
  const { body: res } = await this.shogun.get(`/data/cdc/v0/connectors/${args.connector}`, this.shogun.defaults);
22
- const tables = [...new Set(res.tables.concat(tablesToAdd).filter(t => !tablesToRemove.includes(t)))];
23
- const excludedColumns = [...new Set(res.excluded_columns.concat(excludedColumnsToAdd).filter(c => !excludedColumnsToRemove.includes(c)))];
24
- await this.shogun.patch(`/data/cdc/v0/connectors/${args.connector}`, Object.assign({ body: {
25
- settings: params,
26
- tables: tables,
52
+ const tables = [...new Set([...res.tables, ...tablesToAdd].filter(t => !tablesToRemove.includes(t)))];
53
+ const excludedColumns = [...new Set([...res.excluded_columns, ...excludedColumnsToAdd].filter(c => !excludedColumnsToRemove.includes(c)))];
54
+ await this.shogun.patch(`/data/cdc/v0/connectors/${args.connector}`, {
55
+ body: {
27
56
  excluded_columns: excludedColumns,
28
- } }, this.shogun.defaults));
57
+ settings: params,
58
+ tables,
59
+ },
60
+ ...this.shogun.defaults,
61
+ });
29
62
  }
30
63
  catch (error) {
31
- cli_ux_1.default.error(error);
64
+ core_1.ux.error(error);
32
65
  }
33
- cli_ux_1.default.action.stop();
66
+ core_1.ux.action.stop();
34
67
  this.log();
35
68
  this.log('Your Data Connector is now being updated.');
36
69
  this.log(`Run ${color_1.default.cyan(`heroku data:connectors:wait ${args.connector}`)} to check the update process.`);
37
70
  }
38
- }
39
- exports.default = ConnectorsUpdate;
40
- ConnectorsUpdate.description = 'Update the settings, tables, and columns to exclude for a Data Connector\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors#update-configuration';
41
- ConnectorsUpdate.examples = [
42
- '$ heroku data:connectors:update gentle-connector-1234 --setting key=value --setting otherKey=otherValue --add-table public.posts --add-table public.people --remove-table public.messages --exclude-column public.posts.key --remove-excluded-column public.parcels.key',
43
- ];
44
- ConnectorsUpdate.args = [
45
- {
46
- name: 'connector',
47
- },
48
- ];
49
- ConnectorsUpdate.flags = {
50
- setting: command_1.flags.string({
51
- multiple: true,
52
- required: false,
53
- parse: input => {
54
- const [key, value] = input.split('=');
71
+ parseSettings(settings) {
72
+ return settings.map(setting => {
73
+ const [key, value] = setting.split('=');
55
74
  if (!key || !value) {
56
- cli_ux_1.default.error('You must pass each --setting flag using the format `key=value`');
75
+ core_1.ux.error('You must pass each --setting flag using the format `key=value`');
57
76
  }
58
77
  return [key, value];
59
- },
60
- }),
61
- 'add-table': command_1.flags.string({
62
- description: 'Tables to add',
63
- multiple: true,
64
- required: false,
65
- }),
66
- 'remove-table': command_1.flags.string({
67
- description: 'Tables to remove',
68
- multiple: true,
69
- required: false,
70
- }),
71
- 'exclude-column': command_1.flags.string({
72
- description: 'Columns to exclude',
73
- multiple: true,
74
- required: false,
75
- }),
76
- 'remove-excluded-column': command_1.flags.string({
77
- description: 'Columns to no longer exclude',
78
- multiple: true,
79
- required: false,
80
- }),
81
- };
78
+ }).reduce((acc, [key, value]) => {
79
+ acc[key] = value;
80
+ return acc;
81
+ }, {});
82
+ }
83
+ }
84
+ exports.default = ConnectorsUpdate;
@@ -1,9 +1,9 @@
1
1
  import BaseCommand from '../../../lib/base';
2
2
  export default class ConnectorsWait extends BaseCommand {
3
- static description: string;
4
3
  static args: {
5
- name: string;
6
- }[];
4
+ connector: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
7
  static examples: string[];
8
8
  run(): Promise<void>;
9
9
  }