@etohq/core-flows 1.4.0 → 1.5.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/dist/api-key/steps/create-api-keys.d.ts +17 -0
- package/dist/api-key/steps/create-api-keys.d.ts.map +1 -1
- package/dist/api-key/steps/create-api-keys.js +11 -0
- package/dist/api-key/steps/create-api-keys.js.map +1 -1
- package/dist/api-key/steps/delete-api-keys.d.ts +5 -1
- package/dist/api-key/steps/delete-api-keys.d.ts.map +1 -1
- package/dist/api-key/steps/delete-api-keys.js.map +1 -1
- package/dist/api-key/steps/revoke-api-keys.d.ts +19 -0
- package/dist/api-key/steps/revoke-api-keys.d.ts.map +1 -1
- package/dist/api-key/steps/revoke-api-keys.js +10 -0
- package/dist/api-key/steps/revoke-api-keys.js.map +1 -1
- package/dist/api-key/steps/update-api-keys.d.ts +19 -0
- package/dist/api-key/steps/update-api-keys.d.ts.map +1 -1
- package/dist/api-key/steps/update-api-keys.js +10 -0
- package/dist/api-key/steps/update-api-keys.js.map +1 -1
- package/dist/api-key/workflows/create-api-keys.d.ts +41 -2
- package/dist/api-key/workflows/create-api-keys.d.ts.map +1 -1
- package/dist/api-key/workflows/create-api-keys.js +30 -2
- package/dist/api-key/workflows/create-api-keys.js.map +1 -1
- package/dist/api-key/workflows/delete-api-keys.d.ts +23 -1
- package/dist/api-key/workflows/delete-api-keys.d.ts.map +1 -1
- package/dist/api-key/workflows/delete-api-keys.js +17 -1
- package/dist/api-key/workflows/delete-api-keys.js.map +1 -1
- package/dist/api-key/workflows/link-sales-channels-to-publishable-key.d.ts +32 -0
- package/dist/api-key/workflows/link-sales-channels-to-publishable-key.d.ts.map +1 -0
- package/dist/api-key/workflows/link-sales-channels-to-publishable-key.js +33 -0
- package/dist/api-key/workflows/link-sales-channels-to-publishable-key.js.map +1 -0
- package/dist/api-key/workflows/revoke-api-keys.d.ts +38 -2
- package/dist/api-key/workflows/revoke-api-keys.d.ts.map +1 -1
- package/dist/api-key/workflows/revoke-api-keys.js +24 -1
- package/dist/api-key/workflows/revoke-api-keys.js.map +1 -1
- package/dist/api-key/workflows/update-api-keys.d.ts +36 -2
- package/dist/api-key/workflows/update-api-keys.d.ts.map +1 -1
- package/dist/api-key/workflows/update-api-keys.js +22 -1
- package/dist/api-key/workflows/update-api-keys.js.map +1 -1
- package/dist/auth/steps/set-auth-app-metadata.d.ts +30 -1
- package/dist/auth/steps/set-auth-app-metadata.d.ts.map +1 -1
- package/dist/auth/steps/set-auth-app-metadata.js +30 -1
- package/dist/auth/steps/set-auth-app-metadata.js.map +1 -1
- package/dist/auth/workflows/generate-reset-password-token.d.ts +32 -1
- package/dist/auth/workflows/generate-reset-password-token.d.ts.map +1 -1
- package/dist/auth/workflows/generate-reset-password-token.js +30 -5
- package/dist/auth/workflows/generate-reset-password-token.js.map +1 -1
- package/dist/common/index.d.ts +1 -2
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +1 -2
- package/dist/common/index.js.map +1 -1
- package/dist/common/steps/create-entities.d.ts +33 -1
- package/dist/common/steps/create-entities.d.ts.map +1 -1
- package/dist/common/steps/create-entities.js +17 -1
- package/dist/common/steps/create-entities.js.map +1 -1
- package/dist/common/steps/create-remote-links.d.ts +8 -23
- package/dist/common/steps/create-remote-links.d.ts.map +1 -1
- package/dist/common/steps/create-remote-links.js +8 -23
- package/dist/common/steps/create-remote-links.js.map +1 -1
- package/dist/common/steps/delete-entities.d.ts +26 -1
- package/dist/common/steps/delete-entities.d.ts.map +1 -1
- package/dist/common/steps/delete-entities.js +9 -1
- package/dist/common/steps/delete-entities.js.map +1 -1
- package/dist/common/steps/dismiss-remote-links.d.ts +8 -23
- package/dist/common/steps/dismiss-remote-links.d.ts.map +1 -1
- package/dist/common/steps/dismiss-remote-links.js +8 -23
- package/dist/common/steps/dismiss-remote-links.js.map +1 -1
- package/dist/common/steps/emit-event.d.ts +5 -17
- package/dist/common/steps/emit-event.d.ts.map +1 -1
- package/dist/common/steps/emit-event.js +5 -17
- package/dist/common/steps/emit-event.js.map +1 -1
- package/dist/common/steps/remove-remote-links.d.ts +5 -20
- package/dist/common/steps/remove-remote-links.d.ts.map +1 -1
- package/dist/common/steps/remove-remote-links.js +5 -20
- package/dist/common/steps/remove-remote-links.js.map +1 -1
- package/dist/common/steps/update-remote-links.d.ts +22 -0
- package/dist/common/steps/update-remote-links.d.ts.map +1 -1
- package/dist/common/steps/update-remote-links.js +22 -0
- package/dist/common/steps/update-remote-links.js.map +1 -1
- package/dist/common/steps/use-query-graph.d.ts +8 -20
- package/dist/common/steps/use-query-graph.d.ts.map +1 -1
- package/dist/common/steps/use-query-graph.js +7 -19
- package/dist/common/steps/use-query-graph.js.map +1 -1
- package/dist/common/steps/use-remote-query.d.ts +34 -70
- package/dist/common/steps/use-remote-query.d.ts.map +1 -1
- package/dist/common/steps/use-remote-query.js +34 -70
- package/dist/common/steps/use-remote-query.js.map +1 -1
- package/dist/common/workflows/batch-links.d.ts +51 -0
- package/dist/common/workflows/batch-links.d.ts.map +1 -1
- package/dist/common/workflows/batch-links.js +51 -0
- package/dist/common/workflows/batch-links.js.map +1 -1
- package/dist/common/workflows/create-links.d.ts +25 -0
- package/dist/common/workflows/create-links.d.ts.map +1 -1
- package/dist/common/workflows/create-links.js +25 -0
- package/dist/common/workflows/create-links.js.map +1 -1
- package/dist/common/workflows/dismiss-links.d.ts +25 -0
- package/dist/common/workflows/dismiss-links.d.ts.map +1 -1
- package/dist/common/workflows/dismiss-links.js +25 -0
- package/dist/common/workflows/dismiss-links.js.map +1 -1
- package/dist/common/workflows/update-links.d.ts +30 -0
- package/dist/common/workflows/update-links.d.ts.map +1 -1
- package/dist/common/workflows/update-links.js +30 -0
- package/dist/common/workflows/update-links.js.map +1 -1
- package/dist/file/steps/delete-files.d.ts +13 -2
- package/dist/file/steps/delete-files.d.ts.map +1 -1
- package/dist/file/steps/delete-files.js +8 -1
- package/dist/file/steps/delete-files.js.map +1 -1
- package/dist/file/steps/upload-files.d.ts +40 -1
- package/dist/file/steps/upload-files.d.ts.map +1 -1
- package/dist/file/steps/upload-files.js +14 -1
- package/dist/file/steps/upload-files.js.map +1 -1
- package/dist/file/workflows/delete-files.d.ts +20 -1
- package/dist/file/workflows/delete-files.d.ts.map +1 -1
- package/dist/file/workflows/delete-files.js +20 -1
- package/dist/file/workflows/delete-files.js.map +1 -1
- package/dist/file/workflows/upload-files.d.ts +51 -1
- package/dist/file/workflows/upload-files.d.ts.map +1 -1
- package/dist/file/workflows/upload-files.js +25 -1
- package/dist/file/workflows/upload-files.js.map +1 -1
- package/dist/invite/index.d.ts +3 -0
- package/dist/invite/index.d.ts.map +1 -0
- package/dist/invite/index.js +19 -0
- package/dist/invite/index.js.map +1 -0
- package/dist/invite/steps/create-invites.d.ts +14 -0
- package/dist/invite/steps/create-invites.d.ts.map +1 -0
- package/dist/invite/steps/create-invites.js +28 -0
- package/dist/invite/steps/create-invites.js.map +1 -0
- package/dist/invite/steps/delete-invites.d.ts +10 -0
- package/dist/invite/steps/delete-invites.d.ts.map +1 -0
- package/dist/invite/steps/delete-invites.js +21 -0
- package/dist/invite/steps/delete-invites.js.map +1 -0
- package/dist/invite/steps/index.d.ts +5 -0
- package/dist/invite/steps/index.d.ts.map +1 -0
- package/dist/invite/steps/index.js +21 -0
- package/dist/invite/steps/index.js.map +1 -0
- package/dist/invite/steps/refresh-invite-tokens.d.ts +10 -0
- package/dist/invite/steps/refresh-invite-tokens.d.ts.map +1 -0
- package/dist/invite/steps/refresh-invite-tokens.js +15 -0
- package/dist/invite/steps/refresh-invite-tokens.js.map +1 -0
- package/dist/invite/steps/validate-token.d.ts +11 -0
- package/dist/invite/steps/validate-token.d.ts.map +1 -0
- package/dist/invite/steps/validate-token.js +16 -0
- package/dist/invite/steps/validate-token.js.map +1 -0
- package/dist/invite/workflows/accept-invite.d.ts +33 -0
- package/dist/invite/workflows/accept-invite.d.ts.map +1 -0
- package/dist/invite/workflows/accept-invite.js +70 -0
- package/dist/invite/workflows/accept-invite.js.map +1 -0
- package/dist/invite/workflows/create-invites.d.ts +27 -0
- package/dist/invite/workflows/create-invites.d.ts.map +1 -0
- package/dist/invite/workflows/create-invites.js +45 -0
- package/dist/invite/workflows/create-invites.js.map +1 -0
- package/dist/invite/workflows/delete-invites.d.ts +23 -0
- package/dist/invite/workflows/delete-invites.d.ts.map +1 -0
- package/dist/invite/workflows/delete-invites.js +40 -0
- package/dist/invite/workflows/delete-invites.js.map +1 -0
- package/dist/invite/workflows/index.d.ts +5 -0
- package/dist/invite/workflows/index.d.ts.map +1 -0
- package/dist/invite/workflows/index.js +21 -0
- package/dist/invite/workflows/index.js.map +1 -0
- package/dist/invite/workflows/refresh-invite-tokens.d.ts +27 -0
- package/dist/invite/workflows/refresh-invite-tokens.d.ts.map +1 -0
- package/dist/invite/workflows/refresh-invite-tokens.js +45 -0
- package/dist/invite/workflows/refresh-invite-tokens.js.map +1 -0
- package/dist/locking/acquire-lock.d.ts +23 -0
- package/dist/locking/acquire-lock.d.ts.map +1 -0
- package/dist/locking/acquire-lock.js +61 -0
- package/dist/locking/acquire-lock.js.map +1 -0
- package/dist/locking/index.d.ts +3 -0
- package/dist/locking/index.d.ts.map +1 -0
- package/dist/locking/index.js +19 -0
- package/dist/locking/index.js.map +1 -0
- package/dist/locking/release-lock.d.ts +19 -0
- package/dist/locking/release-lock.d.ts.map +1 -0
- package/dist/locking/release-lock.js +31 -0
- package/dist/locking/release-lock.js.map +1 -0
- package/dist/notification/steps/notify-on-failure.d.ts +52 -2
- package/dist/notification/steps/notify-on-failure.d.ts.map +1 -1
- package/dist/notification/steps/notify-on-failure.js +12 -2
- package/dist/notification/steps/notify-on-failure.js.map +1 -1
- package/dist/notification/steps/send-notifications.d.ts +38 -0
- package/dist/notification/steps/send-notifications.d.ts.map +1 -1
- package/dist/notification/steps/send-notifications.js.map +1 -1
- package/dist/payment/steps/authorize-payment-session.d.ts +19 -3
- package/dist/payment/steps/authorize-payment-session.d.ts.map +1 -1
- package/dist/payment/steps/authorize-payment-session.js +10 -1
- package/dist/payment/steps/authorize-payment-session.js.map +1 -1
- package/dist/payment/steps/cancel-payment.d.ts +6 -0
- package/dist/payment/steps/cancel-payment.d.ts.map +1 -1
- package/dist/payment/steps/cancel-payment.js.map +1 -1
- package/dist/payment/steps/capture-payment.d.ts +14 -2
- package/dist/payment/steps/capture-payment.d.ts.map +1 -1
- package/dist/payment/steps/capture-payment.js +4 -1
- package/dist/payment/steps/capture-payment.js.map +1 -1
- package/dist/payment/steps/complete-cart-after-payment.d.ts +15 -0
- package/dist/payment/steps/complete-cart-after-payment.d.ts.map +1 -0
- package/dist/payment/steps/complete-cart-after-payment.js +20 -0
- package/dist/payment/steps/complete-cart-after-payment.js.map +1 -0
- package/dist/payment/steps/refund-payment.d.ts +14 -2
- package/dist/payment/steps/refund-payment.d.ts.map +1 -1
- package/dist/payment/steps/refund-payment.js +4 -1
- package/dist/payment/steps/refund-payment.js.map +1 -1
- package/dist/payment/steps/refund-payments.d.ts +22 -5
- package/dist/payment/steps/refund-payments.d.ts.map +1 -1
- package/dist/payment/steps/refund-payments.js.map +1 -1
- package/dist/payment-collection/steps/cancel-payment.d.ts +15 -0
- package/dist/payment-collection/steps/cancel-payment.d.ts.map +1 -0
- package/dist/payment-collection/steps/cancel-payment.js +33 -0
- package/dist/payment-collection/steps/cancel-payment.js.map +1 -0
- package/dist/payment-collection/steps/create-payment-account-holder.d.ts +18 -0
- package/dist/payment-collection/steps/create-payment-account-holder.d.ts.map +1 -0
- package/dist/payment-collection/steps/create-payment-account-holder.js +37 -0
- package/dist/payment-collection/steps/create-payment-account-holder.js.map +1 -0
- package/dist/payment-collection/steps/create-payment-session.d.ts +31 -2
- package/dist/payment-collection/steps/create-payment-session.d.ts.map +1 -1
- package/dist/payment-collection/steps/create-payment-session.js +1 -0
- package/dist/payment-collection/steps/create-payment-session.js.map +1 -1
- package/dist/payment-collection/steps/create-refund-reasons.d.ts +6 -2
- package/dist/payment-collection/steps/create-refund-reasons.d.ts.map +1 -1
- package/dist/payment-collection/steps/create-refund-reasons.js.map +1 -1
- package/dist/payment-collection/steps/delete-payment-sessions.d.ts +7 -1
- package/dist/payment-collection/steps/delete-payment-sessions.d.ts.map +1 -1
- package/dist/payment-collection/steps/delete-payment-sessions.js +1 -1
- package/dist/payment-collection/steps/delete-payment-sessions.js.map +1 -1
- package/dist/payment-collection/steps/delete-refund-reasons.d.ts +5 -1
- package/dist/payment-collection/steps/delete-refund-reasons.d.ts.map +1 -1
- package/dist/payment-collection/steps/delete-refund-reasons.js.map +1 -1
- package/dist/payment-collection/steps/index.d.ts +1 -0
- package/dist/payment-collection/steps/index.d.ts.map +1 -1
- package/dist/payment-collection/steps/index.js +1 -0
- package/dist/payment-collection/steps/index.js.map +1 -1
- package/dist/payment-collection/steps/update-payment-collection.d.ts +21 -2
- package/dist/payment-collection/steps/update-payment-collection.d.ts.map +1 -1
- package/dist/payment-collection/steps/update-payment-collection.js +10 -0
- package/dist/payment-collection/steps/update-payment-collection.js.map +1 -1
- package/dist/payment-collection/steps/update-refund-reasons.d.ts +6 -2
- package/dist/payment-collection/steps/update-refund-reasons.d.ts.map +1 -1
- package/dist/payment-collection/steps/update-refund-reasons.js.map +1 -1
- package/dist/payment-collection/steps/validate-deleted-payment-sessions.d.ts +16 -0
- package/dist/payment-collection/steps/validate-deleted-payment-sessions.d.ts.map +1 -1
- package/dist/payment-collection/steps/validate-deleted-payment-sessions.js +7 -0
- package/dist/payment-collection/steps/validate-deleted-payment-sessions.js.map +1 -1
- package/dist/payment-collection/workflows/cancel-payment-collection.d.ts +23 -0
- package/dist/payment-collection/workflows/cancel-payment-collection.d.ts.map +1 -0
- package/dist/payment-collection/workflows/cancel-payment-collection.js +66 -0
- package/dist/payment-collection/workflows/cancel-payment-collection.js.map +1 -0
- package/dist/payment-collection/workflows/create-payment-session.d.ts +42 -3
- package/dist/payment-collection/workflows/create-payment-session.d.ts.map +1 -1
- package/dist/payment-collection/workflows/create-payment-session.js +81 -3
- package/dist/payment-collection/workflows/create-payment-session.js.map +1 -1
- package/dist/payment-collection/workflows/create-refund-reasons.d.ts +32 -5
- package/dist/payment-collection/workflows/create-refund-reasons.d.ts.map +1 -1
- package/dist/payment-collection/workflows/create-refund-reasons.js +21 -1
- package/dist/payment-collection/workflows/create-refund-reasons.js.map +1 -1
- package/dist/payment-collection/workflows/delete-payment-sessions.d.ts +23 -1
- package/dist/payment-collection/workflows/delete-payment-sessions.d.ts.map +1 -1
- package/dist/payment-collection/workflows/delete-payment-sessions.js +17 -1
- package/dist/payment-collection/workflows/delete-payment-sessions.js.map +1 -1
- package/dist/payment-collection/workflows/delete-refund-reasons.d.ts +27 -4
- package/dist/payment-collection/workflows/delete-refund-reasons.d.ts.map +1 -1
- package/dist/payment-collection/workflows/delete-refund-reasons.js +17 -1
- package/dist/payment-collection/workflows/delete-refund-reasons.js.map +1 -1
- package/dist/payment-collection/workflows/index.d.ts +1 -0
- package/dist/payment-collection/workflows/index.d.ts.map +1 -1
- package/dist/payment-collection/workflows/index.js +1 -0
- package/dist/payment-collection/workflows/index.js.map +1 -1
- package/dist/payment-collection/workflows/update-refund-reasons.d.ts +30 -3
- package/dist/payment-collection/workflows/update-refund-reasons.d.ts.map +1 -1
- package/dist/payment-collection/workflows/update-refund-reasons.js +20 -1
- package/dist/payment-collection/workflows/update-refund-reasons.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/user/steps/create-users.d.ts +11 -1
- package/dist/user/steps/create-users.d.ts.map +1 -1
- package/dist/user/steps/create-users.js +11 -1
- package/dist/user/steps/create-users.js.map +1 -1
- package/dist/user/steps/delete-users.d.ts +6 -2
- package/dist/user/steps/delete-users.d.ts.map +1 -1
- package/dist/user/steps/delete-users.js +1 -1
- package/dist/user/steps/delete-users.js.map +1 -1
- package/dist/user/steps/update-users.d.ts +9 -1
- package/dist/user/steps/update-users.d.ts.map +1 -1
- package/dist/user/steps/update-users.js +9 -1
- package/dist/user/steps/update-users.js.map +1 -1
- package/dist/user/workflows/create-user-account.d.ts +33 -1
- package/dist/user/workflows/create-user-account.d.ts.map +1 -1
- package/dist/user/workflows/create-user-account.js +24 -1
- package/dist/user/workflows/create-user-account.js.map +1 -1
- package/dist/user/workflows/create-users.d.ts +25 -1
- package/dist/user/workflows/create-users.d.ts.map +1 -1
- package/dist/user/workflows/create-users.js +25 -1
- package/dist/user/workflows/create-users.js.map +1 -1
- package/dist/user/workflows/delete-users.d.ts +20 -1
- package/dist/user/workflows/delete-users.d.ts.map +1 -1
- package/dist/user/workflows/delete-users.js +26 -3
- package/dist/user/workflows/delete-users.js.map +1 -1
- package/dist/user/workflows/remove-user-account.d.ts +23 -1
- package/dist/user/workflows/remove-user-account.d.ts.map +1 -1
- package/dist/user/workflows/remove-user-account.js +17 -1
- package/dist/user/workflows/remove-user-account.js.map +1 -1
- package/dist/user/workflows/update-users.d.ts +22 -1
- package/dist/user/workflows/update-users.d.ts.map +1 -1
- package/dist/user/workflows/update-users.js +22 -1
- package/dist/user/workflows/update-users.js.map +1 -1
- package/package.json +10 -10
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The keys to be locked
|
|
3
|
+
*/
|
|
4
|
+
export interface AcquireLockStepInput {
|
|
5
|
+
key: string | string[];
|
|
6
|
+
timeout?: number;
|
|
7
|
+
retryInterval?: number;
|
|
8
|
+
ttl?: number;
|
|
9
|
+
ownerId?: string;
|
|
10
|
+
provider?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const acquireLockStepId = "acquire-lock-step";
|
|
13
|
+
/**
|
|
14
|
+
* This step acquires a lock for a given key.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const data = acquireLockStep({
|
|
18
|
+
* "key": "my-lock-key",
|
|
19
|
+
* "ttl": 60
|
|
20
|
+
* })
|
|
21
|
+
*/
|
|
22
|
+
export declare const acquireLockStep: import("@etohq/framework/workflows-sdk").StepFunction<AcquireLockStepInput, undefined>;
|
|
23
|
+
//# sourceMappingURL=acquire-lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acquire-lock.d.ts","sourceRoot":"","sources":["../../src/locking/acquire-lock.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,eAAO,MAAM,iBAAiB,sBAAsB,CAAA;AACpD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,wFAuD3B,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.acquireLockStep = exports.acquireLockStepId = void 0;
|
|
4
|
+
const utils_1 = require("@etohq/framework/utils");
|
|
5
|
+
const workflows_sdk_1 = require("@etohq/framework/workflows-sdk");
|
|
6
|
+
const promises_1 = require("timers/promises");
|
|
7
|
+
exports.acquireLockStepId = "acquire-lock-step";
|
|
8
|
+
/**
|
|
9
|
+
* This step acquires a lock for a given key.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const data = acquireLockStep({
|
|
13
|
+
* "key": "my-lock-key",
|
|
14
|
+
* "ttl": 60
|
|
15
|
+
* })
|
|
16
|
+
*/
|
|
17
|
+
exports.acquireLockStep = (0, workflows_sdk_1.createStep)(exports.acquireLockStepId, async (data, { container }) => {
|
|
18
|
+
const keys = Array.isArray(data.key)
|
|
19
|
+
? data.key
|
|
20
|
+
: (0, utils_1.isDefined)(data.key)
|
|
21
|
+
? [data.key]
|
|
22
|
+
: [];
|
|
23
|
+
if (!keys.length) {
|
|
24
|
+
return new workflows_sdk_1.StepResponse(void 0);
|
|
25
|
+
}
|
|
26
|
+
const locking = container.resolve(utils_1.Modules.LOCKING);
|
|
27
|
+
const retryInterval = data.retryInterval ?? 0.3;
|
|
28
|
+
const tryUntil = Date.now() + (data.timeout ?? 0) * 1000;
|
|
29
|
+
while (true) {
|
|
30
|
+
try {
|
|
31
|
+
await locking.acquire(data.key, {
|
|
32
|
+
expire: data.ttl,
|
|
33
|
+
ownerId: data.ownerId,
|
|
34
|
+
provider: data.provider,
|
|
35
|
+
});
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
if (Date.now() >= tryUntil) {
|
|
40
|
+
throw e;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
await (0, promises_1.setTimeout)(retryInterval * 1000);
|
|
44
|
+
}
|
|
45
|
+
return new workflows_sdk_1.StepResponse(void 0, {
|
|
46
|
+
keys,
|
|
47
|
+
ownerId: data.ownerId,
|
|
48
|
+
provider: data.provider,
|
|
49
|
+
});
|
|
50
|
+
}, async (data, { container }) => {
|
|
51
|
+
if (!data?.keys?.length) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const locking = container.resolve(utils_1.Modules.LOCKING);
|
|
55
|
+
await locking.release(data.keys, {
|
|
56
|
+
ownerId: data.ownerId,
|
|
57
|
+
provider: data.provider,
|
|
58
|
+
});
|
|
59
|
+
return new workflows_sdk_1.StepResponse();
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=acquire-lock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acquire-lock.js","sourceRoot":"","sources":["../../src/locking/acquire-lock.ts"],"names":[],"mappings":";;;AAAA,kDAA2D;AAC3D,kEAAyE;AACzE,8CAA4C;AAc/B,QAAA,iBAAiB,GAAG,mBAAmB,CAAA;AACpD;;;;;;;;GAQG;AACU,QAAA,eAAe,GAAG,IAAA,0BAAU,EACvC,yBAAiB,EACjB,KAAK,EAAE,IAA0B,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAClD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;QAClC,CAAC,CAAC,IAAI,CAAC,GAAG;QACV,CAAC,CAAC,IAAA,iBAAS,EAAC,IAAI,CAAC,GAAG,CAAC;YACrB,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YACZ,CAAC,CAAC,EAAE,CAAA;IAEN,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,IAAI,4BAAY,CAAC,KAAK,CAAC,CAAC,CAAA;IACjC,CAAC;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,eAAO,CAAC,OAAO,CAAC,CAAA;IAElD,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,IAAI,GAAG,CAAA;IAC/C,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,IAAI,CAAA;IAExD,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC9B,MAAM,EAAE,IAAI,CAAC,GAAG;gBAChB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB,CAAC,CAAA;YACF,MAAK;QACP,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,QAAQ,EAAE,CAAC;gBAC3B,MAAM,CAAC,CAAA;YACT,CAAC;QACH,CAAC;QAED,MAAM,IAAA,qBAAU,EAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IACxC,CAAC;IAED,OAAO,IAAI,4BAAY,CAAC,KAAK,CAAC,EAAE;QAC9B,IAAI;QACJ,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CAAC,CAAA;AACJ,CAAC,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAC5B,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACxB,OAAM;IACR,CAAC;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,eAAO,CAAC,OAAO,CAAC,CAAA;IAElD,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE;QAC/B,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CAAC,CAAA;IAEF,OAAO,IAAI,4BAAY,EAAE,CAAA;AAC3B,CAAC,CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/locking/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./acquire-lock"), exports);
|
|
18
|
+
__exportStar(require("./release-lock"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/locking/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,iDAA8B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The locked keys to be released
|
|
3
|
+
*/
|
|
4
|
+
export interface ReleaseLockStepInput {
|
|
5
|
+
key: string | string[];
|
|
6
|
+
ownerId?: string;
|
|
7
|
+
provider?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const releaseLockStepId = "release-lock-step";
|
|
10
|
+
/**
|
|
11
|
+
* This step releases a lock for a given key.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const data = releaseLockStep({
|
|
15
|
+
* "key": "my-lock-key"
|
|
16
|
+
* })
|
|
17
|
+
*/
|
|
18
|
+
export declare const releaseLockStep: import("@etohq/framework/workflows-sdk").StepFunction<ReleaseLockStepInput, boolean>;
|
|
19
|
+
//# sourceMappingURL=release-lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-lock.d.ts","sourceRoot":"","sources":["../../src/locking/release-lock.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,eAAO,MAAM,iBAAiB,sBAAsB,CAAA;AACpD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,sFAqB3B,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.releaseLockStep = exports.releaseLockStepId = void 0;
|
|
4
|
+
const utils_1 = require("@etohq/framework/utils");
|
|
5
|
+
const workflows_sdk_1 = require("@etohq/framework/workflows-sdk");
|
|
6
|
+
exports.releaseLockStepId = "release-lock-step";
|
|
7
|
+
/**
|
|
8
|
+
* This step releases a lock for a given key.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const data = releaseLockStep({
|
|
12
|
+
* "key": "my-lock-key"
|
|
13
|
+
* })
|
|
14
|
+
*/
|
|
15
|
+
exports.releaseLockStep = (0, workflows_sdk_1.createStep)(exports.releaseLockStepId, async (data, { container }) => {
|
|
16
|
+
const keys = Array.isArray(data.key)
|
|
17
|
+
? data.key
|
|
18
|
+
: (0, utils_1.isDefined)(data.key)
|
|
19
|
+
? [data.key]
|
|
20
|
+
: [];
|
|
21
|
+
if (!keys.length) {
|
|
22
|
+
return new workflows_sdk_1.StepResponse(true);
|
|
23
|
+
}
|
|
24
|
+
const locking = container.resolve(utils_1.Modules.LOCKING);
|
|
25
|
+
const released = await locking.release(keys, {
|
|
26
|
+
ownerId: data.ownerId,
|
|
27
|
+
provider: data.provider,
|
|
28
|
+
});
|
|
29
|
+
return new workflows_sdk_1.StepResponse(released);
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=release-lock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-lock.js","sourceRoot":"","sources":["../../src/locking/release-lock.ts"],"names":[],"mappings":";;;AAAA,kDAA2D;AAC3D,kEAAyE;AAW5D,QAAA,iBAAiB,GAAG,mBAAmB,CAAA;AACpD;;;;;;;GAOG;AACU,QAAA,eAAe,GAAG,IAAA,0BAAU,EACvC,yBAAiB,EACjB,KAAK,EAAE,IAA0B,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAClD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;QAClC,CAAC,CAAC,IAAI,CAAC,GAAG;QACV,CAAC,CAAC,IAAA,iBAAS,EAAC,IAAI,CAAC,GAAG,CAAC;YACrB,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YACZ,CAAC,CAAC,EAAE,CAAA;IAEN,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,IAAI,4BAAY,CAAC,IAAI,CAAC,CAAA;IAC/B,CAAC;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,eAAO,CAAC,OAAO,CAAC,CAAA;IAClD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE;QAC3C,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CAAC,CAAA;IAEF,OAAO,IAAI,4BAAY,CAAC,QAAQ,CAAC,CAAA;AACnC,CAAC,CACF,CAAA"}
|
|
@@ -1,20 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The notifications to send.
|
|
3
|
+
*/
|
|
1
4
|
export type NotifyOnFailureStepInput = {
|
|
5
|
+
/**
|
|
6
|
+
* The address to send the notification to, depending on
|
|
7
|
+
* the channel. For example, the email address for the email channel.
|
|
8
|
+
*/
|
|
2
9
|
to: string;
|
|
10
|
+
/**
|
|
11
|
+
* The channel to send the notification through. For example, `email`.
|
|
12
|
+
* A [Notification Module Provider](https://docs.etohq.com/resources/infrastructure-modules/notification)
|
|
13
|
+
* must be installed and configured for the specified channel.
|
|
14
|
+
*/
|
|
3
15
|
channel: string;
|
|
16
|
+
/**
|
|
17
|
+
* The ID of the template to use for the notification. This template ID may be defined
|
|
18
|
+
* in a third-party service used to send the notification.
|
|
19
|
+
*/
|
|
4
20
|
template: string;
|
|
21
|
+
/**
|
|
22
|
+
* The data to use in the notification template. This data may be used to personalize
|
|
23
|
+
* the notification, such as the user's name or the order number.
|
|
24
|
+
*/
|
|
5
25
|
data?: Record<string, unknown> | null;
|
|
26
|
+
/**
|
|
27
|
+
* The type of trigger that caused the notification to be sent. For example, `order_created`.
|
|
28
|
+
*/
|
|
6
29
|
trigger_type?: string | null;
|
|
30
|
+
/**
|
|
31
|
+
* The ID of the resource that triggered the notification. For example, the ID of the order
|
|
32
|
+
* that triggered the notification.
|
|
33
|
+
*/
|
|
7
34
|
resource_id?: string | null;
|
|
35
|
+
/**
|
|
36
|
+
* The type of the resource that triggered the notification. For example, `order`.
|
|
37
|
+
*/
|
|
8
38
|
resource_type?: string | null;
|
|
39
|
+
/**
|
|
40
|
+
* The ID of the user receiving the notification.
|
|
41
|
+
*/
|
|
9
42
|
receiver_id?: string | null;
|
|
43
|
+
/**
|
|
44
|
+
* The ID of the original notification if it's being resent.
|
|
45
|
+
*/
|
|
10
46
|
original_notification_id?: string | null;
|
|
47
|
+
/**
|
|
48
|
+
* A key to ensure that the notification is sent only once. If the notification
|
|
49
|
+
* is sent multiple times, the key ensures that the notification is sent only once.
|
|
50
|
+
*/
|
|
11
51
|
idempotency_key?: string | null;
|
|
12
52
|
}[];
|
|
13
53
|
export declare const notifyOnFailureStepId = "notify-on-failure";
|
|
14
54
|
/**
|
|
15
55
|
* This step sends one or more notification when a workflow fails. This
|
|
16
|
-
* step can be used in a workflow
|
|
17
|
-
*
|
|
56
|
+
* step can be used in the beginning of a workflow so that, when the workflow fails,
|
|
57
|
+
* the step's compensation function is triggered to send the notification.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* const data = notifyOnFailureStep([{
|
|
61
|
+
* to: "example@gmail.com",
|
|
62
|
+
* channel: "email",
|
|
63
|
+
* template: "order-failed",
|
|
64
|
+
* data: {
|
|
65
|
+
* order_id: "order_123",
|
|
66
|
+
* }
|
|
67
|
+
* }])
|
|
18
68
|
*/
|
|
19
69
|
export declare const notifyOnFailureStep: import("@etohq/framework/workflows-sdk").StepFunction<NotifyOnFailureStepInput, undefined>;
|
|
20
70
|
//# sourceMappingURL=notify-on-failure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify-on-failure.d.ts","sourceRoot":"","sources":["../../../src/notification/steps/notify-on-failure.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,wBAAwB,GAAG;IACrC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IACrC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC,EAAE,CAAA;AAEH,eAAO,MAAM,qBAAqB,sBAAsB,CAAA;AACxD
|
|
1
|
+
{"version":3,"file":"notify-on-failure.d.ts","sourceRoot":"","sources":["../../../src/notification/steps/notify-on-failure.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IACrC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC,EAAE,CAAA;AAEH,eAAO,MAAM,qBAAqB,sBAAsB,CAAA;AACxD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,4FAgB/B,CAAA"}
|
|
@@ -6,8 +6,18 @@ const workflows_sdk_1 = require("@etohq/framework/workflows-sdk");
|
|
|
6
6
|
exports.notifyOnFailureStepId = "notify-on-failure";
|
|
7
7
|
/**
|
|
8
8
|
* This step sends one or more notification when a workflow fails. This
|
|
9
|
-
* step can be used in a workflow
|
|
10
|
-
*
|
|
9
|
+
* step can be used in the beginning of a workflow so that, when the workflow fails,
|
|
10
|
+
* the step's compensation function is triggered to send the notification.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const data = notifyOnFailureStep([{
|
|
14
|
+
* to: "example@gmail.com",
|
|
15
|
+
* channel: "email",
|
|
16
|
+
* template: "order-failed",
|
|
17
|
+
* data: {
|
|
18
|
+
* order_id: "order_123",
|
|
19
|
+
* }
|
|
20
|
+
* }])
|
|
11
21
|
*/
|
|
12
22
|
exports.notifyOnFailureStep = (0, workflows_sdk_1.createStep)(exports.notifyOnFailureStepId, async (data) => {
|
|
13
23
|
return new workflows_sdk_1.StepResponse(void 0, data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify-on-failure.js","sourceRoot":"","sources":["../../../src/notification/steps/notify-on-failure.ts"],"names":[],"mappings":";;;AACA,kDAAgD;AAChD,kEAAyE;
|
|
1
|
+
{"version":3,"file":"notify-on-failure.js","sourceRoot":"","sources":["../../../src/notification/steps/notify-on-failure.ts"],"names":[],"mappings":";;;AACA,kDAAgD;AAChD,kEAAyE;AAuD5D,QAAA,qBAAqB,GAAG,mBAAmB,CAAA;AACxD;;;;;;;;;;;;;;GAcG;AACU,QAAA,mBAAmB,GAAG,IAAA,0BAAU,EAC3C,6BAAqB,EACrB,KAAK,EAAE,IAA8B,EAAE,EAAE;IACvC,OAAO,IAAI,4BAAY,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAA;AACvC,CAAC,EAED,KAAK,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAM;IACR,CAAC;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAC/B,eAAO,CAAC,YAAY,CACrB,CAAA;IACD,MAAM,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAA;AACzC,CAAC,CACF,CAAA"}
|
|
@@ -1,13 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The notifications to send.
|
|
3
|
+
*/
|
|
1
4
|
export type SendNotificationsStepInput = {
|
|
5
|
+
/**
|
|
6
|
+
* The address to send the notification to, depending on
|
|
7
|
+
* the channel. For example, the email address for the email channel.
|
|
8
|
+
*/
|
|
2
9
|
to: string;
|
|
10
|
+
/**
|
|
11
|
+
* The channel to send the notification through. For example, `email`.
|
|
12
|
+
*/
|
|
3
13
|
channel: string;
|
|
14
|
+
/**
|
|
15
|
+
* The ID of the template to use for the notification. This template ID may be defined
|
|
16
|
+
* in a third-party service used to send the notification.
|
|
17
|
+
*/
|
|
4
18
|
template: string;
|
|
19
|
+
/**
|
|
20
|
+
* The data to use in the notification template. This data may be used to personalize
|
|
21
|
+
* the notification, such as the user's name or the order number.
|
|
22
|
+
*/
|
|
5
23
|
data?: Record<string, unknown> | null;
|
|
24
|
+
/**
|
|
25
|
+
* The type of trigger that caused the notification to be sent. For example, `order_created`.
|
|
26
|
+
*/
|
|
6
27
|
trigger_type?: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* The ID of the resource that triggered the notification. For example, the ID of the order
|
|
30
|
+
* that triggered the notification.
|
|
31
|
+
*/
|
|
7
32
|
resource_id?: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* The type of the resource that triggered the notification. For example, `order`.
|
|
35
|
+
*/
|
|
8
36
|
resource_type?: string | null;
|
|
37
|
+
/**
|
|
38
|
+
* The ID of the user receiving the notification.
|
|
39
|
+
*/
|
|
9
40
|
receiver_id?: string | null;
|
|
41
|
+
/**
|
|
42
|
+
* The ID of the original notification if it's being resent.
|
|
43
|
+
*/
|
|
10
44
|
original_notification_id?: string | null;
|
|
45
|
+
/**
|
|
46
|
+
* A key to ensure that the notification is sent only once. If the notification
|
|
47
|
+
* is sent multiple times, the key ensures that the notification is sent only once.
|
|
48
|
+
*/
|
|
11
49
|
idempotency_key?: string | null;
|
|
12
50
|
}[];
|
|
13
51
|
export declare const sendNotificationsStepId = "send-notifications";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-notifications.d.ts","sourceRoot":"","sources":["../../../src/notification/steps/send-notifications.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,0BAA0B,GAAG;IACvC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IACrC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC,EAAE,CAAA;AAEH,eAAO,MAAM,uBAAuB,uBAAuB,CAAA;AAC3D;;GAEG;AACH,eAAO,MAAM,qBAAqB,uIAajC,CAAA"}
|
|
1
|
+
{"version":3,"file":"send-notifications.d.ts","sourceRoot":"","sources":["../../../src/notification/steps/send-notifications.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IACrC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC,EAAE,CAAA;AAEH,eAAO,MAAM,uBAAuB,uBAAuB,CAAA;AAC3D;;GAEG;AACH,eAAO,MAAM,qBAAqB,uIAajC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-notifications.js","sourceRoot":"","sources":["../../../src/notification/steps/send-notifications.ts"],"names":[],"mappings":";;;AACA,kDAAgD;AAChD,kEAAyE;
|
|
1
|
+
{"version":3,"file":"send-notifications.js","sourceRoot":"","sources":["../../../src/notification/steps/send-notifications.ts"],"names":[],"mappings":";;;AACA,kDAAgD;AAChD,kEAAyE;AAqD5D,QAAA,uBAAuB,GAAG,oBAAoB,CAAA;AAC3D;;GAEG;AACU,QAAA,qBAAqB,GAAG,IAAA,0BAAU,EAC7C,+BAAuB,EACvB,KAAK,EAAE,IAAgC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IACxD,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAC/B,eAAO,CAAC,YAAY,CACrB,CAAA;IACD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAA;IACvD,OAAO,IAAI,4BAAY,CACrB,OAAO,EACP,OAAO,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAC/C,CAAA;AACH,CAAC;AACD,4FAA4F;CAC7F,CAAA"}
|
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
import { PaymentDTO } from "@etohq/types";
|
|
1
|
+
import { PaymentDTO } from "@etohq/framework/types";
|
|
2
|
+
/**
|
|
3
|
+
* The data to authorize the payment session.
|
|
4
|
+
*/
|
|
2
5
|
export type AuthorizePaymentSessionStepInput = {
|
|
6
|
+
/**
|
|
7
|
+
* The ID of the payment session to authorize.
|
|
8
|
+
*/
|
|
3
9
|
id: string;
|
|
4
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The context to authorize the payment session with.
|
|
12
|
+
* This context is passed to the payment provider associated with the payment session.
|
|
13
|
+
*/
|
|
14
|
+
context?: Record<string, unknown>;
|
|
5
15
|
};
|
|
6
16
|
export declare const authorizePaymentSessionStepId = "authorize-payment-session-step";
|
|
7
17
|
/**
|
|
8
18
|
* This step authorizes a payment session.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* const data = authorizePaymentSessionStep({
|
|
22
|
+
* id: "payses_123",
|
|
23
|
+
* context: {}
|
|
24
|
+
* })
|
|
9
25
|
*/
|
|
10
|
-
export declare const authorizePaymentSessionStep: import("@etohq/framework/workflows-sdk").StepFunction<AuthorizePaymentSessionStepInput, PaymentDTO>;
|
|
26
|
+
export declare const authorizePaymentSessionStep: import("@etohq/framework/workflows-sdk").StepFunction<AuthorizePaymentSessionStepInput, PaymentDTO | null>;
|
|
11
27
|
//# sourceMappingURL=authorize-payment-session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorize-payment-session.d.ts","sourceRoot":"","sources":["../../../src/payment/steps/authorize-payment-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACX,MAAM,
|
|
1
|
+
{"version":3,"file":"authorize-payment-session.d.ts","sourceRoot":"","sources":["../../../src/payment/steps/authorize-payment-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACX,MAAM,wBAAwB,CAAA;AAS/B;;GAEG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC,CAAA;AAED,eAAO,MAAM,6BAA6B,mCAAmC,CAAA;AAC7E;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,4GA+EvC,CAAA"}
|
|
@@ -6,11 +6,20 @@ const workflows_sdk_1 = require("@etohq/framework/workflows-sdk");
|
|
|
6
6
|
exports.authorizePaymentSessionStepId = "authorize-payment-session-step";
|
|
7
7
|
/**
|
|
8
8
|
* This step authorizes a payment session.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const data = authorizePaymentSessionStep({
|
|
12
|
+
* id: "payses_123",
|
|
13
|
+
* context: {}
|
|
14
|
+
* })
|
|
9
15
|
*/
|
|
10
16
|
exports.authorizePaymentSessionStep = (0, workflows_sdk_1.createStep)(exports.authorizePaymentSessionStepId, async (input, { container }) => {
|
|
11
17
|
let payment;
|
|
12
18
|
const logger = container.resolve(utils_1.ContainerRegistrationKeys.LOGGER);
|
|
13
19
|
const paymentModule = container.resolve(utils_1.Modules.PAYMENT);
|
|
20
|
+
if (!input.id) {
|
|
21
|
+
return new workflows_sdk_1.StepResponse(null);
|
|
22
|
+
}
|
|
14
23
|
try {
|
|
15
24
|
payment = await paymentModule.authorizePaymentSession(input.id, input.context || {});
|
|
16
25
|
}
|
|
@@ -30,7 +39,7 @@ exports.authorizePaymentSessionStep = (0, workflows_sdk_1.createStep)(exports.au
|
|
|
30
39
|
if (paymentSession.status !== utils_1.PaymentSessionStatus.AUTHORIZED || !payment) {
|
|
31
40
|
throw new utils_1.EtoError(utils_1.EtoError.Types.PAYMENT_AUTHORIZATION_ERROR, `Payment authorization failed`);
|
|
32
41
|
}
|
|
33
|
-
return new workflows_sdk_1.StepResponse(payment);
|
|
42
|
+
return new workflows_sdk_1.StepResponse(paymentSession.payment);
|
|
34
43
|
},
|
|
35
44
|
// If payment or any other part of complete cart fails post payment step, we cancel any payments made
|
|
36
45
|
async (payment, { container }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorize-payment-session.js","sourceRoot":"","sources":["../../../src/payment/steps/authorize-payment-session.ts"],"names":[],"mappings":";;;AAKA,kDAK+B;AAC/B,kEAAyE;
|
|
1
|
+
{"version":3,"file":"authorize-payment-session.js","sourceRoot":"","sources":["../../../src/payment/steps/authorize-payment-session.ts"],"names":[],"mappings":";;;AAKA,kDAK+B;AAC/B,kEAAyE;AAiB5D,QAAA,6BAA6B,GAAG,gCAAgC,CAAA;AAC7E;;;;;;;;GAQG;AACU,QAAA,2BAA2B,GAAG,IAAA,0BAAU,EACnD,qCAA6B,EAC7B,KAAK,EAAE,KAAuC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAC/D,IAAI,OAA+B,CAAA;IACnC,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAS,iCAAyB,CAAC,MAAM,CAAC,CAAA;IAC1E,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CACrC,eAAO,CAAC,OAAO,CAChB,CAAA;IAED,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;QACd,OAAO,IAAI,4BAAY,CAAC,IAAI,CAAC,CAAA;IAC/B,CAAC;IAED,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,aAAa,CAAC,uBAAuB,CACnD,KAAK,CAAC,EAAE,EACR,KAAK,CAAC,OAAO,IAAI,EAAE,CACpB,CAAA;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,KAAK,CACV,0DAA0D,KAAK,CAAC,EAAE,MAAM,CAAC,EAAE,CAC5E,CAAA;IACH,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,aAAa,CAAC,sBAAsB,CAC/D,KAAK,CAAC,EAAE,EACR;QACE,SAAS,EAAE,CAAC,SAAS,EAAE,kBAAkB,CAAC;KAC3C,CACF,CAAA;IAED,uGAAuG;IACvG,oBAAoB;IACpB,IAAI,cAAc,CAAC,MAAM,KAAK,4BAAoB,CAAC,aAAa,EAAE,CAAC;QACjE,MAAM,IAAI,gBAAQ,CAChB,gBAAQ,CAAC,KAAK,CAAC,2BAA2B,EAC1C,0CAA0C,CAC3C,CAAA;IACH,CAAC;IAED,2HAA2H;IAC3H,mHAAmH;IACnH,IAAI,cAAc,CAAC,MAAM,KAAK,4BAAoB,CAAC,UAAU,IAAI,CAAC,OAAO,EAAE,CAAC;QAC1E,MAAM,IAAI,gBAAQ,CAChB,gBAAQ,CAAC,KAAK,CAAC,2BAA2B,EAC1C,8BAA8B,CAC/B,CAAA;IACH,CAAC;IAED,OAAO,IAAI,4BAAY,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;AACjD,CAAC;AACD,qGAAqG;AACrG,KAAK,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAC/B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAM;IACR,CAAC;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAS,iCAAyB,CAAC,MAAM,CAAC,CAAA;IAC1E,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CACrC,eAAO,CAAC,OAAO,CAChB,CAAA;IAED,uFAAuF;IACvF,+DAA+D;IAC/D,IACE,OAAO,CAAC,eAAe;QACvB,OAAO,CAAC,eAAe,CAAC,MAAM,KAAK,4BAAoB,CAAC,aAAa,EACrE,CAAC;QACD,OAAM;IACR,CAAC;IAED,IAAI,CAAC;QACH,MAAM,aAAa,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IAC/C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,KAAK,CACV,+CAA+C,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,CACnE,CAAA;IACH,CAAC;AACH,CAAC,CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel-payment.d.ts","sourceRoot":"","sources":["../../../src/payment/steps/cancel-payment.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,mBAAmB,wBAAwB,CAAA;AACxD;;GAEG;AACH,eAAO,MAAM,iBAAiB,wFA0B7B,CAAA"}
|
|
1
|
+
{"version":3,"file":"cancel-payment.d.ts","sourceRoot":"","sources":["../../../src/payment/steps/cancel-payment.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,mBAAmB,wBAAwB,CAAA;AACxD;;GAEG;AACH,eAAO,MAAM,iBAAiB,wFA0B7B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel-payment.js","sourceRoot":"","sources":["../../../src/payment/steps/cancel-payment.ts"],"names":[],"mappings":";;;AACA,kDAI+B;AAC/B,kEAA2D;
|
|
1
|
+
{"version":3,"file":"cancel-payment.js","sourceRoot":"","sources":["../../../src/payment/steps/cancel-payment.ts"],"names":[],"mappings":";;;AACA,kDAI+B;AAC/B,kEAA2D;AAY9C,QAAA,mBAAmB,GAAG,qBAAqB,CAAA;AACxD;;GAEG;AACU,QAAA,iBAAiB,GAAG,IAAA,0BAAU,EACzC,2BAAmB,EACnB,KAAK,EAAE,KAA6B,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IACrD,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAS,iCAAyB,CAAC,MAAM,CAAC,CAAA;IAC1E,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CACrC,eAAO,CAAC,OAAO,CAChB,CAAA;IAED,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;QAChD,CAAC,CAAC,KAAK,CAAC,UAAU;QAClB,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IAEtB,MAAM,QAAQ,GAAmB,EAAE,CAAA;IAEnC,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;QAC5B,QAAQ,CAAC,IAAI,CACX,aAAa,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YAC1C,MAAM,CAAC,KAAK,CACV,+CAA+C,EAAE,MAAM,CAAC,EAAE,CAC3D,CAAA;QACH,CAAC,CAAC,CACH,CAAA;IACH,CAAC;IAED,MAAM,IAAA,kBAAU,EAAC,QAAQ,CAAC,CAAA;AAC5B,CAAC,CACF,CAAA"}
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
import { BigNumberInput } from "@etohq/types";
|
|
1
|
+
import { BigNumberInput } from "@etohq/framework/types";
|
|
2
|
+
/**
|
|
3
|
+
* The data to capture a payment.
|
|
4
|
+
*/
|
|
2
5
|
export type CapturePaymentStepInput = {
|
|
6
|
+
/**
|
|
7
|
+
* The ID of the payment to capture.
|
|
8
|
+
*/
|
|
3
9
|
payment_id: string;
|
|
10
|
+
/**
|
|
11
|
+
* The ID of the user that captured the payment.
|
|
12
|
+
*/
|
|
4
13
|
captured_by?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The amount to capture. If not provided, the full payment amount will be captured.
|
|
16
|
+
*/
|
|
5
17
|
amount?: BigNumberInput;
|
|
6
18
|
};
|
|
7
19
|
export declare const capturePaymentStepId = "capture-payment-step";
|
|
8
20
|
/**
|
|
9
21
|
* This step captures a payment.
|
|
10
22
|
*/
|
|
11
|
-
export declare const capturePaymentStep: import("@etohq/framework/workflows-sdk").StepFunction<CapturePaymentStepInput, import("@etohq/types").PaymentDTO>;
|
|
23
|
+
export declare const capturePaymentStep: import("@etohq/framework/workflows-sdk").StepFunction<CapturePaymentStepInput, import("@etohq/framework/types").PaymentDTO>;
|
|
12
24
|
//# sourceMappingURL=capture-payment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture-payment.d.ts","sourceRoot":"","sources":["../../../src/payment/steps/capture-payment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAEf,MAAM,
|
|
1
|
+
{"version":3,"file":"capture-payment.d.ts","sourceRoot":"","sources":["../../../src/payment/steps/capture-payment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAEf,MAAM,wBAAwB,CAAA;AAI/B;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,oBAAoB,yBAAyB,CAAA;AAC1D;;GAEG;AACH,eAAO,MAAM,kBAAkB,6HAa9B,CAAA"}
|
|
@@ -11,5 +11,8 @@ exports.capturePaymentStep = (0, workflows_sdk_1.createStep)(exports.capturePaym
|
|
|
11
11
|
const paymentModule = container.resolve(utils_1.Modules.PAYMENT);
|
|
12
12
|
const payment = await paymentModule.capturePayment(input);
|
|
13
13
|
return new workflows_sdk_1.StepResponse(payment);
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
|
+
// We don't want to compensate a capture automatically as the actual funds have already been taken.
|
|
16
|
+
// The only want to compensate here is to issue a refund, but it's better to leave that as a manual operation for now.
|
|
17
|
+
);
|
|
15
18
|
//# sourceMappingURL=capture-payment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture-payment.js","sourceRoot":"","sources":["../../../src/payment/steps/capture-payment.ts"],"names":[],"mappings":";;;AAIA,kDAAgD;AAChD,kEAAyE;
|
|
1
|
+
{"version":3,"file":"capture-payment.js","sourceRoot":"","sources":["../../../src/payment/steps/capture-payment.ts"],"names":[],"mappings":";;;AAIA,kDAAgD;AAChD,kEAAyE;AAoB5D,QAAA,oBAAoB,GAAG,sBAAsB,CAAA;AAC1D;;GAEG;AACU,QAAA,kBAAkB,GAAG,IAAA,0BAAU,EAC1C,4BAAoB,EACpB,KAAK,EAAE,KAA8B,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IACtD,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CACrC,eAAO,CAAC,OAAO,CAChB,CAAA;IAED,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;IAEzD,OAAO,IAAI,4BAAY,CAAC,OAAO,CAAC,CAAA;AAClC,CAAC;AACD,mGAAmG;AACnG,sHAAsH;CACvH,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The data to complete a cart after a payment is captured.
|
|
3
|
+
*/
|
|
4
|
+
export type CompleteCartAfterPaymentStepInput = {
|
|
5
|
+
/**
|
|
6
|
+
* The ID of the cart to complete.
|
|
7
|
+
*/
|
|
8
|
+
cart_id: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const completeCartAfterPaymentStepId = "complete-cart-after-payment-step";
|
|
11
|
+
/**
|
|
12
|
+
* This step completes a cart after a payment is captured.
|
|
13
|
+
*/
|
|
14
|
+
export declare const completeCartAfterPaymentStep: import("@etohq/framework/workflows-sdk").StepFunction<CompleteCartAfterPaymentStepInput, unknown>;
|
|
15
|
+
//# sourceMappingURL=complete-cart-after-payment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complete-cart-after-payment.d.ts","sourceRoot":"","sources":["../../../src/payment/steps/complete-cart-after-payment.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,8BAA8B,qCAAqC,CAAA;AAChF;;GAEG;AACH,eAAO,MAAM,4BAA4B,mGAYxC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.completeCartAfterPaymentStep = exports.completeCartAfterPaymentStepId = void 0;
|
|
4
|
+
const utils_1 = require("@etohq/framework/utils");
|
|
5
|
+
const workflows_sdk_1 = require("@etohq/framework/workflows-sdk");
|
|
6
|
+
const complete_cart_1 = require("../../cart/workflows/complete-cart");
|
|
7
|
+
exports.completeCartAfterPaymentStepId = "complete-cart-after-payment-step";
|
|
8
|
+
/**
|
|
9
|
+
* This step completes a cart after a payment is captured.
|
|
10
|
+
*/
|
|
11
|
+
exports.completeCartAfterPaymentStep = (0, workflows_sdk_1.createStep)(exports.completeCartAfterPaymentStepId, async (input, { container }) => {
|
|
12
|
+
const workflowEngine = container.resolve(utils_1.Modules.WORKFLOW_ENGINE);
|
|
13
|
+
await workflowEngine.run(complete_cart_1.completeCartWorkflowId, {
|
|
14
|
+
input: {
|
|
15
|
+
id: input.cart_id,
|
|
16
|
+
},
|
|
17
|
+
transactionId: input.cart_id,
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=complete-cart-after-payment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complete-cart-after-payment.js","sourceRoot":"","sources":["../../../src/payment/steps/complete-cart-after-payment.ts"],"names":[],"mappings":";;;AAAA,kDAAgD;AAChD,kEAA2D;AAC3D,sEAA2E;AAY9D,QAAA,8BAA8B,GAAG,kCAAkC,CAAA;AAChF;;GAEG;AACU,QAAA,4BAA4B,GAAG,IAAA,0BAAU,EACpD,sCAA8B,EAC9B,KAAK,EAAE,KAAwC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAChE,MAAM,cAAc,GAAG,SAAS,CAAC,OAAO,CAAC,eAAO,CAAC,eAAe,CAAC,CAAA;IAEjE,MAAM,cAAc,CAAC,GAAG,CAAC,sCAAsB,EAAE;QAC/C,KAAK,EAAE;YACL,EAAE,EAAE,KAAK,CAAC,OAAO;SAClB;QACD,aAAa,EAAE,KAAK,CAAC,OAAO;KAC7B,CAAC,CAAA;AACJ,CAAC,CACF,CAAA"}
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
import { BigNumberInput } from "@etohq/types";
|
|
1
|
+
import { BigNumberInput } from "@etohq/framework/types";
|
|
2
|
+
/**
|
|
3
|
+
* The data to refund a payment.
|
|
4
|
+
*/
|
|
2
5
|
export type RefundPaymentStepInput = {
|
|
6
|
+
/**
|
|
7
|
+
* The ID of the payment to refund.
|
|
8
|
+
*/
|
|
3
9
|
payment_id: string;
|
|
10
|
+
/**
|
|
11
|
+
* The ID of the user that refunded the payment.
|
|
12
|
+
*/
|
|
4
13
|
created_by?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The amount to refund. If not provided, the full refundable amount is refunded.
|
|
16
|
+
*/
|
|
5
17
|
amount?: BigNumberInput;
|
|
6
18
|
};
|
|
7
19
|
export declare const refundPaymentStepId = "refund-payment-step";
|
|
8
20
|
/**
|
|
9
21
|
* This step refunds a payment.
|
|
10
22
|
*/
|
|
11
|
-
export declare const refundPaymentStep: import("@etohq/framework/workflows-sdk").StepFunction<RefundPaymentStepInput, import("@etohq/types").PaymentDTO>;
|
|
23
|
+
export declare const refundPaymentStep: import("@etohq/framework/workflows-sdk").StepFunction<RefundPaymentStepInput, import("@etohq/framework/types").PaymentDTO>;
|
|
12
24
|
//# sourceMappingURL=refund-payment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refund-payment.d.ts","sourceRoot":"","sources":["../../../src/payment/steps/refund-payment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAEf,MAAM,
|
|
1
|
+
{"version":3,"file":"refund-payment.d.ts","sourceRoot":"","sources":["../../../src/payment/steps/refund-payment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAEf,MAAM,wBAAwB,CAAA;AAI/B;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,mBAAmB,wBAAwB,CAAA;AACxD;;GAEG;AACH,eAAO,MAAM,iBAAiB,4HAa7B,CAAA"}
|
|
@@ -11,5 +11,8 @@ exports.refundPaymentStep = (0, workflows_sdk_1.createStep)(exports.refundPaymen
|
|
|
11
11
|
const paymentModule = container.resolve(utils_1.Modules.PAYMENT);
|
|
12
12
|
const payment = await paymentModule.refundPayment(input);
|
|
13
13
|
return new workflows_sdk_1.StepResponse(payment);
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
|
+
// We don't want to compensate a refund automatically as the actual funds have already been sent
|
|
16
|
+
// And in most cases we can't simply do another capture/authorization
|
|
17
|
+
);
|
|
15
18
|
//# sourceMappingURL=refund-payment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refund-payment.js","sourceRoot":"","sources":["../../../src/payment/steps/refund-payment.ts"],"names":[],"mappings":";;;AAIA,kDAAgD;AAChD,kEAAyE;
|
|
1
|
+
{"version":3,"file":"refund-payment.js","sourceRoot":"","sources":["../../../src/payment/steps/refund-payment.ts"],"names":[],"mappings":";;;AAIA,kDAAgD;AAChD,kEAAyE;AAoB5D,QAAA,mBAAmB,GAAG,qBAAqB,CAAA;AACxD;;GAEG;AACU,QAAA,iBAAiB,GAAG,IAAA,0BAAU,EACzC,2BAAmB,EACnB,KAAK,EAAE,KAA6B,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IACrD,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CACrC,eAAO,CAAC,OAAO,CAChB,CAAA;IAED,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;IAExD,OAAO,IAAI,4BAAY,CAAC,OAAO,CAAC,CAAA;AAClC,CAAC;AACD,gGAAgG;AAChG,qEAAqE;CACtE,CAAA"}
|