@commercelayer/cli-plugin-triggers 4.1.0 → 4.2.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
@@ -122,6 +122,7 @@ $ commercelayer plugins:install triggers
122
122
  * [`commercelayer order_subscription ID`](#commercelayer-order_subscription-id)
123
123
  * [`commercelayer order_subscription:activate ID`](#commercelayer-order_subscriptionactivate-id)
124
124
  * [`commercelayer order_subscription:cancel ID`](#commercelayer-order_subscriptioncancel-id)
125
+ * [`commercelayer order_subscription:convert ID`](#commercelayer-order_subscriptionconvert-id)
125
126
  * [`commercelayer order_subscription:deactivate ID`](#commercelayer-order_subscriptiondeactivate-id)
126
127
  * [`commercelayer payment_method ID`](#commercelayer-payment_method-id)
127
128
  * [`commercelayer payment_method:disable ID`](#commercelayer-payment_methoddisable-id)
@@ -2232,6 +2233,29 @@ DESCRIPTION
2232
2233
 
2233
2234
  _See code: [src/commands/order_subscription/cancel.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/order_subscription/cancel.ts)_
2234
2235
 
2236
+ ### `commercelayer order_subscription:convert ID`
2237
+
2238
+ Send this attribute if you want to convert a manual subscription to an automatic one. A subscription model is required before conversion.
2239
+
2240
+ ```sh-session
2241
+ USAGE
2242
+ $ commercelayer order_subscription:convert ID [-u [-j -p]]
2243
+
2244
+ ARGUMENTS
2245
+ ID the unique id of the resource
2246
+
2247
+ FLAGS
2248
+ -j, --json print result in JSON format
2249
+ -p, --print print out the modified resource
2250
+ -u, --unformatted print JSON output without indentation
2251
+
2252
+ DESCRIPTION
2253
+ Send this attribute if you want to convert a manual subscription to an automatic one. A subscription model is required
2254
+ before conversion.
2255
+ ```
2256
+
2257
+ _See code: [src/commands/order_subscription/convert.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/order_subscription/convert.ts)_
2258
+
2235
2259
  ### `commercelayer order_subscription:deactivate ID`
2236
2260
 
2237
2261
  Send this attribute if you want to mark this subscription as inactive.
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class OrderSubscriptionConvert 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 order_subscriptions_1 = require("../../triggers/order_subscriptions");
6
+ const TRIGGER = 'convert';
7
+ class OrderSubscriptionConvert extends base_1.default {
8
+ static description = order_subscriptions_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(OrderSubscriptionConvert);
15
+ const res = await this.executeAction('order_subscriptions', args.id, TRIGGER, flags);
16
+ if (flags.print)
17
+ this.printOutput(res, flags);
18
+ this.successMessage('order_subscription', TRIGGER, res.id);
19
+ return res;
20
+ }
21
+ }
22
+ exports.default = OrderSubscriptionConvert;
@@ -1,3 +1,3 @@
1
1
  import type { Trigger } from '../common';
2
2
  export declare const triggers: Record<string, Trigger>;
3
- export type ActionType = 'activate' | 'deactivate' | 'cancel';
3
+ export type ActionType = 'activate' | 'deactivate' | 'cancel' | 'convert';
@@ -17,4 +17,9 @@ exports.triggers = {
17
17
  trigger: '_cancel',
18
18
  description: 'Send this attribute if you want to mark this subscription as cancelled.',
19
19
  },
20
+ convert: {
21
+ action: 'convert',
22
+ trigger: '_convert',
23
+ description: 'Send this attribute if you want to convert a manual subscription to an automatic one. A subscription model is required before conversion.',
24
+ },
20
25
  };
@@ -196,7 +196,7 @@
196
196
  "index.js"
197
197
  ]
198
198
  },
199
- "authorization:capture": {
199
+ "axerve_payment": {
200
200
  "aliases": [],
201
201
  "args": {
202
202
  "id": {
@@ -205,7 +205,7 @@
205
205
  "required": true
206
206
  }
207
207
  },
208
- "description": "Send this attribute if you want to create a capture for this authorization.",
208
+ "description": "execute an action on a resource of type axerve_payments",
209
209
  "flags": {
210
210
  "organization": {
211
211
  "char": "o",
@@ -270,7 +270,7 @@
270
270
  },
271
271
  "hasDynamicHelp": false,
272
272
  "hiddenAliases": [],
273
- "id": "authorization:capture",
273
+ "id": "axerve_payment",
274
274
  "pluginAlias": "@commercelayer/cli-plugin-triggers",
275
275
  "pluginName": "@commercelayer/cli-plugin-triggers",
276
276
  "pluginType": "core",
@@ -280,11 +280,11 @@
280
280
  "relativePath": [
281
281
  "lib",
282
282
  "commands",
283
- "authorization",
284
- "capture.js"
283
+ "axerve_payment",
284
+ "index.js"
285
285
  ]
286
286
  },
287
- "authorization:capture_amount_cents": {
287
+ "axerve_payment:update": {
288
288
  "aliases": [],
289
289
  "args": {
290
290
  "id": {
@@ -293,7 +293,7 @@
293
293
  "required": true
294
294
  }
295
295
  },
296
- "description": "The associated capture amount, in cents.",
296
+ "description": "Send this attribute if you want to update the payment with fresh order data.",
297
297
  "flags": {
298
298
  "organization": {
299
299
  "char": "o",
@@ -358,7 +358,7 @@
358
358
  },
359
359
  "hasDynamicHelp": false,
360
360
  "hiddenAliases": [],
361
- "id": "authorization:capture_amount_cents",
361
+ "id": "axerve_payment:update",
362
362
  "pluginAlias": "@commercelayer/cli-plugin-triggers",
363
363
  "pluginName": "@commercelayer/cli-plugin-triggers",
364
364
  "pluginType": "core",
@@ -368,11 +368,11 @@
368
368
  "relativePath": [
369
369
  "lib",
370
370
  "commands",
371
- "authorization",
372
- "capture_amount_cents.js"
371
+ "axerve_payment",
372
+ "update.js"
373
373
  ]
374
374
  },
375
- "authorization": {
375
+ "authorization:capture": {
376
376
  "aliases": [],
377
377
  "args": {
378
378
  "id": {
@@ -381,7 +381,7 @@
381
381
  "required": true
382
382
  }
383
383
  },
384
- "description": "execute an action on a resource of type authorizations",
384
+ "description": "Send this attribute if you want to create a capture for this authorization.",
385
385
  "flags": {
386
386
  "organization": {
387
387
  "char": "o",
@@ -446,7 +446,7 @@
446
446
  },
447
447
  "hasDynamicHelp": false,
448
448
  "hiddenAliases": [],
449
- "id": "authorization",
449
+ "id": "authorization:capture",
450
450
  "pluginAlias": "@commercelayer/cli-plugin-triggers",
451
451
  "pluginName": "@commercelayer/cli-plugin-triggers",
452
452
  "pluginType": "core",
@@ -457,10 +457,10 @@
457
457
  "lib",
458
458
  "commands",
459
459
  "authorization",
460
- "index.js"
460
+ "capture.js"
461
461
  ]
462
462
  },
463
- "authorization:void": {
463
+ "authorization:capture_amount_cents": {
464
464
  "aliases": [],
465
465
  "args": {
466
466
  "id": {
@@ -469,7 +469,7 @@
469
469
  "required": true
470
470
  }
471
471
  },
472
- "description": "Send this attribute if you want to create a void for this authorization.",
472
+ "description": "The associated capture amount, in cents.",
473
473
  "flags": {
474
474
  "organization": {
475
475
  "char": "o",
@@ -534,7 +534,7 @@
534
534
  },
535
535
  "hasDynamicHelp": false,
536
536
  "hiddenAliases": [],
537
- "id": "authorization:void",
537
+ "id": "authorization:capture_amount_cents",
538
538
  "pluginAlias": "@commercelayer/cli-plugin-triggers",
539
539
  "pluginName": "@commercelayer/cli-plugin-triggers",
540
540
  "pluginType": "core",
@@ -545,10 +545,10 @@
545
545
  "lib",
546
546
  "commands",
547
547
  "authorization",
548
- "void.js"
548
+ "capture_amount_cents.js"
549
549
  ]
550
550
  },
551
- "axerve_payment": {
551
+ "authorization": {
552
552
  "aliases": [],
553
553
  "args": {
554
554
  "id": {
@@ -557,7 +557,7 @@
557
557
  "required": true
558
558
  }
559
559
  },
560
- "description": "execute an action on a resource of type axerve_payments",
560
+ "description": "execute an action on a resource of type authorizations",
561
561
  "flags": {
562
562
  "organization": {
563
563
  "char": "o",
@@ -622,7 +622,7 @@
622
622
  },
623
623
  "hasDynamicHelp": false,
624
624
  "hiddenAliases": [],
625
- "id": "axerve_payment",
625
+ "id": "authorization",
626
626
  "pluginAlias": "@commercelayer/cli-plugin-triggers",
627
627
  "pluginName": "@commercelayer/cli-plugin-triggers",
628
628
  "pluginType": "core",
@@ -632,11 +632,11 @@
632
632
  "relativePath": [
633
633
  "lib",
634
634
  "commands",
635
- "axerve_payment",
635
+ "authorization",
636
636
  "index.js"
637
637
  ]
638
638
  },
639
- "axerve_payment:update": {
639
+ "authorization:void": {
640
640
  "aliases": [],
641
641
  "args": {
642
642
  "id": {
@@ -645,7 +645,7 @@
645
645
  "required": true
646
646
  }
647
647
  },
648
- "description": "Send this attribute if you want to update the payment with fresh order data.",
648
+ "description": "Send this attribute if you want to create a void for this authorization.",
649
649
  "flags": {
650
650
  "organization": {
651
651
  "char": "o",
@@ -710,7 +710,7 @@
710
710
  },
711
711
  "hasDynamicHelp": false,
712
712
  "hiddenAliases": [],
713
- "id": "axerve_payment:update",
713
+ "id": "authorization:void",
714
714
  "pluginAlias": "@commercelayer/cli-plugin-triggers",
715
715
  "pluginName": "@commercelayer/cli-plugin-triggers",
716
716
  "pluginType": "core",
@@ -720,8 +720,8 @@
720
720
  "relativePath": [
721
721
  "lib",
722
722
  "commands",
723
- "axerve_payment",
724
- "update.js"
723
+ "authorization",
724
+ "void.js"
725
725
  ]
726
726
  },
727
727
  "bundle:compute_compare_at_amount": {
@@ -8055,6 +8055,94 @@
8055
8055
  "cancel.js"
8056
8056
  ]
8057
8057
  },
8058
+ "order_subscription:convert": {
8059
+ "aliases": [],
8060
+ "args": {
8061
+ "id": {
8062
+ "description": "the unique id of the resource",
8063
+ "name": "id",
8064
+ "required": true
8065
+ }
8066
+ },
8067
+ "description": "Send this attribute if you want to convert a manual subscription to an automatic one. A subscription model is required before conversion.",
8068
+ "flags": {
8069
+ "organization": {
8070
+ "char": "o",
8071
+ "description": "the slug of your organization",
8072
+ "env": "CL_CLI_ORGANIZATION",
8073
+ "hidden": true,
8074
+ "name": "organization",
8075
+ "required": true,
8076
+ "hasDynamicHelp": false,
8077
+ "multiple": false,
8078
+ "type": "option"
8079
+ },
8080
+ "domain": {
8081
+ "char": "d",
8082
+ "dependsOn": [
8083
+ "organization"
8084
+ ],
8085
+ "env": "CL_CLI_DOMAIN",
8086
+ "hidden": true,
8087
+ "name": "domain",
8088
+ "required": false,
8089
+ "hasDynamicHelp": false,
8090
+ "multiple": false,
8091
+ "type": "option"
8092
+ },
8093
+ "accessToken": {
8094
+ "env": "CL_CLI_ACCESS_TOKEN",
8095
+ "hidden": true,
8096
+ "name": "accessToken",
8097
+ "required": true,
8098
+ "hasDynamicHelp": false,
8099
+ "multiple": false,
8100
+ "type": "option"
8101
+ },
8102
+ "print": {
8103
+ "char": "p",
8104
+ "description": "print out the modified resource",
8105
+ "name": "print",
8106
+ "allowNo": false,
8107
+ "type": "boolean"
8108
+ },
8109
+ "json": {
8110
+ "char": "j",
8111
+ "dependsOn": [
8112
+ "print"
8113
+ ],
8114
+ "description": "print result in JSON format",
8115
+ "name": "json",
8116
+ "allowNo": false,
8117
+ "type": "boolean"
8118
+ },
8119
+ "unformatted": {
8120
+ "char": "u",
8121
+ "dependsOn": [
8122
+ "json"
8123
+ ],
8124
+ "description": "print JSON output without indentation",
8125
+ "name": "unformatted",
8126
+ "allowNo": false,
8127
+ "type": "boolean"
8128
+ }
8129
+ },
8130
+ "hasDynamicHelp": false,
8131
+ "hiddenAliases": [],
8132
+ "id": "order_subscription:convert",
8133
+ "pluginAlias": "@commercelayer/cli-plugin-triggers",
8134
+ "pluginName": "@commercelayer/cli-plugin-triggers",
8135
+ "pluginType": "core",
8136
+ "strict": true,
8137
+ "enableJsonFlag": false,
8138
+ "isESM": false,
8139
+ "relativePath": [
8140
+ "lib",
8141
+ "commands",
8142
+ "order_subscription",
8143
+ "convert.js"
8144
+ ]
8145
+ },
8058
8146
  "order_subscription:deactivate": {
8059
8147
  "aliases": [],
8060
8148
  "args": {
@@ -13600,5 +13688,5 @@
13600
13688
  ]
13601
13689
  }
13602
13690
  },
13603
- "version": "4.1.0"
13691
+ "version": "4.2.0"
13604
13692
  }
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": "4.1.0",
4
+ "version": "4.2.0",
5
5
  "author": "Pierluigi Viti <pierluigi@commercelayer.io>",
6
6
  "homepage": "https://github.com/commercelayer/commercelayer-cli-plugin-triggers",
7
7
  "repository": "commercelayer/commercelayer-cli-plugin-triggers",
@@ -78,7 +78,7 @@
78
78
  },
79
79
  "dependencies": {
80
80
  "@commercelayer/cli-core": "^5.0.2",
81
- "@commercelayer/sdk": "^6.1.0",
81
+ "@commercelayer/sdk": "^6.2.0",
82
82
  "@oclif/core": "^3.26.6",
83
83
  "inquirer": "^8.2.6",
84
84
  "tslib": "^2.6.2"