@commercelayer/cli-plugin-triggers 3.9.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)
@@ -130,6 +131,7 @@ $ commercelayer plugins:install triggers
130
131
  * [`commercelayer stock_transfer:upcoming ID`](#commercelayer-stock_transferupcoming-id)
131
132
  * [`commercelayer stripe_payment ID`](#commercelayer-stripe_payment-id)
132
133
  * [`commercelayer stripe_payment:refresh ID`](#commercelayer-stripe_paymentrefresh-id)
134
+ * [`commercelayer stripe_payment:update ID`](#commercelayer-stripe_paymentupdate-id)
133
135
  * [`commercelayer webhook ID`](#commercelayer-webhook-id)
134
136
  * [`commercelayer webhook:reset_circuit ID`](#commercelayer-webhookreset_circuit-id)
135
137
 
@@ -820,6 +822,29 @@ DESCRIPTION
820
822
 
821
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)_
822
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
+
823
848
  ### `commercelayer market ID`
824
849
 
825
850
  Execute an action on a resource of type markets.
@@ -2348,6 +2373,28 @@ DESCRIPTION
2348
2373
 
2349
2374
  _See code: [src/commands/stripe_payment/refresh.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/stripe_payment/refresh.ts)_
2350
2375
 
2376
+ ### `commercelayer stripe_payment:update ID`
2377
+
2378
+ Send this attribute if you want to update the created payment intent with fresh order data.
2379
+
2380
+ ```sh-session
2381
+ USAGE
2382
+ $ commercelayer stripe_payment:update ID [-u [-j -p]]
2383
+
2384
+ ARGUMENTS
2385
+ ID the unique id of the resource
2386
+
2387
+ FLAGS
2388
+ -j, --json print result in JSON format
2389
+ -p, --print print out the modified resource
2390
+ -u, --unformatted print JSON output without indentation
2391
+
2392
+ DESCRIPTION
2393
+ Send this attribute if you want to update the created payment intent with fresh order data.
2394
+ ```
2395
+
2396
+ _See code: [src/commands/stripe_payment/update.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/stripe_payment/update.ts)_
2397
+
2351
2398
  ### `commercelayer webhook ID`
2352
2399
 
2353
2400
  Execute an action on a resource of type webhooks.
@@ -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;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class StripePaymentUpdate 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 stripe_payments_1 = require("../../triggers/stripe_payments");
7
+ const TRIGGER = 'update';
8
+ class StripePaymentUpdate extends base_1.default {
9
+ async run() {
10
+ const { args, flags } = await this.parse(StripePaymentUpdate);
11
+ const res = await (0, exec_1.default)('stripe_payments', args.id, TRIGGER, flags);
12
+ if (flags.print)
13
+ this.printOutput(res, flags);
14
+ this.successMessage('stripe_payment', TRIGGER, res.id);
15
+ return res;
16
+ }
17
+ }
18
+ StripePaymentUpdate.description = stripe_payments_1.triggers[TRIGGER].description;
19
+ StripePaymentUpdate.flags = {};
20
+ StripePaymentUpdate.args = Object.assign({}, base_1.default.args);
21
+ exports.default = StripePaymentUpdate;
@@ -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,3 +1,3 @@
1
1
  import type { Trigger } from '../common';
2
2
  export declare const triggers: Record<string, Trigger>;
3
- export type ActionType = 'refresh';
3
+ export type ActionType = 'update' | 'refresh';
@@ -2,6 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.triggers = void 0;
4
4
  exports.triggers = {
5
+ update: {
6
+ action: 'update',
7
+ trigger: '_update',
8
+ description: 'Send this attribute if you want to update the created payment intent with fresh order data.',
9
+ },
5
10
  refresh: {
6
11
  action: 'refresh',
7
12
  trigger: '_refresh',
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.9.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.",
@@ -7236,6 +7308,78 @@
7236
7308
  }
7237
7309
  }
7238
7310
  },
7311
+ "stripe_payment:update": {
7312
+ "id": "stripe_payment:update",
7313
+ "description": "Send this attribute if you want to update the created payment intent with fresh order data.",
7314
+ "strict": true,
7315
+ "pluginName": "@commercelayer/cli-plugin-triggers",
7316
+ "pluginAlias": "@commercelayer/cli-plugin-triggers",
7317
+ "pluginType": "core",
7318
+ "aliases": [],
7319
+ "flags": {
7320
+ "organization": {
7321
+ "name": "organization",
7322
+ "type": "option",
7323
+ "char": "o",
7324
+ "description": "the slug of your organization",
7325
+ "hidden": true,
7326
+ "required": true,
7327
+ "multiple": false
7328
+ },
7329
+ "domain": {
7330
+ "name": "domain",
7331
+ "type": "option",
7332
+ "char": "d",
7333
+ "hidden": true,
7334
+ "required": false,
7335
+ "multiple": false,
7336
+ "dependsOn": [
7337
+ "organization"
7338
+ ]
7339
+ },
7340
+ "accessToken": {
7341
+ "name": "accessToken",
7342
+ "type": "option",
7343
+ "hidden": true,
7344
+ "required": true,
7345
+ "multiple": false
7346
+ },
7347
+ "print": {
7348
+ "name": "print",
7349
+ "type": "boolean",
7350
+ "char": "p",
7351
+ "description": "print out the modified resource",
7352
+ "allowNo": false
7353
+ },
7354
+ "json": {
7355
+ "name": "json",
7356
+ "type": "boolean",
7357
+ "char": "j",
7358
+ "description": "print result in JSON format",
7359
+ "allowNo": false,
7360
+ "dependsOn": [
7361
+ "print"
7362
+ ]
7363
+ },
7364
+ "unformatted": {
7365
+ "name": "unformatted",
7366
+ "type": "boolean",
7367
+ "char": "u",
7368
+ "description": "print JSON output without indentation",
7369
+ "allowNo": false,
7370
+ "dependsOn": [
7371
+ "json"
7372
+ ]
7373
+ }
7374
+ },
7375
+ "args": {
7376
+ "id": {
7377
+ "name": "id",
7378
+ "description": "the unique id of the resource",
7379
+ "required": true
7380
+ }
7381
+ }
7382
+ },
7239
7383
  "webhook": {
7240
7384
  "id": "webhook",
7241
7385
  "description": "execute an action on a resource of type webhooks",
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.9.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.20",
49
+ "@oclif/test": "^2.3.22",
50
50
  "@types/chai": "^4.3.5",
51
51
  "@types/inquirer": "^8.2.6",
52
- "@types/lodash": "^4.14.194",
52
+ "@types/lodash": "^4.14.195",
53
53
  "@types/mocha": "^10.0.1",
54
- "@types/node": "^20.1.4",
54
+ "@types/node": "^20.2.5",
55
55
  "chai": "^4.3.7",
56
- "eslint": "^8.40.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.0"
70
+ "tslib": "^2.5.3"
71
71
  },
72
72
  "publishConfig": {
73
73
  "access": "public"