@medusajs/order 0.1.3-snapshot-20240718083016 → 0.1.3-snapshot-20240719080828

Sign up to get free protection for your applications and to get access to all the features.
Files changed (331) 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/migrations/Migration20240219102530.d.ts +1 -0
  6. package/dist/migrations/Migration20240219102530.d.ts.map +1 -0
  7. package/dist/migrations/Migration20240219102530.js +38 -4
  8. package/dist/migrations/Migration20240219102530.js.map +1 -1
  9. package/dist/migrations/Migration20240604100512.d.ts +5 -0
  10. package/dist/migrations/Migration20240604100512.d.ts.map +1 -0
  11. package/dist/migrations/Migration20240604100512.js +364 -0
  12. package/dist/migrations/Migration20240604100512.js.map +1 -0
  13. package/dist/migrations/Migration20240715102100.d.ts +5 -0
  14. package/dist/migrations/Migration20240715102100.d.ts.map +1 -0
  15. package/dist/migrations/Migration20240715102100.js +15 -0
  16. package/dist/migrations/Migration20240715102100.js.map +1 -0
  17. package/dist/migrations/Migration20240715174100.d.ts +5 -0
  18. package/dist/migrations/Migration20240715174100.d.ts.map +1 -0
  19. package/dist/migrations/Migration20240715174100.js +21 -0
  20. package/dist/migrations/Migration20240715174100.js.map +1 -0
  21. package/dist/migrations/Migration20240716081800.d.ts +5 -0
  22. package/dist/migrations/Migration20240716081800.d.ts.map +1 -0
  23. package/dist/migrations/Migration20240716081800.js +67 -0
  24. package/dist/migrations/Migration20240716081800.js.map +1 -0
  25. package/dist/models/address.d.ts +2 -1
  26. package/dist/models/address.d.ts.map +1 -0
  27. package/dist/models/adjustment-line.d.ts +3 -1
  28. package/dist/models/adjustment-line.d.ts.map +1 -0
  29. package/dist/models/adjustment-line.js +5 -0
  30. package/dist/models/adjustment-line.js.map +1 -1
  31. package/dist/models/claim-item-image.d.ts +19 -0
  32. package/dist/models/claim-item-image.d.ts.map +1 -0
  33. package/dist/models/claim-item-image.js +109 -0
  34. package/dist/models/claim-item-image.js.map +1 -0
  35. package/dist/models/claim-item.d.ts +29 -0
  36. package/dist/models/claim-item.d.ts.map +1 -0
  37. package/dist/models/claim-item.js +156 -0
  38. package/dist/models/claim-item.js.map +1 -0
  39. package/dist/models/claim.d.ts +36 -0
  40. package/dist/models/claim.d.ts.map +1 -0
  41. package/dist/models/claim.js +195 -0
  42. package/dist/models/claim.js.map +1 -0
  43. package/dist/models/exchange-item.d.ts +24 -0
  44. package/dist/models/exchange-item.d.ts.map +1 -0
  45. package/dist/models/exchange-item.js +138 -0
  46. package/dist/models/exchange-item.js.map +1 -0
  47. package/dist/models/exchange.d.ts +34 -0
  48. package/dist/models/exchange.d.ts.map +1 -0
  49. package/dist/models/exchange.js +188 -0
  50. package/dist/models/exchange.js.map +1 -0
  51. package/dist/models/index.d.ts +9 -0
  52. package/dist/models/index.d.ts.map +1 -0
  53. package/dist/models/index.js +17 -1
  54. package/dist/models/index.js.map +1 -1
  55. package/dist/models/line-item-adjustment.d.ts +3 -1
  56. package/dist/models/line-item-adjustment.d.ts.map +1 -0
  57. package/dist/models/line-item-adjustment.js +3 -3
  58. package/dist/models/line-item-adjustment.js.map +1 -1
  59. package/dist/models/line-item-tax-line.d.ts +3 -1
  60. package/dist/models/line-item-tax-line.d.ts.map +1 -0
  61. package/dist/models/line-item-tax-line.js +3 -3
  62. package/dist/models/line-item-tax-line.js.map +1 -1
  63. package/dist/models/line-item.d.ts +3 -1
  64. package/dist/models/line-item.d.ts.map +1 -0
  65. package/dist/models/line-item.js +18 -4
  66. package/dist/models/line-item.js.map +1 -1
  67. package/dist/models/order-change-action.d.ts +15 -4
  68. package/dist/models/order-change-action.d.ts.map +1 -0
  69. package/dist/models/order-change-action.js +102 -7
  70. package/dist/models/order-change-action.js.map +1 -1
  71. package/dist/models/order-change.d.ts +17 -5
  72. package/dist/models/order-change.d.ts.map +1 -0
  73. package/dist/models/order-change.js +109 -4
  74. package/dist/models/order-change.js.map +1 -1
  75. package/dist/models/order-item.d.ts +5 -4
  76. package/dist/models/order-item.d.ts.map +1 -0
  77. package/dist/models/order-item.js +13 -13
  78. package/dist/models/order-item.js.map +1 -1
  79. package/dist/models/order-shipping-method.d.ts +14 -4
  80. package/dist/models/order-shipping-method.d.ts.map +1 -0
  81. package/dist/models/order-shipping-method.js +89 -13
  82. package/dist/models/order-shipping-method.js.map +1 -1
  83. package/dist/models/order-summary.d.ts +6 -7
  84. package/dist/models/order-summary.d.ts.map +1 -0
  85. package/dist/models/order-summary.js +9 -6
  86. package/dist/models/order-summary.js.map +1 -1
  87. package/dist/models/order.d.ts +6 -4
  88. package/dist/models/order.d.ts.map +1 -0
  89. package/dist/models/order.js +11 -1
  90. package/dist/models/order.js.map +1 -1
  91. package/dist/models/return-item.d.ts +29 -0
  92. package/dist/models/return-item.d.ts.map +1 -0
  93. package/dist/models/return-item.js +170 -0
  94. package/dist/models/return-item.js.map +1 -0
  95. package/dist/models/return-reason.d.ts +21 -0
  96. package/dist/models/return-reason.d.ts.map +1 -0
  97. package/dist/models/return-reason.js +120 -0
  98. package/dist/models/return-reason.js.map +1 -0
  99. package/dist/models/return.d.ts +39 -0
  100. package/dist/models/return.d.ts.map +1 -0
  101. package/dist/models/return.js +216 -0
  102. package/dist/models/return.js.map +1 -0
  103. package/dist/models/shipping-method-adjustment.d.ts +3 -1
  104. package/dist/models/shipping-method-adjustment.d.ts.map +1 -0
  105. package/dist/models/shipping-method-adjustment.js +3 -3
  106. package/dist/models/shipping-method-adjustment.js.map +1 -1
  107. package/dist/models/shipping-method-tax-line.d.ts +3 -1
  108. package/dist/models/shipping-method-tax-line.d.ts.map +1 -0
  109. package/dist/models/shipping-method-tax-line.js +3 -3
  110. package/dist/models/shipping-method-tax-line.js.map +1 -1
  111. package/dist/models/shipping-method.d.ts +2 -0
  112. package/dist/models/shipping-method.d.ts.map +1 -0
  113. package/dist/models/shipping-method.js +17 -4
  114. package/dist/models/shipping-method.js.map +1 -1
  115. package/dist/models/tax-line.d.ts +2 -0
  116. package/dist/models/tax-line.d.ts.map +1 -0
  117. package/dist/models/tax-line.js +7 -0
  118. package/dist/models/tax-line.js.map +1 -1
  119. package/dist/models/transaction.d.ts +15 -3
  120. package/dist/models/transaction.d.ts.map +1 -0
  121. package/dist/models/transaction.js +109 -4
  122. package/dist/models/transaction.js.map +1 -1
  123. package/dist/repositories/claim.d.ts +9 -0
  124. package/dist/repositories/claim.d.ts.map +1 -0
  125. package/dist/repositories/claim.js +11 -0
  126. package/dist/repositories/claim.js.map +1 -0
  127. package/dist/repositories/exchange.d.ts +9 -0
  128. package/dist/repositories/exchange.d.ts.map +1 -0
  129. package/dist/repositories/exchange.js +11 -0
  130. package/dist/repositories/exchange.js.map +1 -0
  131. package/dist/repositories/index.d.ts +4 -1
  132. package/dist/repositories/index.d.ts.map +1 -0
  133. package/dist/repositories/index.js +7 -16
  134. package/dist/repositories/index.js.map +1 -1
  135. package/dist/repositories/order.d.ts +1 -3
  136. package/dist/repositories/order.d.ts.map +1 -0
  137. package/dist/repositories/order.js +2 -85
  138. package/dist/repositories/order.js.map +1 -1
  139. package/dist/repositories/return.d.ts +9 -0
  140. package/dist/repositories/return.d.ts.map +1 -0
  141. package/dist/repositories/return.js +11 -0
  142. package/dist/repositories/return.js.map +1 -0
  143. package/dist/services/actions/cancel-claim.d.ts +3 -0
  144. package/dist/services/actions/cancel-claim.d.ts.map +1 -0
  145. package/dist/services/actions/cancel-claim.js +107 -0
  146. package/dist/services/actions/cancel-claim.js.map +1 -0
  147. package/dist/services/actions/cancel-exchange.d.ts +3 -0
  148. package/dist/services/actions/cancel-exchange.d.ts.map +1 -0
  149. package/dist/services/actions/cancel-exchange.js +92 -0
  150. package/dist/services/actions/cancel-exchange.js.map +1 -0
  151. package/dist/services/actions/cancel-fulfillment.d.ts +3 -0
  152. package/dist/services/actions/cancel-fulfillment.d.ts.map +1 -0
  153. package/dist/services/actions/cancel-fulfillment.js +32 -0
  154. package/dist/services/actions/cancel-fulfillment.js.map +1 -0
  155. package/dist/services/actions/cancel-return.d.ts +3 -0
  156. package/dist/services/actions/cancel-return.d.ts.map +1 -0
  157. package/dist/services/actions/cancel-return.js +72 -0
  158. package/dist/services/actions/cancel-return.js.map +1 -0
  159. package/dist/services/actions/create-claim.d.ts +3 -0
  160. package/dist/services/actions/create-claim.d.ts.map +1 -0
  161. package/dist/services/actions/create-claim.js +228 -0
  162. package/dist/services/actions/create-claim.js.map +1 -0
  163. package/dist/services/actions/create-exchange.d.ts +3 -0
  164. package/dist/services/actions/create-exchange.d.ts.map +1 -0
  165. package/dist/services/actions/create-exchange.js +193 -0
  166. package/dist/services/actions/create-exchange.js.map +1 -0
  167. package/dist/services/actions/create-return.d.ts +3 -0
  168. package/dist/services/actions/create-return.d.ts.map +1 -0
  169. package/dist/services/actions/create-return.js +102 -0
  170. package/dist/services/actions/create-return.js.map +1 -0
  171. package/dist/services/actions/index.d.ts +11 -0
  172. package/dist/services/actions/index.d.ts.map +1 -0
  173. package/dist/services/actions/index.js +27 -0
  174. package/dist/services/actions/index.js.map +1 -0
  175. package/dist/services/actions/receive-return.d.ts +3 -0
  176. package/dist/services/actions/receive-return.d.ts.map +1 -0
  177. package/dist/services/actions/receive-return.js +72 -0
  178. package/dist/services/actions/receive-return.js.map +1 -0
  179. package/dist/services/actions/register-fulfillment.d.ts +3 -0
  180. package/dist/services/actions/register-fulfillment.d.ts.map +1 -0
  181. package/dist/services/actions/register-fulfillment.js +30 -0
  182. package/dist/services/actions/register-fulfillment.js.map +1 -0
  183. package/dist/services/actions/register-shipment.d.ts +3 -0
  184. package/dist/services/actions/register-shipment.d.ts.map +1 -0
  185. package/dist/services/actions/register-shipment.js +38 -0
  186. package/dist/services/actions/register-shipment.js.map +1 -0
  187. package/dist/services/index.d.ts +1 -1
  188. package/dist/services/index.d.ts.map +1 -0
  189. package/dist/services/index.js +1 -3
  190. package/dist/services/index.js.map +1 -1
  191. package/dist/services/order-module-service.d.ts +138 -67
  192. package/dist/services/order-module-service.d.ts.map +1 -0
  193. package/dist/services/order-module-service.js +992 -240
  194. package/dist/services/order-module-service.js.map +1 -1
  195. package/dist/services/order-service.d.ts +5 -4
  196. package/dist/services/order-service.d.ts.map +1 -0
  197. package/dist/services/order-service.js +1 -1
  198. package/dist/services/order-service.js.map +1 -1
  199. package/dist/types/address.d.ts +1 -0
  200. package/dist/types/address.d.ts.map +1 -0
  201. package/dist/types/index.d.ts +3 -1
  202. package/dist/types/index.d.ts.map +1 -0
  203. package/dist/types/index.js +1 -0
  204. package/dist/types/index.js.map +1 -1
  205. package/dist/types/line-item-adjustment.d.ts +1 -0
  206. package/dist/types/line-item-adjustment.d.ts.map +1 -0
  207. package/dist/types/line-item-tax-line.d.ts +1 -0
  208. package/dist/types/line-item-tax-line.d.ts.map +1 -0
  209. package/dist/types/line-item.d.ts +1 -0
  210. package/dist/types/line-item.d.ts.map +1 -0
  211. package/dist/types/order-change.d.ts +6 -0
  212. package/dist/types/order-change.d.ts.map +1 -0
  213. package/dist/types/order-change.js +3 -0
  214. package/dist/types/order-change.js.map +1 -0
  215. package/dist/types/order-detail.d.ts +2 -1
  216. package/dist/types/order-detail.d.ts.map +1 -0
  217. package/dist/types/order.d.ts +3 -2
  218. package/dist/types/order.d.ts.map +1 -0
  219. package/dist/types/shipping-method-adjustment.d.ts +1 -0
  220. package/dist/types/shipping-method-adjustment.d.ts.map +1 -0
  221. package/dist/types/shipping-method-tax-line.d.ts +1 -0
  222. package/dist/types/shipping-method-tax-line.d.ts.map +1 -0
  223. package/dist/types/shipping-method.d.ts +4 -0
  224. package/dist/types/shipping-method.d.ts.map +1 -0
  225. package/dist/types/tax-line.d.ts +1 -0
  226. package/dist/types/tax-line.d.ts.map +1 -0
  227. package/dist/types/transaction.d.ts +1 -0
  228. package/dist/types/transaction.d.ts.map +1 -0
  229. package/dist/types/utils/index.d.ts +40 -21
  230. package/dist/types/utils/index.d.ts.map +1 -0
  231. package/dist/types/utils/index.js +0 -1
  232. package/dist/types/utils/index.js.map +1 -1
  233. package/dist/utils/actions/cancel-item-fulfillment.d.ts +2 -0
  234. package/dist/utils/actions/cancel-item-fulfillment.d.ts.map +1 -0
  235. package/dist/utils/actions/cancel-item-fulfillment.js +34 -0
  236. package/dist/utils/actions/cancel-item-fulfillment.js.map +1 -0
  237. package/dist/utils/actions/cancel-return.d.ts +1 -0
  238. package/dist/utils/actions/cancel-return.d.ts.map +1 -0
  239. package/dist/utils/actions/cancel-return.js +6 -10
  240. package/dist/utils/actions/cancel-return.js.map +1 -1
  241. package/dist/utils/actions/fulfill-item.d.ts +1 -0
  242. package/dist/utils/actions/fulfill-item.d.ts.map +1 -0
  243. package/dist/utils/actions/fulfill-item.js +6 -10
  244. package/dist/utils/actions/fulfill-item.js.map +1 -1
  245. package/dist/utils/actions/index.d.ts +4 -1
  246. package/dist/utils/actions/index.d.ts.map +1 -0
  247. package/dist/utils/actions/index.js +3 -1
  248. package/dist/utils/actions/index.js.map +1 -1
  249. package/dist/utils/actions/item-add.d.ts +1 -0
  250. package/dist/utils/actions/item-add.d.ts.map +1 -0
  251. package/dist/utils/actions/item-add.js +15 -24
  252. package/dist/utils/actions/item-add.js.map +1 -1
  253. package/dist/utils/actions/item-remove.d.ts +1 -0
  254. package/dist/utils/actions/item-remove.d.ts.map +1 -0
  255. package/dist/utils/actions/item-remove.js +8 -22
  256. package/dist/utils/actions/item-remove.js.map +1 -1
  257. package/dist/utils/actions/receive-damaged-return-item.d.ts +1 -0
  258. package/dist/utils/actions/receive-damaged-return-item.d.ts.map +1 -0
  259. package/dist/utils/actions/receive-damaged-return-item.js +9 -35
  260. package/dist/utils/actions/receive-damaged-return-item.js.map +1 -1
  261. package/dist/utils/actions/receive-return-item.d.ts +1 -0
  262. package/dist/utils/actions/receive-return-item.d.ts.map +1 -0
  263. package/dist/utils/actions/receive-return-item.js +7 -36
  264. package/dist/utils/actions/receive-return-item.js.map +1 -1
  265. package/dist/utils/actions/reinstate-item.d.ts +2 -0
  266. package/dist/utils/actions/reinstate-item.d.ts.map +1 -0
  267. package/dist/utils/actions/reinstate-item.js +32 -0
  268. package/dist/utils/actions/reinstate-item.js.map +1 -0
  269. package/dist/utils/actions/return-item.d.ts +1 -0
  270. package/dist/utils/actions/return-item.d.ts.map +1 -0
  271. package/dist/utils/actions/return-item.js +8 -12
  272. package/dist/utils/actions/return-item.js.map +1 -1
  273. package/dist/utils/actions/ship-item.d.ts +1 -0
  274. package/dist/utils/actions/ship-item.d.ts.map +1 -0
  275. package/dist/utils/actions/ship-item.js +6 -10
  276. package/dist/utils/actions/ship-item.js.map +1 -1
  277. package/dist/utils/actions/shipping-add.d.ts +1 -0
  278. package/dist/utils/actions/shipping-add.d.ts.map +1 -0
  279. package/dist/utils/actions/shipping-add.js +16 -16
  280. package/dist/utils/actions/shipping-add.js.map +1 -1
  281. package/dist/utils/actions/shipping-remove.d.ts +2 -0
  282. package/dist/utils/actions/shipping-remove.d.ts.map +1 -0
  283. package/dist/utils/actions/shipping-remove.js +25 -0
  284. package/dist/utils/actions/shipping-remove.js.map +1 -0
  285. package/dist/utils/actions/write-off-item.d.ts +1 -0
  286. package/dist/utils/actions/write-off-item.d.ts.map +1 -0
  287. package/dist/utils/actions/write-off-item.js +6 -10
  288. package/dist/utils/actions/write-off-item.js.map +1 -1
  289. package/dist/utils/apply-order-changes.d.ts +18 -0
  290. package/dist/utils/apply-order-changes.d.ts.map +1 -0
  291. package/dist/utils/apply-order-changes.js +95 -0
  292. package/dist/utils/apply-order-changes.js.map +1 -0
  293. package/dist/utils/base-repository-find.d.ts +3 -0
  294. package/dist/utils/base-repository-find.d.ts.map +1 -0
  295. package/dist/utils/base-repository-find.js +142 -0
  296. package/dist/utils/base-repository-find.js.map +1 -0
  297. package/dist/utils/calculate-order-change.d.ts +11 -5
  298. package/dist/utils/calculate-order-change.d.ts.map +1 -0
  299. package/dist/utils/calculate-order-change.js +57 -182
  300. package/dist/utils/calculate-order-change.js.map +1 -1
  301. package/dist/utils/index.d.ts +4 -1
  302. package/dist/utils/index.d.ts.map +1 -0
  303. package/dist/utils/index.js +3 -1
  304. package/dist/utils/index.js.map +1 -1
  305. package/dist/utils/set-action-reference.d.ts +2 -0
  306. package/dist/utils/set-action-reference.d.ts.map +1 -0
  307. package/dist/utils/set-action-reference.js +11 -0
  308. package/dist/utils/set-action-reference.js.map +1 -0
  309. package/dist/utils/transform-order.d.ts +4 -2
  310. package/dist/utils/transform-order.d.ts.map +1 -0
  311. package/dist/utils/transform-order.js +131 -17
  312. package/dist/utils/transform-order.js.map +1 -1
  313. package/package.json +8 -14
  314. package/dist/joiner-config.d.ts +0 -5
  315. package/dist/joiner-config.js +0 -36
  316. package/dist/joiner-config.js.map +0 -1
  317. package/dist/module-definition.d.ts +0 -2
  318. package/dist/module-definition.js +0 -59
  319. package/dist/module-definition.js.map +0 -1
  320. package/dist/scripts/bin/run-seed.d.ts +0 -3
  321. package/dist/scripts/bin/run-seed.js +0 -49
  322. package/dist/scripts/bin/run-seed.js.map +0 -1
  323. package/dist/services/order-change-service.d.ts +0 -15
  324. package/dist/services/order-change-service.js +0 -96
  325. package/dist/services/order-change-service.js.map +0 -1
  326. package/dist/utils/action-key.d.ts +0 -13
  327. package/dist/utils/action-key.js +0 -18
  328. package/dist/utils/action-key.js.map +0 -1
  329. package/dist/utils/actions/cancel.d.ts +0 -1
  330. package/dist/utils/actions/cancel.js +0 -8
  331. package/dist/utils/actions/cancel.js.map +0 -1
