@commercelayer/cli-plugin-triggers 3.5.1 → 3.6.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 +72 -0
- package/lib/commands/market/disable.d.ts +18 -0
- package/lib/commands/market/disable.js +23 -0
- package/lib/commands/market/enable.d.ts +18 -0
- package/lib/commands/market/enable.js +23 -0
- package/lib/commands/market/index.d.ts +18 -0
- package/lib/commands/market/index.js +40 -0
- package/lib/common.d.ts +1 -1
- package/lib/triggers/adyen_payments.d.ts +1 -1
- package/lib/triggers/authorizations.d.ts +1 -1
- package/lib/triggers/bundles.d.ts +1 -1
- package/lib/triggers/captures.d.ts +1 -1
- package/lib/triggers/checkout_com_payments.d.ts +1 -1
- package/lib/triggers/customer_password_resets.d.ts +1 -1
- package/lib/triggers/gift_cards.d.ts +1 -1
- package/lib/triggers/in_stock_subscriptions.d.ts +1 -1
- package/lib/triggers/klarna_payments.d.ts +1 -1
- package/lib/triggers/markets.d.ts +5 -0
- package/lib/triggers/markets.js +15 -0
- package/lib/triggers/order_subscriptions.d.ts +1 -1
- package/lib/triggers/orders.d.ts +1 -1
- package/lib/triggers/payment_methods.d.ts +1 -1
- package/lib/triggers/return_line_items.d.ts +1 -1
- package/lib/triggers/returns.d.ts +1 -1
- package/lib/triggers/shipments.d.ts +1 -1
- package/lib/triggers/shipping_methods.d.ts +1 -1
- package/lib/triggers/stock_transfers.d.ts +1 -1
- package/lib/triggers/stripe_payments.d.ts +1 -1
- package/lib/triggers/webhooks.d.ts +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -57,6 +57,9 @@ $ commercelayer plugins:install triggers
|
|
|
57
57
|
* [`commercelayer in_stock_subscription:deactivate ID`](#commercelayer-in_stock_subscriptiondeactivate-id)
|
|
58
58
|
* [`commercelayer klarna_payment ID`](#commercelayer-klarna_payment-id)
|
|
59
59
|
* [`commercelayer klarna_payment:update ID`](#commercelayer-klarna_paymentupdate-id)
|
|
60
|
+
* [`commercelayer market ID`](#commercelayer-market-id)
|
|
61
|
+
* [`commercelayer market:disable ID`](#commercelayer-marketdisable-id)
|
|
62
|
+
* [`commercelayer market:enable ID`](#commercelayer-marketenable-id)
|
|
60
63
|
* [`commercelayer order ID`](#commercelayer-order-id)
|
|
61
64
|
* [`commercelayer order:approve ID`](#commercelayer-orderapprove-id)
|
|
62
65
|
* [`commercelayer order:approve_and_capture ID`](#commercelayer-orderapprove_and_capture-id)
|
|
@@ -747,6 +750,75 @@ DESCRIPTION
|
|
|
747
750
|
|
|
748
751
|
_See code: [src/commands/klarna_payment/update.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/klarna_payment/update.ts)_
|
|
749
752
|
|
|
753
|
+
### `commercelayer market ID`
|
|
754
|
+
|
|
755
|
+
Execute an action on a resource of type markets.
|
|
756
|
+
|
|
757
|
+
```sh-session
|
|
758
|
+
USAGE
|
|
759
|
+
$ commercelayer market [ID] -o <value> [-u [-j -p]]
|
|
760
|
+
|
|
761
|
+
ARGUMENTS
|
|
762
|
+
ID the unique id of the resource
|
|
763
|
+
|
|
764
|
+
FLAGS
|
|
765
|
+
-j, --json print result in JSON format
|
|
766
|
+
-o, --organization=<value> (required) the slug of your organization
|
|
767
|
+
-p, --print print out the modified resource
|
|
768
|
+
-u, --unformatted print JSON output without indentation
|
|
769
|
+
|
|
770
|
+
DESCRIPTION
|
|
771
|
+
execute an action on a resource of type markets
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
_See code: [src/commands/market/index.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/market/index.ts)_
|
|
775
|
+
|
|
776
|
+
### `commercelayer market:disable ID`
|
|
777
|
+
|
|
778
|
+
Send this attribute if you want to mark the market as disabled.
|
|
779
|
+
|
|
780
|
+
```sh-session
|
|
781
|
+
USAGE
|
|
782
|
+
$ commercelayer market:disable [ID] -o <value> [-u [-j -p]]
|
|
783
|
+
|
|
784
|
+
ARGUMENTS
|
|
785
|
+
ID the unique id of the resource
|
|
786
|
+
|
|
787
|
+
FLAGS
|
|
788
|
+
-j, --json print result in JSON format
|
|
789
|
+
-o, --organization=<value> (required) the slug of your organization
|
|
790
|
+
-p, --print print out the modified resource
|
|
791
|
+
-u, --unformatted print JSON output without indentation
|
|
792
|
+
|
|
793
|
+
DESCRIPTION
|
|
794
|
+
Send this attribute if you want to mark the market as disabled.
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
_See code: [src/commands/market/disable.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/market/disable.ts)_
|
|
798
|
+
|
|
799
|
+
### `commercelayer market:enable ID`
|
|
800
|
+
|
|
801
|
+
Send this attribute if you want to mark the market as enabled.
|
|
802
|
+
|
|
803
|
+
```sh-session
|
|
804
|
+
USAGE
|
|
805
|
+
$ commercelayer market:enable [ID] -o <value> [-u [-j -p]]
|
|
806
|
+
|
|
807
|
+
ARGUMENTS
|
|
808
|
+
ID the unique id of the resource
|
|
809
|
+
|
|
810
|
+
FLAGS
|
|
811
|
+
-j, --json print result in JSON format
|
|
812
|
+
-o, --organization=<value> (required) the slug of your organization
|
|
813
|
+
-p, --print print out the modified resource
|
|
814
|
+
-u, --unformatted print JSON output without indentation
|
|
815
|
+
|
|
816
|
+
DESCRIPTION
|
|
817
|
+
Send this attribute if you want to mark the market as enabled.
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
_See code: [src/commands/market/enable.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/market/enable.ts)_
|
|
821
|
+
|
|
750
822
|
### `commercelayer order ID`
|
|
751
823
|
|
|
752
824
|
Execute an action on a resource of type orders.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class MarketDisable extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
organization: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
|
+
domain: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
+
accessToken: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
8
|
+
print: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static args: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
}[];
|
|
17
|
+
run(): Promise<any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 markets_1 = require("../../triggers/markets");
|
|
7
|
+
const TRIGGER = 'disable';
|
|
8
|
+
class MarketDisable extends base_1.default {
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(MarketDisable);
|
|
11
|
+
const res = await (0, exec_1.default)('markets', args.id, TRIGGER, flags);
|
|
12
|
+
if (flags.print)
|
|
13
|
+
this.printOutput(res, flags);
|
|
14
|
+
this.successMessage('market', TRIGGER, res.id);
|
|
15
|
+
return res;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = MarketDisable;
|
|
19
|
+
MarketDisable.description = markets_1.triggers[TRIGGER].description;
|
|
20
|
+
MarketDisable.flags = Object.assign({}, base_1.default.flags);
|
|
21
|
+
MarketDisable.args = [
|
|
22
|
+
...base_1.default.args,
|
|
23
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class MarketEnable extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
organization: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
|
+
domain: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
+
accessToken: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
8
|
+
print: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static args: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
}[];
|
|
17
|
+
run(): Promise<any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 markets_1 = require("../../triggers/markets");
|
|
7
|
+
const TRIGGER = 'enable';
|
|
8
|
+
class MarketEnable extends base_1.default {
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(MarketEnable);
|
|
11
|
+
const res = await (0, exec_1.default)('markets', args.id, TRIGGER, flags);
|
|
12
|
+
if (flags.print)
|
|
13
|
+
this.printOutput(res, flags);
|
|
14
|
+
this.successMessage('market', TRIGGER, res.id);
|
|
15
|
+
return res;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = MarketEnable;
|
|
19
|
+
MarketEnable.description = markets_1.triggers[TRIGGER].description;
|
|
20
|
+
MarketEnable.flags = Object.assign({}, base_1.default.flags);
|
|
21
|
+
MarketEnable.args = [
|
|
22
|
+
...base_1.default.args,
|
|
23
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class MarketIndex extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
organization: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
|
+
domain: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
+
accessToken: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
8
|
+
print: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static args: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
}[];
|
|
17
|
+
run(): Promise<any>;
|
|
18
|
+
}
|
|
@@ -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 markets_1 = require("../../triggers/markets");
|
|
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 market ${cli_core_1.clColor.api.id(id)}:`,
|
|
14
|
+
choices: Object.keys(markets_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 MarketIndex extends base_1.default {
|
|
23
|
+
async run() {
|
|
24
|
+
const { args, flags } = await this.parse(MarketIndex);
|
|
25
|
+
const id = args.id;
|
|
26
|
+
const action = await promptAction(id);
|
|
27
|
+
const fields = [];
|
|
28
|
+
const res = await (0, exec_1.default)('markets', id, action, flags, fields);
|
|
29
|
+
this.log();
|
|
30
|
+
this.printOutput(res, flags);
|
|
31
|
+
this.successMessage('market', action, res.id);
|
|
32
|
+
return res;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.default = MarketIndex;
|
|
36
|
+
MarketIndex.description = 'execute an action on a resource of type markets';
|
|
37
|
+
MarketIndex.flags = Object.assign({}, base_1.default.flags);
|
|
38
|
+
MarketIndex.args = [
|
|
39
|
+
...base_1.default.args,
|
|
40
|
+
];
|
package/lib/common.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
|
|
|
2
2
|
export declare const triggers: {
|
|
3
3
|
[key: string]: Trigger;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type ActionType = 'compute_price_amount' | 'compute_compare_at_amount';
|
|
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
|
|
|
2
2
|
export declare const triggers: {
|
|
3
3
|
[key: string]: Trigger;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type ActionType = 'purchase' | 'activate' | 'deactivate' | 'balance_change_cents';
|
|
@@ -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 the market as disabled.',
|
|
9
|
+
},
|
|
10
|
+
enable: {
|
|
11
|
+
action: 'enable',
|
|
12
|
+
trigger: '_enable',
|
|
13
|
+
description: 'Send this attribute if you want to mark the market as enabled.',
|
|
14
|
+
},
|
|
15
|
+
};
|
package/lib/triggers/orders.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
|
|
|
2
2
|
export declare const triggers: {
|
|
3
3
|
[key: string]: Trigger;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type ActionType = 'archive' | 'unarchive' | 'place' | 'cancel' | 'approve' | 'approve_and_capture' | 'authorize' | 'authorization_amount_cents' | 'capture' | 'refund' | 'update_taxes' | 'nullify_payment_source' | 'billing_address_clone_id' | 'shipping_address_clone_id' | 'customer_payment_source_id' | 'shipping_address_same_as_billing' | 'billing_address_same_as_shipping' | 'commit_invoice' | 'refund_invoice' | 'save_payment_source_to_customer_wallet' | 'save_shipping_address_to_customer_address_book' | 'save_billing_address_to_customer_address_book' | 'refresh';
|
|
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
|
|
|
2
2
|
export declare const triggers: {
|
|
3
3
|
[key: string]: Trigger;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type ActionType = 'request' | 'approve' | 'cancel' | 'ship' | 'reject' | 'receive' | 'restock' | 'archive' | 'unarchive';
|
|
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
|
|
|
2
2
|
export declare const triggers: {
|
|
3
3
|
[key: string]: Trigger;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type ActionType = 'on_hold' | 'picking' | 'packing' | 'ready_to_ship' | 'ship' | 'get_rates' | 'purchase';
|
|
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
|
|
|
2
2
|
export declare const triggers: {
|
|
3
3
|
[key: string]: Trigger;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type ActionType = 'upcoming' | 'picking' | 'in_transit' | 'complete' | 'cancel';
|