@commercelayer/cli-plugin-triggers 4.9.1 → 4.10.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.
Files changed (35) hide show
  1. package/README.md +232 -0
  2. package/lib/commands/adyen_payment/authorize.d.ts +9 -0
  3. package/lib/commands/adyen_payment/authorize.js +22 -0
  4. package/lib/commands/cleanup/index.d.ts +9 -0
  5. package/lib/commands/cleanup/index.js +40 -0
  6. package/lib/commands/cleanup/interrupt.d.ts +9 -0
  7. package/lib/commands/cleanup/interrupt.js +22 -0
  8. package/lib/commands/export/index.d.ts +9 -0
  9. package/lib/commands/export/index.js +40 -0
  10. package/lib/commands/export/interrupt.d.ts +9 -0
  11. package/lib/commands/export/interrupt.js +22 -0
  12. package/lib/commands/import/index.d.ts +9 -0
  13. package/lib/commands/import/index.js +40 -0
  14. package/lib/commands/import/interrupt.d.ts +9 -0
  15. package/lib/commands/import/interrupt.js +22 -0
  16. package/lib/commands/order/fix_payment_source.d.ts +9 -0
  17. package/lib/commands/order/fix_payment_source.js +22 -0
  18. package/lib/commands/vertex_account/index.d.ts +9 -0
  19. package/lib/commands/vertex_account/index.js +40 -0
  20. package/lib/commands/vertex_account/refresh_token.d.ts +9 -0
  21. package/lib/commands/vertex_account/refresh_token.js +22 -0
  22. package/lib/triggers/adyen_payments.d.ts +1 -1
  23. package/lib/triggers/adyen_payments.js +5 -0
  24. package/lib/triggers/cleanups.d.ts +3 -0
  25. package/lib/triggers/cleanups.js +10 -0
  26. package/lib/triggers/exports.d.ts +3 -0
  27. package/lib/triggers/exports.js +10 -0
  28. package/lib/triggers/imports.d.ts +3 -0
  29. package/lib/triggers/imports.js +10 -0
  30. package/lib/triggers/orders.d.ts +1 -1
  31. package/lib/triggers/orders.js +5 -0
  32. package/lib/triggers/vertex_accounts.d.ts +3 -0
  33. package/lib/triggers/vertex_accounts.js +10 -0
  34. package/oclif.manifest.json +981 -101
  35. package/package.json +9 -8
