@commercelayer/cli-plugin-triggers 4.3.0 → 4.5.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
@@ -86,6 +86,9 @@ $ commercelayer plugins:install triggers
86
86
  * [`commercelayer line_item:external_price ID`](#commercelayer-line_itemexternal_price-id)
87
87
  * [`commercelayer line_item:reserve_stock ID`](#commercelayer-line_itemreserve_stock-id)
88
88
  * [`commercelayer line_item:reset_circuit ID`](#commercelayer-line_itemreset_circuit-id)
89
+ * [`commercelayer link ID`](#commercelayer-link-id)
90
+ * [`commercelayer link:disable ID`](#commercelayer-linkdisable-id)
91
+ * [`commercelayer link:enable ID`](#commercelayer-linkenable-id)
89
92
  * [`commercelayer market ID`](#commercelayer-market-id)
90
93
  * [`commercelayer market:disable ID`](#commercelayer-marketdisable-id)
91
94
  * [`commercelayer market:enable ID`](#commercelayer-marketenable-id)
@@ -149,6 +152,7 @@ $ commercelayer plugins:install triggers
149
152
  * [`commercelayer satispay_payment ID`](#commercelayer-satispay_payment-id)
150
153
  * [`commercelayer satispay_payment:refresh ID`](#commercelayer-satispay_paymentrefresh-id)
151
154
  * [`commercelayer shipment ID`](#commercelayer-shipment-id)
155
+ * [`commercelayer shipment:cancel ID`](#commercelayer-shipmentcancel-id)
152
156
  * [`commercelayer shipment:decrement_stock ID`](#commercelayer-shipmentdecrement_stock-id)
153
157
  * [`commercelayer shipment:deliver ID`](#commercelayer-shipmentdeliver-id)
154
158
  * [`commercelayer shipment:get_rates ID`](#commercelayer-shipmentget_rates-id)
@@ -1431,6 +1435,72 @@ DESCRIPTION
1431
1435
 
1432
1436
  _See code: [src/commands/line_item/reset_circuit.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/line_item/reset_circuit.ts)_
1433
1437
 
1438
+ ### `commercelayer link ID`
1439
+
1440
+ Execute an action on a resource of type links.
1441
+
1442
+ ```sh-session
1443
+ USAGE
1444
+ $ commercelayer link ID [-u [-j -p]]
1445
+
1446
+ ARGUMENTS
1447
+ ID the unique id of the resource
1448
+
1449
+ FLAGS
1450
+ -j, --json print result in JSON format
1451
+ -p, --print print out the modified resource
1452
+ -u, --unformatted print JSON output without indentation
1453
+
1454
+ DESCRIPTION
1455
+ execute an action on a resource of type links
1456
+ ```
1457
+
1458
+ _See code: [src/commands/link/index.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/link/index.ts)_
1459
+
1460
+ ### `commercelayer link:disable ID`
1461
+
1462
+ Send this attribute if you want to mark this resource as disabled.
1463
+
1464
+ ```sh-session
1465
+ USAGE
1466
+ $ commercelayer link:disable ID [-u [-j -p]]
1467
+
1468
+ ARGUMENTS
1469
+ ID the unique id of the resource
1470
+
1471
+ FLAGS
1472
+ -j, --json print result in JSON format
1473
+ -p, --print print out the modified resource
1474
+ -u, --unformatted print JSON output without indentation
1475
+
1476
+ DESCRIPTION
1477
+ Send this attribute if you want to mark this resource as disabled.
1478
+ ```
1479
+
1480
+ _See code: [src/commands/link/disable.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/link/disable.ts)_
1481
+
1482
+ ### `commercelayer link:enable ID`
1483
+
1484
+ Send this attribute if you want to mark this resource as enabled.
1485
+
1486
+ ```sh-session
1487
+ USAGE
1488
+ $ commercelayer link:enable ID [-u [-j -p]]
1489
+
1490
+ ARGUMENTS
1491
+ ID the unique id of the resource
1492
+
1493
+ FLAGS
1494
+ -j, --json print result in JSON format
1495
+ -p, --print print out the modified resource
1496
+ -u, --unformatted print JSON output without indentation
1497
+
1498
+ DESCRIPTION
1499
+ Send this attribute if you want to mark this resource as enabled.
1500
+ ```
1501
+
1502
+ _See code: [src/commands/link/enable.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/link/enable.ts)_
1503
+
1434
1504
  ### `commercelayer market ID`
1435
1505
 
1436
1506
  Execute an action on a resource of type markets.
@@ -2830,6 +2900,28 @@ DESCRIPTION
2830
2900
 
2831
2901
  _See code: [src/commands/shipment/index.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/shipment/index.ts)_
2832
2902
 
2903
+ ### `commercelayer shipment:cancel ID`
2904
+
2905
+ Send this attribute if you want to mark this shipment as cancelled (unless already shipped or delivered).
2906
+
2907
+ ```sh-session
2908
+ USAGE
2909
+ $ commercelayer shipment:cancel ID [-u [-j -p]]
2910
+
2911
+ ARGUMENTS
2912
+ ID the unique id of the resource
2913
+
2914
+ FLAGS
2915
+ -j, --json print result in JSON format
2916
+ -p, --print print out the modified resource
2917
+ -u, --unformatted print JSON output without indentation
2918
+
2919
+ DESCRIPTION
2920
+ Send this attribute if you want to mark this shipment as cancelled (unless already shipped or delivered).
2921
+ ```
2922
+
2923
+ _See code: [src/commands/shipment/cancel.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/shipment/cancel.ts)_
2924
+
2833
2925
  ### `commercelayer shipment:decrement_stock ID`
2834
2926
 
2835
2927
  Send this attribute if you want to automatically decrement and release the stock for each of the associated stock line item. Can be done only when fulfillment is in progress.
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class LinkDisable 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 links_1 = require("../../triggers/links");
6
+ const TRIGGER = 'disable';
7
+ class LinkDisable extends base_1.default {
8
+ static description = links_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(LinkDisable);
15
+ const res = await this.executeAction('links', args.id, TRIGGER, flags);
16
+ if (flags.print)
17
+ this.printOutput(res, flags);
18
+ this.successMessage('link', TRIGGER, res.id);
19
+ return res;
20
+ }
21
+ }
22
+ exports.default = LinkDisable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class LinkEnable 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 links_1 = require("../../triggers/links");
6
+ const TRIGGER = 'enable';
7
+ class LinkEnable extends base_1.default {
8
+ static description = links_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(LinkEnable);
15
+ const res = await this.executeAction('links', args.id, TRIGGER, flags);
16
+ if (flags.print)
17
+ this.printOutput(res, flags);
18
+ this.successMessage('link', TRIGGER, res.id);
19
+ return res;
20
+ }
21
+ }
22
+ exports.default = LinkEnable;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class LinkIndex 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 links_1 = require("../../triggers/links");
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 link ${cli_core_1.clColor.api.id(id)}:`,
14
+ choices: Object.keys(links_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 LinkIndex extends base_1.default {
23
+ static description = 'execute an action on a resource of type links';
24
+ static flags = {};
25
+ static args = {
26
+ ...base_1.default.args,
27
+ };
28
+ async run() {
29
+ const { args, flags } = await this.parse(LinkIndex);
30
+ const id = args.id;
31
+ const action = await promptAction(id);
32
+ const fields = [];
33
+ const res = await (0, exec_1.default)('links', id, action, flags, fields);
34
+ this.log();
35
+ this.printOutput(res, flags);
36
+ this.successMessage('link', action, res.id);
37
+ return res;
38
+ }
39
+ }
40
+ exports.default = LinkIndex;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class ShipmentCancel 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 shipments_1 = require("../../triggers/shipments");
6
+ const TRIGGER = 'cancel';
7
+ class ShipmentCancel extends base_1.default {
8
+ static description = shipments_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(ShipmentCancel);
15
+ const res = await this.executeAction('shipments', args.id, TRIGGER, flags);
16
+ if (flags.print)
17
+ this.printOutput(res, flags);
18
+ this.successMessage('shipment', TRIGGER, res.id);
19
+ return res;
20
+ }
21
+ }
22
+ exports.default = ShipmentCancel;
@@ -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
+ };
@@ -1,3 +1,3 @@
1
1
  import type { Trigger } from '../common';
2
2
  export declare const triggers: Record<string, Trigger>;
3
- export type ActionType = 'upcoming' | 'on_hold' | 'picking' | 'packing' | 'ready_to_ship' | 'ship' | 'deliver' | 'reserve_stock' | 'release_stock' | 'decrement_stock' | 'get_rates' | 'purchase';
3
+ export type ActionType = 'upcoming' | 'cancel' | 'on_hold' | 'picking' | 'packing' | 'ready_to_ship' | 'ship' | 'deliver' | 'reserve_stock' | 'release_stock' | 'decrement_stock' | 'get_rates' | 'purchase';
@@ -7,6 +7,11 @@ exports.triggers = {
7
7
  trigger: '_upcoming',
8
8
  description: 'Send this attribute if you want to mark this shipment as upcoming.',
9
9
  },
10
+ cancel: {
11
+ action: 'cancel',
12
+ trigger: '_cancel',
13
+ description: 'Send this attribute if you want to mark this shipment as cancelled (unless already shipped or delivered).',
14
+ },
10
15
  on_hold: {
11
16
  action: 'on_hold',
12
17
  trigger: '_on_hold',