@medusajs/core-flows 3.0.0-snapshot-20251208164410 → 3.0.0-snapshot-20251211180009

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/dist/cart/steps/index.d.ts +1 -0
  2. package/dist/cart/steps/index.d.ts.map +1 -1
  3. package/dist/cart/steps/index.js +1 -0
  4. package/dist/cart/steps/index.js.map +1 -1
  5. package/dist/cart/steps/update-cart-items-translations.d.ts +19 -0
  6. package/dist/cart/steps/update-cart-items-translations.d.ts.map +1 -0
  7. package/dist/cart/steps/update-cart-items-translations.js +129 -0
  8. package/dist/cart/steps/update-cart-items-translations.js.map +1 -0
  9. package/dist/cart/steps/update-carts.d.ts.map +1 -1
  10. package/dist/cart/steps/update-carts.js +34 -3
  11. package/dist/cart/steps/update-carts.js.map +1 -1
  12. package/dist/cart/utils/fields.d.ts.map +1 -1
  13. package/dist/cart/utils/fields.js +2 -0
  14. package/dist/cart/utils/fields.js.map +1 -1
  15. package/dist/cart/utils/prepare-line-item-data.js +14 -14
  16. package/dist/cart/utils/prepare-line-item-data.js.map +1 -1
  17. package/dist/cart/workflows/add-to-cart.d.ts.map +1 -1
  18. package/dist/cart/workflows/add-to-cart.js +16 -2
  19. package/dist/cart/workflows/add-to-cart.js.map +1 -1
  20. package/dist/cart/workflows/complete-cart.d.ts.map +1 -1
  21. package/dist/cart/workflows/complete-cart.js +1 -0
  22. package/dist/cart/workflows/complete-cart.js.map +1 -1
  23. package/dist/cart/workflows/create-carts.d.ts +1 -15
  24. package/dist/cart/workflows/create-carts.d.ts.map +1 -1
  25. package/dist/cart/workflows/create-carts.js +13 -5
  26. package/dist/cart/workflows/create-carts.js.map +1 -1
  27. package/dist/cart/workflows/get-variants-and-items-with-prices.d.ts +2 -2
  28. package/dist/cart/workflows/get-variants-and-items-with-prices.d.ts.map +1 -1
  29. package/dist/cart/workflows/get-variants-and-items-with-prices.js +3 -1
  30. package/dist/cart/workflows/get-variants-and-items-with-prices.js.map +1 -1
  31. package/dist/cart/workflows/refresh-cart-items.d.ts +5 -0
  32. package/dist/cart/workflows/refresh-cart-items.d.ts.map +1 -1
  33. package/dist/cart/workflows/refresh-cart-items.js +10 -0
  34. package/dist/cart/workflows/refresh-cart-items.js.map +1 -1
  35. package/dist/cart/workflows/update-cart-promotions.d.ts +5 -0
  36. package/dist/cart/workflows/update-cart-promotions.d.ts.map +1 -1
  37. package/dist/cart/workflows/update-cart-promotions.js +6 -0
  38. package/dist/cart/workflows/update-cart-promotions.js.map +1 -1
  39. package/dist/cart/workflows/update-cart.d.ts +1 -0
  40. package/dist/cart/workflows/update-cart.d.ts.map +1 -1
  41. package/dist/cart/workflows/update-cart.js +9 -0
  42. package/dist/cart/workflows/update-cart.js.map +1 -1
  43. package/dist/common/index.d.ts +1 -0
  44. package/dist/common/index.d.ts.map +1 -1
  45. package/dist/common/index.js +1 -0
  46. package/dist/common/index.js.map +1 -1
  47. package/dist/common/steps/create-remote-links.d.ts +4 -4
  48. package/dist/common/steps/create-remote-links.js +4 -4
  49. package/dist/common/steps/dismiss-remote-links.d.ts +4 -4
  50. package/dist/common/steps/dismiss-remote-links.js +4 -4
  51. package/dist/common/steps/get-translated-line-items.d.ts +15 -0
  52. package/dist/common/steps/get-translated-line-items.d.ts.map +1 -0
  53. package/dist/common/steps/get-translated-line-items.js +28 -0
  54. package/dist/common/steps/get-translated-line-items.js.map +1 -0
  55. package/dist/common/steps/remove-remote-links.d.ts +2 -2
  56. package/dist/common/steps/remove-remote-links.js +2 -2
  57. package/dist/common/steps/update-remote-links.d.ts +5 -4
  58. package/dist/common/steps/update-remote-links.d.ts.map +1 -1
  59. package/dist/common/steps/update-remote-links.js +5 -4
  60. package/dist/common/steps/update-remote-links.js.map +1 -1
  61. package/dist/common/utils/apply-translations-to-items.d.ts +9 -0
  62. package/dist/common/utils/apply-translations-to-items.d.ts.map +1 -0
  63. package/dist/common/utils/apply-translations-to-items.js +54 -0
  64. package/dist/common/utils/apply-translations-to-items.js.map +1 -0
  65. package/dist/draft-order/workflows/convert-draft-order.d.ts.map +1 -1
  66. package/dist/draft-order/workflows/convert-draft-order.js +4 -2
  67. package/dist/draft-order/workflows/convert-draft-order.js.map +1 -1
  68. package/dist/draft-order/workflows/update-draft-order.d.ts +5 -0
  69. package/dist/draft-order/workflows/update-draft-order.d.ts.map +1 -1
  70. package/dist/draft-order/workflows/update-draft-order.js +23 -1
  71. package/dist/draft-order/workflows/update-draft-order.js.map +1 -1
  72. package/dist/index.d.ts +1 -0
  73. package/dist/index.d.ts.map +1 -1
  74. package/dist/index.js +1 -0
  75. package/dist/index.js.map +1 -1
  76. package/dist/order/steps/index.d.ts +1 -0
  77. package/dist/order/steps/index.d.ts.map +1 -1
  78. package/dist/order/steps/index.js +1 -0
  79. package/dist/order/steps/index.js.map +1 -1
  80. package/dist/order/steps/update-order-items-translations.d.ts +19 -0
  81. package/dist/order/steps/update-order-items-translations.d.ts.map +1 -0
  82. package/dist/order/steps/update-order-items-translations.js +136 -0
  83. package/dist/order/steps/update-order-items-translations.js.map +1 -0
  84. package/dist/order/workflows/add-line-items.d.ts.map +1 -1
  85. package/dist/order/workflows/add-line-items.js +7 -1
  86. package/dist/order/workflows/add-line-items.js.map +1 -1
  87. package/dist/order/workflows/order-edit/begin-order-edit.d.ts.map +1 -1
  88. package/dist/order/workflows/order-edit/begin-order-edit.js +9 -0
  89. package/dist/order/workflows/order-edit/begin-order-edit.js.map +1 -1
  90. package/dist/order/workflows/order-edit/cancel-begin-order-edit.d.ts.map +1 -1
  91. package/dist/order/workflows/order-edit/cancel-begin-order-edit.js +9 -0
  92. package/dist/order/workflows/order-edit/cancel-begin-order-edit.js.map +1 -1
  93. package/dist/order/workflows/order-edit/confirm-order-edit-request.d.ts.map +1 -1
  94. package/dist/order/workflows/order-edit/confirm-order-edit-request.js +9 -0
  95. package/dist/order/workflows/order-edit/confirm-order-edit-request.js.map +1 -1
  96. package/dist/order/workflows/order-edit/create-order-edit-shipping-method.d.ts.map +1 -1
  97. package/dist/order/workflows/order-edit/create-order-edit-shipping-method.js +11 -1
  98. package/dist/order/workflows/order-edit/create-order-edit-shipping-method.js.map +1 -1
  99. package/dist/order/workflows/order-edit/order-edit-add-new-item.d.ts.map +1 -1
  100. package/dist/order/workflows/order-edit/order-edit-add-new-item.js +12 -2
  101. package/dist/order/workflows/order-edit/order-edit-add-new-item.js.map +1 -1
  102. package/dist/order/workflows/order-edit/order-edit-update-item-quantity.d.ts.map +1 -1
  103. package/dist/order/workflows/order-edit/order-edit-update-item-quantity.js +12 -2
  104. package/dist/order/workflows/order-edit/order-edit-update-item-quantity.js.map +1 -1
  105. package/dist/order/workflows/order-edit/remove-order-edit-item-action.d.ts.map +1 -1
  106. package/dist/order/workflows/order-edit/remove-order-edit-item-action.js +11 -1
  107. package/dist/order/workflows/order-edit/remove-order-edit-item-action.js.map +1 -1
  108. package/dist/order/workflows/order-edit/remove-order-edit-shipping-method.d.ts.map +1 -1
  109. package/dist/order/workflows/order-edit/remove-order-edit-shipping-method.js +11 -1
  110. package/dist/order/workflows/order-edit/remove-order-edit-shipping-method.js.map +1 -1
  111. package/dist/order/workflows/order-edit/request-order-edit.d.ts.map +1 -1
  112. package/dist/order/workflows/order-edit/request-order-edit.js +11 -1
  113. package/dist/order/workflows/order-edit/request-order-edit.js.map +1 -1
  114. package/dist/order/workflows/order-edit/update-order-edit-add-item.d.ts.map +1 -1
  115. package/dist/order/workflows/order-edit/update-order-edit-add-item.js +11 -1
  116. package/dist/order/workflows/order-edit/update-order-edit-add-item.js.map +1 -1
  117. package/dist/order/workflows/order-edit/update-order-edit-item-quantity.d.ts.map +1 -1
  118. package/dist/order/workflows/order-edit/update-order-edit-item-quantity.js +11 -1
  119. package/dist/order/workflows/order-edit/update-order-edit-item-quantity.js.map +1 -1
  120. package/dist/order/workflows/order-edit/update-order-edit-shipping-method.d.ts.map +1 -1
  121. package/dist/order/workflows/order-edit/update-order-edit-shipping-method.js +11 -1
  122. package/dist/order/workflows/order-edit/update-order-edit-shipping-method.js.map +1 -1
  123. package/dist/order/workflows/update-order.d.ts.map +1 -1
  124. package/dist/order/workflows/update-order.js +22 -0
  125. package/dist/order/workflows/update-order.js.map +1 -1
  126. package/dist/product/steps/create-product-options.d.ts +1 -6
  127. package/dist/product/steps/create-product-options.d.ts.map +1 -1
  128. package/dist/product/steps/create-product-options.js +1 -6
  129. package/dist/product/steps/create-product-options.js.map +1 -1
  130. package/dist/product/steps/index.d.ts +0 -2
  131. package/dist/product/steps/index.d.ts.map +1 -1
  132. package/dist/product/steps/index.js +0 -2
  133. package/dist/product/steps/index.js.map +1 -1
  134. package/dist/product/steps/update-product-options.d.ts.map +1 -1
  135. package/dist/product/steps/update-product-options.js +6 -6
  136. package/dist/product/steps/update-product-options.js.map +1 -1
  137. package/dist/product/workflows/batch-products.d.ts.map +1 -1
  138. package/dist/product/workflows/batch-products.js +4 -10
  139. package/dist/product/workflows/batch-products.js.map +1 -1
  140. package/dist/product/workflows/create-product-options.d.ts +0 -6
  141. package/dist/product/workflows/create-product-options.d.ts.map +1 -1
  142. package/dist/product/workflows/create-product-options.js +0 -6
  143. package/dist/product/workflows/create-product-options.js.map +1 -1
  144. package/dist/product/workflows/index.d.ts +0 -1
  145. package/dist/product/workflows/index.d.ts.map +1 -1
  146. package/dist/product/workflows/index.js +0 -1
  147. package/dist/product/workflows/index.js.map +1 -1
  148. package/dist/translation/index.d.ts +3 -0
  149. package/dist/translation/index.d.ts.map +1 -0
  150. package/dist/translation/index.js +19 -0
  151. package/dist/translation/index.js.map +1 -0
  152. package/dist/translation/steps/create-translations.d.ts +17 -0
  153. package/dist/translation/steps/create-translations.d.ts.map +1 -0
  154. package/dist/translation/steps/create-translations.js +31 -0
  155. package/dist/translation/steps/create-translations.js.map +1 -0
  156. package/dist/translation/steps/delete-translations.d.ts +10 -0
  157. package/dist/translation/steps/delete-translations.d.ts.map +1 -0
  158. package/dist/translation/steps/delete-translations.js +21 -0
  159. package/dist/translation/steps/delete-translations.js.map +1 -0
  160. package/dist/translation/steps/index.d.ts +5 -0
  161. package/dist/translation/steps/index.d.ts.map +1 -0
  162. package/dist/translation/steps/index.js +21 -0
  163. package/dist/translation/steps/index.js.map +1 -0
  164. package/dist/translation/steps/update-translations.d.ts +33 -0
  165. package/dist/translation/steps/update-translations.d.ts.map +1 -0
  166. package/dist/translation/steps/update-translations.js +66 -0
  167. package/dist/translation/steps/update-translations.js.map +1 -0
  168. package/dist/translation/steps/validate-translations.d.ts +5 -0
  169. package/dist/translation/steps/validate-translations.d.ts.map +1 -0
  170. package/dist/translation/steps/validate-translations.js +30 -0
  171. package/dist/translation/steps/validate-translations.js.map +1 -0
  172. package/dist/translation/workflows/batch-translations.d.ts +13 -0
  173. package/dist/translation/workflows/batch-translations.d.ts.map +1 -0
  174. package/dist/translation/workflows/batch-translations.js +25 -0
  175. package/dist/translation/workflows/batch-translations.js.map +1 -0
  176. package/dist/translation/workflows/create-translations.d.ts +32 -0
  177. package/dist/translation/workflows/create-translations.d.ts.map +1 -0
  178. package/dist/translation/workflows/create-translations.js +49 -0
  179. package/dist/translation/workflows/create-translations.js.map +1 -0
  180. package/dist/translation/workflows/delete-translations.d.ts +24 -0
  181. package/dist/translation/workflows/delete-translations.d.ts.map +1 -0
  182. package/dist/translation/workflows/delete-translations.js +39 -0
  183. package/dist/translation/workflows/delete-translations.js.map +1 -0
  184. package/dist/translation/workflows/index.d.ts +5 -0
  185. package/dist/translation/workflows/index.d.ts.map +1 -0
  186. package/dist/translation/workflows/index.js +21 -0
  187. package/dist/translation/workflows/index.js.map +1 -0
  188. package/dist/translation/workflows/update-translations.d.ts +30 -0
  189. package/dist/translation/workflows/update-translations.d.ts.map +1 -0
  190. package/dist/translation/workflows/update-translations.js +51 -0
  191. package/dist/translation/workflows/update-translations.js.map +1 -0
  192. package/dist/tsconfig.tsbuildinfo +1 -1
  193. package/package.json +3 -3
  194. package/dist/product/steps/link-product-options-to-product.d.ts +0 -30
  195. package/dist/product/steps/link-product-options-to-product.d.ts.map +0 -1
  196. package/dist/product/steps/link-product-options-to-product.js +0 -58
  197. package/dist/product/steps/link-product-options-to-product.js.map +0 -1
  198. package/dist/product/steps/process-product-options-for-import.d.ts +0 -15
  199. package/dist/product/steps/process-product-options-for-import.d.ts.map +0 -1
  200. package/dist/product/steps/process-product-options-for-import.js +0 -61
  201. package/dist/product/steps/process-product-options-for-import.js.map +0 -1
  202. package/dist/product/workflows/create-and-link-product-options-to-product.d.ts +0 -50
  203. package/dist/product/workflows/create-and-link-product-options-to-product.d.ts.map +0 -1
  204. package/dist/product/workflows/create-and-link-product-options-to-product.js +0 -85
  205. package/dist/product/workflows/create-and-link-product-options-to-product.js.map +0 -1
