@medusajs/core-flows 2.11.4-snapshot-20251106122834 → 2.11.4-snapshot-20251107094001
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/file/steps/upload-files.d.ts +2 -2
- package/dist/file/steps/upload-files.js +1 -1
- package/dist/file/workflows/upload-files.d.ts +2 -2
- package/dist/file/workflows/upload-files.js +1 -1
- package/dist/notification/steps/send-notifications.d.ts +10 -1
- package/dist/notification/steps/send-notifications.d.ts.map +1 -1
- package/dist/notification/steps/send-notifications.js.map +1 -1
- package/dist/payment/workflows/process-payment.d.ts.map +1 -1
- package/dist/payment/workflows/process-payment.js +23 -0
- package/dist/payment/workflows/process-payment.js.map +1 -1
- package/package.json +3 -3
|
@@ -19,7 +19,7 @@ export type UploadFilesStepInput = {
|
|
|
19
19
|
mimeType: string;
|
|
20
20
|
/**
|
|
21
21
|
* The content of the file. For images, for example,
|
|
22
|
-
* use
|
|
22
|
+
* use base64 string. For CSV files, use the CSV content.
|
|
23
23
|
*/
|
|
24
24
|
content: string;
|
|
25
25
|
/**
|
|
@@ -43,7 +43,7 @@ export declare const uploadFilesStepId = "upload-files";
|
|
|
43
43
|
* {
|
|
44
44
|
* filename: "test.jpg",
|
|
45
45
|
* mimeType: "img/jpg",
|
|
46
|
-
* content: "
|
|
46
|
+
* content: "base64-string",
|
|
47
47
|
* access: "public"
|
|
48
48
|
* }
|
|
49
49
|
* ]
|
|
@@ -20,7 +20,7 @@ export type UploadFilesWorkflowInput = {
|
|
|
20
20
|
mimeType: string;
|
|
21
21
|
/**
|
|
22
22
|
* The content of the file. For images, for example,
|
|
23
|
-
* use
|
|
23
|
+
* use base64 string. For CSV files, use the CSV content.
|
|
24
24
|
*/
|
|
25
25
|
content: string;
|
|
26
26
|
/**
|
|
@@ -50,7 +50,7 @@ export declare const uploadFilesWorkflowId = "upload-files";
|
|
|
50
50
|
* {
|
|
51
51
|
* filename: "test.jpg",
|
|
52
52
|
* mimeType: "img/jpg",
|
|
53
|
-
* content: "
|
|
53
|
+
* content: "base64-string",
|
|
54
54
|
* access: "public"
|
|
55
55
|
* }
|
|
56
56
|
* ]
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Attachment, NotificationContent } from "@medusajs/framework/types";
|
|
1
2
|
/**
|
|
2
3
|
* The notifications to send.
|
|
3
4
|
*/
|
|
@@ -15,7 +16,11 @@ export type SendNotificationsStepInput = {
|
|
|
15
16
|
* The ID of the template to use for the notification. This template ID may be defined
|
|
16
17
|
* in a third-party service used to send the notification.
|
|
17
18
|
*/
|
|
18
|
-
template
|
|
19
|
+
template?: string | null;
|
|
20
|
+
/**
|
|
21
|
+
* The content that gets passed over to the provider.
|
|
22
|
+
*/
|
|
23
|
+
content?: NotificationContent | null;
|
|
19
24
|
/**
|
|
20
25
|
* The data to use in the notification template. This data may be used to personalize
|
|
21
26
|
* the notification, such as the user's name or the order number.
|
|
@@ -47,6 +52,10 @@ export type SendNotificationsStepInput = {
|
|
|
47
52
|
* is sent multiple times, the key ensures that the notification is sent only once.
|
|
48
53
|
*/
|
|
49
54
|
idempotency_key?: string | null;
|
|
55
|
+
/**
|
|
56
|
+
* Optional attachments for the notification.
|
|
57
|
+
*/
|
|
58
|
+
attachments?: Attachment[] | null;
|
|
50
59
|
}[];
|
|
51
60
|
export declare const sendNotificationsStepId = "send-notifications";
|
|
52
61
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-notifications.d.ts","sourceRoot":"","sources":["../../../src/notification/steps/send-notifications.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"send-notifications.d.ts","sourceRoot":"","sources":["../../../src/notification/steps/send-notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA8B,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAI5G;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACpC;;;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;IAC/B;;OAEG;IACH,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,CAAA;CAClC,EAAE,CAAA;AAEH,eAAO,MAAM,uBAAuB,uBAAuB,CAAA;AAC3D;;GAEG;AACH,eAAO,MAAM,qBAAqB,6IAajC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-notifications.js","sourceRoot":"","sources":["../../../src/notification/steps/send-notifications.ts"],"names":[],"mappings":";;;AACA,qDAAmD;AACnD,qEAA4E;
|
|
1
|
+
{"version":3,"file":"send-notifications.js","sourceRoot":"","sources":["../../../src/notification/steps/send-notifications.ts"],"names":[],"mappings":";;;AACA,qDAAmD;AACnD,qEAA4E;AA6D/D,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-payment.d.ts","sourceRoot":"","sources":["../../../src/payment/workflows/process-payment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"process-payment.d.ts","sourceRoot":"","sources":["../../../src/payment/workflows/process-payment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAYpE;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;CAAG;AAE3E,eAAO,MAAM,wBAAwB,6BAA6B,CAAA;AAClE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,sBAAsB,+FAgIlC,CAAA"}
|
|
@@ -7,6 +7,9 @@ const common_1 = require("../../common");
|
|
|
7
7
|
const steps_1 = require("../steps");
|
|
8
8
|
const complete_cart_after_payment_1 = require("../steps/complete-cart-after-payment");
|
|
9
9
|
const capture_payment_1 = require("./capture-payment");
|
|
10
|
+
const locking_1 = require("../../locking");
|
|
11
|
+
const THIRTY_SECONDS = 30;
|
|
12
|
+
const TWO_MINUTES = 60 * 2;
|
|
10
13
|
exports.processPaymentWorkflowId = "process-payment-workflow";
|
|
11
14
|
/**
|
|
12
15
|
* This workflow processes a payment to either complete its associated cart,
|
|
@@ -56,6 +59,18 @@ exports.processPaymentWorkflow = (0, workflows_sdk_1.createWorkflow)(exports.pro
|
|
|
56
59
|
}).config({
|
|
57
60
|
name: "cart-payment-query",
|
|
58
61
|
});
|
|
62
|
+
const cartId = (0, workflows_sdk_1.transform)({ cartPaymentCollection }, ({ cartPaymentCollection }) => {
|
|
63
|
+
return cartPaymentCollection.data[0].cart_id;
|
|
64
|
+
});
|
|
65
|
+
(0, workflows_sdk_1.when)("lock-cart-when-available", { cartId }, ({ cartId }) => {
|
|
66
|
+
return !!cartId;
|
|
67
|
+
}).then(() => {
|
|
68
|
+
(0, locking_1.acquireLockStep)({
|
|
69
|
+
key: cartId,
|
|
70
|
+
timeout: THIRTY_SECONDS,
|
|
71
|
+
ttl: TWO_MINUTES,
|
|
72
|
+
});
|
|
73
|
+
});
|
|
59
74
|
(0, workflows_sdk_1.when)({ input, paymentData }, ({ input, paymentData }) => {
|
|
60
75
|
return (input.action === utils_1.PaymentActions.SUCCESSFUL && !!paymentData.data.length);
|
|
61
76
|
}).then(() => {
|
|
@@ -105,6 +120,14 @@ exports.processPaymentWorkflow = (0, workflows_sdk_1.createWorkflow)(exports.pro
|
|
|
105
120
|
name: "authorize-payment-session",
|
|
106
121
|
});
|
|
107
122
|
});
|
|
123
|
+
// We release before the completion to prevent dead locks
|
|
124
|
+
(0, workflows_sdk_1.when)("release-lock-cart-when-available", { cartId }, ({ cartId }) => {
|
|
125
|
+
return !!cartId;
|
|
126
|
+
}).then(() => {
|
|
127
|
+
(0, locking_1.releaseLockStep)({
|
|
128
|
+
key: cartId,
|
|
129
|
+
});
|
|
130
|
+
});
|
|
108
131
|
(0, workflows_sdk_1.when)({ cartPaymentCollection }, ({ cartPaymentCollection }) => {
|
|
109
132
|
return !!cartPaymentCollection.data.length;
|
|
110
133
|
}).then(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-payment.js","sourceRoot":"","sources":["../../../src/payment/workflows/process-payment.ts"],"names":[],"mappings":";;;AACA,2CAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"process-payment.js","sourceRoot":"","sources":["../../../src/payment/workflows/process-payment.ts"],"names":[],"mappings":";;;AACA,2CAAgD;AAChD,2DAAyE;AACzE,yCAAgD;AAChD,oCAAsD;AACtD,sFAAmF;AACnF,uDAA0D;AAC1D,2CAAgE;AAEhE,MAAM,cAAc,GAAG,EAAE,CAAA;AACzB,MAAM,WAAW,GAAG,EAAE,GAAG,CAAC,CAAA;AAOb,QAAA,wBAAwB,GAAG,0BAA0B,CAAA;AAClE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACU,QAAA,sBAAsB,GAAG,IAAA,8BAAc,EAClD,gCAAwB,EACxB,CAAC,KAAkC,EAAE,EAAE;IACrC,MAAM,WAAW,GAAG,IAAA,0BAAiB,EAAC;QACpC,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,CAAC,IAAI,CAAC;QACd,OAAO,EAAE,EAAE,kBAAkB,EAAE,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE;KACxD,CAAC,CAAC,MAAM,CAAC;QACR,IAAI,EAAE,eAAe;KACtB,CAAC,CAAA;IAEF,MAAM,oBAAoB,GAAG,IAAA,0BAAiB,EAAC;QAC7C,MAAM,EAAE,iBAAiB;QACzB,MAAM,EAAE,CAAC,uBAAuB,CAAC;QACjC,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE;KACxC,CAAC,CAAC,MAAM,CAAC;QACR,IAAI,EAAE,uBAAuB;KAC9B,CAAC,CAAA;IAEF,MAAM,qBAAqB,GAAG,IAAA,0BAAiB,EAAC;QAC9C,MAAM,EAAE,yBAAyB;QACjC,MAAM,EAAE,CAAC,SAAS,CAAC;QACnB,OAAO,EAAE;YACP,qBAAqB,EACnB,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,qBAAqB;SACrD;KACF,CAAC,CAAC,MAAM,CAAC;QACR,IAAI,EAAE,oBAAoB;KAC3B,CAAC,CAAA;IAE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AAM,CAAA;IACjB,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACX,IAAA,yBAAe,EAAC;YACd,GAAG,EAAE,MAAM;SACZ,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAA,oBAAI,EAAC,EAAE,qBAAqB,EAAE,EAAE,CAAC,EAAE,qBAAqB,EAAE,EAAE,EAAE;QAC5D,OAAO,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAA;IAC5C,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACX,IAAA,0DAA4B,EAAC;YAC3B,OAAO,EAAE,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO;SAC/C,CAAC,CAAC,MAAM,CAAC;YACR,0BAA0B,EAAE,IAAI,EAAE,4DAA4D;SAC/F,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CACF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/core-flows",
|
|
3
|
-
"version": "2.11.4-snapshot-
|
|
3
|
+
"version": "2.11.4-snapshot-20251107094001",
|
|
4
4
|
"description": "Set of workflow definitions for Medusa",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"author": "Medusa",
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@medusajs/framework": "2.11.4-snapshot-
|
|
29
|
+
"@medusajs/framework": "2.11.4-snapshot-20251107094001"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"csv-parse": "^5.6.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"zod": "3.25.76"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@medusajs/framework": "2.11.4-snapshot-
|
|
37
|
+
"@medusajs/framework": "2.11.4-snapshot-20251107094001"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "yarn run -T rimraf dist && yarn run -T tsc --build",
|