@medusajs/order 0.1.3 → 1.0.0-rc-20241003153304

Sign up to get free protection for your applications and to get access to all the features.
Files changed (379) hide show
  1. package/dist/index.d.ts +6 -8
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +4 -26
  4. package/dist/index.js.map +1 -1
  5. package/dist/joiner-config.d.ts +2 -5
  6. package/dist/joiner-config.d.ts.map +1 -0
  7. package/dist/joiner-config.js +21 -28
  8. package/dist/joiner-config.js.map +1 -1
  9. package/dist/migrations/Migration20240219102530.d.ts +1 -0
  10. package/dist/migrations/Migration20240219102530.d.ts.map +1 -0
  11. package/dist/migrations/Migration20240219102530.js +53 -19
  12. package/dist/migrations/Migration20240219102530.js.map +1 -1
  13. package/dist/migrations/Migration20240604100512.d.ts +5 -0
  14. package/dist/migrations/Migration20240604100512.d.ts.map +1 -0
  15. package/dist/migrations/Migration20240604100512.js +371 -0
  16. package/dist/migrations/Migration20240604100512.js.map +1 -0
  17. package/dist/migrations/Migration20240715102100.d.ts +5 -0
  18. package/dist/migrations/Migration20240715102100.d.ts.map +1 -0
  19. package/dist/migrations/Migration20240715102100.js +15 -0
  20. package/dist/migrations/Migration20240715102100.js.map +1 -0
  21. package/dist/migrations/Migration20240715174100.d.ts +5 -0
  22. package/dist/migrations/Migration20240715174100.d.ts.map +1 -0
  23. package/dist/migrations/Migration20240715174100.js +21 -0
  24. package/dist/migrations/Migration20240715174100.js.map +1 -0
  25. package/dist/migrations/Migration20240716081800.d.ts +5 -0
  26. package/dist/migrations/Migration20240716081800.d.ts.map +1 -0
  27. package/dist/migrations/Migration20240716081800.js +67 -0
  28. package/dist/migrations/Migration20240716081800.js.map +1 -0
  29. package/dist/migrations/Migration20240801085921.d.ts +5 -0
  30. package/dist/migrations/Migration20240801085921.d.ts.map +1 -0
  31. package/dist/migrations/Migration20240801085921.js +30 -0
  32. package/dist/migrations/Migration20240801085921.js.map +1 -0
  33. package/dist/migrations/Migration20240821164505.d.ts +6 -0
  34. package/dist/migrations/Migration20240821164505.d.ts.map +1 -0
  35. package/dist/migrations/Migration20240821164505.js +26 -0
  36. package/dist/migrations/Migration20240821164505.js.map +1 -0
  37. package/dist/migrations/Migration20240821170920.d.ts +6 -0
  38. package/dist/migrations/Migration20240821170920.d.ts.map +1 -0
  39. package/dist/migrations/Migration20240821170920.js +18 -0
  40. package/dist/migrations/Migration20240821170920.js.map +1 -0
  41. package/dist/migrations/Migration20240827133639.d.ts +6 -0
  42. package/dist/migrations/Migration20240827133639.d.ts.map +1 -0
  43. package/dist/migrations/Migration20240827133639.js +17 -0
  44. package/dist/migrations/Migration20240827133639.js.map +1 -0
  45. package/dist/migrations/Migration20240902195921.d.ts +6 -0
  46. package/dist/migrations/Migration20240902195921.d.ts.map +1 -0
  47. package/dist/migrations/Migration20240902195921.js +16 -0
  48. package/dist/migrations/Migration20240902195921.js.map +1 -0
  49. package/dist/migrations/Migration20240913092514.d.ts +6 -0
  50. package/dist/migrations/Migration20240913092514.d.ts.map +1 -0
  51. package/dist/migrations/Migration20240913092514.js +17 -0
  52. package/dist/migrations/Migration20240913092514.js.map +1 -0
  53. package/dist/models/address.d.ts +4 -3
  54. package/dist/models/address.d.ts.map +1 -0
  55. package/dist/models/address.js +22 -22
  56. package/dist/models/address.js.map +1 -1
  57. package/dist/models/adjustment-line.d.ts +5 -3
  58. package/dist/models/adjustment-line.d.ts.map +1 -0
  59. package/dist/models/adjustment-line.js +6 -1
  60. package/dist/models/adjustment-line.js.map +1 -1
  61. package/dist/models/claim-item-image.d.ts +19 -0
  62. package/dist/models/claim-item-image.d.ts.map +1 -0
  63. package/dist/models/claim-item-image.js +109 -0
  64. package/dist/models/claim-item-image.js.map +1 -0
  65. package/dist/models/claim-item.d.ts +29 -0
  66. package/dist/models/claim-item.d.ts.map +1 -0
  67. package/dist/models/claim-item.js +157 -0
  68. package/dist/models/claim-item.js.map +1 -0
  69. package/dist/models/claim.d.ts +37 -0
  70. package/dist/models/claim.d.ts.map +1 -0
  71. package/dist/models/claim.js +201 -0
  72. package/dist/models/claim.js.map +1 -0
  73. package/dist/models/exchange-item.d.ts +24 -0
  74. package/dist/models/exchange-item.d.ts.map +1 -0
  75. package/dist/models/exchange-item.js +138 -0
  76. package/dist/models/exchange-item.js.map +1 -0
  77. package/dist/models/exchange.d.ts +35 -0
  78. package/dist/models/exchange.d.ts.map +1 -0
  79. package/dist/models/exchange.js +194 -0
  80. package/dist/models/exchange.js.map +1 -0
  81. package/dist/models/index.d.ts +18 -9
  82. package/dist/models/index.d.ts.map +1 -0
  83. package/dist/models/index.js +26 -10
  84. package/dist/models/index.js.map +1 -1
  85. package/dist/models/line-item-adjustment.d.ts +5 -3
  86. package/dist/models/line-item-adjustment.d.ts.map +1 -0
  87. package/dist/models/line-item-adjustment.js +12 -12
  88. package/dist/models/line-item-adjustment.js.map +1 -1
  89. package/dist/models/line-item-tax-line.d.ts +5 -3
  90. package/dist/models/line-item-tax-line.d.ts.map +1 -0
  91. package/dist/models/line-item-tax-line.js +12 -12
  92. package/dist/models/line-item-tax-line.js.map +1 -1
  93. package/dist/models/line-item.d.ts +11 -8
  94. package/dist/models/line-item.d.ts.map +1 -0
  95. package/dist/models/line-item.js +58 -39
  96. package/dist/models/line-item.js.map +1 -1
  97. package/dist/models/order-change-action.d.ts +17 -6
  98. package/dist/models/order-change-action.d.ts.map +1 -0
  99. package/dist/models/order-change-action.js +110 -8
  100. package/dist/models/order-change-action.js.map +1 -1
  101. package/dist/models/order-change.d.ts +18 -6
  102. package/dist/models/order-change.d.ts.map +1 -0
  103. package/dist/models/order-change.js +108 -6
  104. package/dist/models/order-change.js.map +1 -1
  105. package/dist/models/order-item.d.ts +10 -7
  106. package/dist/models/order-item.d.ts.map +1 -0
  107. package/dist/models/order-item.js +29 -19
  108. package/dist/models/order-item.js.map +1 -1
  109. package/dist/models/order-shipping-method.d.ts +17 -7
  110. package/dist/models/order-shipping-method.d.ts.map +1 -0
  111. package/dist/models/order-shipping-method.js +113 -33
  112. package/dist/models/order-shipping-method.js.map +1 -1
  113. package/dist/models/order-summary.d.ts +7 -8
  114. package/dist/models/order-summary.d.ts.map +1 -0
  115. package/dist/models/order-summary.js +14 -10
  116. package/dist/models/order-summary.js.map +1 -1
  117. package/dist/models/order.d.ts +13 -11
  118. package/dist/models/order.d.ts.map +1 -0
  119. package/dist/models/order.js +12 -2
  120. package/dist/models/order.js.map +1 -1
  121. package/dist/models/return-item.d.ts +31 -0
  122. package/dist/models/return-item.d.ts.map +1 -0
  123. package/dist/models/return-item.js +180 -0
  124. package/dist/models/return-item.js.map +1 -0
  125. package/dist/models/return-reason.d.ts +22 -0
  126. package/dist/models/return-reason.d.ts.map +1 -0
  127. package/dist/models/return-reason.js +122 -0
  128. package/dist/models/return-reason.js.map +1 -0
  129. package/dist/models/return.d.ts +41 -0
  130. package/dist/models/return.d.ts.map +1 -0
  131. package/dist/models/return.js +227 -0
  132. package/dist/models/return.js.map +1 -0
  133. package/dist/models/shipping-method-adjustment.d.ts +5 -3
  134. package/dist/models/shipping-method-adjustment.d.ts.map +1 -0
  135. package/dist/models/shipping-method-adjustment.js +12 -12
  136. package/dist/models/shipping-method-adjustment.js.map +1 -1
  137. package/dist/models/shipping-method-tax-line.d.ts +5 -3
  138. package/dist/models/shipping-method-tax-line.d.ts.map +1 -0
  139. package/dist/models/shipping-method-tax-line.js +12 -12
  140. package/dist/models/shipping-method-tax-line.js.map +1 -1
  141. package/dist/models/shipping-method.d.ts +10 -7
  142. package/dist/models/shipping-method.d.ts.map +1 -0
  143. package/dist/models/shipping-method.js +42 -24
  144. package/dist/models/shipping-method.js.map +1 -1
  145. package/dist/models/tax-line.d.ts +4 -2
  146. package/dist/models/tax-line.d.ts.map +1 -0
  147. package/dist/models/tax-line.js +8 -1
  148. package/dist/models/tax-line.js.map +1 -1
  149. package/dist/models/transaction.d.ts +18 -6
  150. package/dist/models/transaction.d.ts.map +1 -0
  151. package/dist/models/transaction.js +133 -24
  152. package/dist/models/transaction.js.map +1 -1
  153. package/dist/repositories/claim.d.ts +9 -0
  154. package/dist/repositories/claim.d.ts.map +1 -0
  155. package/dist/repositories/claim.js +11 -0
  156. package/dist/repositories/claim.js.map +1 -0
  157. package/dist/repositories/exchange.d.ts +9 -0
  158. package/dist/repositories/exchange.d.ts.map +1 -0
  159. package/dist/repositories/exchange.js +11 -0
  160. package/dist/repositories/exchange.js.map +1 -0
  161. package/dist/repositories/index.d.ts +5 -2
  162. package/dist/repositories/index.d.ts.map +1 -0
  163. package/dist/repositories/index.js +8 -17
  164. package/dist/repositories/index.js.map +1 -1
  165. package/dist/repositories/order.d.ts +2 -4
  166. package/dist/repositories/order.d.ts.map +1 -0
  167. package/dist/repositories/order.js +3 -86
  168. package/dist/repositories/order.js.map +1 -1
  169. package/dist/repositories/return.d.ts +9 -0
  170. package/dist/repositories/return.d.ts.map +1 -0
  171. package/dist/repositories/return.js +11 -0
  172. package/dist/repositories/return.js.map +1 -0
  173. package/dist/schema/index.d.ts +3 -0
  174. package/dist/schema/index.d.ts.map +1 -0
  175. package/dist/schema/index.js +556 -0
  176. package/dist/schema/index.js.map +1 -0
  177. package/dist/services/actions/cancel-claim.d.ts +3 -0
  178. package/dist/services/actions/cancel-claim.d.ts.map +1 -0
  179. package/dist/services/actions/cancel-claim.js +85 -0
  180. package/dist/services/actions/cancel-claim.js.map +1 -0
  181. package/dist/services/actions/cancel-exchange.d.ts +3 -0
  182. package/dist/services/actions/cancel-exchange.d.ts.map +1 -0
  183. package/dist/services/actions/cancel-exchange.js +71 -0
  184. package/dist/services/actions/cancel-exchange.js.map +1 -0
  185. package/dist/services/actions/cancel-fulfillment.d.ts +3 -0
  186. package/dist/services/actions/cancel-fulfillment.d.ts.map +1 -0
  187. package/dist/services/actions/cancel-fulfillment.js +31 -0
  188. package/dist/services/actions/cancel-fulfillment.js.map +1 -0
  189. package/dist/services/actions/cancel-return.d.ts +3 -0
  190. package/dist/services/actions/cancel-return.d.ts.map +1 -0
  191. package/dist/services/actions/cancel-return.js +69 -0
  192. package/dist/services/actions/cancel-return.js.map +1 -0
  193. package/dist/services/actions/create-claim.d.ts +3 -0
  194. package/dist/services/actions/create-claim.d.ts.map +1 -0
  195. package/dist/services/actions/create-claim.js +225 -0
  196. package/dist/services/actions/create-claim.js.map +1 -0
  197. package/dist/services/actions/create-exchange.d.ts +3 -0
  198. package/dist/services/actions/create-exchange.d.ts.map +1 -0
  199. package/dist/services/actions/create-exchange.js +191 -0
  200. package/dist/services/actions/create-exchange.js.map +1 -0
  201. package/dist/services/actions/create-return.d.ts +3 -0
  202. package/dist/services/actions/create-return.d.ts.map +1 -0
  203. package/dist/services/actions/create-return.js +100 -0
  204. package/dist/services/actions/create-return.js.map +1 -0
  205. package/dist/services/actions/index.d.ts +12 -0
  206. package/dist/services/actions/index.d.ts.map +1 -0
  207. package/dist/services/actions/index.js +28 -0
  208. package/dist/services/actions/index.js.map +1 -0
  209. package/dist/services/actions/receive-return.d.ts +3 -0
  210. package/dist/services/actions/receive-return.d.ts.map +1 -0
  211. package/dist/services/actions/receive-return.js +71 -0
  212. package/dist/services/actions/receive-return.js.map +1 -0
  213. package/dist/services/actions/register-delivery.d.ts +3 -0
  214. package/dist/services/actions/register-delivery.d.ts.map +1 -0
  215. package/dist/services/actions/register-delivery.js +29 -0
  216. package/dist/services/actions/register-delivery.js.map +1 -0
  217. package/dist/services/actions/register-fulfillment.d.ts +3 -0
  218. package/dist/services/actions/register-fulfillment.d.ts.map +1 -0
  219. package/dist/services/actions/register-fulfillment.js +29 -0
  220. package/dist/services/actions/register-fulfillment.js.map +1 -0
  221. package/dist/services/actions/register-shipment.d.ts +3 -0
  222. package/dist/services/actions/register-shipment.d.ts.map +1 -0
  223. package/dist/services/actions/register-shipment.js +37 -0
  224. package/dist/services/actions/register-shipment.js.map +1 -0
  225. package/dist/services/index.d.ts +1 -1
  226. package/dist/services/index.d.ts.map +1 -0
  227. package/dist/services/index.js +1 -3
  228. package/dist/services/index.js.map +1 -1
  229. package/dist/services/order-module-service.d.ts +191 -109
  230. package/dist/services/order-module-service.d.ts.map +1 -0
  231. package/dist/services/order-module-service.js +1165 -425
  232. package/dist/services/order-module-service.js.map +1 -1
  233. package/dist/services/order-service.d.ts +6 -5
  234. package/dist/services/order-service.d.ts.map +1 -0
  235. package/dist/services/order-service.js +2 -2
  236. package/dist/services/order-service.js.map +1 -1
  237. package/dist/tsconfig.tsbuildinfo +1 -0
  238. package/dist/types/address.d.ts +2 -1
  239. package/dist/types/address.d.ts.map +1 -0
  240. package/dist/types/index.d.ts +5 -2
  241. package/dist/types/index.d.ts.map +1 -0
  242. package/dist/types/index.js +2 -0
  243. package/dist/types/index.js.map +1 -1
  244. package/dist/types/line-item-adjustment.d.ts +2 -1
  245. package/dist/types/line-item-adjustment.d.ts.map +1 -0
  246. package/dist/types/line-item-tax-line.d.ts +1 -0
  247. package/dist/types/line-item-tax-line.d.ts.map +1 -0
  248. package/dist/types/line-item.d.ts +2 -1
  249. package/dist/types/line-item.d.ts.map +1 -0
  250. package/dist/types/order-change.d.ts +4 -0
  251. package/dist/types/order-change.d.ts.map +1 -0
  252. package/dist/types/order-change.js +3 -0
  253. package/dist/types/order-change.js.map +1 -0
  254. package/dist/types/order-detail.d.ts +3 -2
  255. package/dist/types/order-detail.d.ts.map +1 -0
  256. package/dist/types/order.d.ts +4 -3
  257. package/dist/types/order.d.ts.map +1 -0
  258. package/dist/types/return-reason.d.ts +5 -0
  259. package/dist/types/return-reason.d.ts.map +1 -0
  260. package/dist/types/return-reason.js +3 -0
  261. package/dist/types/return-reason.js.map +1 -0
  262. package/dist/types/shipping-method-adjustment.d.ts +2 -1
  263. package/dist/types/shipping-method-adjustment.d.ts.map +1 -0
  264. package/dist/types/shipping-method-tax-line.d.ts +1 -0
  265. package/dist/types/shipping-method-tax-line.d.ts.map +1 -0
  266. package/dist/types/shipping-method.d.ts +5 -1
  267. package/dist/types/shipping-method.d.ts.map +1 -0
  268. package/dist/types/tax-line.d.ts +2 -1
  269. package/dist/types/tax-line.d.ts.map +1 -0
  270. package/dist/types/transaction.d.ts +2 -1
  271. package/dist/types/transaction.d.ts.map +1 -0
  272. package/dist/types/utils/index.d.ts +41 -23
  273. package/dist/types/utils/index.d.ts.map +1 -0
  274. package/dist/types/utils/index.js +0 -1
  275. package/dist/types/utils/index.js.map +1 -1
  276. package/dist/utils/actions/cancel-item-fulfillment.d.ts +2 -0
  277. package/dist/utils/actions/cancel-item-fulfillment.d.ts.map +1 -0
  278. package/dist/utils/actions/cancel-item-fulfillment.js +34 -0
  279. package/dist/utils/actions/cancel-item-fulfillment.js.map +1 -0
  280. package/dist/utils/actions/cancel-return.d.ts +1 -0
  281. package/dist/utils/actions/cancel-return.d.ts.map +1 -0
  282. package/dist/utils/actions/cancel-return.js +9 -16
  283. package/dist/utils/actions/cancel-return.js.map +1 -1
  284. package/dist/utils/actions/deliver-item.d.ts +2 -0
  285. package/dist/utils/actions/deliver-item.d.ts.map +1 -0
  286. package/dist/utils/actions/deliver-item.js +38 -0
  287. package/dist/utils/actions/deliver-item.js.map +1 -0
  288. package/dist/utils/actions/fulfill-item.d.ts +1 -0
  289. package/dist/utils/actions/fulfill-item.d.ts.map +1 -0
  290. package/dist/utils/actions/fulfill-item.js +8 -12
  291. package/dist/utils/actions/fulfill-item.js.map +1 -1
  292. package/dist/utils/actions/index.d.ts +7 -1
  293. package/dist/utils/actions/index.d.ts.map +1 -0
  294. package/dist/utils/actions/index.js +6 -1
  295. package/dist/utils/actions/index.js.map +1 -1
  296. package/dist/utils/actions/item-add.d.ts +1 -0
  297. package/dist/utils/actions/item-add.d.ts.map +1 -0
  298. package/dist/utils/actions/item-add.js +17 -26
  299. package/dist/utils/actions/item-add.js.map +1 -1
  300. package/dist/utils/actions/item-remove.d.ts +1 -0
  301. package/dist/utils/actions/item-remove.d.ts.map +1 -0
  302. package/dist/utils/actions/item-remove.js +10 -30
  303. package/dist/utils/actions/item-remove.js.map +1 -1
  304. package/dist/utils/actions/item-update.d.ts +2 -0
  305. package/dist/utils/actions/item-update.d.ts.map +1 -0
  306. package/dist/utils/actions/item-update.js +37 -0
  307. package/dist/utils/actions/item-update.js.map +1 -0
  308. package/dist/utils/actions/receive-damaged-return-item.d.ts +1 -0
  309. package/dist/utils/actions/receive-damaged-return-item.d.ts.map +1 -0
  310. package/dist/utils/actions/receive-damaged-return-item.js +11 -37
  311. package/dist/utils/actions/receive-damaged-return-item.js.map +1 -1
  312. package/dist/utils/actions/receive-return-item.d.ts +1 -0
  313. package/dist/utils/actions/receive-return-item.d.ts.map +1 -0
  314. package/dist/utils/actions/receive-return-item.js +9 -38
  315. package/dist/utils/actions/receive-return-item.js.map +1 -1
  316. package/dist/utils/actions/reinstate-item.d.ts +2 -0
  317. package/dist/utils/actions/reinstate-item.d.ts.map +1 -0
  318. package/dist/utils/actions/reinstate-item.js +32 -0
  319. package/dist/utils/actions/reinstate-item.js.map +1 -0
  320. package/dist/utils/actions/return-item.d.ts +1 -0
  321. package/dist/utils/actions/return-item.d.ts.map +1 -0
  322. package/dist/utils/actions/return-item.js +10 -15
  323. package/dist/utils/actions/return-item.js.map +1 -1
  324. package/dist/utils/actions/ship-item.d.ts +1 -0
  325. package/dist/utils/actions/ship-item.d.ts.map +1 -0
  326. package/dist/utils/actions/ship-item.js +8 -12
  327. package/dist/utils/actions/ship-item.js.map +1 -1
  328. package/dist/utils/actions/shipping-add.d.ts +1 -0
  329. package/dist/utils/actions/shipping-add.d.ts.map +1 -0
  330. package/dist/utils/actions/shipping-add.js +18 -18
  331. package/dist/utils/actions/shipping-add.js.map +1 -1
  332. package/dist/utils/actions/shipping-remove.d.ts +2 -0
  333. package/dist/utils/actions/shipping-remove.d.ts.map +1 -0
  334. package/dist/utils/actions/shipping-remove.js +22 -0
  335. package/dist/utils/actions/shipping-remove.js.map +1 -0
  336. package/dist/utils/actions/write-off-item.d.ts +1 -0
  337. package/dist/utils/actions/write-off-item.d.ts.map +1 -0
  338. package/dist/utils/actions/write-off-item.js +8 -12
  339. package/dist/utils/actions/write-off-item.js.map +1 -1
  340. package/dist/utils/apply-order-changes.d.ts +18 -0
  341. package/dist/utils/apply-order-changes.d.ts.map +1 -0
  342. package/dist/utils/apply-order-changes.js +98 -0
  343. package/dist/utils/apply-order-changes.js.map +1 -0
  344. package/dist/utils/base-repository-find.d.ts +3 -0
  345. package/dist/utils/base-repository-find.d.ts.map +1 -0
  346. package/dist/utils/base-repository-find.js +154 -0
  347. package/dist/utils/base-repository-find.js.map +1 -0
  348. package/dist/utils/calculate-order-change.d.ts +12 -6
  349. package/dist/utils/calculate-order-change.d.ts.map +1 -0
  350. package/dist/utils/calculate-order-change.js +56 -187
  351. package/dist/utils/calculate-order-change.js.map +1 -1
  352. package/dist/utils/index.d.ts +4 -1
  353. package/dist/utils/index.d.ts.map +1 -0
  354. package/dist/utils/index.js +3 -1
  355. package/dist/utils/index.js.map +1 -1
  356. package/dist/utils/set-action-reference.d.ts +2 -0
  357. package/dist/utils/set-action-reference.d.ts.map +1 -0
  358. package/dist/utils/set-action-reference.js +10 -0
  359. package/dist/utils/set-action-reference.js.map +1 -0
  360. package/dist/utils/transform-order.d.ts +5 -4
  361. package/dist/utils/transform-order.d.ts.map +1 -0
  362. package/dist/utils/transform-order.js +138 -21
  363. package/dist/utils/transform-order.js.map +1 -1
  364. package/package.json +25 -26
  365. package/dist/module-definition.d.ts +0 -2
  366. package/dist/module-definition.js +0 -59
  367. package/dist/module-definition.js.map +0 -1
  368. package/dist/scripts/bin/run-seed.d.ts +0 -3
  369. package/dist/scripts/bin/run-seed.js +0 -49
  370. package/dist/scripts/bin/run-seed.js.map +0 -1
  371. package/dist/services/order-change-service.d.ts +0 -15
  372. package/dist/services/order-change-service.js +0 -96
  373. package/dist/services/order-change-service.js.map +0 -1
  374. package/dist/utils/action-key.d.ts +0 -13
  375. package/dist/utils/action-key.js +0 -18
  376. package/dist/utils/action-key.js.map +0 -1
  377. package/dist/utils/actions/cancel.d.ts +0 -1
  378. package/dist/utils/actions/cancel.js +0 -8
  379. package/dist/utils/actions/cancel.js.map +0 -1
