@medusajs/core-flows 3.0.0-snapshot-20251106143524 → 3.0.0-snapshot-20251106181920
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/notification/steps/send-notifications.d.ts +1 -10
- package/dist/notification/steps/send-notifications.d.ts.map +1 -1
- package/dist/notification/steps/send-notifications.js.map +1 -1
- package/dist/product/steps/process-product-options-for-import.d.ts +1 -1
- package/dist/product/steps/process-product-options-for-import.d.ts.map +1 -1
- package/dist/product/steps/process-product-options-for-import.js +25 -11
- package/dist/product/steps/process-product-options-for-import.js.map +1 -1
- package/dist/product/steps/update-product-options.d.ts.map +1 -1
- package/dist/product/steps/update-product-options.js +3 -0
- package/dist/product/steps/update-product-options.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Attachment, NotificationContent } from "@medusajs/framework/types";
|
|
2
1
|
/**
|
|
3
2
|
* The notifications to send.
|
|
4
3
|
*/
|
|
@@ -16,11 +15,7 @@ export type SendNotificationsStepInput = {
|
|
|
16
15
|
* The ID of the template to use for the notification. This template ID may be defined
|
|
17
16
|
* in a third-party service used to send the notification.
|
|
18
17
|
*/
|
|
19
|
-
template
|
|
20
|
-
/**
|
|
21
|
-
* The content that gets passed over to the provider.
|
|
22
|
-
*/
|
|
23
|
-
content?: NotificationContent | null;
|
|
18
|
+
template: string;
|
|
24
19
|
/**
|
|
25
20
|
* The data to use in the notification template. This data may be used to personalize
|
|
26
21
|
* the notification, such as the user's name or the order number.
|
|
@@ -52,10 +47,6 @@ export type SendNotificationsStepInput = {
|
|
|
52
47
|
* is sent multiple times, the key ensures that the notification is sent only once.
|
|
53
48
|
*/
|
|
54
49
|
idempotency_key?: string | null;
|
|
55
|
-
/**
|
|
56
|
-
* Optional attachments for the notification.
|
|
57
|
-
*/
|
|
58
|
-
attachments?: Attachment[] | null;
|
|
59
50
|
}[];
|
|
60
51
|
export declare const sendNotificationsStepId = "send-notifications";
|
|
61
52
|
/**
|
|
@@ -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":"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,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;AAqD/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"}
|
|
@@ -2,7 +2,7 @@ import type { ProductTypes, UpdateProductWorkflowInputDTO } from "@medusajs/fram
|
|
|
2
2
|
export declare const processProductOptionsForImportStepId = "process-product-options-for-import";
|
|
3
3
|
export type ProcessProductOptionsForImportInput = {
|
|
4
4
|
products: (Omit<UpdateProductWorkflowInputDTO, "option_ids"> & {
|
|
5
|
-
options
|
|
5
|
+
options?: ProductTypes.CreateProductOptionDTO[];
|
|
6
6
|
})[];
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-product-options-for-import.d.ts","sourceRoot":"","sources":["../../../src/product/steps/process-product-options-for-import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EACZ,6BAA6B,EAC9B,MAAM,2BAA2B,CAAA;AAKlC,eAAO,MAAM,oCAAoC,uCACX,CAAA;AAEtC,MAAM,MAAM,mCAAmC,GAAG;IAChD,QAAQ,EAAE,CAAC,IAAI,CAAC,6BAA6B,EAAE,YAAY,CAAC,GAAG;QAC7D,OAAO,EAAE,YAAY,CAAC,sBAAsB,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"process-product-options-for-import.d.ts","sourceRoot":"","sources":["../../../src/product/steps/process-product-options-for-import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EACZ,6BAA6B,EAC9B,MAAM,2BAA2B,CAAA;AAKlC,eAAO,MAAM,oCAAoC,uCACX,CAAA;AAEtC,MAAM,MAAM,mCAAmC,GAAG;IAChD,QAAQ,EAAE,CAAC,IAAI,CAAC,6BAA6B,EAAE,YAAY,CAAC,GAAG;QAC7D,OAAO,CAAC,EAAE,YAAY,CAAC,sBAAsB,EAAE,CAAA;KAChD,CAAC,EAAE,CAAA;CACL,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,kCAAkC,gIAsE9C,CAAA"}
|
|
@@ -13,26 +13,40 @@ exports.processProductOptionsForImportStepId = "process-product-options-for-impo
|
|
|
13
13
|
*/
|
|
14
14
|
exports.processProductOptionsForImportStep = (0, workflows_sdk_1.createStep)(exports.processProductOptionsForImportStepId, async (data, { container }) => {
|
|
15
15
|
const productService = container.resolve(utils_1.Modules.PRODUCT);
|
|
16
|
-
const createdOptionIds = [];
|
|
17
16
|
const processedProducts = [];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
const allOptions = [];
|
|
18
|
+
const productIndices = []; // Maps option index to product index
|
|
19
|
+
data.products.forEach((product, index) => {
|
|
20
|
+
(product.options ?? []).forEach((option) => {
|
|
21
|
+
allOptions.push(option);
|
|
22
|
+
productIndices.push(index);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
const createdOptions = allOptions.length > 0
|
|
26
|
+
? await productService.createProductOptions(allOptions)
|
|
27
|
+
: [];
|
|
28
|
+
const createdOptionIds = createdOptions.map((opt) => opt.id);
|
|
29
|
+
const productOptionsMap = new Map();
|
|
30
|
+
createdOptions.forEach((option, index) => {
|
|
31
|
+
const productIndex = productIndices[index];
|
|
32
|
+
if (!productOptionsMap.has(productIndex)) {
|
|
33
|
+
productOptionsMap.set(productIndex, []);
|
|
34
|
+
}
|
|
35
|
+
productOptionsMap.get(productIndex).push(option);
|
|
36
|
+
});
|
|
37
|
+
data.products.forEach((product, index) => {
|
|
38
|
+
const createdOptionsForProduct = productOptionsMap.get(index);
|
|
39
|
+
if (createdOptionsForProduct && createdOptionsForProduct.length) {
|
|
26
40
|
// Transform product to use option_ids instead of options
|
|
27
41
|
const transformedProduct = (0, utils_2.deepCopy)(product);
|
|
28
42
|
delete transformedProduct.options;
|
|
29
|
-
transformedProduct.option_ids =
|
|
43
|
+
transformedProduct.option_ids = createdOptionsForProduct.map((opt) => opt.id);
|
|
30
44
|
processedProducts.push(transformedProduct);
|
|
31
45
|
}
|
|
32
46
|
else {
|
|
33
47
|
processedProducts.push(product);
|
|
34
48
|
}
|
|
35
|
-
}
|
|
49
|
+
});
|
|
36
50
|
return new workflows_sdk_1.StepResponse(processedProducts, createdOptionIds);
|
|
37
51
|
}, async (createdOptionIds, { container }) => {
|
|
38
52
|
if (!createdOptionIds || createdOptionIds.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-product-options-for-import.js","sourceRoot":"","sources":["../../../src/product/steps/process-product-options-for-import.ts"],"names":[],"mappings":";;;AAKA,qDAAmD;AACnD,qEAA4E;AAC5E,2CAA0C;AAE7B,QAAA,oCAAoC,GAC/C,oCAAoC,CAAA;AAQtC;;;;;GAKG;AACU,QAAA,kCAAkC,GAAG,IAAA,0BAAU,EAC1D,4CAAoC,EACpC,KAAK,EACH,IAAyC,EACzC,EAAE,SAAS,EAAE,EACqD,EAAE;IACpE,MAAM,cAAc,GAAG,SAAS,CAAC,OAAO,CACtC,eAAO,CAAC,OAAO,CAChB,CAAA;IAED,MAAM,
|
|
1
|
+
{"version":3,"file":"process-product-options-for-import.js","sourceRoot":"","sources":["../../../src/product/steps/process-product-options-for-import.ts"],"names":[],"mappings":";;;AAKA,qDAAmD;AACnD,qEAA4E;A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ceRoot":"","sources":["../../../src/product/steps/update-product-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"update-product-options.d.ts","sourceRoot":"","sources":["../../../src/product/steps/update-product-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,2BAA2B,CAAA;AAQlC;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC,4BAA4B,CAAA;IACnD;;OAEG;IACH,MAAM,EAAE,YAAY,CAAC,sBAAsB,CAAA;CAC5C,CAAA;AAED,eAAO,MAAM,0BAA0B,2BAA2B,CAAA;AAClE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB,0HAwCpC,CAAA"}
|
|
@@ -25,6 +25,9 @@ exports.updateProductOptionsStep = (0, workflows_sdk_1.createStep)(exports.updat
|
|
|
25
25
|
select: selects,
|
|
26
26
|
relations: ["values"],
|
|
27
27
|
});
|
|
28
|
+
if (!prevData.length) {
|
|
29
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.NOT_FOUND, `Product option with id "${data.selector.id}" not found`);
|
|
30
|
+
}
|
|
28
31
|
const productOptions = await service.updateProductOptions(data.selector, data.update);
|
|
29
32
|
return new workflows_sdk_1.StepResponse(productOptions, prevData);
|
|
30
33
|
}, async (prevData, { container }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-product-options.js","sourceRoot":"","sources":["../../../src/product/steps/update-product-options.ts"],"names":[],"mappings":";;;AAIA,
|
|
1
|
+
{"version":3,"file":"update-product-options.js","sourceRoot":"","sources":["../../../src/product/steps/update-product-options.ts"],"names":[],"mappings":";;;AAIA,qDAIkC;AAClC,qEAA4E;AAgB/D,QAAA,0BAA0B,GAAG,wBAAwB,CAAA;AAClE;;;;;;;;;;;;GAYG;AACU,QAAA,wBAAwB,GA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AC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;KACtC,CAAC,CAAC,CACJ,CAAA;AACH,CAAC,CACF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/core-flows",
|
|
3
|
-
"version": "3.0.0-snapshot-
|
|
3
|
+
"version": "3.0.0-snapshot-20251106181920",
|
|
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": "3.0.0-snapshot-
|
|
29
|
+
"@medusajs/framework": "3.0.0-snapshot-20251106181920"
|
|
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": "3.0.0-snapshot-
|
|
37
|
+
"@medusajs/framework": "3.0.0-snapshot-20251106181920"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "yarn run -T rimraf dist && yarn run -T tsc --build",
|