@@ -32,6 +32,4 @@ export * from "./get-variant-availability";
32
32
  export * from "./normalize-products";
33
33
  export * from "./normalize-products-to-chunks";
34
34
  export * from "./process-import-chunks";
35
- export * from "./link-product-options-to-product";
36
- export * from "./process-product-options-for-import";
37
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/product/steps/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kCAAkC,CAAA;AAChD,cAAc,m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A;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oCAAoC,CAAA;AAClD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,yBAAyB,CAAA"}
@@ -48,6 +48,4 @@ __exportStar(require("./get-variant-availability"), exports);
48
48
  __exportStar(require("./normalize-products"), exports);
49
49
  __exportStar(require("./normalize-products-to-chunks"), exports);
50
50
  __exportStar(require("./process-import-chunks"), exports);
51
- __exportStar(require("./link-product-options-to-product"), exports);
52
- __exportStar(require("./process-product-options-for-import"), exports);
53
51
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/product/steps/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAuC;AACvC,0DAAuC;AACvC,+DAA4C;AAC5C,oDAAiC;AACjC,oDAAiC;AACjC,oDAAiC;AACjC,iDAA8B;AAC9B,qDAAkC;AAClC,gEAA6C;AAC7C,2DAAwC;AACxC,2DAAwC;AACxC,2DAAwC;AACxC,4DAAyC;AACzC,4DAAyC;AACzC,4DAAyC;AACzC,uDAAoC;AACpC,uDAAoC;AACpC,uDAAoC;AACpC,mEAAgD;AAChD,oEAAiD;AACjD,yDAAsC;AACtC,yDAAsC;AACtC,yDAAsC;AACtC,wDAAqC;AACrC,wDAAqC;AACrC,wDAAqC;AACrC,+DAA4C;AAC5C,yDAAsC;AACtC,sDAAmC;AACnC,qEAAkD;AAClD,6DAA0C;AAC1C,uDAAoC;AACpC,iEAA8C;AAC9C,0DAAuC;AACvC,oEAAiD;AACjD,uEAAoD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/product/steps/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAuC;AACvC,0DAAuC;AACvC,+DAA4C;AAC5C,oDAAiC;AACjC,oDAAiC;AACjC,oDAAiC;AACjC,iDAA8B;AAC9B,qDAAkC;AAClC,gEAA6C;AAC7C,2DAAwC;AACxC,2DAAwC;AACxC,2DAAwC;AACxC,4DAAyC;AACzC,4DAAyC;AACzC,4DAAyC;AACzC,uDAAoC;AACpC,uDAAoC;AACpC,uDAAoC;AACpC,mEAAgD;AAChD,oEAAiD;AACjD,yDAAsC;AACtC,yDAAsC;AACtC,yDAAsC;AACtC,wDAAqC;AACrC,wDAAqC;AACrC,wDAAqC;AACrC,+DAA4C;AAC5C,yDAAsC;AACtC,sDAAmC;AACnC,qEAAkD;AAClD,6DAA0C;AAC1C,uDAAoC;AACpC,iEAA8C;AAC9C,0DAAuC"}
@@ -1 +1 @@
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"}
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;AAOlC;;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,0HAoCpC,CAAA"}
@@ -19,15 +19,13 @@ exports.updateProductOptionsStepId = "update-product-options";
19
19
  */
