@commercelayer/cli-plugin-triggers 4.0.0-rc.3 → 4.1.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.
package/README.md CHANGED
@@ -129,6 +129,9 @@ $ commercelayer plugins:install triggers
129
129
  * [`commercelayer percentage_discount_promotion ID`](#commercelayer-percentage_discount_promotion-id)
130
130
  * [`commercelayer percentage_discount_promotion:disable ID`](#commercelayer-percentage_discount_promotiondisable-id)
131
131
  * [`commercelayer percentage_discount_promotion:enable ID`](#commercelayer-percentage_discount_promotionenable-id)
132
+ * [`commercelayer price_list_scheduler ID`](#commercelayer-price_list_scheduler-id)
133
+ * [`commercelayer price_list_scheduler:disable ID`](#commercelayer-price_list_schedulerdisable-id)
134
+ * [`commercelayer price_list_scheduler:enable ID`](#commercelayer-price_list_schedulerenable-id)
132
135
  * [`commercelayer return ID`](#commercelayer-return-id)
133
136
  * [`commercelayer return:approve ID`](#commercelayer-returnapprove-id)
134
137
  * [`commercelayer return:archive ID`](#commercelayer-returnarchive-id)
@@ -2383,6 +2386,72 @@ DESCRIPTION
2383
2386
 
2384
2387
  _See code: [src/commands/percentage_discount_promotion/enable.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/percentage_discount_promotion/enable.ts)_
2385
2388
 
2389
+ ### `commercelayer price_list_scheduler ID`
2390
+
2391
+ Execute an action on a resource of type price_list_schedulers.
2392
+
2393
+ ```sh-session
2394
+ USAGE
2395
+ $ commercelayer price_list_scheduler ID [-u [-j -p]]
2396
+
2397
+ ARGUMENTS
2398
+ ID the unique id of the resource
2399
+
2400
+ FLAGS
2401
+ -j, --json print result in JSON format
2402
+ -p, --print print out the modified resource
2403
+ -u, --unformatted print JSON output without indentation
2404
+
2405
+ DESCRIPTION
2406
+ execute an action on a resource of type price_list_schedulers
2407
+ ```
2408
+
2409
+ _See code: [src/commands/price_list_scheduler/index.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/price_list_scheduler/index.ts)_
2410
+
2411
+ ### `commercelayer price_list_scheduler:disable ID`
2412
+
2413
+ Send this attribute if you want to mark this resource as disabled.
2414
+
2415
+ ```sh-session
2416
+ USAGE
2417
+ $ commercelayer price_list_scheduler:disable ID [-u [-j -p]]
2418
+
2419
+ ARGUMENTS
2420
+ ID the unique id of the resource
2421
+
2422
+ FLAGS
2423
+ -j, --json print result in JSON format
2424
+ -p, --print print out the modified resource
2425
+ -u, --unformatted print JSON output without indentation
2426
+
2427
+ DESCRIPTION
2428
+ Send this attribute if you want to mark this resource as disabled.
2429
+ ```
2430
+
2431
+ _See code: [src/commands/price_list_scheduler/disable.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/price_list_scheduler/disable.ts)_
2432
+
2433
+ ### `commercelayer price_list_scheduler:enable ID`
2434
+
2435
+ Send this attribute if you want to mark this resource as enabled.
2436
+
2437
+ ```sh-session
2438
+ USAGE
2439
+ $ commercelayer price_list_scheduler:enable ID [-u [-j -p]]
2440
+
2441
+ ARGUMENTS
2442
+ ID the unique id of the resource
2443
+
2444
+ FLAGS
2445
+ -j, --json print result in JSON format
2446
+ -p, --print print out the modified resource
2447
+ -u, --unformatted print JSON output without indentation
2448
+
2449
+ DESCRIPTION
2450
+ Send this attribute if you want to mark this resource as enabled.
2451
+ ```
2452
+
2453
+ _See code: [src/commands/price_list_scheduler/enable.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/price_list_scheduler/enable.ts)_
2454
+
2386
2455
  ### `commercelayer return ID`
2387
2456
 
2388
2457
  Execute an action on a resource of type returns.
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class PriceListSchedulerDisable extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,22 @@
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 price_list_schedulers_1 = require("../../triggers/price_list_schedulers");
6
+ const TRIGGER = 'disable';
7
+ class PriceListSchedulerDisable extends base_1.default {
8
+ static description = price_list_schedulers_1.triggers[TRIGGER].description;
9
+ static flags = {};
10
+ static args = {
11
+ ...base_1.default.args,
12
+ };
13
+ async run() {
14
+ const { args, flags } = await this.parse(PriceListSchedulerDisable);
15
+ const res = await this.executeAction('price_list_schedulers', args.id, TRIGGER, flags);
16
+ if (flags.print)
17
+ this.printOutput(res, flags);
18
+ this.successMessage('price_list_scheduler', TRIGGER, res.id);
19
+ return res;
20
+ }
21
+ }
22
+ exports.default = PriceListSchedulerDisable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class PriceListSchedulerEnable extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,22 @@
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 price_list_schedulers_1 = require("../../triggers/price_list_schedulers");
6
+ const TRIGGER = 'enable';
7
+ class PriceListSchedulerEnable extends base_1.default {
8
+ static description = price_list_schedulers_1.triggers[TRIGGER].description;
9
+ static flags = {};
10
+ static args = {
11
+ ...base_1.default.args,
12
+ };
13
+ async run() {
14
+ const { args, flags } = await this.parse(PriceListSchedulerEnable);
15
+ const res = await this.executeAction('price_list_schedulers', args.id, TRIGGER, flags);
16
+ if (flags.print)
17
+ this.printOutput(res, flags);
18
+ this.successMessage('price_list_scheduler', TRIGGER, res.id);
19
+ return res;
20
+ }
21
+ }
22
+ exports.default = PriceListSchedulerEnable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class PriceListSchedulerIndex extends Command {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<any>;
9
+ }
@@ -0,0 +1,40 @@
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 price_list_schedulers_1 = require("../../triggers/price_list_schedulers");
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 price list scheduler ${cli_core_1.clColor.api.id(id)}:`,
14
+ choices: Object.keys(price_list_schedulers_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 PriceListSchedulerIndex extends base_1.default {
23
+ static description = 'execute an action on a resource of type price_list_schedulers';
24
+ static flags = {};
25
+ static args = {
26
+ ...base_1.default.args,
27
+ };
28
+ async run() {
29
+ const { args, flags } = await this.parse(PriceListSchedulerIndex);
30
+ const id = args.id;
31
+ const action = await promptAction(id);
32
+ const fields = [];
33
+ const res = await (0, exec_1.default)('price_list_schedulers', id, action, flags, fields);
34
+ this.log();
35
+ this.printOutput(res, flags);
36
+ this.successMessage('price list scheduler', action, res.id);
37
+ return res;
38
+ }
39
+ }
40
+ exports.default = PriceListSchedulerIndex;
@@ -0,0 +1,3 @@
1
+ import type { Trigger } from '../common';
2
+ export declare const triggers: Record<string, Trigger>;
3
+ export type ActionType = 'disable' | 'enable';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggers = void 0;
4
+ exports.triggers = {
5
+ disable: {
6
+ action: 'disable',
7
+ trigger: '_disable',
8
+ description: 'Send this attribute if you want to mark this resource as disabled.',
9
+ },
10
+ enable: {
11
+ action: 'enable',
12
+ trigger: '_enable',
13
+ description: 'Send this attribute if you want to mark this resource as enabled.',
14
+ },
15
+ };