@@ -1,14 +1,25 @@
1
- import { BigNumberInput } from "@medusajs/types";
1
+ import { BigNumberInput } from "@medusajs/framework/types";
2
2
  export type VirtualOrder = {
3
+ id: string;
3
4
  items: {
4
5
  id: string;
6
+ order_id: string;
7
+ return_id?: string;
8
+ claim_id?: string;
9
+ exchange_id?: string;
5
10
  unit_price: BigNumberInput;
6
11
  quantity: BigNumberInput;
7
12
  detail: {
8
13
  id?: string;
14
+ order_id: string;
15
+ return_id?: string;
16
+ claim_id?: string;
17
+ exchange_id?: string;
18
+ item_id?: string;
9
19
  quantity: BigNumberInput;
10
20
  shipped_quantity: BigNumberInput;
11
21
  fulfilled_quantity: BigNumberInput;
22
+ delivered_quantity: BigNumberInput;
12
23
  return_requested_quantity: BigNumberInput;
13
24
  return_received_quantity: BigNumberInput;
14
25
  return_dismissed_quantity: BigNumberInput;
@@ -18,25 +29,35 @@ export type VirtualOrder = {
18
29
  }[];
19
30
  shipping_methods: {
20
31
  id: string;
21
- price: BigNumberInput;
32
+ order_id: string;
33
+ return_id?: string;
34
+ claim_id?: string;
35
+ exchange_id?: string;
36
+ detail?: {
37
+ id?: string;
38
+ order_id: string;
39
+ return_id?: string;
40
+ claim_id?: string;
41
+ exchange_id?: string;
42
+ };
43
+ amount: BigNumberInput;
22
44
  }[];
23
45
  total: BigNumberInput;
46
+ transactions?: OrderTransaction[];
24
47
  metadata?: Record<string, unknown>;
25
48
  };
26
49
  export declare enum EVENT_STATUS {
27
50
  PENDING = "pending",
28
- VOIDED = "voided",
29
51
  DONE = "done"
30
52
  }
31
53
  export interface OrderSummaryCalculated {
32
- currentOrderTotal: BigNumberInput;
33
- originalOrderTotal: BigNumberInput;
34
- transactionTotal: BigNumberInput;
35
- futureDifference: BigNumberInput;
36
- pendingDifference: BigNumberInput;
37
- futureTemporaryDifference: BigNumberInput;
38
- temporaryDifference: BigNumberInput;
39
- differenceSum: BigNumberInput;
54
+ current_order_total: BigNumberInput;
55
+ original_order_total: BigNumberInput;
56
+ transaction_total: BigNumberInput;
57
+ pending_difference: BigNumberInput;
58
+ difference_sum: BigNumberInput;
59
+ paid_total: BigNumberInput;
60
+ refunded_total: BigNumberInput;
40
61
  }
41
62
  export interface OrderTransaction {
42
63
  amount: BigNumberInput;
@@ -46,14 +67,11 @@ export interface OrderChangeEvent {
46
67
  amount?: BigNumberInput;
47
68
  reference?: string;
48
69
  reference_id?: string;
49
- group_id?: string;
50
- evaluationOnly?: boolean;
70
+ return_id?: string;
71
+ claim_id?: string;
72
+ exchange_id?: string;
73
+ change_id?: string;
51
74
  details?: any;
52
- resolve?: {
53
- group_id?: string;
54
- reference_id?: string;
55
- amount?: BigNumberInput;
56
- };
57
75
  }
58
76
  export type InternalOrderChangeEvent = OrderChangeEvent & {
59
77
  status?: EVENT_STATUS;
@@ -67,15 +85,15 @@ export type OrderReferences = {
67
85
  transactions: OrderTransaction[];
68
86
  type: ActionTypeDefinition;
69
87
  actions: InternalOrderChangeEvent[];
88
+ options?: {
89
+ addActionReferenceToObject?: boolean;
90
+ [key: string]: unknown;
91
+ };
70
92
  };
71
93
  export interface ActionTypeDefinition {
72
94
  isDeduction?: boolean;
73
- awaitRequired?: boolean;
74
- versioning?: boolean;
75
- void?: boolean;
76
- commitsAction?: string;
77
95
  operation?: (obj: OrderReferences) => BigNumberInput | void;
78
- revert?: (obj: OrderReferences) => BigNumberInput | void;
79
96
  validate?: (obj: OrderReferences) => void;
80
97
  [key: string]: unknown;
81
98
  }
99
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE1D,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAA;IAEV,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAA;QACV,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,CAAC,EAAE,MAAM,CAAA;QACl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A;IACnC,OAAO,CAAC,EAAE;QACR,0BAA0B,CAAC,EAAE,OAAO,CAAA;QACpC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB,CAAA;CACF,CAAA;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,cAAc,GAAG,IAAI,CAAA;IAC3D,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,CAAA;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB"}
@@ -4,7 +4,6 @@ exports.EVENT_STATUS = void 0;
4
4
  var EVENT_STATUS;
5
5
  (function (EVENT_STATUS) {
6
6
  EVENT_STATUS["PENDING"] = "pending";
7
- EVENT_STATUS["VOIDED"] = "voided";
8
7
  EVENT_STATUS["DONE"] = "done";
9
8
  })(EVENT_STATUS || (exports.EVENT_STATUS = EVENT_STATUS = {}));
10
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/utils/index.ts"],"names":[],"mappings":";;;AA+BA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,iCAAiB,CAAA;IACjB,6BAAa,CAAA;AACf,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/utils/index.ts"],"names":[],"mappings":";;;AA2DA,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,6BAAa,CAAA;AACf,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cancel-item-fulfillment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel-item-fulfillment.d.ts","sourceRoot":"","sources":["../../../src/utils/actions/cancel-item-fulfillment.ts"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@medusajs/framework/utils");
4
+ const calculate_order_change_1 = require("../calculate-order-change");
5
+ const set_action_reference_1 = require("../set-action-reference");
6
+ calculate_order_change_1.OrderChangeProcessing.registerActionType(utils_1.ChangeActionType.CANCEL_ITEM_FULFILLMENT, {
7
+ operation({ action, currentOrder, options }) {
8
+ const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
9
+ existing.detail.fulfilled_quantity ??= 0;
10
+ existing.detail.fulfilled_quantity = utils_1.MathBN.sub(existing.detail.fulfilled_quantity, action.details.quantity);
11
+ (0, set_action_reference_1.setActionReference)(existing, action, options);
12
+ },
13
+ validate({ action, currentOrder }) {
14
+ const refId = action.details?.reference_id;
15
+ if (refId == null) {
16
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "Reference ID is required.");
17
+ }
18
+ const existing = currentOrder.items.find((item) => item.id === refId);
19
+ if (!existing) {
20
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Item ID "${refId}" not found.`);
21
+ }
22
+ if (!action.details?.quantity) {
23
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Quantity to cancel item fulfillment ${refId} is required.`);
24
+ }
25
+ if (action.details?.quantity < 1) {
26
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Quantity to cancel item ${refId} must be greater than 0.`);
27
+ }
28
+ const greater = utils_1.MathBN.gt(action.details?.quantity, existing.detail?.fulfilled_quantity);
29
+ if (greater) {
30
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Cannot cancel more items than what was fulfilled for item ${refId}.`);
31
+ }
32
+ },
33
+ });
34
+ //# sourceMappingURL=cancel-item-fulfillment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel-item-fulf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CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,uCAAuC,KAAK,eAAe,CAC5D,CAAA;QACH,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,QAAQ,GAAG,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,2BAA2B,KAAK,0BAA0B,CAC3D,CAAA;QACH,CAAC;QAED,MAAM,OAAO,GAAG,cAAM,CAAC,EAAE,CACvB,MAAM,CAAC,OAAO,EAAE,QAAQ,EACxB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CACpC,CAAA;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,6DAA6D,KAAK,GAAG,CACtE,CAAA;QACH,CAAC;IACH,CAAC;CACF,CACF,CAAA"}
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=cancel-return.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel-return.d.ts","sourceRoot":"","sources":["../../../src/utils/actions/cancel-return.ts"],"names":[],"mappings":""}
@@ -1,31 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("@medusajs/utils");
4
- const action_key_1 = require("../action-key");
3
+ const utils_1 = require("@medusajs/framework/utils");
5
4
  const calculate_order_change_1 = require("../calculate-order-change");
