@commercelayer/cli-plugin-triggers 4.4.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
@@ -152,6 +152,7 @@ $ commercelayer plugins:install triggers
152
152
  * [`commercelayer satispay_payment ID`](#commercelayer-satispay_payment-id)
153
153
  * [`commercelayer satispay_payment:refresh ID`](#commercelayer-satispay_paymentrefresh-id)
154
154
  * [`commercelayer shipment ID`](#commercelayer-shipment-id)
155
+ * [`commercelayer shipment:cancel ID`](#commercelayer-shipmentcancel-id)
155
156
  * [`commercelayer shipment:decrement_stock ID`](#commercelayer-shipmentdecrement_stock-id)
156
157
  * [`commercelayer shipment:deliver ID`](#commercelayer-shipmentdeliver-id)
157
158
  * [`commercelayer shipment:get_rates ID`](#commercelayer-shipmentget_rates-id)
@@ -2899,6 +2900,28 @@ DESCRIPTION
2899
2900
 
2900
2901
  _See code: [src/commands/shipment/index.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/shipment/index.ts)_
2901
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
+
2902
2925
  ### `commercelayer shipment:decrement_stock ID`
2903
2926
 
2904
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 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;
@@ -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',