@commercelayer/cli-plugin-triggers 3.13.1 → 3.14.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 (60) hide show
  1. package/README.md +486 -3
  2. package/lib/commands/buy_x_pay_y_promotion/disable.d.ts +9 -0
  3. package/lib/commands/buy_x_pay_y_promotion/disable.js +21 -0
  4. package/lib/commands/buy_x_pay_y_promotion/enable.d.ts +9 -0
  5. package/lib/commands/buy_x_pay_y_promotion/enable.js +21 -0
  6. package/lib/commands/buy_x_pay_y_promotion/index.d.ts +9 -0
  7. package/lib/commands/buy_x_pay_y_promotion/index.js +38 -0
  8. package/lib/commands/external_promotion/disable.d.ts +9 -0
  9. package/lib/commands/external_promotion/disable.js +21 -0
  10. package/lib/commands/external_promotion/enable.d.ts +9 -0
  11. package/lib/commands/external_promotion/enable.js +21 -0
  12. package/lib/commands/external_promotion/index.d.ts +9 -0
  13. package/lib/commands/external_promotion/index.js +38 -0
  14. package/lib/commands/fixed_amount_promotion/disable.d.ts +9 -0
  15. package/lib/commands/fixed_amount_promotion/disable.js +21 -0
  16. package/lib/commands/fixed_amount_promotion/enable.d.ts +9 -0
  17. package/lib/commands/fixed_amount_promotion/enable.js +21 -0
  18. package/lib/commands/fixed_amount_promotion/index.d.ts +9 -0
  19. package/lib/commands/fixed_amount_promotion/index.js +38 -0
  20. package/lib/commands/fixed_price_promotion/disable.d.ts +9 -0
  21. package/lib/commands/fixed_price_promotion/disable.js +21 -0
  22. package/lib/commands/fixed_price_promotion/enable.d.ts +9 -0
  23. package/lib/commands/fixed_price_promotion/enable.js +21 -0
  24. package/lib/commands/fixed_price_promotion/index.d.ts +9 -0
  25. package/lib/commands/fixed_price_promotion/index.js +38 -0
  26. package/lib/commands/free_gift_promotion/disable.d.ts +9 -0
  27. package/lib/commands/free_gift_promotion/disable.js +21 -0
  28. package/lib/commands/free_gift_promotion/enable.d.ts +9 -0
  29. package/lib/commands/free_gift_promotion/enable.js +21 -0
  30. package/lib/commands/free_gift_promotion/index.d.ts +9 -0
  31. package/lib/commands/free_gift_promotion/index.js +38 -0
  32. package/lib/commands/free_shipping_promotion/disable.d.ts +9 -0
  33. package/lib/commands/free_shipping_promotion/disable.js +21 -0
  34. package/lib/commands/free_shipping_promotion/enable.d.ts +9 -0
  35. package/lib/commands/free_shipping_promotion/enable.js +21 -0
  36. package/lib/commands/free_shipping_promotion/index.d.ts +9 -0
  37. package/lib/commands/free_shipping_promotion/index.js +38 -0
  38. package/lib/commands/percentage_discount_promotion/disable.d.ts +9 -0
  39. package/lib/commands/percentage_discount_promotion/disable.js +21 -0
  40. package/lib/commands/percentage_discount_promotion/enable.d.ts +9 -0
  41. package/lib/commands/percentage_discount_promotion/enable.js +21 -0
  42. package/lib/commands/percentage_discount_promotion/index.d.ts +9 -0
  43. package/lib/commands/percentage_discount_promotion/index.js +38 -0
  44. package/lib/triggers/buy_x_pay_y_promotions.d.ts +3 -0
  45. package/lib/triggers/buy_x_pay_y_promotions.js +15 -0
  46. package/lib/triggers/external_promotions.d.ts +3 -0
  47. package/lib/triggers/external_promotions.js +15 -0
  48. package/lib/triggers/fixed_amount_promotions.d.ts +3 -0
  49. package/lib/triggers/fixed_amount_promotions.js +15 -0
  50. package/lib/triggers/fixed_price_promotions.d.ts +3 -0
  51. package/lib/triggers/fixed_price_promotions.js +15 -0
  52. package/lib/triggers/free_gift_promotions.d.ts +3 -0
  53. package/lib/triggers/free_gift_promotions.js +15 -0
  54. package/lib/triggers/free_shipping_promotions.d.ts +3 -0
  55. package/lib/triggers/free_shipping_promotions.js +15 -0
  56. package/lib/triggers/orders.js +1 -1
  57. package/lib/triggers/percentage_discount_promotions.d.ts +3 -0
  58. package/lib/triggers/percentage_discount_promotions.js +15 -0
  59. package/oclif.manifest.json +1535 -23
  60. package/package.json +15 -15
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class ExternalPromotionEnable extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const external_promotions_1 = require("../../triggers/external_promotions");
7
+ const TRIGGER = 'enable';
8
+ class ExternalPromotionEnable extends base_1.default {
9
+ async run() {
10
+ const { args, flags } = await this.parse(ExternalPromotionEnable);
11
+ const res = await (0, exec_1.default)('external_promotions', args.id, TRIGGER, flags);
12
+ if (flags.print)
13
+ this.printOutput(res, flags);
14
+ this.successMessage('external_promotion', TRIGGER, res.id);
15
+ return res;
16
+ }
17
+ }
18
+ ExternalPromotionEnable.description = external_promotions_1.triggers[TRIGGER].description;
19
+ ExternalPromotionEnable.flags = {};
20
+ ExternalPromotionEnable.args = Object.assign({}, base_1.default.args);
21
+ exports.default = ExternalPromotionEnable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class ExternalPromotionIndex extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
7
+ const cli_core_1 = require("@commercelayer/cli-core");
8
+ const external_promotions_1 = require("../../triggers/external_promotions");
9
+ const promptAction = async (id) => {
10
+ const answers = await inquirer_1.default.prompt([{
11
+ type: 'list',
12
+ name: 'trigger',
13
+ message: `Select an action to execute on external promotion ${cli_core_1.clColor.api.id(id)}:`,
14
+ choices: Object.keys(external_promotions_1.triggers).sort().map(a => {
15
+ return { name: a, value: a };
16
+ }),
17
+ loop: false,
18
+ pageSize: 10,
19
+ }]);
20
+ return answers.trigger;
21
+ };
22
+ class ExternalPromotionIndex extends base_1.default {
23
+ async run() {
24
+ const { args, flags } = await this.parse(ExternalPromotionIndex);
25
+ const id = args.id;
26
+ const action = await promptAction(id);
27
+ const fields = [];
28
+ const res = await (0, exec_1.default)('external_promotions', id, action, flags, fields);
29
+ this.log();
30
+ this.printOutput(res, flags);
31
+ this.successMessage('external promotion', action, res.id);
32
+ return res;
33
+ }
34
+ }
35
+ ExternalPromotionIndex.description = 'execute an action on a resource of type external_promotions';
36
+ ExternalPromotionIndex.flags = {};
37
+ ExternalPromotionIndex.args = Object.assign({}, base_1.default.args);
38
+ exports.default = ExternalPromotionIndex;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class FixedAmountPromotionDisable extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const fixed_amount_promotions_1 = require("../../triggers/fixed_amount_promotions");
7
+ const TRIGGER = 'disable';
8
+ class FixedAmountPromotionDisable extends base_1.default {
9
+ async run() {
10
+ const { args, flags } = await this.parse(FixedAmountPromotionDisable);
11
+ const res = await (0, exec_1.default)('fixed_amount_promotions', args.id, TRIGGER, flags);
12
+ if (flags.print)
13
+ this.printOutput(res, flags);
14
+ this.successMessage('fixed_amount_promotion', TRIGGER, res.id);
15
+ return res;
16
+ }
17
+ }
18
+ FixedAmountPromotionDisable.description = fixed_amount_promotions_1.triggers[TRIGGER].description;
19
+ FixedAmountPromotionDisable.flags = {};
20
+ FixedAmountPromotionDisable.args = Object.assign({}, base_1.default.args);
21
+ exports.default = FixedAmountPromotionDisable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class FixedAmountPromotionEnable extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const fixed_amount_promotions_1 = require("../../triggers/fixed_amount_promotions");
7
+ const TRIGGER = 'enable';
8
+ class FixedAmountPromotionEnable extends base_1.default {
9
+ async run() {
10
+ const { args, flags } = await this.parse(FixedAmountPromotionEnable);
11
+ const res = await (0, exec_1.default)('fixed_amount_promotions', args.id, TRIGGER, flags);
12
+ if (flags.print)
13
+ this.printOutput(res, flags);
14
+ this.successMessage('fixed_amount_promotion', TRIGGER, res.id);
15
+ return res;
16
+ }
17
+ }
18
+ FixedAmountPromotionEnable.description = fixed_amount_promotions_1.triggers[TRIGGER].description;
19
+ FixedAmountPromotionEnable.flags = {};
20
+ FixedAmountPromotionEnable.args = Object.assign({}, base_1.default.args);
21
+ exports.default = FixedAmountPromotionEnable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class FixedAmountPromotionIndex extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
7
+ const cli_core_1 = require("@commercelayer/cli-core");
8
+ const fixed_amount_promotions_1 = require("../../triggers/fixed_amount_promotions");
9
+ const promptAction = async (id) => {
10
+ const answers = await inquirer_1.default.prompt([{
11
+ type: 'list',
12
+ name: 'trigger',
13
+ message: `Select an action to execute on fixed amount promotion ${cli_core_1.clColor.api.id(id)}:`,
14
+ choices: Object.keys(fixed_amount_promotions_1.triggers).sort().map(a => {
15
+ return { name: a, value: a };
16
+ }),
17
+ loop: false,
18
+ pageSize: 10,
19
+ }]);
20
+ return answers.trigger;
21
+ };
22
+ class FixedAmountPromotionIndex extends base_1.default {
23
+ async run() {
24
+ const { args, flags } = await this.parse(FixedAmountPromotionIndex);
25
+ const id = args.id;
26
+ const action = await promptAction(id);
27
+ const fields = [];
28
+ const res = await (0, exec_1.default)('fixed_amount_promotions', id, action, flags, fields);
29
+ this.log();
30
+ this.printOutput(res, flags);
31
+ this.successMessage('fixed amount promotion', action, res.id);
32
+ return res;
33
+ }
34
+ }
35
+ FixedAmountPromotionIndex.description = 'execute an action on a resource of type fixed_amount_promotions';
36
+ FixedAmountPromotionIndex.flags = {};
37
+ FixedAmountPromotionIndex.args = Object.assign({}, base_1.default.args);
38
+ exports.default = FixedAmountPromotionIndex;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class FixedPricePromotionDisable extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const fixed_price_promotions_1 = require("../../triggers/fixed_price_promotions");
7
+ const TRIGGER = 'disable';
8
+ class FixedPricePromotionDisable extends base_1.default {
9
+ async run() {
10
+ const { args, flags } = await this.parse(FixedPricePromotionDisable);
11
+ const res = await (0, exec_1.default)('fixed_price_promotions', args.id, TRIGGER, flags);
12
+ if (flags.print)
13
+ this.printOutput(res, flags);
14
+ this.successMessage('fixed_price_promotion', TRIGGER, res.id);
15
+ return res;
16
+ }
17
+ }
18
+ FixedPricePromotionDisable.description = fixed_price_promotions_1.triggers[TRIGGER].description;
19
+ FixedPricePromotionDisable.flags = {};
20
+ FixedPricePromotionDisable.args = Object.assign({}, base_1.default.args);
21
+ exports.default = FixedPricePromotionDisable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class FixedPricePromotionEnable extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const fixed_price_promotions_1 = require("../../triggers/fixed_price_promotions");
7
+ const TRIGGER = 'enable';
8
+ class FixedPricePromotionEnable extends base_1.default {
9
+ async run() {
10
+ const { args, flags } = await this.parse(FixedPricePromotionEnable);
11
+ const res = await (0, exec_1.default)('fixed_price_promotions', args.id, TRIGGER, flags);
12
+ if (flags.print)
13
+ this.printOutput(res, flags);
14
+ this.successMessage('fixed_price_promotion', TRIGGER, res.id);
15
+ return res;
16
+ }
17
+ }
18
+ FixedPricePromotionEnable.description = fixed_price_promotions_1.triggers[TRIGGER].description;
19
+ FixedPricePromotionEnable.flags = {};
20
+ FixedPricePromotionEnable.args = Object.assign({}, base_1.default.args);
21
+ exports.default = FixedPricePromotionEnable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class FixedPricePromotionIndex extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
7
+ const cli_core_1 = require("@commercelayer/cli-core");
8
+ const fixed_price_promotions_1 = require("../../triggers/fixed_price_promotions");
9
+ const promptAction = async (id) => {
10
+ const answers = await inquirer_1.default.prompt([{
11
+ type: 'list',
12
+ name: 'trigger',
13
+ message: `Select an action to execute on fixed price promotion ${cli_core_1.clColor.api.id(id)}:`,
14
+ choices: Object.keys(fixed_price_promotions_1.triggers).sort().map(a => {
15
+ return { name: a, value: a };
16
+ }),
17
+ loop: false,
18
+ pageSize: 10,
19
+ }]);
20
+ return answers.trigger;
21
+ };
22
+ class FixedPricePromotionIndex extends base_1.default {
23
+ async run() {
24
+ const { args, flags } = await this.parse(FixedPricePromotionIndex);
25
+ const id = args.id;
26
+ const action = await promptAction(id);
27
+ const fields = [];
28
+ const res = await (0, exec_1.default)('fixed_price_promotions', id, action, flags, fields);
29
+ this.log();
30
+ this.printOutput(res, flags);
31
+ this.successMessage('fixed price promotion', action, res.id);
32
+ return res;
33
+ }
34
+ }
35
+ FixedPricePromotionIndex.description = 'execute an action on a resource of type fixed_price_promotions';
36
+ FixedPricePromotionIndex.flags = {};
37
+ FixedPricePromotionIndex.args = Object.assign({}, base_1.default.args);
38
+ exports.default = FixedPricePromotionIndex;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class FreeGiftPromotionDisable extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const free_gift_promotions_1 = require("../../triggers/free_gift_promotions");
7
+ const TRIGGER = 'disable';
8
+ class FreeGiftPromotionDisable extends base_1.default {
9
+ async run() {
10
+ const { args, flags } = await this.parse(FreeGiftPromotionDisable);
11
+ const res = await (0, exec_1.default)('free_gift_promotions', args.id, TRIGGER, flags);
12
+ if (flags.print)
13
+ this.printOutput(res, flags);
14
+ this.successMessage('free_gift_promotion', TRIGGER, res.id);
15
+ return res;
16
+ }
17
+ }
18
+ FreeGiftPromotionDisable.description = free_gift_promotions_1.triggers[TRIGGER].description;
19
+ FreeGiftPromotionDisable.flags = {};
20
+ FreeGiftPromotionDisable.args = Object.assign({}, base_1.default.args);
21
+ exports.default = FreeGiftPromotionDisable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class FreeGiftPromotionEnable extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const free_gift_promotions_1 = require("../../triggers/free_gift_promotions");
7
+ const TRIGGER = 'enable';
8
+ class FreeGiftPromotionEnable extends base_1.default {
9
+ async run() {
10
+ const { args, flags } = await this.parse(FreeGiftPromotionEnable);
11
+ const res = await (0, exec_1.default)('free_gift_promotions', args.id, TRIGGER, flags);
12
+ if (flags.print)
13
+ this.printOutput(res, flags);
14
+ this.successMessage('free_gift_promotion', TRIGGER, res.id);
15
+ return res;
16
+ }
17
+ }
18
+ FreeGiftPromotionEnable.description = free_gift_promotions_1.triggers[TRIGGER].description;
19
+ FreeGiftPromotionEnable.flags = {};
20
+ FreeGiftPromotionEnable.args = Object.assign({}, base_1.default.args);
21
+ exports.default = FreeGiftPromotionEnable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class FreeGiftPromotionIndex extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
7
+ const cli_core_1 = require("@commercelayer/cli-core");
8
+ const free_gift_promotions_1 = require("../../triggers/free_gift_promotions");
9
+ const promptAction = async (id) => {
10
+ const answers = await inquirer_1.default.prompt([{
11
+ type: 'list',
12
+ name: 'trigger',
13
+ message: `Select an action to execute on free gift promotion ${cli_core_1.clColor.api.id(id)}:`,
14
+ choices: Object.keys(free_gift_promotions_1.triggers).sort().map(a => {
15
+ return { name: a, value: a };
16
+ }),
17
+ loop: false,
18
+ pageSize: 10,
19
+ }]);
20
+ return answers.trigger;
21
+ };
22
+ class FreeGiftPromotionIndex extends base_1.default {
23
+ async run() {
24
+ const { args, flags } = await this.parse(FreeGiftPromotionIndex);
25
+ const id = args.id;
26
+ const action = await promptAction(id);
27
+ const fields = [];
28
+ const res = await (0, exec_1.default)('free_gift_promotions', id, action, flags, fields);
29
+ this.log();
30
+ this.printOutput(res, flags);
31
+ this.successMessage('free gift promotion', action, res.id);
32
+ return res;
33
+ }
34
+ }
35
+ FreeGiftPromotionIndex.description = 'execute an action on a resource of type free_gift_promotions';
36
+ FreeGiftPromotionIndex.flags = {};
37
+ FreeGiftPromotionIndex.args = Object.assign({}, base_1.default.args);
38
+ exports.default = FreeGiftPromotionIndex;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class FreeShippingPromotionDisable extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const free_shipping_promotions_1 = require("../../triggers/free_shipping_promotions");
7
+ const TRIGGER = 'disable';
8
+ class FreeShippingPromotionDisable extends base_1.default {
9
+ async run() {
10
+ const { args, flags } = await this.parse(FreeShippingPromotionDisable);
11
+ const res = await (0, exec_1.default)('free_shipping_promotions', args.id, TRIGGER, flags);
12
+ if (flags.print)
13
+ this.printOutput(res, flags);
14
+ this.successMessage('free_shipping_promotion', TRIGGER, res.id);
15
+ return res;
16
+ }
17
+ }
18
+ FreeShippingPromotionDisable.description = free_shipping_promotions_1.triggers[TRIGGER].description;
19
+ FreeShippingPromotionDisable.flags = {};
20
+ FreeShippingPromotionDisable.args = Object.assign({}, base_1.default.args);
21
+ exports.default = FreeShippingPromotionDisable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class FreeShippingPromotionEnable extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const free_shipping_promotions_1 = require("../../triggers/free_shipping_promotions");
7
+ const TRIGGER = 'enable';
8
+ class FreeShippingPromotionEnable extends base_1.default {
9
+ async run() {
10
+ const { args, flags } = await this.parse(FreeShippingPromotionEnable);
11
+ const res = await (0, exec_1.default)('free_shipping_promotions', args.id, TRIGGER, flags);
12
+ if (flags.print)
13
+ this.printOutput(res, flags);
14
+ this.successMessage('free_shipping_promotion', TRIGGER, res.id);
15
+ return res;
16
+ }
17
+ }
18
+ FreeShippingPromotionEnable.description = free_shipping_promotions_1.triggers[TRIGGER].description;
19
+ FreeShippingPromotionEnable.flags = {};
20
+ FreeShippingPromotionEnable.args = Object.assign({}, base_1.default.args);
21
+ exports.default = FreeShippingPromotionEnable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class FreeShippingPromotionIndex extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
7
+ const cli_core_1 = require("@commercelayer/cli-core");
8
+ const free_shipping_promotions_1 = require("../../triggers/free_shipping_promotions");
9
+ const promptAction = async (id) => {
10
+ const answers = await inquirer_1.default.prompt([{
11
+ type: 'list',
12
+ name: 'trigger',
13
+ message: `Select an action to execute on free shipping promotion ${cli_core_1.clColor.api.id(id)}:`,
14
+ choices: Object.keys(free_shipping_promotions_1.triggers).sort().map(a => {
15
+ return { name: a, value: a };
16
+ }),
17
+ loop: false,
18
+ pageSize: 10,
19
+ }]);
20
+ return answers.trigger;
21
+ };
22
+ class FreeShippingPromotionIndex extends base_1.default {
23
+ async run() {
24
+ const { args, flags } = await this.parse(FreeShippingPromotionIndex);
25
+ const id = args.id;
26
+ const action = await promptAction(id);
27
+ const fields = [];
28
+ const res = await (0, exec_1.default)('free_shipping_promotions', id, action, flags, fields);
29
+ this.log();
30
+ this.printOutput(res, flags);
31
+ this.successMessage('free shipping promotion', action, res.id);
32
+ return res;
33
+ }
34
+ }
35
+ FreeShippingPromotionIndex.description = 'execute an action on a resource of type free_shipping_promotions';
36
+ FreeShippingPromotionIndex.flags = {};
37
+ FreeShippingPromotionIndex.args = Object.assign({}, base_1.default.args);
38
+ exports.default = FreeShippingPromotionIndex;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class PercentageDiscountPromotionDisable extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const percentage_discount_promotions_1 = require("../../triggers/percentage_discount_promotions");
7
+ const TRIGGER = 'disable';
8
+ class PercentageDiscountPromotionDisable extends base_1.default {
9
+ async run() {
10
+ const { args, flags } = await this.parse(PercentageDiscountPromotionDisable);
11
+ const res = await (0, exec_1.default)('percentage_discount_promotions', args.id, TRIGGER, flags);
12
+ if (flags.print)
13
+ this.printOutput(res, flags);
14
+ this.successMessage('percentage_discount_promotion', TRIGGER, res.id);
15
+ return res;
16
+ }
17
+ }
18
+ PercentageDiscountPromotionDisable.description = percentage_discount_promotions_1.triggers[TRIGGER].description;
19
+ PercentageDiscountPromotionDisable.flags = {};
20
+ PercentageDiscountPromotionDisable.args = Object.assign({}, base_1.default.args);
21
+ exports.default = PercentageDiscountPromotionDisable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class PercentageDiscountPromotionEnable extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const percentage_discount_promotions_1 = require("../../triggers/percentage_discount_promotions");
7
+ const TRIGGER = 'enable';
8
+ class PercentageDiscountPromotionEnable extends base_1.default {
9
+ async run() {
10
+ const { args, flags } = await this.parse(PercentageDiscountPromotionEnable);
11
+ const res = await (0, exec_1.default)('percentage_discount_promotions', args.id, TRIGGER, flags);
12
+ if (flags.print)
13
+ this.printOutput(res, flags);
14
+ this.successMessage('percentage_discount_promotion', TRIGGER, res.id);
15
+ return res;
16
+ }
17
+ }
18
+ PercentageDiscountPromotionEnable.description = percentage_discount_promotions_1.triggers[TRIGGER].description;
19
+ PercentageDiscountPromotionEnable.flags = {};
20
+ PercentageDiscountPromotionEnable.args = Object.assign({}, base_1.default.args);
21
+ exports.default = PercentageDiscountPromotionEnable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class PercentageDiscountPromotionIndex extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }