@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 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
@@ -1,4 +1,4 @@
1
- export declare type Trigger = {
1
+ export type Trigger = {
2
2
  action: string;
3
3
  trigger: string;
4
4
  description: string;
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
2
2
  export declare const triggers: {
3
3
  [key: string]: Trigger;
4
4
  };
5
- export declare type ActionType = 'details';
5
+ export type ActionType = 'details';
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
2
2
  export declare const triggers: {
3
3
  [key: string]: Trigger;
4
4
  };
5
- export declare type ActionType = 'capture' | 'capture_amount_cents' | 'void';
5
+ export type ActionType = 'capture' | 'capture_amount_cents' | 'void';
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
2
2
  export declare const triggers: {
3
3
  [key: string]: Trigger;
4
4
  };
5
- export declare type ActionType = 'compute_price_amount' | 'compute_compare_at_amount';
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 declare type ActionType = 'refund' | 'refund_amount_cents';
5
+ export type ActionType = 'refund' | 'refund_amount_cents';
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
2
2
  export declare const triggers: {
3
3
  [key: string]: Trigger;
4
4
  };
5
- export declare type ActionType = 'details' | 'refresh';
5
+ export type ActionType = 'details' | '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 declare type ActionType = 'reset_password_token';
5
+ export type ActionType = 'reset_password_token';
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
2
2
  export declare const triggers: {
3
3
  [key: string]: Trigger;
4
4
  };
5
- export declare type ActionType = 'purchase' | 'activate' | 'deactivate' | 'balance_change_cents';
5
+ export type ActionType = 'purchase' | 'activate' | 'deactivate' | 'balance_change_cents';
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
2
2
  export declare const triggers: {
3
3
  [key: string]: Trigger;
4
4
  };
5
- export declare type ActionType = 'activate' | 'deactivate';
5
+ export type ActionType = 'activate' | 'deactivate';
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
2
2
  export declare const triggers: {
3
3
  [key: string]: Trigger;
4
4
  };
5
- export declare type ActionType = 'update';
5
+ export type ActionType = 'update';
@@ -0,0 +1,5 @@
1
+ import type { Trigger } from '../common';
2
+ export declare const triggers: {
3
+ [key: string]: Trigger;
4
+ };
5
+ export type ActionType = 'disable' | 'enable';
@@ -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
+ };
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
2
2
  export declare const triggers: {
3
3
  [key: string]: Trigger;
4
4
  };
5
- export declare type ActionType = 'activate' | 'deactivate' | 'cancel';
5
+ export type ActionType = 'activate' | 'deactivate' | 'cancel';
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
2
2
  export declare const triggers: {
3
3
  [key: string]: Trigger;
4
4
  };
5
- export declare 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';
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 declare type ActionType = 'disable' | 'enable';
5
+ export type ActionType = 'disable' | 'enable';
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
2
2
  export declare const triggers: {
3
3
  [key: string]: Trigger;
4
4
  };
5
- export declare type ActionType = 'restock';
5
+ export type ActionType = 'restock';
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
2
2
  export declare const triggers: {
3
3
  [key: string]: Trigger;
4
4
  };
5
- export declare type ActionType = 'request' | 'approve' | 'cancel' | 'ship' | 'reject' | 'receive' | 'restock' | 'archive' | 'unarchive';
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 declare type ActionType = 'on_hold' | 'picking' | 'packing' | 'ready_to_ship' | 'ship' | 'get_rates' | 'purchase';
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 declare type ActionType = 'disable' | 'enable';
5
+ export type ActionType = 'disable' | 'enable';
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
2
2
  export declare const triggers: {
3
3
  [key: string]: Trigger;
4
4
  };
5
- export declare type ActionType = 'upcoming' | 'picking' | 'in_transit' | 'complete' | 'cancel';
5
+ export type ActionType = 'upcoming' | 'picking' | 'in_transit' | 'complete' | 'cancel';
@@ -2,4 +2,4 @@ import type { Trigger } from '../common';
2
2
  export declare const triggers: {
3
3
  [key: string]: Trigger;
4
4
  };
5
- export declare type ActionType = 'refresh';
5
+ export type ActionType = '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 declare type ActionType = 'reset_circuit';
5
+ export type ActionType = 'reset_circuit';