@commercelayer/cli-plugin-triggers 4.0.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 +93 -0
- package/lib/commands/order_subscription/convert.d.ts +9 -0
- package/lib/commands/order_subscription/convert.js +22 -0
- package/lib/commands/price_list_scheduler/disable.d.ts +9 -0
- package/lib/commands/price_list_scheduler/disable.js +22 -0
- package/lib/commands/price_list_scheduler/enable.d.ts +9 -0
- package/lib/commands/price_list_scheduler/enable.js +22 -0
- package/lib/commands/price_list_scheduler/index.d.ts +9 -0
- package/lib/commands/price_list_scheduler/index.js +40 -0
- package/lib/triggers/order_subscriptions.d.ts +1 -1
- package/lib/triggers/order_subscriptions.js +5 -0
- package/lib/triggers/price_list_schedulers.d.ts +3 -0
- package/lib/triggers/price_list_schedulers.js +15 -0
- package/oclif.manifest.json +539 -187
- package/package.json +11 -11
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)
|
|
@@ -129,6 +130,9 @@ $ commercelayer plugins:install triggers
|
|
|
129
130
|
* [`commercelayer percentage_discount_promotion ID`](#commercelayer-percentage_discount_promotion-id)
|
|
130
131
|
* [`commercelayer percentage_discount_promotion:disable ID`](#commercelayer-percentage_discount_promotiondisable-id)
|
|
131
132
|
* [`commercelayer percentage_discount_promotion:enable ID`](#commercelayer-percentage_discount_promotionenable-id)
|
|
133
|
+
* [`commercelayer price_list_scheduler ID`](#commercelayer-price_list_scheduler-id)
|
|
134
|
+
* [`commercelayer price_list_scheduler:disable ID`](#commercelayer-price_list_schedulerdisable-id)
|
|
135
|
+
* [`commercelayer price_list_scheduler:enable ID`](#commercelayer-price_list_schedulerenable-id)
|
|
132
136
|
* [`commercelayer return ID`](#commercelayer-return-id)
|
|
133
137
|
* [`commercelayer return:approve ID`](#commercelayer-returnapprove-id)
|
|
134
138
|
* [`commercelayer return:archive ID`](#commercelayer-returnarchive-id)
|
|
@@ -2229,6 +2233,29 @@ DESCRIPTION
|
|
|
2229
2233
|
|
|
2230
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)_
|
|
2231
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
|
+
|
|
2232
2259
|
### `commercelayer order_subscription:deactivate ID`
|
|
2233
2260
|
|
|
2234
2261
|
Send this attribute if you want to mark this subscription as inactive.
|
|
@@ -2383,6 +2410,72 @@ DESCRIPTION
|
|
|
2383
2410
|
|
|
2384
2411
|
_See code: [src/commands/percentage_discount_promotion/enable.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/percentage_discount_promotion/enable.ts)_
|
|
2385
2412
|
|
|
2413
|
+
### `commercelayer price_list_scheduler ID`
|
|
2414
|
+
|
|
2415
|
+
Execute an action on a resource of type price_list_schedulers.
|
|
2416
|
+
|
|
2417
|
+
```sh-session
|
|
2418
|
+
USAGE
|
|
2419
|
+
$ commercelayer price_list_scheduler ID [-u [-j -p]]
|
|
2420
|
+
|
|
2421
|
+
ARGUMENTS
|
|
2422
|
+
ID the unique id of the resource
|
|
2423
|
+
|
|
2424
|
+
FLAGS
|
|
2425
|
+
-j, --json print result in JSON format
|
|
2426
|
+
-p, --print print out the modified resource
|
|
2427
|
+
-u, --unformatted print JSON output without indentation
|
|
2428
|
+
|
|
2429
|
+
DESCRIPTION
|
|
2430
|
+
execute an action on a resource of type price_list_schedulers
|
|
2431
|
+
```
|
|
2432
|
+
|
|
2433
|
+
_See code: [src/commands/price_list_scheduler/index.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/price_list_scheduler/index.ts)_
|
|
2434
|
+
|
|
2435
|
+
### `commercelayer price_list_scheduler:disable ID`
|
|
2436
|
+
|
|
2437
|
+
Send this attribute if you want to mark this resource as disabled.
|
|
2438
|
+
|
|
2439
|
+
```sh-session
|
|
2440
|
+
USAGE
|
|
2441
|
+
$ commercelayer price_list_scheduler:disable ID [-u [-j -p]]
|
|
2442
|
+
|
|
2443
|
+
ARGUMENTS
|
|
2444
|
+
ID the unique id of the resource
|
|
2445
|
+
|
|
2446
|
+
FLAGS
|
|
2447
|
+
-j, --json print result in JSON format
|
|
2448
|
+
-p, --print print out the modified resource
|
|
2449
|
+
-u, --unformatted print JSON output without indentation
|
|
2450
|
+
|
|
2451
|
+
DESCRIPTION
|
|
2452
|
+
Send this attribute if you want to mark this resource as disabled.
|
|
2453
|
+
```
|
|
2454
|
+
|
|
2455
|
+
_See code: [src/commands/price_list_scheduler/disable.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/price_list_scheduler/disable.ts)_
|
|
2456
|
+
|
|
2457
|
+
### `commercelayer price_list_scheduler:enable ID`
|
|
2458
|
+
|
|
2459
|
+
Send this attribute if you want to mark this resource as enabled.
|
|
2460
|
+
|
|
2461
|
+
```sh-session
|
|
2462
|
+
USAGE
|
|
2463
|
+
$ commercelayer price_list_scheduler:enable ID [-u [-j -p]]
|
|
2464
|
+
|
|
2465
|
+
ARGUMENTS
|
|
2466
|
+
ID the unique id of the resource
|
|
2467
|
+
|
|
2468
|
+
FLAGS
|
|
2469
|
+
-j, --json print result in JSON format
|
|
2470
|
+
-p, --print print out the modified resource
|
|
2471
|
+
-u, --unformatted print JSON output without indentation
|
|
2472
|
+
|
|
2473
|
+
DESCRIPTION
|
|
2474
|
+
Send this attribute if you want to mark this resource as enabled.
|
|
2475
|
+
```
|
|
2476
|
+
|
|
2477
|
+
_See code: [src/commands/price_list_scheduler/enable.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/price_list_scheduler/enable.ts)_
|
|
2478
|
+
|
|
2386
2479
|
### `commercelayer return ID`
|
|
2387
2480
|
|
|
2388
2481
|
Execute an action on a resource of type returns.
|
|
@@ -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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class PriceListSchedulerDisable 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 price_list_schedulers_1 = require("../../triggers/price_list_schedulers");
|
|
6
|
+
const TRIGGER = 'disable';
|
|
7
|
+
class PriceListSchedulerDisable extends base_1.default {
|
|
8
|
+
static description = price_list_schedulers_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(PriceListSchedulerDisable);
|
|
15
|
+
const res = await this.executeAction('price_list_schedulers', args.id, TRIGGER, flags);
|
|
16
|
+
if (flags.print)
|
|
17
|
+
this.printOutput(res, flags);
|
|
18
|
+
this.successMessage('price_list_scheduler', TRIGGER, res.id);
|
|
19
|
+
return res;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = PriceListSchedulerDisable;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class PriceListSchedulerEnable 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 price_list_schedulers_1 = require("../../triggers/price_list_schedulers");
|
|
6
|
+
const TRIGGER = 'enable';
|
|
7
|
+
class PriceListSchedulerEnable extends base_1.default {
|
|
8
|
+
static description = price_list_schedulers_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(PriceListSchedulerEnable);
|
|
15
|
+
const res = await this.executeAction('price_list_schedulers', args.id, TRIGGER, flags);
|
|
16
|
+
if (flags.print)
|
|
17
|
+
this.printOutput(res, flags);
|
|
18
|
+
this.successMessage('price_list_scheduler', TRIGGER, res.id);
|
|
19
|
+
return res;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = PriceListSchedulerEnable;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class PriceListSchedulerIndex 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 price_list_schedulers_1 = require("../../triggers/price_list_schedulers");
|
|
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 price list scheduler ${cli_core_1.clColor.api.id(id)}:`,
|
|
14
|
+
choices: Object.keys(price_list_schedulers_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 PriceListSchedulerIndex extends base_1.default {
|
|
23
|
+
static description = 'execute an action on a resource of type price_list_schedulers';
|
|
24
|
+
static flags = {};
|
|
25
|
+
static args = {
|
|
26
|
+
...base_1.default.args,
|
|
27
|
+
};
|
|
28
|
+
async run() {
|
|
29
|
+
const { args, flags } = await this.parse(PriceListSchedulerIndex);
|
|
30
|
+
const id = args.id;
|
|
31
|
+
const action = await promptAction(id);
|
|
32
|
+
const fields = [];
|
|
33
|
+
const res = await (0, exec_1.default)('price_list_schedulers', id, action, flags, fields);
|
|
34
|
+
this.log();
|
|
35
|
+
this.printOutput(res, flags);
|
|
36
|
+
this.successMessage('price list scheduler', action, res.id);
|
|
37
|
+
return res;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.default = PriceListSchedulerIndex;
|
|
@@ -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
|
};
|
|
@@ -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
|
+
};
|