@@ -14,31 +14,71 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const utils_1 = require("@medusajs/utils");
16
16
  const core_1 = require("@mikro-orm/core");
17
+ const claim_1 = __importDefault(require("./claim"));
18
+ const exchange_1 = __importDefault(require("./exchange"));
17
19
  const order_1 = __importDefault(require("./order"));
20
+ const return_1 = __importDefault(require("./return"));
18
21
  const ReferenceIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
19
22
  tableName: "order_transaction",
20
23
  columns: "reference_id",
24
+ where: "deleted_at IS NOT NULL",
21
25
  });
22
26
  const OrderIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
23
27
  tableName: "order_transaction",
24
28
  columns: "order_id",
29
+ where: "deleted_at IS NOT NULL",
30
+ });
31
+ const ReturnIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
32
+ tableName: "order_transaction",
33
+ columns: "return_id",
34
+ where: "return_id IS NOT NULL AND deleted_at IS NOT NULL",
35
+ });
36
+ const ExchangeIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
37
+ tableName: "order_item",
38
+ columns: ["exchange_id"],
39
+ where: "exchange_id IS NOT NULL AND deleted_at IS NOT NULL",
40
+ });
41
+ const ClaimIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
42
+ tableName: "order_item",
43
+ columns: ["claim_id"],
44
+ where: "claim_id IS NOT NULL AND deleted_at IS NOT NULL",
25
45
  });