20
20
  exports.updateProductOptionsStep = (0, workflows_sdk_1.createStep)(exports.updateProductOptionsStepId, async (data, { container }) => {
21
21
  const service = container.resolve(utils_1.Modules.PRODUCT);
22
- const { ranks, ...cleanedUpdate } = data.update;
23
- const { selects } = (0, utils_1.getSelectsAndRelationsFromObjectArray)([cleanedUpdate]);
22
+ const { selects, relations } = (0, utils_1.getSelectsAndRelationsFromObjectArray)([
23
+ data.update,
24
+ ]);
24
25
  const prevData = await service.listProductOptions(data.selector, {
25
26
  select: selects,
26
- relations: ["values"],
27
+ relations,
27
28
  });
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
- }
31
29
  const productOptions = await service.updateProductOptions(data.selector, data.update);
32
30
  return new workflows_sdk_1.StepResponse(productOptions, prevData);
33
31
  }, async (prevData, { container }) => {
@@ -38,6 +36,8 @@ exports.updateProductOptionsStep = (0, workflows_sdk_1.createStep)(exports.updat
38
36
  await service.upsertProductOptions(prevData.map((o) => ({
39
37
  ...o,
40
38
  values: o.values?.map((v) => v.value),
39
+ product: undefined,
40
+ product_id: o.product_id ?? undefined,
41
41
  })));
42
42
  });