@@ -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 vertex_accounts_1 = require("../../triggers/vertex_accounts");
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 vertex account ${cli_core_1.clColor.api.id(id)}:`,
14
+ choices: Object.keys(vertex_accounts_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 VertexAccountIndex extends base_1.default {
23
+ static description = 'execute an action on a resource of type vertex_accounts';
24
+ static flags = {};
25
+ static args = {
26
+ ...base_1.default.args,
27
+ };
28
+ async run() {
29
+ const { args, flags } = await this.parse(VertexAccountIndex);
30
+ const id = args.id;
31
+ const action = await promptAction(id);
32
+ const fields = [];
33
+ const res = await (0, exec_1.default)('vertex_accounts', id, action, flags, fields);
34
+ this.log();
35
+ this.printOutput(res, flags);
36
+ this.successMessage('vertex account', action, res.id);
37
+ return res;
38
+ }
39
+ }
40
+ exports.default = VertexAccountIndex;
@@ -0,0 +1,9 @@
1
+ import Command from '../../base';
2
+ export default class VertexAccountRefreshToken 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 vertex_accounts_1 = require("../../triggers/vertex_accounts");
6
+ const TRIGGER = 'refresh_token';
7
+ class VertexAccountRefreshToken extends base_1.default {
8
+ static description = vertex_accounts_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(VertexAccountRefreshToken);
15
+ const res = await this.executeAction('vertex_accounts', args.id, TRIGGER, flags);
16
+ if (flags.print)
17
+ this.printOutput(res, flags);
18
+ this.successMessage('vertex_account', TRIGGER, res.id);
19
+ return res;
20
+ }
21
+ }
22
+ exports.default = VertexAccountRefreshToken;
@@ -1,3 +1,3 @@
1
1
  import type { Trigger } from '../common';
2
2
  export declare const triggers: Record<string, Trigger>;
3
- export type ActionType = 'details';
3
+ export type ActionType = 'authorize' | 'details';
@@ -2,6 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.triggers = void 0;
4
4
  exports.triggers = {
5
+ authorize: {
6
+ action: 'authorize',
7
+ trigger: '_authorize',
8
+ description: 'Send this attribute if you want to authorize the payment.',
9
+ },
5
10
  details: {
6
11
  action: 'details',
7
12
  trigger: '_details',
@@ -0,0 +1,3 @@
1
+ import type { Trigger } from '../common';
2
+ export declare const triggers: Record<string, Trigger>;
3
+ export type ActionType = 'interrupt';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggers = void 0;
4
+ exports.triggers = {
5
+ interrupt: {
6
+ action: 'interrupt',
7
+ trigger: '_interrupt',
8
+ description: 'Send this attribute if you want to mark status as \'interrupted\'.',
9
+ },
10
+ };
@@ -0,0 +1,3 @@
1
+ import type { Trigger } from '../common';
2
+ export declare const triggers: Record<string, Trigger>;
3
+ export type ActionType = 'interrupt';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggers = void 0;
4
+ exports.triggers = {
5
+ interrupt: {
6
+ action: 'interrupt',
7
+ trigger: '_interrupt',
8
+ description: 'Send this attribute if you want to mark status as \'interrupted\'.',
9
+ },
10
+ };
@@ -0,0 +1,3 @@
1
+ import type { Trigger } from '../common';
2
+ export declare const triggers: Record<string, Trigger>;
3
+ export type ActionType = 'interrupt';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggers = void 0;
4
+ exports.triggers = {
5
+ interrupt: {
6
+ action: 'interrupt',
7
+ trigger: '_interrupt',
8
+ description: 'Send this attribute if you want to mark status as \'interrupted\'.',
9
+ },
10
+ };
@@ -1,3 +1,3 @@
1
1
  import type { Trigger } from '../common';
2
2
  export declare const triggers: Record<string, Trigger>;
3
- export type ActionType = 'archive' | 'unarchive' | 'pending' | 'place' | 'cancel' | 'approve' | 'approve_and_capture' | 'authorize' | 'authorization_amount_cents' | 'capture' | 'refund' | 'fulfill' | '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' | 'validate' | 'create_subscriptions' | 'start_editing' | 'stop_editing' | 'reset_circuit';
3
+ export type ActionType = 'archive' | 'unarchive' | 'pending' | 'place' | 'cancel' | 'approve' | 'approve_and_capture' | 'authorize' | 'authorization_amount_cents' | 'capture' | 'refund' | 'fulfill' | 'update_taxes' | 'nullify_payment_source' | 'fix_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' | 'validate' | 'create_subscriptions' | 'start_editing' | 'stop_editing' | 'reset_circuit';
@@ -72,6 +72,11 @@ exports.triggers = {
72
72
  trigger: '_nullify_payment_source',
73
73
  description: 'Send this attribute if you want to nullify the payment source for this order.',
74
74
  },
75
+ fix_payment_source: {
76
+ action: 'fix_payment_source',
77
+ trigger: '_fix_payment_source',
78
+ description: 'Send this attribute if you want to set the payment source associated with the last succeeded authorization. At the end of the fix the order should be placed and authorized and ready to be approved. A tentative to fix the payment source is done before approval automatically. Cannot be passed by sales channels.',
79
+ },
75
80
  billing_address_clone_id: {
76
81
  action: 'billing_address_clone_id',
77
82
  trigger: '_billing_address_clone_id',
@@ -0,0 +1,3 @@
1
+ import type { Trigger } from '../common';
2
+ export declare const triggers: Record<string, Trigger>;
3
+ export type ActionType = 'refresh_token';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggers = void 0;
4
+ exports.triggers = {
5
+ refresh_token: {
6
+ action: 'refresh_token',
7
+ trigger: '_refresh_token',
8
+ description: 'Send this attribute if you want to manually refresh the access token.',
9
+ },
10
+ };