26
46
  const CurrencyCodeIndex = (0, utils_1.createPsqlIndexStatementHelper)({
27
47
  tableName: "order_transaction",
28
48
  columns: "currency_code",
49
+ where: "deleted_at IS NOT NULL",
50
+ });
51
+ const DeletedAtIndex = (0, utils_1.createPsqlIndexStatementHelper)({
52
+ tableName: "order_transaction",
53
+ columns: "deleted_at",
54
+ where: "deleted_at IS NOT NULL",
55
+ });
56
+ const OrderIdVersionIndex = (0, utils_1.createPsqlIndexStatementHelper)({
57
+ tableName: "order_transaction",
58
+ columns: ["order_id", "version"],
59
+ where: "deleted_at IS NOT NULL",
29
60
  });
30
61
  let Transaction = class Transaction {
31
62
  constructor() {
63
+ this.return_id = null;
64
+ this.version = 1;
32
65
  this.reference = null;
33
66
  this.reference_id = null;
67
+ this.deleted_at = null;
34
68
  }
35
69
  onCreate() {
36
70
  this.id = (0, utils_1.generateEntityId)(this.id, "ordtrx");
37
- this.order_id ?? (this.order_id = this.order?.id);
71
+ this.order_id ??= this.order?.id;
72
+ this.return_id ??= this.return?.id;
73
+ this.claim_id ??= this.claim?.id;
74
+ this.exchange_id ??= this.exchange?.id;
38
75
  }
39
76
  onInit() {
40
77
  this.id = (0, utils_1.generateEntityId)(this.id, "ordtrx");
41
- this.order_id ?? (this.order_id = this.order?.id);
78
+ this.order_id ??= this.order?.id;
79
+ this.return_id ??= this.return?.id;
80
+ this.claim_id ??= this.claim?.id;
81
+ this.exchange_id ??= this.exchange?.id;
42
82
  }
43
83
  };
