@commercelayer/cli-plugin-triggers 1.0.0-alpha.0 → 1.0.2
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 +330 -330
- package/lib/base.d.ts +1 -1
- package/lib/base.js +2 -2
- package/lib/commands/adyen_payment/authorize.js +1 -1
- package/lib/commands/adyen_payment/details.js +1 -1
- package/lib/commands/adyen_payment/index.js +1 -1
- package/lib/commands/authorization/capture.js +1 -1
- package/lib/commands/authorization/capture_amount_cents.js +1 -1
- package/lib/commands/authorization/index.js +1 -1
- package/lib/commands/authorization/void.js +1 -1
- package/lib/commands/bundle/compute_compare_at_amount.js +1 -1
- package/lib/commands/bundle/index.js +1 -1
- package/lib/commands/capture/index.js +1 -1
- package/lib/commands/capture/refund.js +1 -1
- package/lib/commands/capture/refund_amount_cents.js +1 -1
- package/lib/commands/checkout_com_payment/authorize.js +1 -1
- package/lib/commands/checkout_com_payment/details.js +1 -1
- package/lib/commands/checkout_com_payment/index.js +1 -1
- package/lib/commands/checkout_com_payment/refresh.js +1 -1
- package/lib/commands/customer_password_reset/index.js +1 -1
- package/lib/commands/customer_password_reset/reset_password_token.js +1 -1
- package/lib/commands/gift_card/activate.js +1 -1
- package/lib/commands/gift_card/balance_change_cents.js +1 -1
- package/lib/commands/gift_card/deactivate.js +1 -1
- package/lib/commands/gift_card/index.js +1 -1
- package/lib/commands/gift_card/purchase.js +1 -1
- package/lib/commands/in_stock_subscription/activate.js +1 -1
- package/lib/commands/in_stock_subscription/deactivate.js +1 -1
- package/lib/commands/in_stock_subscription/index.js +1 -1
- package/lib/commands/order/approve.js +1 -1
- package/lib/commands/order/approve_and_capture.js +1 -1
- package/lib/commands/order/archive.js +1 -1
- package/lib/commands/order/authorization_amount_cents.js +1 -1
- package/lib/commands/order/authorize.js +1 -1
- package/lib/commands/order/billing_address_clone_id.js +1 -1
- package/lib/commands/order/billing_address_same_as_shipping.js +1 -1
- package/lib/commands/order/cancel.js +1 -1
- package/lib/commands/order/capture.js +1 -1
- package/lib/commands/order/customer_payment_source_id.js +1 -1
- package/lib/commands/order/index.js +1 -1
- package/lib/commands/order/place.js +1 -1
- package/lib/commands/order/refresh.js +1 -1
- package/lib/commands/order/refund.js +1 -1
- package/lib/commands/order/save_billing_address_to_customer_address_book.js +1 -1
- package/lib/commands/order/save_payment_source_to_customer_wallet.js +1 -1
- package/lib/commands/order/save_shipping_address_to_customer_address_book.js +1 -1
- package/lib/commands/order/shipping_address_clone_id.js +1 -1
- package/lib/commands/order/shipping_address_same_as_billing.js +1 -1
- package/lib/commands/order/unarchive.js +1 -1
- package/lib/commands/order/update_taxes.js +1 -1
- package/lib/commands/order_subscription/activate.js +1 -1
- package/lib/commands/order_subscription/cancel.js +1 -1
- package/lib/commands/order_subscription/deactivate.js +1 -1
- package/lib/commands/order_subscription/index.js +1 -1
- package/lib/commands/return/approve.js +1 -1
- package/lib/commands/return/archive.js +1 -1
- package/lib/commands/return/cancel.js +1 -1
- package/lib/commands/return/index.js +1 -1
- package/lib/commands/return/receive.js +1 -1
- package/lib/commands/return/reject.js +1 -1
- package/lib/commands/return/request.js +1 -1
- package/lib/commands/return/restock.js +1 -1
- package/lib/commands/return/ship.js +1 -1
- package/lib/commands/return/unarchive.js +1 -1
- package/lib/commands/return_line_item/index.js +1 -1
- package/lib/commands/return_line_item/restock.js +1 -1
- package/lib/commands/shipment/get_rates.js +1 -1
- package/lib/commands/shipment/index.js +1 -1
- package/lib/commands/shipment/on_hold.js +1 -1
- package/lib/commands/shipment/packing.js +1 -1
- package/lib/commands/shipment/picking.js +1 -1
- package/lib/commands/shipment/purchase.js +1 -1
- package/lib/commands/shipment/ready_to_ship.js +1 -1
- package/lib/commands/shipment/ship.js +1 -1
- package/lib/commands/stock_transfer/cancel.js +1 -1
- package/lib/commands/stock_transfer/complete.js +1 -1
- package/lib/commands/stock_transfer/in_transit.js +1 -1
- package/lib/commands/stock_transfer/index.js +1 -1
- package/lib/commands/stock_transfer/picking.js +1 -1
- package/lib/commands/stock_transfer/upcoming.js +1 -1
- package/lib/commands/stripe_payment/index.js +1 -1
- package/lib/commands/stripe_payment/refresh.js +1 -1
- package/lib/commands/webhook/index.js +1 -1
- package/lib/commands/webhook/reset_circuit.js +1 -1
- package/lib/exec.d.ts +1 -1
- package/lib/exec.js +4 -4
- package/oclif.manifest.json +1 -1
- package/package.json +12 -16
|
@@ -9,7 +9,7 @@ class ReturnShip extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(ReturnShip);
|
|
11
11
|
const res = await (0, exec_1.default)('returns', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('return', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -9,7 +9,7 @@ class ReturnUnarchive extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(ReturnUnarchive);
|
|
11
11
|
const res = await (0, exec_1.default)('returns', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('return', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -28,7 +28,7 @@ class ReturnLineItemIndex extends base_1.default {
|
|
|
28
28
|
const res = await (0, exec_1.default)('return_line_items', id, action, flags, fields);
|
|
29
29
|
this.log();
|
|
30
30
|
this.printOutput(res, flags);
|
|
31
|
-
this.successMessage(action, res.id);
|
|
31
|
+
this.successMessage('return line item', action, res.id);
|
|
32
32
|
return res;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -9,7 +9,7 @@ class ReturnLineItemRestock extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(ReturnLineItemRestock);
|
|
11
11
|
const res = await (0, exec_1.default)('return_line_items', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('return_line_item', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -9,7 +9,7 @@ class ShipmentGetRates extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(ShipmentGetRates);
|
|
11
11
|
const res = await (0, exec_1.default)('shipments', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('shipment', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -28,7 +28,7 @@ class ShipmentIndex extends base_1.default {
|
|
|
28
28
|
const res = await (0, exec_1.default)('shipments', id, action, flags, fields);
|
|
29
29
|
this.log();
|
|
30
30
|
this.printOutput(res, flags);
|
|
31
|
-
this.successMessage(action, res.id);
|
|
31
|
+
this.successMessage('shipment', action, res.id);
|
|
32
32
|
return res;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -9,7 +9,7 @@ class ShipmentOnHold extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(ShipmentOnHold);
|
|
11
11
|
const res = await (0, exec_1.default)('shipments', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('shipment', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -9,7 +9,7 @@ class ShipmentPacking extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(ShipmentPacking);
|
|
11
11
|
const res = await (0, exec_1.default)('shipments', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('shipment', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -9,7 +9,7 @@ class ShipmentPicking extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(ShipmentPicking);
|
|
11
11
|
const res = await (0, exec_1.default)('shipments', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('shipment', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -9,7 +9,7 @@ class ShipmentPurchase extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(ShipmentPurchase);
|
|
11
11
|
const res = await (0, exec_1.default)('shipments', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('shipment', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -9,7 +9,7 @@ class ShipmentReadyToShip extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(ShipmentReadyToShip);
|
|
11
11
|
const res = await (0, exec_1.default)('shipments', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('shipment', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -9,7 +9,7 @@ class ShipmentShip extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(ShipmentShip);
|
|
11
11
|
const res = await (0, exec_1.default)('shipments', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('shipment', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -9,7 +9,7 @@ class StockTransferCancel extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(StockTransferCancel);
|
|
11
11
|
const res = await (0, exec_1.default)('stock_transfers', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('stock_transfer', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -9,7 +9,7 @@ class StockTransferComplete extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(StockTransferComplete);
|
|
11
11
|
const res = await (0, exec_1.default)('stock_transfers', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('stock_transfer', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -9,7 +9,7 @@ class StockTransferInTransit extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(StockTransferInTransit);
|
|
11
11
|
const res = await (0, exec_1.default)('stock_transfers', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('stock_transfer', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -28,7 +28,7 @@ class StockTransferIndex extends base_1.default {
|
|
|
28
28
|
const res = await (0, exec_1.default)('stock_transfers', id, action, flags, fields);
|
|
29
29
|
this.log();
|
|
30
30
|
this.printOutput(res, flags);
|
|
31
|
-
this.successMessage(action, res.id);
|
|
31
|
+
this.successMessage('stock transfer', action, res.id);
|
|
32
32
|
return res;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -9,7 +9,7 @@ class StockTransferPicking extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(StockTransferPicking);
|
|
11
11
|
const res = await (0, exec_1.default)('stock_transfers', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('stock_transfer', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -9,7 +9,7 @@ class StockTransferUpcoming extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(StockTransferUpcoming);
|
|
11
11
|
const res = await (0, exec_1.default)('stock_transfers', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('stock_transfer', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -28,7 +28,7 @@ class StripePaymentIndex extends base_1.default {
|
|
|
28
28
|
const res = await (0, exec_1.default)('stripe_payments', id, action, flags, fields);
|
|
29
29
|
this.log();
|
|
30
30
|
this.printOutput(res, flags);
|
|
31
|
-
this.successMessage(action, res.id);
|
|
31
|
+
this.successMessage('stripe payment', action, res.id);
|
|
32
32
|
return res;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -9,7 +9,7 @@ class StripePaymentRefresh extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(StripePaymentRefresh);
|
|
11
11
|
const res = await (0, exec_1.default)('stripe_payments', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('stripe_payment', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -28,7 +28,7 @@ class WebhookIndex extends base_1.default {
|
|
|
28
28
|
const res = await (0, exec_1.default)('webhooks', id, action, flags, fields);
|
|
29
29
|
this.log();
|
|
30
30
|
this.printOutput(res, flags);
|
|
31
|
-
this.successMessage(action, res.id);
|
|
31
|
+
this.successMessage('webhook', action, res.id);
|
|
32
32
|
return res;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -9,7 +9,7 @@ class WebhookResetCircuit extends base_1.default {
|
|
|
9
9
|
async run() {
|
|
10
10
|
const { args, flags } = this.parse(WebhookResetCircuit);
|
|
11
11
|
const res = await (0, exec_1.default)('webhooks', args.id, TRIGGER, flags);
|
|
12
|
-
this.successMessage(TRIGGER, res.id);
|
|
12
|
+
this.successMessage('webhook', TRIGGER, res.id);
|
|
13
13
|
return res;
|
|
14
14
|
}
|
|
15
15
|
}
|
package/lib/exec.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const executeAction: (
|
|
1
|
+
declare const executeAction: (resourceType: string, id: string, action: string, flags: any, fields?: string[] | undefined) => Promise<any>;
|
|
2
2
|
export default executeAction;
|
package/lib/exec.js
CHANGED
|
@@ -12,7 +12,7 @@ const commercelayerInit = (flags) => {
|
|
|
12
12
|
accessToken,
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
const executeAction = (
|
|
15
|
+
const executeAction = (resourceType, id, action, flags, fields) => {
|
|
16
16
|
const cl = commercelayerInit(flags);
|
|
17
17
|
const res = { id };
|
|
18
18
|
const trigger = `_${action}`;
|
|
@@ -20,12 +20,12 @@ const executeAction = (resource, id, action, flags, fields) => {
|
|
|
20
20
|
const params = {};
|
|
21
21
|
if (fields && (fields.length > 0)) {
|
|
22
22
|
params.fields = {};
|
|
23
|
-
params.fields[
|
|
23
|
+
params.fields[resourceType] = fields;
|
|
24
24
|
}
|
|
25
|
-
const resSdk = cl[
|
|
25
|
+
const resSdk = cl[resourceType];
|
|
26
26
|
const result = resSdk.update(res, params).catch((error) => {
|
|
27
27
|
if (sdk_1.CommerceLayerStatic.isApiError(error))
|
|
28
|
-
error.code = 'RES_' +
|
|
28
|
+
error.code = 'RES_' + resourceType;
|
|
29
29
|
throw error;
|
|
30
30
|
});
|
|
31
31
|
return result;
|