6
- calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.CANCEL_RETURN, {
7
- operation({ action, currentOrder }) {
8
- var _a;
5
+ const set_action_reference_1 = require("../set-action-reference");
6
+ calculate_order_change_1.OrderChangeProcessing.registerActionType(utils_1.ChangeActionType.CANCEL_RETURN_ITEM, {
7
+ operation({ action, currentOrder, options }) {
9
8
  const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
10
- (_a = existing.detail).return_requested_quantity ?? (_a.return_requested_quantity = 0);
9
+ existing.detail.return_requested_quantity ??= 0;
11
10
  existing.detail.return_requested_quantity = utils_1.MathBN.sub(existing.detail.return_requested_quantity, action.details.quantity);
12
- return action.details.unit_price * action.details.quantity;
13
- },
14
- revert({ action, currentOrder }) {
15
- const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
16
- existing.detail.return_requested_quantity = utils_1.MathBN.add(existing.detail.return_requested_quantity, action.details.quantity);
11
+ (0, set_action_reference_1.setActionReference)(existing, action, options);
12
+ return utils_1.MathBN.mult(existing.unit_price, action.details.quantity);
17
13
  },
18
14
  validate({ action, currentOrder }) {
19
15
  const refId = action.details?.reference_id;
20
- if (!(0, utils_1.isDefined)(refId)) {
16
+ if (refId == null) {
21
17
  throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "Details reference ID is required.");
22
18
  }
23
- if (!(0, utils_1.isDefined)(action.amount) && !(0, utils_1.isDefined)(action.details?.unit_price)) {
24
- throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Unit price of item ${action.reference_id} is required if no action.amount is provided.`);
25
- }
26
19
  const existing = currentOrder.items.find((item) => item.id === refId);
27
20
  if (!existing) {
28
- throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Reference ID "${refId}" not found.`);
21
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Item ID "${refId}" not found.`);
29
22
  }
30
23
  if (!action.details?.quantity) {
31
24
  throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Quantity to cancel return of item ${refId} is required.`);
@@ -1 +1 @@
1
- {"version":3,"file":"cancel-return.js","sourceRoot":"","sources":["../../../src/utils/actions/cancel-return.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,8CAAgD;AAChD,sEAAiE;AAEjE,8CAAqB,CAAC,kBAAkB,CAA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MAAM,OAAO,GAAG,cAAM,CAAC,EAAE,CACvB,MAAM,CAAC,OAAO,EAAE,QAAQ,EACxB,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAC3C,CAAA;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,uEAAuE,KAAK,GAAG,CAChF,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=deliver-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deliver-item.d.ts","sourceRoot":"","sources":["../../../src/utils/actions/deliver-item.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@medusajs/framework/utils");
4
+ const calculate_order_change_1 = require("../calculate-order-change");
5
+ const set_action_reference_1 = require("../set-action-reference");
6
+ calculate_order_change_1.OrderChangeProcessing.registerActionType(utils_1.ChangeActionType.DELIVER_ITEM, {
7
+ operation({ action, currentOrder, options }) {
8
+ const item = currentOrder.items.find((item) => item.id === action.details.reference_id);
9
+ item.detail.delivered_quantity ??= 0;
10
+ item.detail.delivered_quantity = utils_1.MathBN.add(item.detail.delivered_quantity, action.details.quantity);
11
+ (0, set_action_reference_1.setActionReference)(item, action, options);
12
+ },
13
+ validate({ action, currentOrder }) {
14
+ const refId = action.details?.reference_id;
15
+ if (refId == null) {
16
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "Reference ID is required.");
17
+ }
18
+ const item = currentOrder.items.find((item) => item.id === refId);
19
+ if (!item) {
20
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Item ID "${refId}" not found.`);
21
+ }
22
+ const totalDeliverable = utils_1.MathBN.convert(item.quantity);
23
+ const totalDelivered = utils_1.MathBN.convert(item.detail?.delivered_quantity);
24
+ const newDelivered = utils_1.MathBN.convert(action.details?.quantity ?? 0);
25
+ const newTotalDelivered = utils_1.MathBN.sum(totalDelivered, newDelivered);
26
+ const totalFulfilled = utils_1.MathBN.convert(item.detail?.fulfilled_quantity);
27
+ if (utils_1.MathBN.lte(newDelivered, 0)) {
28
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Quantity of item ${refId} must be greater than 0.`);
29
+ }
30
+ if (utils_1.MathBN.gt(newTotalDelivered, totalFulfilled)) {
31
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Cannot deliver more items than what was fulfilled for item ${refId}.`);
32
+ }
33
+ if (utils_1.MathBN.gt(newTotalDelivered, totalDeliverable)) {
34
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Cannot deliver more items than what was ordered for item ${refId}.`);
35
+ }
36
+ },
37
+ });
38
+ //# sourceMappingURL=deliver-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deliver-item.js","sourceRoot":"","sources":["../../../src/utils/actions/deliver-item.ts"],"names":[],"mappings":";;AAAA,qDAIkC;AAClC,sEAAiE;AACjE,kEAA4D;AAE5D,8CAAqB,CAAC,kBAAkB,CAAC,wBAAgB,CAAC,YAAY,EAAE;IACtE,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE;QACzC,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAClC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,YAAY,CACjD,CAAA;QAEF,IAAI,CAAC,MAAM,CAAC,kBAAkB,KAAK,CAAC,CAAA;QAEpC,IAAI,CAAC,MAAM,CAAC,kBAAkB,GAAG,cAAM,CAAC,GAAG,CACzC,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAC9B,MAAM,CAAC,OAAO,CAAC,QAAQ,CACxB,CAAA;QAED,IAAA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QACH,CAAC;QAED,IAAI,cAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,cAAc,CAAC,EAAE,CAAC;YACjD,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,8DAA8D,KAAK,GAAG,CACvE,CAAA;QACH,CAAC;QAED,IAAI,cAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,4DAA4D,KAAK,GAAG,CACrE,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=fulfill-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fulfill-item.d.ts","sourceRoot":"","sources":["../../../src/utils/actions/fulfill-item.ts"],"names":[],"mappings":""}
@@ -1,27 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("@medusajs/utils");
4
- const action_key_1 = require("../action-key");
3
+ const utils_1 = require("@medusajs/framework/utils");
5
4
  const calculate_order_change_1 = require("../calculate-order-change");
6
- calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.FULFILL_ITEM, {
7
- operation({ action, currentOrder }) {
8
- var _a;
5
+ const set_action_reference_1 = require("../set-action-reference");
6
+ calculate_order_change_1.OrderChangeProcessing.registerActionType(utils_1.ChangeActionType.FULFILL_ITEM, {
7
+ operation({ action, currentOrder, options }) {
9
8
  const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
10
- (_a = existing.detail).fulfilled_quantity ?? (_a.fulfilled_quantity = 0);
9
+ existing.detail.fulfilled_quantity ??= 0;
11
10
  existing.detail.fulfilled_quantity = utils_1.MathBN.add(existing.detail.fulfilled_quantity, action.details.quantity);
12
- },
13
- revert({ action, currentOrder }) {
14
- const existing = currentOrder.items.find((item) => item.id === action.reference_id);
15
- existing.detail.fulfilled_quantity = utils_1.MathBN.sub(existing.detail.fulfilled_quantity, action.details.quantity);
11
+ (0, set_action_reference_1.setActionReference)(existing, action, options);
16
12
  },
17
13
  validate({ action, currentOrder }) {
18
14
  const refId = action.details?.reference_id;
19
- if (!(0, utils_1.isDefined)(refId)) {
15
+ if (refId == null) {
20
16
  throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "Reference ID is required.");
21
17
  }
22
18
  const existing = currentOrder.items.find((item) => item.id === refId);
23
19
  if (!existing) {
24
- throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Reference ID "${refId}" not found.`);
20
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Item ID "${refId}" not found.`);
25
21
  }
26
22
  if (!action.details?.quantity) {
27
23
  throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Quantity to fulfill of item ${refId} is required.`);
@@ -1 +1 @@
1
- {"version":3,"file":"fulfill-item.js","sourceRoot":"","sources":["../../../src/utils/actions/fulfill-item.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,8CAAgD;AAChD,sEAAiE;AAEjE,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,YAAY,EAAE;IACtE,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE;;QAChC,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CACtC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,YAAY,CACjD,CAAA;QAEF,MAAA,QAAQ,CAAC,MAAM,EAAC,kBAAkB,QAAlB,kBAAkB,GAAK,CAAC,EAAA;QAExC,QAAQ,CAAC,MAAM,CAAC,kBAAkB,GAAG,cAAM,CAAC,GAAG,CAC7C,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAClC,MAAM,CAAC,OAAO,CAAC,QA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el-return";
3
+ export * from "./deliver-item";
3
4
  export * from "./fulfill-item";
4
5
  export * from "./item-add";
5
6
  export * from "./item-remove";
7
+ export * from "./item-update";
6
8
  export * from "./receive-damaged-return-item";
7
9
  export * from "./receive-return-item";
10
+ export * from "./reinstate-item";
8
11
  export * from "./return-item";
9
12
  export * from "./ship-item";
10
13
  export * from "./shipping-add";
14
+ export * from "./shipping-remove";
15
+ export * from "./write-off-item";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA"}
@@ -14,14 +14,19 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./cancel"), exports);
17
+ __exportStar(require("./cancel-item-fulfillment"), exports);
18
18
  __exportStar(require("./cancel-return"), exports);
19
+ __exportStar(require("./deliver-item"), exports);
19
20
  __exportStar(require("./fulfill-item"), exports);
20
21
  __exportStar(require("./item-add"), exports);
21
22
  __exportStar(require("./item-remove"), exports);
23
+ __exportStar(require("./item-update"), exports);
22
24
  __exportStar(require("./receive-damaged-return-item"), exports);
23
25
  __exportStar(require("./receive-return-item"), exports);
26
+ __exportStar(require("./reinstate-item"), exports);
24
27
  __exportStar(require("./return-item"), exports);
25
28
  __exportStar(require("./ship-item"), exports);
26
29
  __exportStar(require("./shipping-add"), exports);
30
+ __exportStar(require("./shipping-remove"), exports);
31
+ __exportStar(require("./write-off-item"), exports);
27
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,kDAA+B;AAC/B,iDAA8B;AAC9B,6CAA0B;AAC1B,gDAA6B;AAC7B,gEAA6C;AAC7C,wDAAqC;AACrC,gDAA6B;AAC7B,8CAA2B;AAC3B,iDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAAyC;AACzC,kDAA+B;AAC/B,iDAA8B;AAC9B,iDAA8B;AAC9B,6CAA0B;AAC1B,gDAA6B;AAC7B,gDAA6B;AAC7B,gEAA6C;AAC7C,wDAAqC;AACrC,mDAAgC;AAChC,gDAA6B;AAC7B,8CAA2B;AAC3B,iDAA8B;AAC9B,oDAAiC;AACjC,mDAAgC"}
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=item-add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"item-add.d.ts","sourceRoot":"","sources":["../../../src/utils/actions/item-add.ts"],"names":[],"mappings":""}
@@ -1,43 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("@medusajs/utils");
4
- const action_key_1 = require("../action-key");
3
+ const utils_1 = require("@medusajs/framework/utils");
5
4
  const calculate_order_change_1 = require("../calculate-order-change");
6
- calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.ITEM_ADD, {
7
- operation({ action, currentOrder }) {
8
- var _a;
9
- const existing = currentOrder.items.find((item) => item.id === action.reference_id);
5
+ const set_action_reference_1 = require("../set-action-reference");
6
+ calculate_order_change_1.OrderChangeProcessing.registerActionType(utils_1.ChangeActionType.ITEM_ADD, {
7
+ operation({ action, currentOrder, options }) {
8
+ let existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
10
9
  if (existing) {
11
- (_a = existing.detail).quantity ?? (_a.quantity = 0);
10
+ existing.detail.quantity ??= 0;
12
11
  existing.quantity = utils_1.MathBN.add(existing.quantity, action.details.quantity);
13
12
  existing.detail.quantity = utils_1.MathBN.add(existing.detail.quantity, action.details.quantity);
14
13
  }
15
14
  else {
16
- currentOrder.items.push({
17
- id: action.reference_id,
15
+ existing = {
16
+ id: action.details.reference_id,
17
+ order_id: currentOrder.id,
18
+ return_id: action.return_id,
19
+ claim_id: action.claim_id,
20
+ exchange_id: action.exchange_id,
18
21
  unit_price: action.details.unit_price,
19
22
  quantity: action.details.quantity,
20
- });
23
+ };
24
+ currentOrder.items.push(existing);
21
25
  }
26
+ (0, set_action_reference_1.setActionReference)(existing, action, options);
22
27
  return utils_1.MathBN.mult(action.details.unit_price, action.details.quantity);
23
28
  },
24
- revert({ action, currentOrder }) {
25
- const existingIndex = currentOrder.items.findIndex((item) => item.id === action.reference_id);
26
- if (existingIndex > -1) {
27
- const existing = currentOrder.items[existingIndex];
28
- existing.quantity = utils_1.MathBN.sub(existing.quantity, action.details.quantity);
29
- existing.detail.quantity = utils_1.MathBN.sub(existing.detail.quantity, action.details.quantity);
30
- if (utils_1.MathBN.lte(existing.quantity, 0)) {
31
- currentOrder.items.splice(existingIndex, 1);
32
- }
33
- }
34
- },
35
29
  validate({ action }) {
36
- const refId = action.reference_id;
37
- if (!(0, utils_1.isDefined)(action.reference_id)) {
38
- throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "Reference ID is required.");
39
- }
40
- if (!(0, utils_1.isDefined)(action.amount) && !(0, utils_1.isDefined)(action.details?.unit_price)) {
30
+ const refId = action.details?.reference_id;
31
+ if (action.amount == null && action.details?.unit_price == null) {
41
32
  throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Unit price of item ${refId} is required if no action.amount is provided.`);
42
33
  }
43
34
  if (!action.details?.quantity) {
@@ -1 +1 @@
1
- {"version":3,"file":"item-add.js","sourceRoot":"","sources":["../../../src/utils/actions/item-add.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAEhE,8CAAgD;AAChD,sEAAiE;AAEjE,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,QAAQ,EAAE;IAClE,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE;;QAChC,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CACtC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,YAAY,CAC1C,CAAA;QAED,IAAI,QAAQ,EAAE;YACZ,MAAA,QAAQ,CAAC,MAAM,EAAC,QAAQ,QAAR,QAAQ,GAAK,CAAC,EAAA;YAE9B,QAAQ,CAAC,QAAQ,GAAG,cAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;YAE1E,QAAQ,CAAC,MAAM,CAAC,QAAQ,GAAG,cAAM,CAAC,GAAG,CACnC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EACxB,MAAM,CAAC,OAAO,CAAC,QAAQ,CACxB,CAAA;SACF;aAAM;YACL,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;gBACtB,EAAE,EAAE,MAAM,CAAC,YAAa;gBACxB,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU;gBACrC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ;aACN,CAAC,CAAA;SAC/B;QAED,OAAO,cAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE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I,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,oBAAoB,KAAK,0BAA0B,CACpD,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=item-remove.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"item-remove.d.ts","sourceRoot":"","sources":["../../../src/utils/actions/item-remove.ts"],"names":[],"mappings":""}
@@ -1,47 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("@medusajs/utils");
4
- const action_key_1 = require("../action-key");
3
+ const utils_1 = require("@medusajs/framework/utils");
5
4
  const calculate_order_change_1 = require("../calculate-order-change");
6
- calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.ITEM_REMOVE, {
5
+ const set_action_reference_1 = require("../set-action-reference");
6
+ calculate_order_change_1.OrderChangeProcessing.registerActionType(utils_1.ChangeActionType.ITEM_REMOVE, {
7
7
  isDeduction: true,
8
- operation({ action, currentOrder }) {
9
- var _a;
10
- const existingIndex = currentOrder.items.findIndex((item) => item.id === action.reference_id);
8
+ operation({ action, currentOrder, options }) {
9
+ const existingIndex = currentOrder.items.findIndex((item) => item.id === action.details.reference_id);
11
10
  const existing = currentOrder.items[existingIndex];
12
- (_a = existing.detail).quantity ?? (_a.quantity = 0);
11
+ existing.detail.quantity ??= 0;
13
12
  existing.quantity = utils_1.MathBN.sub(existing.quantity, action.details.quantity);
14
13
  existing.detail.quantity = utils_1.MathBN.sub(existing.detail.quantity, action.details.quantity);
15
- if (utils_1.MathBN.lte(existing.quantity, 0)) {
16
- currentOrder.items.splice(existingIndex, 1);
17
- }
14
+ (0, set_action_reference_1.setActionReference)(existing, action, options);
18
15
  return utils_1.MathBN.mult(existing.unit_price, action.details.quantity);
19
16
  },
20
- revert({ action, currentOrder }) {
21
- const existing = currentOrder.items.find((item) => item.id === action.reference_id);
22
- if (existing) {
23
- existing.quantity = utils_1.MathBN.add(existing.quantity, action.details.quantity);
24
- existing.detail.quantity = utils_1.MathBN.add(existing.detail.quantity, action.details.quantity);
25
- }
26
- else {
27
- currentOrder.items.push({
28
- id: action.reference_id,
29
- unit_price: action.details.unit_price,
30
- quantity: action.details.quantity,
31
- });
32
- }
33
- },
34
17
  validate({ action, currentOrder }) {
35
- const refId = action.reference_id;
36
- if (!(0, utils_1.isDefined)(refId)) {
18
+ const refId = action.details?.reference_id;
19
+ if (refId == null) {
37
20
  throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "Reference ID is required.");
38
21
  }
39
22
  const existing = currentOrder.items.find((item) => item.id === refId);
40
23
  if (!existing) {
41
- throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Reference ID "${refId}" not found.`);
42
- }
43
- if (!(0, utils_1.isDefined)(action.amount) && !(0, utils_1.isDefined)(action.details?.unit_price)) {
44
- throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Unit price of item ${refId} is required if no action.amount is provided.`);
24
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Item ID "${refId}" not found.`);
45
25
  }
46
26
  if (!action.details?.quantity) {
47
27
  throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Quantity of item ${refId} is required.`);
@@ -1 +1 @@
1
- {"version":3,"file":"item-remove.js","sourceRoot":"","sources":["../../../src/utils/actions/item-remove.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAEhE,8CAAgD;AAChD,sEAAiE;AAEjE,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,WAAW,EAAE;IACrE,WAAW,EAAE,IAAI;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE;;QAChC,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,SAAS,CAChD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,MA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AAG,CAC7B,QAAQ,CAAC,QAAQ,EACjB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CACpC,CAAA;QAED,MAAM,OAAO,GAAG,cAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAA;QACjE,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,sCAAsC,KAAK,GAAG,CAC/C,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=item-update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"item-update.d.ts","sourceRoot":"","sources":["../../../src/utils/actions/item-update.ts"],"names":[],"mappings":""}