@commercelayer/cli-plugin-triggers 3.10.0 → 3.11.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
@@ -61,6 +61,7 @@ $ commercelayer plugins:install triggers
61
61
  * [`commercelayer klarna_payment:update ID`](#commercelayer-klarna_paymentupdate-id)
62
62
  * [`commercelayer line_item ID`](#commercelayer-line_item-id)
63
63
  * [`commercelayer line_item:external_price ID`](#commercelayer-line_itemexternal_price-id)
64
+ * [`commercelayer line_item:reserve_stock ID`](#commercelayer-line_itemreserve_stock-id)
64
65
  * [`commercelayer market ID`](#commercelayer-market-id)
65
66
  * [`commercelayer market:disable ID`](#commercelayer-marketdisable-id)
66
67
  * [`commercelayer market:enable ID`](#commercelayer-marketenable-id)
@@ -821,6 +822,29 @@ DESCRIPTION
821
822
 
822
823
  _See code: [src/commands/line_item/external_price.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/line_item/external_price.ts)_
823
824
 
825
+ ### `commercelayer line_item:reserve_stock ID`
826
+
827
+ Send this attribute if you want to reserve the stock for the line item's SKUs quantity. Stock reservations expiration depends on the inventory model's cutoff. When used on update the existing active stock reservations are renewed.
828
+
829
+ ```sh-session
830
+ USAGE
831
+ $ commercelayer line_item:reserve_stock ID [-u [-j -p]]
832
+
833
+ ARGUMENTS
834
+ ID the unique id of the resource
835
+
836
+ FLAGS
837
+ -j, --json print result in JSON format
838
+ -p, --print print out the modified resource
839
+ -u, --unformatted print JSON output without indentation
840
+
841
+ DESCRIPTION
842
+ Send this attribute if you want to reserve the stock for the line item's SKUs quantity. Stock reservations expiration
843
+ depends on the inventory model's cutoff. When used on update the existing active stock reservations are renewed.
844
+ ```
845
+
846
+ _See code: [src/commands/line_item/reserve_stock.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/line_item/reserve_stock.ts)_
847
+
824
848
  ### `commercelayer market ID`
825
849
 
826
850
  Execute an action on a resource of type markets.
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class LineItemReserveStock 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 line_items_1 = require("../../triggers/line_items");
7
+ const TRIGGER = 'reserve_stock';
8
+ class LineItemReserveStock extends base_1.default {
9
+ async run() {
10
+ const { args, flags } = await this.parse(LineItemReserveStock);
11
+ const res = await (0, exec_1.default)('line_items', args.id, TRIGGER, flags);
12
+ if (flags.print)
13
+ this.printOutput(res, flags);
14
+ this.successMessage('line_item', TRIGGER, res.id);
15
+ return res;
16
+ }
17
+ }
18
+ LineItemReserveStock.description = line_items_1.triggers[TRIGGER].description;
19
+ LineItemReserveStock.flags = {};
20
+ LineItemReserveStock.args = Object.assign({}, base_1.default.args);
21
+ exports.default = LineItemReserveStock;
@@ -1,3 +1,3 @@
1
1
  import type { Trigger } from '../common';
2
2
  export declare const triggers: Record<string, Trigger>;
3
- export type ActionType = 'external_price';
3
+ export type ActionType = 'external_price' | 'reserve_stock';
@@ -7,4 +7,9 @@ exports.triggers = {
7
7
  trigger: '_external_price',
8
8
  description: 'When creating or updating a new line item, set this attribute to \'1\' if you want to inject the unit_amount_cents price from an external source.',
9
9
  },
10
+ reserve_stock: {
11
+ action: 'reserve_stock',
12
+ trigger: '_reserve_stock',
13
+ description: 'Send this attribute if you want to reserve the stock for the line item\'s SKUs quantity. Stock reservations expiration depends on the inventory model\'s cutoff. When used on update the existing active stock reservations are renewed.',
14
+ },
10
15
  };
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.10.0",
2
+ "version": "3.11.0",
3
3
  "commands": {
4
4
  "noc": {
5
5
  "id": "noc",
@@ -2244,6 +2244,78 @@
2244
2244
  }
2245
2245
  }
2246
2246
  },
2247
+ "line_item:reserve_stock": {
2248
+ "id": "line_item:reserve_stock",
2249
+ "description": "Send this attribute if you want to reserve the stock for the line item's SKUs quantity. Stock reservations expiration depends on the inventory model's cutoff. When used on update the existing active stock reservations are renewed.",
2250
+ "strict": true,
2251
+ "pluginName": "@commercelayer/cli-plugin-triggers",
2252
+ "pluginAlias": "@commercelayer/cli-plugin-triggers",
2253
+ "pluginType": "core",
2254
+ "aliases": [],
2255
+ "flags": {
2256
+ "organization": {
2257
+ "name": "organization",
2258
+ "type": "option",
2259
+ "char": "o",
2260
+ "description": "the slug of your organization",
2261
+ "hidden": true,
2262
+ "required": true,
2263
+ "multiple": false
2264
+ },
2265
+ "domain": {
2266
+ "name": "domain",
2267
+ "type": "option",
2268
+ "char": "d",
2269
+ "hidden": true,
2270
+ "required": false,
2271
+ "multiple": false,
2272
+ "dependsOn": [
2273
+ "organization"
2274
+ ]
2275
+ },
2276
+ "accessToken": {
2277
+ "name": "accessToken",
2278
+ "type": "option",
2279
+ "hidden": true,
2280
+ "required": true,
2281
+ "multiple": false
2282
+ },
2283
+ "print": {
2284
+ "name": "print",
2285
+ "type": "boolean",
2286
+ "char": "p",
2287
+ "description": "print out the modified resource",
2288
+ "allowNo": false
2289
+ },
2290
+ "json": {
2291
+ "name": "json",
2292
+ "type": "boolean",
2293
+ "char": "j",
2294
+ "description": "print result in JSON format",
2295
+ "allowNo": false,
2296
+ "dependsOn": [
2297
+ "print"
2298
+ ]
2299
+ },
2300
+ "unformatted": {
2301
+ "name": "unformatted",
2302
+ "type": "boolean",
2303
+ "char": "u",
2304
+ "description": "print JSON output without indentation",
2305
+ "allowNo": false,
2306
+ "dependsOn": [
2307
+ "json"
2308
+ ]
2309
+ }
2310
+ },
2311
+ "args": {
2312
+ "id": {
2313
+ "name": "id",
2314
+ "description": "the unique id of the resource",
2315
+ "required": true
2316
+ }
2317
+ }
2318
+ },
2247
2319
  "market:disable": {
2248
2320
  "id": "market:disable",
2249
2321
  "description": "Send this attribute if you want to mark the market as disabled.",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercelayer/cli-plugin-triggers",
3
3
  "description": "Commerce Layer CLI Triggers plugin",
4
- "version": "3.10.0",
4
+ "version": "3.11.0",
5
5
  "author": "Pierluigi Viti <pierluigi@commercelayer.io>",
6
6
  "bugs": "https://github.com/commercelayer/commercelayer-cli-plugin-triggers/issues",
7
7
  "engines": {
@@ -46,14 +46,14 @@
46
46
  "@commercelayer/cli-dev": "^2.0.5",
47
47
  "@commercelayer/eslint-config-ts": "^1.0.0",
48
48
  "@oclif/plugin-help": "^5.2.9",
49
- "@oclif/test": "^2.3.21",
49
+ "@oclif/test": "^2.3.22",
50
50
  "@types/chai": "^4.3.5",
51
51
  "@types/inquirer": "^8.2.6",
52
52
  "@types/lodash": "^4.14.195",
53
53
  "@types/mocha": "^10.0.1",
54
- "@types/node": "^20.2.4",
54
+ "@types/node": "^20.2.5",
55
55
  "chai": "^4.3.7",
56
- "eslint": "^8.41.0",
56
+ "eslint": "^8.42.0",
57
57
  "inflector-js": "^1.0.1",
58
58
  "lodash": "^4.17.21",
59
59
  "mocha": "^10.2.0",
@@ -64,10 +64,10 @@
64
64
  "dependencies": {
65
65
  "@commercelayer/cli-core": "^3.7.3",
66
66
  "@commercelayer/js-auth": "^2.3.0",
67
- "@commercelayer/sdk": "^4.27.1",
67
+ "@commercelayer/sdk": "^4.29.0",
68
68
  "@oclif/core": "^2.8.5",
69
69
  "inquirer": "^8.2.5",
70
- "tslib": "^2.5.2"
70
+ "tslib": "^2.5.3"
71
71
  },
72
72
  "publishConfig": {
73
73
  "access": "public"