44
84
  __decorate([
@@ -60,8 +100,66 @@ __decorate([
60
100
  (0, core_1.ManyToOne)(() => order_1.default, {
61
101
  persist: false,
62
102
  }),
63
- __metadata("design:type", order_1.default)
103
+ __metadata("design:type", Object)
64
104
  ], Transaction.prototype, "order", void 0);
105
+ __decorate([
106
+ (0, core_1.ManyToOne)({
107
+ entity: () => return_1.default,
108
+ mapToPk: true,
109
+ fieldName: "return_id",
110
+ columnType: "text",
111
+ nullable: true,
112
+ }),
113
+ ReturnIdIndex.MikroORMIndex(),
114
+ __metadata("design:type", Object)
115
+ ], Transaction.prototype, "return_id", void 0);
116
+ __decorate([
117
+ (0, core_1.ManyToOne)(() => return_1.default, {
118
+ persist: false,
119
+ }),
120
+ __metadata("design:type", Object)
121
+ ], Transaction.prototype, "return", void 0);
122
+ __decorate([
123
+ (0, core_1.ManyToOne)({
124
+ entity: () => exchange_1.default,
125
+ mapToPk: true,
126
+ fieldName: "exchange_id",
127
+ columnType: "text",
128
+ nullable: true,
129
+ }),
130
+ ExchangeIdIndex.MikroORMIndex(),
131
+ __metadata("design:type", Object)
132
+ ], Transaction.prototype, "exchange_id", void 0);
133
+ __decorate([
134
+ (0, core_1.ManyToOne)(() => exchange_1.default, {
135
+ persist: false,
136
+ }),
137
+ __metadata("design:type", Object)
138
+ ], Transaction.prototype, "exchange", void 0);
139
+ __decorate([
140
+ (0, core_1.ManyToOne)({
141
+ entity: () => claim_1.default,
142
+ mapToPk: true,
143
+ fieldName: "claim_id",
144
+ columnType: "text",
145
+ nullable: true,
146
+ }),
147
+ ClaimIdIndex.MikroORMIndex(),
148
+ __metadata("design:type", Object)
149
+ ], Transaction.prototype, "claim_id", void 0);
150
+ __decorate([
151
+ (0, core_1.ManyToOne)(() => claim_1.default, {
152
+ persist: false,
153
+ }),
154
+ __metadata("design:type", Object)
155
+ ], Transaction.prototype, "claim", void 0);
156
+ __decorate([
157
+ (0, core_1.Property)({
158
+ columnType: "integer",
159
+ defaultRaw: "1",
160
+ }),
161
+ __metadata("design:type", Number)
162
+ ], Transaction.prototype, "version", void 0);
65
163
  __decorate([
66
164
  (0, utils_1.MikroOrmBigNumberProperty)(),
67
165
  __metadata("design:type", Object)
@@ -107,6 +205,11 @@ __decorate([
107
205
  }),
108
206
  __metadata("design:type", Date)
109
207
  ], Transaction.prototype, "updated_at", void 0);
208
+ __decorate([
209
+ (0, core_1.Property)({ columnType: "timestamptz", nullable: true }),
210
+ DeletedAtIndex.MikroORMIndex(),
211
+ __metadata("design:type", Object)
212
+ ], Transaction.prototype, "deleted_at", void 0);
110
213
  __decorate([
111
214
  (0, core_1.BeforeCreate)(),
112
215
  __metadata("design:type", Function),
@@ -120,7 +223,9 @@ __decorate([
120
223
  __metadata("design:returntype", void 0)
121
224
  ], Transaction.prototype, "onInit", null);
122
225
  Transaction = __decorate([
123
- (0, core_1.Entity)({ tableName: "order_transaction" })
226
+ (0, core_1.Entity)({ tableName: "order_transaction" }),
227
+ (0, core_1.Filter)(utils_1.DALUtils.mikroOrmSoftDeletableFilterOptions),
228
+ OrderIdVersionIndex.MikroORMIndex()
124
229
  ], Transaction);
125
230
  exports.default = Transaction;
126
231
  //# sourceMappingURL=transaction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/models/transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,2CAKwB;AACxB,0CAQwB;AACxB,oDAA2B;AAI3B,MAAM,gBAAgB,GAAG,IAAA,sCAA8B,EAAC;IACtD,SAAS,EAAE,mBAAmB;IAC9B,OAAO,EAAE,cAAc;CACxB,CAAC,CAAA;AAEF,MAAM,YAAY,GAAG,IAAA,sCAA8B,EAAC;IAClD,SAAS,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,UAAU,EAAE,MAAM,EAAE,CAAC;IAChC,iBAAiB,CAAC,aAAa,EAAE;;kDACb;AAMrB;IAJC,IAAA,eAAQ,EAAC;QACR,UAAU,EAAE,MAAM;QAClB,QAAQ,EAAE,IAAI;KACf,CAAC;;8CAC6B;AAO/B;IALC,IAAA,eAAQ,EAAC;QACR,UAAU,EAAE,MAAM;QAClB,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,gBAAgB,CAAC,aAAa,EAAE;;iDACC;AAOlC;IALC,IAAA,eAAQ,EAAC;QACR,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;+CAAA;AAQhB;IANC,IAAA,eAAQ,EAAC;QACR,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;+CAAA;AAIhB;IAFC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvD,cAAc,CAAC,aAAa,EAAE;;+CACD;AAG9B;IADC,IAAA,mBAAY,GAAE;;;;2CAOd;AAGD;IADC,IAAA,aAAM,GAAE;;;;yCAOR;AAlIkB,WAAW;IAH/B,IAAA,aAAM,EAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;IAC1C,IAAA,aAAM,EAAC,gBAAQ,CAAC,kCAAkC,CAAC;IACnD,mBAAmB,CAAC,aAAa,EAAE;GACf,WAAW,CAmI/B;kBAnIoB,WAAW"}
@@ -0,0 +1,9 @@
1
+ import { DALUtils } from "@medusajs/utils";
2
+ import { OrderClaim } from "../models";
3
+ declare const OrderClaimRepository_base: new ({ manager }: {
4
+ manager: any;
5
+ }) => DALUtils.MikroOrmBaseRepository<OrderClaim>;
6
+ export declare class OrderClaimRepository extends OrderClaimRepository_base {
7
+ }
8
+ export {};
9
+ //# sourceMappingURL=claim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim.d.ts","sourceRoot":"","sources":["../../src/repositories/claim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;;;;AAGpC,qBAAa,oBAAqB,SAAQ,yBAEzC;CAAG"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrderClaimRepository = void 0;
4
+ const utils_1 = require("@medusajs/utils");
5
+ const _models_1 = require("../models");
6
+ const base_repository_find_1 = require("../utils/base-repository-find");
7
+ class OrderClaimRepository extends utils_1.DALUtils.mikroOrmBaseRepositoryFactory(_models_1.OrderClaim) {
8
+ }
9
+ exports.OrderClaimRepository = OrderClaimRepository;
10
+ (0, base_repository_find_1.setFindMethods)(OrderClaimRepository, _models_1.OrderClaim);
11
+ //# sourceMappingURL=claim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim.js","sourceRoot":"","sources":["../../src/repositories/claim.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAC1C,qCAAoC;AACpC,wEAA8D;AAE9D,MAAa,oBAAqB,SAAQ,gBAAQ,CAAC,6BAA6B,CAC9E,oBAAU,CACX;CAAG;AAFJ,oDAEI;AAEJ,IAAA,qCAAc,EAAC,oBAAoB,EAAE,oBAAU,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { DALUtils } from "@medusajs/utils";
2
+ import { OrderExchange } from "../models";
3
+ declare const OrderExchangeRepository_base: new ({ manager }: {
4
+ manager: any;
5
+ }) => DALUtils.MikroOrmBaseRepository<OrderExchange>;
6
+ export declare class OrderExchangeRepository extends OrderExchangeRepository_base {
7
+ }
8
+ export {};
9
+ //# sourceMappingURL=exchange.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exchange.d.ts","sourceRoot":"","sources":["../../src/repositories/exchange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;;;;AAGvC,qBAAa,uBAAwB,SAAQ,4BAE5C;CAAG"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrderExchangeRepository = void 0;
4
+ const utils_1 = require("@medusajs/utils");
5
+ const _models_1 = require("../models");
6
+ const base_repository_find_1 = require("../utils/base-repository-find");
7
+ class OrderExchangeRepository extends utils_1.DALUtils.mikroOrmBaseRepositoryFactory(_models_1.OrderExchange) {
8
+ }
9
+ exports.OrderExchangeRepository = OrderExchangeRepository;
10
+ (0, base_repository_find_1.setFindMethods)(OrderExchangeRepository, _models_1.OrderExchange);
11
+ //# sourceMappingURL=exchange.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exchange.js","sourceRoot":"","sources":["../../src/repositories/exchange.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAC1C,qCAAuC;AACvC,wEAA8D;AAE9D,MAAa,uBAAwB,SAAQ,gBAAQ,CAAC,6BAA6B,CACjF,uBAAa,CACd;CAAG;AAFJ,0DAEI;AAEJ,IAAA,qCAAc,EAAC,uBAAuB,EAAE,uBAAa,CAAC,CAAA"}
@@ -1,2 +1,5 @@
1
1
  export { MikroOrmBaseRepository as BaseRepository } from "@medusajs/utils";
2
- export * from "./order";
2
+ export { OrderClaimRepository } from "./claim";
3
+ export { OrderRepository } from "./order";
4
+ export { ReturnRepository } from "./return";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA"}
@@ -1,21 +1,12 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.BaseRepository = void 0;
3
+ exports.ReturnRepository = exports.OrderRepository = exports.OrderClaimRepository = exports.BaseRepository = void 0;
18
4
  var utils_1 = require("@medusajs/utils");
19
5
  Object.defineProperty(exports, "BaseRepository", { enumerable: true, get: function () { return utils_1.MikroOrmBaseRepository; } });
20
- __exportStar(require("./order"), exports);
6
+ var claim_1 = require("./claim");
7
+ Object.defineProperty(exports, "OrderClaimRepository", { enumerable: true, get: function () { return claim_1.OrderClaimRepository; } });
8
+ var order_1 = require("./order");
9
+ Object.defineProperty(exports, "OrderRepository", { enumerable: true, get: function () { return order_1.OrderRepository; } });
10
+ var return_1 = require("./return");
11
+ Object.defineProperty(exports, "ReturnRepository", { enumerable: true, get: function () { return return_1.ReturnRepository; } });
21
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yCAA0E;AAAjE,uGAAA,sBAAsB,OAAkB;AACjD,0CAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":";;;AAAA,yCAA0E;AAAjE,uGAAA,sBAAsB,OAAkB;AACjD,iCAA8C;AAArC,6GAAA,oBAAoB,OAAA;AAC7B,iCAAyC;AAAhC,wGAAA,eAAe,OAAA;AACxB,mCAA2C;AAAlC,0GAAA,gBAAgB,OAAA"}
@@ -1,11 +1,9 @@
1
- import { Context, DAL } from "@medusajs/types";
2
1
  import { DALUtils } from "@medusajs/utils";
3
2
  import { Order } from "../models";
4
3
  declare const OrderRepository_base: new ({ manager }: {
5
4
  manager: any;
6
5
  }) => DALUtils.MikroOrmBaseRepository<Order>;
7
6
  export declare class OrderRepository extends OrderRepository_base {
8
- find(options?: DAL.FindOptions<Order>, context?: Context): Promise<Order[]>;
9
- findAndCount(findOptions?: DAL.FindOptions<Order>, context?: Context): Promise<[Order[], number]>;
10
7
  }
11
8
  export {};
9
+ //# sourceMappingURL=order.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../src/repositories/order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;;;;AAG/B,qBAAa,eAAgB,SAAQ,oBAEpC;CAAG"}
@@ -2,93 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OrderRepository = void 0;
4
4
  const utils_1 = require("@medusajs/utils");
5
- const core_1 = require("@mikro-orm/core");
6
5
  const _models_1 = require("../models");
7
- const transform_order_1 = require("../utils/transform-order");
6
+ const base_repository_find_1 = require("../utils/base-repository-find");
8
7
  class OrderRepository extends utils_1.DALUtils.mikroOrmBaseRepositoryFactory(_models_1.Order) {
9
- async find(options, context) {
10
- var _a, _b, _c, _d;
11
- const manager = this.getActiveManager(context);
12
- const knex = manager.getKnex();
13
- const findOptions_ = { ...options };
14
- findOptions_.options ?? (findOptions_.options = {});
15
- findOptions_.where ?? (findOptions_.where = {});
16
- if (!("strategy" in findOptions_.options)) {
17
- if (findOptions_.options.limit != null || findOptions_.options.offset) {
18
- Object.assign(findOptions_.options, {
19
- strategy: core_1.LoadStrategy.SELECT_IN,
20
- });
21
- }
22
- else {
23
- Object.assign(findOptions_.options, {
24
- strategy: core_1.LoadStrategy.JOINED,
25
- });
26
- }
27
- }
28
- const config = (0, transform_order_1.mapRepositoryToOrderModel)(findOptions_);
29
- let defaultVersion = knex.raw(`"o0"."version"`);
30
- const strategy = config.options.strategy ?? core_1.LoadStrategy.JOINED;
31
- if (strategy === core_1.LoadStrategy.SELECT_IN) {
32
- const sql = manager
33
- .qb(_models_1.Order, "_sub0")
34
- .select("version")
35
- .where({ id: knex.raw(`"o0"."order_id"`) })
36
- .getKnexQuery()
37
- .toString();
38
- defaultVersion = knex.raw(`(${sql})`);
39
- }
40
- const version = config.where.version ?? defaultVersion;
41
- delete config.where?.version;
42
- (_a = config.options).populateWhere ?? (_a.populateWhere = {});
43
- (_b = config.options.populateWhere).items ?? (_b.items = {});
44
- config.options.populateWhere.items.version = version;
45
- (_c = config.options.populateWhere).summary ?? (_c.summary = {});
46
- config.options.populateWhere.summary.version = version;
47
- (_d = config.options.populateWhere).shipping_methods ?? (_d.shipping_methods = {});
48
- config.options.populateWhere.shipping_methods.version = version;
49
- if (!config.options.orderBy) {
50
- config.options.orderBy = { id: "ASC" };
51
- }
52
- return await manager.find(_models_1.Order, config.where, config.options);
53
- }
54
- async findAndCount(findOptions = { where: {} }, context = {}) {
55
- var _a, _b, _c, _d;
56
- const manager = this.getActiveManager(context);
57
- const knex = manager.getKnex();
58
- const findOptions_ = { ...findOptions };
59
- findOptions_.options ?? (findOptions_.options = {});
60
- findOptions_.where ?? (findOptions_.where = {});
61
- if (!("strategy" in findOptions_.options)) {
62
- Object.assign(findOptions_.options, {
63
- strategy: core_1.LoadStrategy.SELECT_IN,
64
- });
65
- }
66
- const config = (0, transform_order_1.mapRepositoryToOrderModel)(findOptions_);
67
- let defaultVersion = knex.raw(`"o0"."version"`);
68
- const strategy = config.options.strategy ?? core_1.LoadStrategy.JOINED;
69
- if (strategy === core_1.LoadStrategy.SELECT_IN) {
70
- const sql = manager
71
- .qb(_models_1.Order, "_sub0")
72
- .select("version")
73
- .where({ id: knex.raw(`"o0"."order_id"`) })
74
- .getKnexQuery()
75
- .toString();
76
- defaultVersion = knex.raw(`(${sql})`);
77
- }
78
- const version = config.where.version ?? defaultVersion;
79
- delete config.where.version;
80
- (_a = config.options).populateWhere ?? (_a.populateWhere = {});
81
- (_b = config.options.populateWhere).items ?? (_b.items = {});
82
- config.options.populateWhere.items.version = version;
83
- (_c = config.options.populateWhere).summary ?? (_c.summary = {});
84
- config.options.populateWhere.summary.version = version;
85
- (_d = config.options.populateWhere).shipping_methods ?? (_d.shipping_methods = {});
86
- config.options.populateWhere.shipping_methods.version = version;
87
- if (!config.options.orderBy) {
88
- config.options.orderBy = { id: "ASC" };
89
- }
90
- return await manager.findAndCount(_models_1.Order, config.where, config.options);
91
- }
92
8
  }
93
9
  exports.OrderRepository = OrderRepository;
10
+ (0, base_repository_find_1.setFindMethods)(OrderRepository, _models_1.Order);
94
11
  //# sourceMappingURL=order.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"order.js","sourceRoot":"","sources":["../../src/repositories/order.ts"],"names":[],"mappings":";;;AACA,2CAA0C;AAC1C,0CAA8C;AAE9C,qCAA+B;AAC/B,8DAAoE;AAEpE,MAAa,eAAgB,SAAQ,gBAAQ,CAAC,6BAA6B,CACzE,eAAK,CACN;IACC,KAAK,CAAC,IAAI,CACR,OAAgC,EAChC,OAAiB;;QAEjB,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAgB,OAAO,CAAC,CAAA;QAC7D,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AAC,OAAO,GAAG,OAAO,CAAA;QAEpD,MAAA,MAAM,CAAC,OAAO,CAAC,aAAa,EAAC,OAAO,QAAP,OAAO,GAAK,EAAE,EAAA;QAC3C,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAA;QAEtD,MAAA,MAAM,CAAC,OAAO,CAAC,aAAa,EAAC,gBAAgB,QAAhB,gBAAgB,GAAK,EAAE,EAAA;QACpD,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,OAAO,GAAG,OAAO,CAAA;QAE/D,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE;YAC3B,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,CAAA;SACvC;QAED,OAAO,MAAM,OAAO,CAAC,YAAY,CAAC,eAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;IACxE,CAAC;CACF;AAjHD,0CAiHC"}
1
+ {"version":3,"file":"order.js","sourceRoot":"","sources":["../../src/repositories/order.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAC1C,qCAA+B;AAC/B,wEAA8D;AAE9D,MAAa,eAAgB,SAAQ,gBAAQ,CAAC,6BAA6B,CACzE,eAAK,CACN;CAAG;AAFJ,0CAEI;AAEJ,IAAA,qCAAc,EAAC,eAAe,EAAE,eAAK,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { DALUtils } from "@medusajs/utils";
2
+ import { Return } from "../models";
3
+ declare const ReturnRepository_base: new ({ manager }: {
4
+ manager: any;
5
+ }) => DALUtils.MikroOrmBaseRepository<Return>;
6
+ export declare class ReturnRepository extends ReturnRepository_base {
7
+ }
8
+ export {};
9
+ //# sourceMappingURL=return.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"return.d.ts","sourceRoot":"","sources":["../../src/repositories/return.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;;;;AAGhC,qBAAa,gBAAiB,SAAQ,qBAErC;CAAG"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReturnRepository = void 0;
4
+ const utils_1 = require("@medusajs/utils");
5
+ const _models_1 = require("../models");
6
+ const base_repository_find_1 = require("../utils/base-repository-find");
7
+ class ReturnRepository extends utils_1.DALUtils.mikroOrmBaseRepositoryFactory(_models_1.Return) {
8
+ }
9
+ exports.ReturnRepository = ReturnRepository;
10
+ (0, base_repository_find_1.setFindMethods)(ReturnRepository, _models_1.Return);
11
+ //# sourceMappingURL=return.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"return.js","sourceRoot":"","sources":["../../src/repositories/return.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAC1C,qCAAgC;AAChC,wEAA8D;AAE9D,MAAa,gBAAiB,SAAQ,gBAAQ,CAAC,6BAA6B,CAC1E,gBAAM,CACP;CAAG;AAFJ,4CAEI;AAEJ,IAAA,qCAAc,EAAC,gBAAgB,EAAE,gBAAM,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Context, OrderTypes } from "@medusajs/types";
2
+ export declare function cancelClaim(this: any, data: OrderTypes.CancelOrderClaimDTO, sharedContext?: Context): Promise<any>;
3
+ //# sourceMappingURL=cancel-claim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel-claim.d.ts","sourceRoot":"","sources":["../../../src/services/actions/cancel-claim.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,UAAU,EACX,MAAM,iBAAiB,CAAA;AA0BxB,wBAAsB,WAAW,CAC/B,IAAI,EAAE,GAAG,EACT,IAAI,EAAE,UAAU,CAAC,mBAAmB,EACpC,aAAa,CAAC,EAAE,OAAO,gBA6GxB"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cancelClaim = void 0;
4
+ const utils_1 = require("@medusajs/utils");
5
+ async function createOrderChange(service, data, returnRef, actions, sharedContext) {
6
+ return await service.createOrderChange_({
7
+ order_id: returnRef.order_id,
8
+ claim_id: returnRef.id,
9
+ reference: "return",
10
+ reference_id: returnRef.id,
11
+ description: data.description,
12
+ internal_note: data.internal_note,
13
+ created_by: data.created_by,
14
+ metadata: data.metadata,
15
+ actions,
16
+ }, sharedContext);
17
+ }
18
+ async function cancelClaim(data, sharedContext) {
19
+ const claimOrder = await this.retrieveClaim(data.claim_id, {
20
+ select: [
21
+ "id",
22
+ "order_id",
23
+ "return.id",
24
+ "return.items.id",
25
+ "return.items.quantity",
26
+ "claim_items.item_id",
27
+ "claim_items.quantity",
28
+ "additional_items.id",
29
+ "additional_items.quantity",
30
+ ],
31
+ relations: ["return.items", "additional_items", "shipping_methods"],
32
+ }, sharedContext);
33
+ const actions = [];
34
+ claimOrder.return.items.forEach((item) => {
35
+ actions.push({
36
+ action: utils_1.ChangeActionType.CANCEL_RETURN_ITEM,
37
+ order_id: claimOrder.order_id,
38
+ claim_id: claimOrder.id,
39
+ return_id: claimOrder.return.id,
40
+ reference: "return",
41
+ reference_id: claimOrder.return.id,
42
+ details: {
43
+ reference_id: item.id,
44
+ order_id: claimOrder.order_id,
45
+ claim_id: claimOrder.id,
46
+ return_id: claimOrder.return.id,
47
+ quantity: item.quantity,
48
+ },
49
+ });
50
+ });
51
+ claimOrder.claim_items.forEach((item) => {
52
+ actions.push({
53
+ action: utils_1.ChangeActionType.REINSTATE_ITEM,
54
+ claim_id: claimOrder.id,
55
+ reference: "claim",
56
+ reference_id: claimOrder.id,
57
+ details: {
58
+ reference_id: item.id,
59
+ claim_id: claimOrder.id,
60
+ quantity: item.quantity,
61
+ },
62
+ });
63
+ });
64
+ claimOrder.additional_items.forEach((item) => {
65
+ actions.push({
66
+ action: utils_1.ChangeActionType.ITEM_REMOVE,
67
+ order_id: claimOrder.order_id,
68
+ claim_id: claimOrder.id,
69
+ reference: "claim",
70
+ reference_id: claimOrder.id,
71
+ details: {
72
+ reference_id: item.id,
73
+ order_id: claimOrder.order_id,
74
+ claim_id: claimOrder.id,
75
+ quantity: item.quantity,
76
+ },
77
+ });
78
+ });
79
+ claimOrder.shipping_methods?.forEach((shipping) => {
80
+ actions.push({
81
+ action: utils_1.ChangeActionType.SHIPPING_REMOVE,
82
+ order_id: claimOrder.order_id,
83
+ claim_id: claimOrder.id,
84
+ return_id: claimOrder.return.id,
85
+ reference: "claim",
86
+ reference_id: shipping.id,
87
+ amount: shipping.price,
88
+ });
89
+ });
90
+ const [change] = await createOrderChange(this, data, claimOrder, actions, sharedContext);
91
+ await (0, utils_1.promiseAll)([
92
+ this.updateClaims([
93
+ {
94
+ data: {
95
+ canceled_at: new Date(),
96
+ },
97
+ selector: {
98
+ id: claimOrder.id,
99
+ },
100
+ },
101
+ ], sharedContext),
102
+ this.confirmOrderChange(change.id, sharedContext),
103
+ ]);
104
+ return claimOrder;
105
+ }
106
+ exports.cancelClaim = cancelClaim;
107
+ //# sourceMappingURL=cancel-claim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel-claim.js","sourceRoot":"","sources":["../../../src/services/actions/cancel-claim.ts"],"names":[],"mappings":";;;AAKA,2CAA8D;AAE9D,KAAK,UAAU,iBAAiB,CAC9B,OAAO,EACP,IAAI,EACJ,SAAS,EACT,OAAO,EACP,aAAa;IAEb,OAAO,MAAM,OAAO,CAAC,kBAAkB,CACrC;QACE,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,QAAQ,EAAE,SAAS,CAAC,EAAE;QACtB,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,SAAS,CAAC,EAAE;QAC1B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;Q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iBAAiB,CACtC,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,OAAO,EACP,aAAa,CACd,CAAA;IAED,MAAM,IAAA,kBAAU,EAAC;QACf,IAAI,CAAC,YAAY,CACf;YACE;gBACE,IAAI,EAAE;oBACJ,WAAW,EAAE,IAAI,IAAI,EAAE;iBACxB;gBACD,QAAQ,EAAE;oBACR,EAAE,EAAE,UAAU,CAAC,EAAE;iBAClB;aACF;SACF,EACD,aAAa,CACd;QACD,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,CAAC;KAClD,CAAC,CAAA;IAEF,OAAO,UAAU,CAAA;AACnB,CAAC;AAhHD,kCAgHC"}
@@ -0,0 +1,3 @@
1
+ import { Context, OrderTypes } from "@medusajs/types";
2
+ export declare function cancelExchange(this: any, data: OrderTypes.CancelOrderExchangeDTO, sharedContext?: Context): Promise<any>;
3
+ //# sourceMappingURL=cancel-exchange.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel-exchange.d.ts","sourceRoot":"","sources":["../../../src/services/actions/cancel-exchange.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,UAAU,EACX,MAAM,iBAAiB,CAAA;AA0BxB,wBAAsB,cAAc,CAClC,IAAI,EAAE,GAAG,EACT,IAAI,EAAE,UAAU,CAAC,sBAAsB,EACvC,aAAa,CAAC,EAAE,OAAO,gBA6FxB"}