43
43
  //# sourceMappingURL=update-product-options.js.map
@@ -1 +1 @@
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,GAAG,IAAA,0BAAU,EAChD,kCAA0B,EAC1B,KAAK,EAAE,IAAmC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAC3D,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAwB,e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AC;QACrC,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,CAAC,CAAC,UAAU,IAAI,SAAS;KACtC,CAAC,CAAC,CACJ,CAAA;AACH,CAAC,CACF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"batch-products.d.ts","sourceRoot":"","sources":["../../../src/product/workflows/batch-products.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,6BAA6B,EAC7B,YAAY,EACZ,6BAA6B,EAC9B,MAAM,2BAA2B,CAAA;AAclC;;GAEG;AACH,MAAM,WAAW,yBACf,SAAQ,kBAAkB,CACxB,6BAA6B,EAC7B,6BAA6B,CAC9B;CAAG;AAEN,eAAO,MAAM,uBAAuB,mBAAmB,CAAA;AACvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,eAAO,MAAM,qBAAqB,yIA2CjC,CAAA"}
1
+ {"version":3,"file":"batch-products.d.ts","sourceRoot":"","sources":["../../../src/product/workflows/batch-products.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,6BAA6B,EAC7B,YAAY,EACZ,6BAA6B,EAC9B,MAAM,2BAA2B,CAAA;AAalC;;GAEG;AACH,MAAM,WAAW,yBACf,SAAQ,kBAAkB,CACxB,6BAA6B,EAC7B,6BAA6B,CAC9B;CAAG;AAiBN,eAAO,MAAM,uBAAuB,mBAAmB,CAAA;AACvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,eAAO,MAAM,qBAAqB,yIAqBjC,CAAA"}
@@ -5,7 +5,9 @@ const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
5
5
  const create_products_1 = require("./create-products");
6
6
  const delete_products_1 = require("./delete-products");
7
7
  const update_products_1 = require("./update-products");
8
- const process_product_options_for_import_1 = require("../steps/process-product-options-for-import");
8
+ const conditionallyCreateProducts = (input) => (0, workflows_sdk_1.when)({ input }, ({ input }) => !!input.create?.length).then(() => create_products_1.createProductsWorkflow.runAsStep({ input: { products: input.create } }));
9
+ const conditionallyUpdateProducts = (input) => (0, workflows_sdk_1.when)({ input }, ({ input }) => !!input.update?.length).then(() => update_products_1.updateProductsWorkflow.runAsStep({ input: { products: input.update } }));
10
+ const conditionallyDeleteProducts = (input) => (0, workflows_sdk_1.when)({ input }, ({ input }) => !!input.delete?.length).then(() => delete_products_1.deleteProductsWorkflow.runAsStep({ input: { ids: input.delete } }));
9
11
  exports.batchProductsWorkflowId = "batch-products";
10
12
  /**
11
13
  * This workflow creates, updates, or deletes products. It's used by the
@@ -58,15 +60,7 @@ exports.batchProductsWorkflowId = "batch-products";
58
60
  * Manage products in bulk.
59
61
  */
60
62
  exports.batchProductsWorkflow = (0, workflows_sdk_1.createWorkflow)(exports.batchProductsWorkflowId, (input) => {
61
- const productsToUpdate = (0, workflows_sdk_1.transform)({ input }, ({ input }) => {
62
- return input.update ?? [];
63
- });
64
- const processedProductsToUpdate = (0, process_product_options_for_import_1.processProductOptionsForImportStep)({
65
- products: productsToUpdate,
66
- });
67
- const res = (0, workflows_sdk_1.parallelize)((0, workflows_sdk_1.when)({ input }, ({ input }) => !!input.create?.length).then(() => create_products_1.createProductsWorkflow.runAsStep({ input: { products: input.create } })), (0, workflows_sdk_1.when)({ processedProductsToUpdate }, ({ processedProductsToUpdate }) => !!processedProductsToUpdate.length).then(() => update_products_1.updateProductsWorkflow.runAsStep({
68
- input: { products: processedProductsToUpdate },
69
- })), (0, workflows_sdk_1.when)({ input }, ({ input }) => !!input.delete?.length).then(() => delete_products_1.deleteProductsWorkflow.runAsStep({ input: { ids: input.delete } })));
63
+ const res = (0, workflows_sdk_1.parallelize)(conditionallyCreateProducts(input), conditionallyUpdateProducts(input), conditionallyDeleteProducts(input));
70
64
  return new workflows_sdk_1.WorkflowResponse((0, workflows_sdk_1.transform)({ res, input }, (data) => {
71
65
  return {
72
66
  created: data.res[0] ??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AK,CAAC,MAAM,IAAI,EAAE;SACjC,CAAA;IACH,CAAC,CAAC,CACH,CAAA;AACH,CAAC,CACF,CAAA"}
@@ -30,12 +30,6 @@ export declare const createProductOptionsWorkflowId = "create-product-options";
30
30
  * {
31
31
  * title: "Color",
32
32
  * values: ["Red", "Blue", "Green"]
33
- * is_exclusive: true,
34
- * ranks: {
35
- * "Red": 2,
36
- * "Blue": 1,
37
- * "Green": 3
38
- * }
39
33
  * }
40
34
  * ],
41
35
  * additional_data: {
@@ -1 +1 @@
1
- {"version":3,"file":"create-product-options.d.ts","sourceRoot":"","sources":["../../../src/product/workflows/create-product-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7E,OAAO,EAIL,YAAY,EAEb,MAAM,mCAAmC,CAAA;AAI1C;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C;;OAEG;IACH,eAAe,EAAE,YAAY,CAAC,sBAAsB,EAAE,CAAA;CACvD,GAAG,cAAc,CAAA;AAElB,eAAO,MAAM,8BAA8B,2BAA2B,CAAA;AACtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,4BAA4B;;;gBAMvB,CAAC;;;;aAqBlB,CAAA"}
1
+ {"version":3,"file":"create-product-options.d.ts","sourceRoot":"","sources":["../../../src/product/workflows/create-product-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7E,OAAO,EACL,YAAY,EAKb,MAAM,mCAAmC,CAAA;AAI1C;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C;;OAEG;IACH,eAAe,EAAE,YAAY,CAAC,sBAAsB,EAAE,CAAA;CACvD,GAAG,cAAc,CAAA;AAElB,eAAO,MAAM,8BAA8B,2BAA2B,CAAA;AACtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,4BAA4B;;;gBAYjC,CAAJ;;;;aAeH,CAAA"}
@@ -26,12 +26,6 @@ exports.createProductOptionsWorkflowId = "create-product-options";
26
26
  * {
27
27
  * title: "Color",
28
28
  * values: ["Red", "Blue", "Green"]
29
- * is_exclusive: true,
30
- * ranks: {
31
- * "Red": 2,
32
- * "Blue": 1,
33
- * "Green": 3
34
- * }
35
29
  * }
36
30
  * ],
37
31
  * additional_data: {
@@ -1 +1 @@
1
- {"version":3,"file":"create-product-options.js","sourceRoot":"","sources":["../../../src/product/workflows/create-product-options.ts"],"names":[],"mappings":";;;AACA,qDAAuE;AACvE,qEAM0C;AAC1C,8DAA6D;AAC7D,oCAAmD;AAYtC,QAAA,8BAA8B,GAAG,wBAAwB,CAAA;AACtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACU,QAAA,4BAA4B,GAAG,IAAA,8BAAc,EACxD,sCAA8B,EAC9B,CAAC,KAAsD,EAAE,EAAE;IACzD,MAAM,cAAc,GAAG,IAAA,gCAAwB,EAAC,KAAK,CAAC,eAAe,CAAC,CAAA;IACtE,MAAM,qBAAqB,GAAG,IAAA,0BAAU,EAAC,uBAAuB,EAAE;QAChE,eAAe,EAAE,cAAc;QAC/B,eAAe,EAAE,KAAK,CAAC,eAAe;KACvC,CAAC,CAAA;IAEF,MAAM,cAAc,GAAG,IAAA,yBAAS,EAC9B,EAAE,cAAc,EAAE,EAClB,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE;QACrB,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YAC9B,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAA;QACrB,CAAC,CAAC,CAAA;IACJ,CAAC,CACF,CAAA;IAED,IAAA,0BAAa,EAAC;QACZ,SAAS,EAAE,mCAA2B,CAAC,OAAO;QAC9C,IAAI,EAAE,cAAc;KACrB,CAAC,CAAA;IAEF,OAAO,IAAI,gCAAgB,CAAC,cAAc,EAAE;QAC1C,KAAK,EAAE,CAAC,qBAAqB,CAAC;KAC/B,CAAC,CAAA;AACJ,CAAC,CACF,CAAA"}
1
+ {"version":3,"file":"create-product-options.js","sourceRoot":"","sources":["../../../src/product/workflows/create-product-options.ts"],"names":[],"mappings":";;;AACA,qDAAuE;AACvE,qEAM0C;AAC1C,8DAA6D;AAC7D,oCAAmD;AAYtC,QAAA,8BAA8B,GAAG,wBAAwB,CAAA;AACtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACU,QAAA,4BAA4B,GAAG,IAAA,8BAAc,EACxD,sCAA8B,EAC9B,CAAC,KAAsD,EAAE,EAAE;IACzD,MAAM,cAAc,GAAG,IAAA,gCAAwB,EAAC,KAAK,CAAC,eAAe,CAAC,CAAA;IACtE,MAAM,qBAAqB,GAAG,IAAA,0BAAU,EAAC,uBAAuB,EAAE;QAChE,eAAe,EAAE,cAAc;QAC/B,eAAe,EAAE,KAAK,CAAC,eAAe;KACvC,CAAC,CAAA;IAEF,MAAM,cAAc,GAAG,IAAA,yBAAS,EAC9B,EAAE,cAAc,EAAE,EAClB,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE;QACrB,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YAC9B,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAA;QACrB,CAAC,CAAC,CAAA;IACJ,CAAC,CACF,CAAA;IAED,IAAA,0BAAa,EAAC;QACZ,SAAS,EAAE,mCAA2B,CAAC,OAAO;QAC9C,IAAI,EAAE,cAAc;KACrB,CAAC,CAAA;IAEF,OAAO,IAAI,gCAAgB,CAAC,cAAc,EAAE;QAC1C,KAAK,EAAE,CAAC,qBAAqB,CAAC;KAC/B,CAAC,CAAA;AACJ,CAAC,CACF,CAAA"}
@@ -16,7 +16,6 @@ export * from "./delete-product-types";
16
16
  export * from "./delete-product-tags";
17
17
  export * from "./delete-product-variants";
18
18
  export * from "./delete-products";
19
- export * from "./create-and-link-product-options-to-product";
20
19
  export * from "./update-collections";
21
20
  export * from "./update-product-options";
22
21
  export * from "./update-product-types";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/product/workflows/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,8CAA8C,CAAA;AAC5D,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/product/workflows/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA"}
@@ -32,7 +32,6 @@ __exportStar(require("./delete-product-types"), exports);
32
32
  __exportStar(require("./delete-product-tags"), exports);
33
33
  __exportStar(require("./delete-product-variants"), exports);
34
34
  __exportStar(require("./delete-products"), exports);
35
- __exportStar(require("./create-and-link-product-options-to-product"), exports);
36
35
  __exportStar(require("./update-collections"), exports);
37
36
  __exportStar(require("./update-product-options"), exports);
38
37
  __exportStar(require("./update-product-types"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/product/workflows/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC;AACtC,yDAAsC;AACtC,mEAAgD;AAChD,2DAAwC;AACxC,mDAAgC;AAChC,+DAA4C;AAC5C,uDAAoC;AACpC,2DAAwC;AACxC,yDAAsC;AACtC,wDAAqC;AACrC,4DAAyC;AACzC,oDAAiC;AACjC,uDAAoC;AACpC,2DAAwC;AACxC,yDAAsC;AACtC,wDAAqC;AACrC,4DAAyC;AACzC,oDAAiC;AACjC,+EAA4D;AAC5D,uDAAoC;AACpC,2DAAwC;AACxC,yDAAsC;AACtC,wDAAqC;AACrC,4DAAyC;AACzC,oDAAiC;AACjC,oDAAiC;AACjC,oDAAiC;AACjC,8DAA2C;AAC3C,0DAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/product/workflows/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC;AACtC,yDAAsC;AACtC,mEAAgD;AAChD,2DAAwC;AACxC,mDAAgC;AAChC,+DAA4C;AAC5C,uDAAoC;AACpC,2DAAwC;AACxC,yDAAsC;AACtC,wDAAqC;AACrC,4DAAyC;AACzC,oDAAiC;AACjC,uDAAoC;AACpC,2DAAwC;AACxC,yDAAsC;AACtC,wDAAqC;AACrC,4DAAyC;AACzC,oDAAiC;AACjC,uDAAoC;AACpC,2DAAwC;AACxC,yDAAsC;AACtC,wDAAqC;AACrC,4DAAyC;AACzC,oDAAiC;AACjC,oDAAiC;AACjC,oDAAiC;AACjC,8DAA2C;AAC3C,0DAAuC"}
@@ -0,0 +1,3 @@
1
+ export * from "./steps";
2
+ export * from "./workflows";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/translation/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,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("./steps"), exports);
18
+ __exportStar(require("./workflows"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/translation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,8CAA2B"}
@@ -0,0 +1,17 @@
1
+ import { CreateTranslationDTO } from "@medusajs/framework/types";
2
+ export declare const createTranslationsStepId = "create-translations";
3
+ /**
4
+ * This step creates one or more translations.
5
+ *
6
+ * @example
7
+ * const data = createTranslationsStep([
8
+ * {
9
+ * reference_id: "prod_123",
10
+ * reference: "product",
11
+ * locale: "fr-FR",
12
+ * translations: { title: "Produit", description: "Description du produit" }
13
+ * }
14
+ * ])
15
+ */
16
+ export declare const createTranslationsStep: import("@medusajs/framework/workflows-sdk").StepFunction<CreateTranslationDTO[], import("@medusajs/framework/types").TranslationDTO[]>;
17
+ //# sourceMappingURL=create-translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-translations.d.ts","sourceRoot":"","sources":["../../../src/translation/steps/create-translations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAErB,MAAM,2BAA2B,CAAA;AAIlC,eAAO,MAAM,wBAAwB,wBAAwB,CAAA;AAC7D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,wIAyBlC,CAAA"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createTranslationsStep = exports.createTranslationsStepId = void 0;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
6
+ exports.createTranslationsStepId = "create-translations";
7
+ /**
8
+ * This step creates one or more translations.
9
+ *
10
+ * @example
11
+ * const data = createTranslationsStep([
12
+ * {
13
+ * reference_id: "prod_123",
14
+ * reference: "product",
15
+ * locale: "fr-FR",
16
+ * translations: { title: "Produit", description: "Description du produit" }
17
+ * }
18
+ * ])
19
+ */
20
+ exports.createTranslationsStep = (0, workflows_sdk_1.createStep)(exports.createTranslationsStepId, async (data, { container }) => {
21
+ const service = container.resolve(utils_1.Modules.TRANSLATION);
22
+ const created = await service.createTranslations(data);
23
+ return new workflows_sdk_1.StepResponse(created, created.map((translation) => translation.id));
24
+ }, async (createdIds, { container }) => {
25
+ if (!createdIds?.length) {
26
+ return;
27
+ }
28
+ const service = container.resolve(utils_1.Modules.TRANSLATION);
29
+ await service.deleteTranslations(createdIds);
30
+ });
31
+ //# sourceMappingURL=create-translations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-translations.js","sourceRoot":"","sources":["../../../src/translation/steps/create-translations.ts"],"names":[],"mappings":";;;AAIA,qDAAmD;AACnD,qEAA4E;AAE/D,QAAA,wBAAwB,GAAG,qBAAqB,CAAA;AAC7D;;;;;;;;;;;;GAYG;AACU,QAAA,sBAAsB,GAAG,IAAA,0BAAU,EAC9C,gCAAwB,EACxB,KAAK,EAAE,IAA4B,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IACpD,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAC/B,eAAO,CAAC,WAAW,CACpB,CAAA;IAED,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAA;IAEtD,OAAO,IAAI,4BAAY,CACrB,OAAO,EACP,OAAO,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAC7C,CAAA;AACH,CAAC,EACD,KAAK,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAClC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;QACxB,OAAM;IACR,CAAC;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAC/B,eAAO,CAAC,WAAW,CACpB,CAAA;IAED,MAAM,OAAO,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAA;AAC9C,CAAC,CACF,CAAA"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The IDs of the translations to delete.
3
+ */
4
+ export type DeleteTranslationsStepInput = string[];
5
+ export declare const deleteTranslationsStepId = "delete-translations";
6
+ /**
7
+ * This step deletes one or more translations.
8
+ */
9
+ export declare const deleteTranslationsStep: import("@medusajs/framework/workflows-sdk").StepFunction<DeleteTranslationsStepInput, undefined>;
10
+ //# sourceMappingURL=delete-translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-translations.d.ts","sourceRoot":"","sources":["../../../src/translation/steps/delete-translations.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,MAAM,EAAE,CAAA;AAElD,eAAO,MAAM,wBAAwB,wBAAwB,CAAA;AAC7D;;GAEG;AACH,eAAO,MAAM,sBAAsB,kGAsBlC,CAAA"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteTranslationsStep = exports.deleteTranslationsStepId = void 0;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
6
+ exports.deleteTranslationsStepId = "delete-translations";
7
+ /**
8
+ * This step deletes one or more translations.
9
+ */
10
+ exports.deleteTranslationsStep = (0, workflows_sdk_1.createStep)(exports.deleteTranslationsStepId, async (ids, { container }) => {
11
+ const service = container.resolve(utils_1.Modules.TRANSLATION);
12
+ await service.softDeleteTranslations(ids);
13
+ return new workflows_sdk_1.StepResponse(void 0, ids);
14
+ }, async (prevIds, { container }) => {
15
+ if (!prevIds?.length) {
16
+ return;
17
+ }
18
+ const service = container.resolve(utils_1.Modules.TRANSLATION);
19
+ await service.restoreTranslations(prevIds);
20
+ });
21
+ //# sourceMappingURL=delete-translations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-translations.js","sourceRoot":"","sources":["../../../src/translation/steps/delete-translations.ts"],"names":[],"mappings":";;;AACA,qDAAmD;AACnD,qEAA4E;AAO/D,QAAA,wBAAwB,GAAG,qBAAqB,CAAA;AAC7D;;GAEG;AACU,QAAA,sBAAsB,GAAG,IAAA,0BAAU,EAC9C,gCAAwB,EACxB,KAAK,EAAE,GAAgC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IACxD,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAC/B,eAAO,CAAC,WAAW,CACpB,CAAA;IAED,MAAM,OAAO,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAA;IAEzC,OAAO,IAAI,4BAAY,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC,EACD,KAAK,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAC/B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;QACrB,OAAM;IACR,CAAC;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAC/B,eAAO,CAAC,WAAW,CACpB,CAAA;IAED,MAAM,OAAO,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAA;AAC5C,CAAC,CACF,CAAA"}
@@ -0,0 +1,5 @@
1
+ export * from "./create-translations";
2
+ export * from "./delete-translations";
3
+ export * from "./update-translations";
4
+ export * from "./validate-translations";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/translation/steps/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA"}
@@ -0,0 +1,21 @@
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("./create-translations"), exports);
18
+ __exportStar(require("./delete-translations"), exports);
19
+ __exportStar(require("./update-translations"), exports);
20
+ __exportStar(require("./validate-translations"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/translation/steps/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC;AACrC,wDAAqC;AACrC,wDAAqC;AACrC,0DAAuC"}
@@ -0,0 +1,33 @@
1
+ import { FilterableTranslationProps, UpdateTranslationDTO } from "@medusajs/framework/types";
2
+ /**
3
+ * The data to update translations.
4
+ */
5
+ export type UpdateTranslationsStepInput = {
6
+ /**
7
+ * The filters to select the translations to update.
8
+ */
9
+ selector: FilterableTranslationProps;
10
+ /**
11
+ * The data to update in the translations.
12
+ */
13
+ update: UpdateTranslationDTO;
14
+ } | {
15
+ translations: UpdateTranslationDTO[];
16
+ };
17
+ export declare const updateTranslationsStepId = "update-translations";
18
+ /**
19
+ * This step updates translations matching the specified filters.
20
+ *
21
+ * @example
22
+ * const data = updateTranslationsStep({
23
+ * selector: {
24
+ * reference_id: "prod_123",
25
+ * locale: "fr-FR"
26
+ * },
27
+ * update: {
28
+ * translations: { title: "Nouveau titre" }
29
+ * }
30
+ * })
31
+ */
32
+ export declare const updateTranslationsStep: import("@medusajs/framework/workflows-sdk").StepFunction<UpdateTranslationsStepInput, import("@medusajs/framework/types").TranslationDTO[]>;
33
+ //# sourceMappingURL=update-translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-translations.d.ts","sourceRoot":"","sources":["../../../src/translation/steps/update-translations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAE1B,oBAAoB,EACrB,MAAM,2BAA2B,CAAA;AAQlC;;GAEG;AACH,MAAM,MAAM,2BAA2B,GACnC;IACE;;OAEG;IACH,QAAQ,EAAE,0BAA0B,CAAA;IACpC;;OAEG;IACH,MAAM,EAAE,oBAAoB,CAAA;CAC7B,GACD;IACE,YAAY,EAAE,oBAAoB,EAAE,CAAA;CACrC,CAAA;AAEL,eAAO,MAAM,wBAAwB,wBAAwB,CAAA;AAC7D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,6IAmElC,CAAA"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateTranslationsStep = exports.updateTranslationsStepId = void 0;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
6
+ exports.updateTranslationsStepId = "update-translations";
7
+ /**
8
+ * This step updates translations matching the specified filters.
9
+ *
10
+ * @example
11
+ * const data = updateTranslationsStep({
12
+ * selector: {
13
+ * reference_id: "prod_123",
14
+ * locale: "fr-FR"
15
+ * },
16
+ * update: {
17
+ * translations: { title: "Nouveau titre" }
18
+ * }
19
+ * })
20
+ */
21
+ exports.updateTranslationsStep = (0, workflows_sdk_1.createStep)(exports.updateTranslationsStepId, async (data, { container }) => {
22
+ const service = container.resolve(utils_1.Modules.TRANSLATION);
23
+ if ("translations" in data) {
24
+ if (data.translations.some((t) => !t.id)) {
25
+ throw new utils_1.MedusaError(utils_1.MedusaErrorTypes.INVALID_DATA, "Translation ID is required when doing a batch update of translations");
26
+ }
27
+ if (!data.translations.length) {
28
+ return new workflows_sdk_1.StepResponse([], []);
29
+ }
30
+ const prevData = await service.listTranslations({
31
+ id: data.translations.map((t) => t.id),
32
+ });
33
+ const translations = await service.updateTranslations(data.translations);
34
+ return new workflows_sdk_1.StepResponse(translations, prevData);
35
+ }
36
+ const prevData = await service.listTranslations(data.selector, {
37
+ select: [
38
+ "id",
39
+ "reference_id",
40
+ "reference",
41
+ "locale_code",
42
+ "translations",
43
+ ],
44
+ });
45
+ if (Object.keys(data.update).length === 0) {
46
+ return new workflows_sdk_1.StepResponse(prevData, []);
47
+ }
48
+ const translations = await service.updateTranslations({
49
+ selector: data.selector,
50
+ data: data.update,
51
+ });
52
+ return new workflows_sdk_1.StepResponse(translations, prevData);
53
+ }, async (prevData, { container }) => {
54
+ if (!prevData?.length) {
55
+ return;
56
+ }
57
+ const service = container.resolve(utils_1.Modules.TRANSLATION);
58
+ await service.updateTranslations(prevData.map((t) => ({
59
+ id: t.id,
60
+ reference_id: t.reference_id,
61
+ reference: t.reference,
62
+ locale_code: t.locale_code,
63
+ translations: t.translations,
64
+ })));
65
+ });
66
+ //# sourceMappingURL=update-translations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-translations.js","sourceRoot":"","sources":["../../../src/translation/steps/update-translations.ts"],"names":[],"mappings":";;;AAKA,qDAIkC;AAClC,qEAA4E;AAoB/D,QAAA,wBAAwB,GAAG,qBAAqB,CAAA;AAC7D;;;;;;;;;;;;;GAaG;AACU,QAAA,sBAAsB,GAAG,IAAA,0BAAU,EAC9C,gCAAwB,EACxB,KAAK,EAAE,IAAiC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IACzD,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAC/B,eAAO,CAAC,WAAW,CACpB,CAAA;IAED,IAAI,cAAc,IAAI,IAAI,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CA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E,QAAQ,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAChC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QACtB,OAAM;IACR,CAAC;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAC/B,eAAO,CAAC,WAAW,CACpB,CAAA;IAED,MAAM,OAAO,CAAC,kBAAkB,CAC9B,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACnB,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,YAAY,EAAE,CAAC,CAAC,YAAY;QAC5B,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,YAAY,EAAE,CAAC,CAAC,YAAY;KAC7B,CAAC,CAAC,CACJ,CAAA;AACH,CAAC,CACF,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { CreateTranslationDTO, UpdateTranslationDTO } from "@medusajs/types";
2
+ export declare const validateTranslationsStepId = "validate-translations";
3
+ export type ValidateTranslationsStepInput = CreateTranslationDTO[] | CreateTranslationDTO | UpdateTranslationDTO[] | UpdateTranslationDTO;
4
+ export declare const validateTranslationsStep: import("@medusajs/framework/workflows-sdk").StepFunction<ValidateTranslationsStepInput, undefined>;
5
+ //# sourceMappingURL=validate-translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-translations.d.ts","sourceRoot":"","sources":["../../../src/translation/steps/validate-translations.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAE5E,eAAO,MAAM,0BAA0B,0BAA0B,CAAA;AAEjE,MAAM,MAAM,6BAA6B,GACrC,oBAAoB,EAAE,GACtB,oBAAoB,GACpB,oBAAoB,EAAE,GACtB,oBAAoB,CAAA;AAGxB,eAAO,MAAM,wBAAwB,oGAuCpC,CAAA"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateTranslationsStep = exports.validateTranslationsStepId = void 0;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
6
+ exports.validateTranslationsStepId = "validate-translations";
7
+ // TODO: Do we want to validate anything else here?
8
+ exports.validateTranslationsStep = (0, workflows_sdk_1.createStep)(exports.validateTranslationsStepId, async (data, { container }) => {
9
+ const query = container.resolve(utils_1.ContainerRegistrationKeys.QUERY);
10
+ const { data: [store], } = await query.graph({
11
+ entity: "store",
12
+ fields: ["id", "supported_locales.*"],
13
+ pagination: {
14
+ take: 1,
15
+ },
16
+ }, {
17
+ cache: { enable: true },
18
+ });
19
+ const enabledLocales = (store.supported_locales ?? []).map((locale) => locale.locale_code);
20
+ const normalizedInput = Array.isArray(data) ? data : [data];
21
+ const unsupportedLocales = normalizedInput
22
+ .filter((translation) => Boolean(translation.locale_code))
23
+ .map((translation) => translation.locale_code)
24
+ .filter((locale) => !enabledLocales.includes(locale));
25
+ if (unsupportedLocales.length) {
26
+ throw new utils_1.MedusaError(utils_1.MedusaErrorTypes.INVALID_DATA, `The following locales are not supported in the store: ${unsupportedLocales.join(", ")}`);
27
+ }
28
+ return new workflows_sdk_1.StepResponse(void 0);
29
+ });
30
+ //# sourceMappingURL=validate-translations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-translations.js","sourceRoot":"","sources":["../../../src/translation/steps/validate-translations.ts"],"names":[],"mappings":";;;AAAA,qDAIkC;AAClC,qEAA4E;AAG/D,QAAA,0BAA0B,GAAG,uBAAuB,CAAA;AAQjE,mDAAmD;AACtC,QAAA,wBAAwB,GAAG,IAAA,0BAAU,EAChD,kCAA0B,EAC1B,KAAK,EAAE,IAAmC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAC3D,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,iCAAyB,CAAC,KAAK,CAAC,CAAA;IAChE,MAAM,EACJ,IAAI,EAAE,CAAC,KAAK,CAAC,GACd,GAAG,MAAM,KAAK,CAAC,KAAK,CACnB;QACE,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,CAAC,IAAI,EAAE,qBAAqB,CAAC;QACrC,UAAU,EAAE;YACV,IAAI,EAAE,CAAC;SACR;KACF,EACD;QACE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;KACxB,CACF,CAAA;IAED,MAAM,cAAc,GAAG,CAAC,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,GAAG,CACxD,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAC/B,CAAA;IACD,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAE3D,MAAM,kBAAkB,GAAG,eAAe;SACvC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;SACzD,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC;SAC7C,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;IAEvD,IAAI,kBAAkB,CAAC,MAAM,EAAE,CAAC;QAC9B,MAAM,IAAI,mBAAW,CACnB,wBAAgB,CAAC,YAAY,EAC7B,yDAAyD,kBAAkB,CAAC,IAAI,CAC9E,IAAI,CACL,EAAE,CACJ,CAAA;IACH,CAAC;IACD,OAAO,IAAI,4BAAY,CAAC,KAAK,CAAC,CAAC,CAAA;AACjC,CAAC,CACF,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { CreateTranslationDTO, UpdateTranslationDTO } from "@medusajs/types";
2
+ export declare const batchTranslationsWorkflowId = "batch-translations";
3
+ export type BatchTranslationsWorkflowInput = {
4
+ create: CreateTranslationDTO[];
5
+ update: UpdateTranslationDTO[];
6
+ delete: string[];
7
+ };
8
+ export declare const batchTranslationsWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<BatchTranslationsWorkflowInput, {
9
+ created: import("@medusajs/types").TranslationDTO[];
10
+ updated: import("@medusajs/types").TranslationDTO[];
11
+ deleted: unknown;
12
+ }, []>;
13
+ //# sourceMappingURL=batch-translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-translations.d.ts","sourceRoot":"","sources":["../../../src/translation/workflows/batch-translations.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAK5E,eAAO,MAAM,2BAA2B,uBAAuB,CAAA;AAE/D,MAAM,MAAM,8BAA8B,GAAG;IAC3C,MAAM,EAAE,oBAAoB,EAAE,CAAA;IAC9B,MAAM,EAAE,oBAAoB,EAAE,CAAA;IAC9B,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB,CAAA;AACD,eAAO,MAAM,yBAAyB;;;;MAyBrC,CAAA"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.batchTranslationsWorkflow = exports.batchTranslationsWorkflowId = void 0;
4
+ const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
5
+ const create_translations_1 = require("./create-translations");
6
+ const delete_translations_1 = require("./delete-translations");
7
+ const update_translations_1 = require("./update-translations");
8
+ exports.batchTranslationsWorkflowId = "batch-translations";
9
+ exports.batchTranslationsWorkflow = (0, workflows_sdk_1.createWorkflow)(exports.batchTranslationsWorkflowId, (input) => {
10
+ const [created, updated, deleted] = (0, workflows_sdk_1.parallelize)(create_translations_1.createTranslationsWorkflow.runAsStep({
11
+ input: {
12
+ translations: input.create,
13
+ },
14
+ }), update_translations_1.updateTranslationsWorkflow.runAsStep({
15
+ input: {
16
+ translations: input.update,
17
+ },
18
+ }), delete_translations_1.deleteTranslationsWorkflow.runAsStep({
19
+ input: {
20
+ ids: input.delete,
21
+ },
22
+ }));
23
+ return new workflows_sdk_1.WorkflowResponse((0, workflows_sdk_1.transform)({ created, updated, deleted }, (result) => result));
24
+ });
25
+ //# sourceMappingURL=batch-translations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-translations.js","sourceRoot":"","sources":["../../../src/translation/workflows/batch-translations.ts"],"names":[],"mappings":";;;AAAA,qEAK0C;AAE1C,+DAAkE;AAClE,+DAAkE;AAClE,+DAAkE;AAErD,QAAA,2BAA2B,GAAG,oBAAoB,CAAA;AAOlD,QAAA,yBAAyB,GAAG,IAAA,8BAAc,EACrD,mCAA2B,EAC3B,CAAC,KAAqC,EAAE,EAAE;IACxC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,IAAA,2BAAW,EAC7C,gDAA0B,CAAC,SAAS,CAAC;QACnC,KAAK,EAAE;YACL,YAAY,EAAE,KAAK,CAAC,MAAM;SAC3B;KACF,CAAC,EACF,gDAA0B,CAAC,SAAS,CAAC;QACnC,KAAK,EAAE;YACL,YAAY,EAAE,KAAK,CAAC,MAAM;SAC3B;KACF,CAAC,EACF,gDAA0B,CAAC,SAAS,CAAC;QACnC,KAAK,EAAE;YACL,GAAG,EAAE,KAAK,CAAC,MAAM;SAClB;KACF,CAAC,CACH,CAAA;IAED,OAAO,IAAI,gCAAgB,CACzB,IAAA,yBAAS,EAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,CAC7D,CAAA;AACH,CAAC,CACF,CAAA"}