@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.
- package/dist/index.d.ts +6 -8
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -26
- package/dist/index.js.map +1 -1
- package/dist/joiner-config.d.ts +2 -5
- package/dist/joiner-config.d.ts.map +1 -0
- package/dist/joiner-config.js +21 -28
- package/dist/joiner-config.js.map +1 -1
- package/dist/migrations/Migration20240219102530.d.ts +1 -0
- package/dist/migrations/Migration20240219102530.d.ts.map +1 -0
- package/dist/migrations/Migration20240219102530.js +53 -19
- package/dist/migrations/Migration20240219102530.js.map +1 -1
- package/dist/migrations/Migration20240604100512.d.ts +5 -0
- package/dist/migrations/Migration20240604100512.d.ts.map +1 -0
- package/dist/migrations/Migration20240604100512.js +371 -0
- package/dist/migrations/Migration20240604100512.js.map +1 -0
- package/dist/migrations/Migration20240715102100.d.ts +5 -0
- package/dist/migrations/Migration20240715102100.d.ts.map +1 -0
- package/dist/migrations/Migration20240715102100.js +15 -0
- package/dist/migrations/Migration20240715102100.js.map +1 -0
- package/dist/migrations/Migration20240715174100.d.ts +5 -0
- package/dist/migrations/Migration20240715174100.d.ts.map +1 -0
- package/dist/migrations/Migration20240715174100.js +21 -0
- package/dist/migrations/Migration20240715174100.js.map +1 -0
- package/dist/migrations/Migration20240716081800.d.ts +5 -0
- package/dist/migrations/Migration20240716081800.d.ts.map +1 -0
- package/dist/migrations/Migration20240716081800.js +67 -0
- package/dist/migrations/Migration20240716081800.js.map +1 -0
- package/dist/migrations/Migration20240801085921.d.ts +5 -0
- package/dist/migrations/Migration20240801085921.d.ts.map +1 -0
- package/dist/migrations/Migration20240801085921.js +30 -0
- package/dist/migrations/Migration20240801085921.js.map +1 -0
- package/dist/migrations/Migration20240821164505.d.ts +6 -0
- package/dist/migrations/Migration20240821164505.d.ts.map +1 -0
- package/dist/migrations/Migration20240821164505.js +26 -0
- package/dist/migrations/Migration20240821164505.js.map +1 -0
- package/dist/migrations/Migration20240821170920.d.ts +6 -0
- package/dist/migrations/Migration20240821170920.d.ts.map +1 -0
- package/dist/migrations/Migration20240821170920.js +18 -0
- package/dist/migrations/Migration20240821170920.js.map +1 -0
- package/dist/migrations/Migration20240827133639.d.ts +6 -0
- package/dist/migrations/Migration20240827133639.d.ts.map +1 -0
- package/dist/migrations/Migration20240827133639.js +17 -0
- package/dist/migrations/Migration20240827133639.js.map +1 -0
- package/dist/migrations/Migration20240902195921.d.ts +6 -0
- package/dist/migrations/Migration20240902195921.d.ts.map +1 -0
- package/dist/migrations/Migration20240902195921.js +16 -0
- package/dist/migrations/Migration20240902195921.js.map +1 -0
- package/dist/migrations/Migration20240913092514.d.ts +6 -0
- package/dist/migrations/Migration20240913092514.d.ts.map +1 -0
- package/dist/migrations/Migration20240913092514.js +17 -0
- package/dist/migrations/Migration20240913092514.js.map +1 -0
- package/dist/models/address.d.ts +4 -3
- package/dist/models/address.d.ts.map +1 -0
- package/dist/models/address.js +22 -22
- package/dist/models/address.js.map +1 -1
- package/dist/models/adjustment-line.d.ts +5 -3
- package/dist/models/adjustment-line.d.ts.map +1 -0
- package/dist/models/adjustment-line.js +6 -1
- package/dist/models/adjustment-line.js.map +1 -1
- package/dist/models/claim-item-image.d.ts +19 -0
- package/dist/models/claim-item-image.d.ts.map +1 -0
- package/dist/models/claim-item-image.js +109 -0
- package/dist/models/claim-item-image.js.map +1 -0
- package/dist/models/claim-item.d.ts +29 -0
- package/dist/models/claim-item.d.ts.map +1 -0
- package/dist/models/claim-item.js +157 -0
- package/dist/models/claim-item.js.map +1 -0
- package/dist/models/claim.d.ts +37 -0
- package/dist/models/claim.d.ts.map +1 -0
- package/dist/models/claim.js +201 -0
- package/dist/models/claim.js.map +1 -0
- package/dist/models/exchange-item.d.ts +24 -0
- package/dist/models/exchange-item.d.ts.map +1 -0
- package/dist/models/exchange-item.js +138 -0
- package/dist/models/exchange-item.js.map +1 -0
- package/dist/models/exchange.d.ts +35 -0
- package/dist/models/exchange.d.ts.map +1 -0
- package/dist/models/exchange.js +194 -0
- package/dist/models/exchange.js.map +1 -0
- package/dist/models/index.d.ts +18 -9
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +26 -10
- package/dist/models/index.js.map +1 -1
- package/dist/models/line-item-adjustment.d.ts +5 -3
- package/dist/models/line-item-adjustment.d.ts.map +1 -0
- package/dist/models/line-item-adjustment.js +12 -12
- package/dist/models/line-item-adjustment.js.map +1 -1
- package/dist/models/line-item-tax-line.d.ts +5 -3
- package/dist/models/line-item-tax-line.d.ts.map +1 -0
- package/dist/models/line-item-tax-line.js +12 -12
- package/dist/models/line-item-tax-line.js.map +1 -1
- package/dist/models/line-item.d.ts +11 -8
- package/dist/models/line-item.d.ts.map +1 -0
- package/dist/models/line-item.js +58 -39
- package/dist/models/line-item.js.map +1 -1
- package/dist/models/order-change-action.d.ts +17 -6
- package/dist/models/order-change-action.d.ts.map +1 -0
- package/dist/models/order-change-action.js +110 -8
- package/dist/models/order-change-action.js.map +1 -1
- package/dist/models/order-change.d.ts +18 -6
- package/dist/models/order-change.d.ts.map +1 -0
- package/dist/models/order-change.js +108 -6
- package/dist/models/order-change.js.map +1 -1
- package/dist/models/order-item.d.ts +10 -7
- package/dist/models/order-item.d.ts.map +1 -0
- package/dist/models/order-item.js +29 -19
- package/dist/models/order-item.js.map +1 -1
- package/dist/models/order-shipping-method.d.ts +17 -7
- package/dist/models/order-shipping-method.d.ts.map +1 -0
- package/dist/models/order-shipping-method.js +113 -33
- package/dist/models/order-shipping-method.js.map +1 -1
- package/dist/models/order-summary.d.ts +7 -8
- package/dist/models/order-summary.d.ts.map +1 -0
- package/dist/models/order-summary.js +14 -10
- package/dist/models/order-summary.js.map +1 -1
- package/dist/models/order.d.ts +13 -11
- package/dist/models/order.d.ts.map +1 -0
- package/dist/models/order.js +12 -2
- package/dist/models/order.js.map +1 -1
- package/dist/models/return-item.d.ts +31 -0
- package/dist/models/return-item.d.ts.map +1 -0
- package/dist/models/return-item.js +180 -0
- package/dist/models/return-item.js.map +1 -0
- package/dist/models/return-reason.d.ts +22 -0
- package/dist/models/return-reason.d.ts.map +1 -0
- package/dist/models/return-reason.js +122 -0
- package/dist/models/return-reason.js.map +1 -0
- package/dist/models/return.d.ts +41 -0
- package/dist/models/return.d.ts.map +1 -0
- package/dist/models/return.js +227 -0
- package/dist/models/return.js.map +1 -0
- package/dist/models/shipping-method-adjustment.d.ts +5 -3
- package/dist/models/shipping-method-adjustment.d.ts.map +1 -0
- package/dist/models/shipping-method-adjustment.js +12 -12
- package/dist/models/shipping-method-adjustment.js.map +1 -1
- package/dist/models/shipping-method-tax-line.d.ts +5 -3
- package/dist/models/shipping-method-tax-line.d.ts.map +1 -0
- package/dist/models/shipping-method-tax-line.js +12 -12
- package/dist/models/shipping-method-tax-line.js.map +1 -1
- package/dist/models/shipping-method.d.ts +10 -7
- package/dist/models/shipping-method.d.ts.map +1 -0
- package/dist/models/shipping-method.js +42 -24
- package/dist/models/shipping-method.js.map +1 -1
- package/dist/models/tax-line.d.ts +4 -2
- package/dist/models/tax-line.d.ts.map +1 -0
- package/dist/models/tax-line.js +8 -1
- package/dist/models/tax-line.js.map +1 -1
- package/dist/models/transaction.d.ts +18 -6
- package/dist/models/transaction.d.ts.map +1 -0
- package/dist/models/transaction.js +133 -24
- package/dist/models/transaction.js.map +1 -1
- package/dist/repositories/claim.d.ts +9 -0
- package/dist/repositories/claim.d.ts.map +1 -0
- package/dist/repositories/claim.js +11 -0
- package/dist/repositories/claim.js.map +1 -0
- package/dist/repositories/exchange.d.ts +9 -0
- package/dist/repositories/exchange.d.ts.map +1 -0
- package/dist/repositories/exchange.js +11 -0
- package/dist/repositories/exchange.js.map +1 -0
- package/dist/repositories/index.d.ts +5 -2
- package/dist/repositories/index.d.ts.map +1 -0
- package/dist/repositories/index.js +8 -17
- package/dist/repositories/index.js.map +1 -1
- package/dist/repositories/order.d.ts +2 -4
- package/dist/repositories/order.d.ts.map +1 -0
- package/dist/repositories/order.js +3 -86
- package/dist/repositories/order.js.map +1 -1
- package/dist/repositories/return.d.ts +9 -0
- package/dist/repositories/return.d.ts.map +1 -0
- package/dist/repositories/return.js +11 -0
- package/dist/repositories/return.js.map +1 -0
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +556 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/services/actions/cancel-claim.d.ts +3 -0
- package/dist/services/actions/cancel-claim.d.ts.map +1 -0
- package/dist/services/actions/cancel-claim.js +85 -0
- package/dist/services/actions/cancel-claim.js.map +1 -0
- package/dist/services/actions/cancel-exchange.d.ts +3 -0
- package/dist/services/actions/cancel-exchange.d.ts.map +1 -0
- package/dist/services/actions/cancel-exchange.js +71 -0
- package/dist/services/actions/cancel-exchange.js.map +1 -0
- package/dist/services/actions/cancel-fulfillment.d.ts +3 -0
- package/dist/services/actions/cancel-fulfillment.d.ts.map +1 -0
- package/dist/services/actions/cancel-fulfillment.js +31 -0
- package/dist/services/actions/cancel-fulfillment.js.map +1 -0
- package/dist/services/actions/cancel-return.d.ts +3 -0
- package/dist/services/actions/cancel-return.d.ts.map +1 -0
- package/dist/services/actions/cancel-return.js +69 -0
- package/dist/services/actions/cancel-return.js.map +1 -0
- package/dist/services/actions/create-claim.d.ts +3 -0
- package/dist/services/actions/create-claim.d.ts.map +1 -0
- package/dist/services/actions/create-claim.js +225 -0
- package/dist/services/actions/create-claim.js.map +1 -0
- package/dist/services/actions/create-exchange.d.ts +3 -0
- package/dist/services/actions/create-exchange.d.ts.map +1 -0
- package/dist/services/actions/create-exchange.js +191 -0
- package/dist/services/actions/create-exchange.js.map +1 -0
- package/dist/services/actions/create-return.d.ts +3 -0
- package/dist/services/actions/create-return.d.ts.map +1 -0
- package/dist/services/actions/create-return.js +100 -0
- package/dist/services/actions/create-return.js.map +1 -0
- package/dist/services/actions/index.d.ts +12 -0
- package/dist/services/actions/index.d.ts.map +1 -0
- package/dist/services/actions/index.js +28 -0
- package/dist/services/actions/index.js.map +1 -0
- package/dist/services/actions/receive-return.d.ts +3 -0
- package/dist/services/actions/receive-return.d.ts.map +1 -0
- package/dist/services/actions/receive-return.js +71 -0
- package/dist/services/actions/receive-return.js.map +1 -0
- package/dist/services/actions/register-delivery.d.ts +3 -0
- package/dist/services/actions/register-delivery.d.ts.map +1 -0
- package/dist/services/actions/register-delivery.js +29 -0
- package/dist/services/actions/register-delivery.js.map +1 -0
- package/dist/services/actions/register-fulfillment.d.ts +3 -0
- package/dist/services/actions/register-fulfillment.d.ts.map +1 -0
- package/dist/services/actions/register-fulfillment.js +29 -0
- package/dist/services/actions/register-fulfillment.js.map +1 -0
- package/dist/services/actions/register-shipment.d.ts +3 -0
- package/dist/services/actions/register-shipment.d.ts.map +1 -0
- package/dist/services/actions/register-shipment.js +37 -0
- package/dist/services/actions/register-shipment.js.map +1 -0
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +1 -3
- package/dist/services/index.js.map +1 -1
- package/dist/services/order-module-service.d.ts +191 -109
- package/dist/services/order-module-service.d.ts.map +1 -0
- package/dist/services/order-module-service.js +1165 -425
- package/dist/services/order-module-service.js.map +1 -1
- package/dist/services/order-service.d.ts +6 -5
- package/dist/services/order-service.d.ts.map +1 -0
- package/dist/services/order-service.js +2 -2
- package/dist/services/order-service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/address.d.ts +2 -1
- package/dist/types/address.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -2
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/line-item-adjustment.d.ts +2 -1
- package/dist/types/line-item-adjustment.d.ts.map +1 -0
- package/dist/types/line-item-tax-line.d.ts +1 -0
- package/dist/types/line-item-tax-line.d.ts.map +1 -0
- package/dist/types/line-item.d.ts +2 -1
- package/dist/types/line-item.d.ts.map +1 -0
- package/dist/types/order-change.d.ts +4 -0
- package/dist/types/order-change.d.ts.map +1 -0
- package/dist/types/order-change.js +3 -0
- package/dist/types/order-change.js.map +1 -0
- package/dist/types/order-detail.d.ts +3 -2
- package/dist/types/order-detail.d.ts.map +1 -0
- package/dist/types/order.d.ts +4 -3
- package/dist/types/order.d.ts.map +1 -0
- package/dist/types/return-reason.d.ts +5 -0
- package/dist/types/return-reason.d.ts.map +1 -0
- package/dist/types/return-reason.js +3 -0
- package/dist/types/return-reason.js.map +1 -0
- package/dist/types/shipping-method-adjustment.d.ts +2 -1
- package/dist/types/shipping-method-adjustment.d.ts.map +1 -0
- package/dist/types/shipping-method-tax-line.d.ts +1 -0
- package/dist/types/shipping-method-tax-line.d.ts.map +1 -0
- package/dist/types/shipping-method.d.ts +5 -1
- package/dist/types/shipping-method.d.ts.map +1 -0
- package/dist/types/tax-line.d.ts +2 -1
- package/dist/types/tax-line.d.ts.map +1 -0
- package/dist/types/transaction.d.ts +2 -1
- package/dist/types/transaction.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +41 -23
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/index.js +0 -1
- package/dist/types/utils/index.js.map +1 -1
- package/dist/utils/actions/cancel-item-fulfillment.d.ts +2 -0
- package/dist/utils/actions/cancel-item-fulfillment.d.ts.map +1 -0
- package/dist/utils/actions/cancel-item-fulfillment.js +34 -0
- package/dist/utils/actions/cancel-item-fulfillment.js.map +1 -0
- package/dist/utils/actions/cancel-return.d.ts +1 -0
- package/dist/utils/actions/cancel-return.d.ts.map +1 -0
- package/dist/utils/actions/cancel-return.js +9 -16
- package/dist/utils/actions/cancel-return.js.map +1 -1
- package/dist/utils/actions/deliver-item.d.ts +2 -0
- package/dist/utils/actions/deliver-item.d.ts.map +1 -0
- package/dist/utils/actions/deliver-item.js +38 -0
- package/dist/utils/actions/deliver-item.js.map +1 -0
- package/dist/utils/actions/fulfill-item.d.ts +1 -0
- package/dist/utils/actions/fulfill-item.d.ts.map +1 -0
- package/dist/utils/actions/fulfill-item.js +8 -12
- package/dist/utils/actions/fulfill-item.js.map +1 -1
- package/dist/utils/actions/index.d.ts +7 -1
- package/dist/utils/actions/index.d.ts.map +1 -0
- package/dist/utils/actions/index.js +6 -1
- package/dist/utils/actions/index.js.map +1 -1
- package/dist/utils/actions/item-add.d.ts +1 -0
- package/dist/utils/actions/item-add.d.ts.map +1 -0
- package/dist/utils/actions/item-add.js +17 -26
- package/dist/utils/actions/item-add.js.map +1 -1
- package/dist/utils/actions/item-remove.d.ts +1 -0
- package/dist/utils/actions/item-remove.d.ts.map +1 -0
- package/dist/utils/actions/item-remove.js +10 -30
- package/dist/utils/actions/item-remove.js.map +1 -1
- package/dist/utils/actions/item-update.d.ts +2 -0
- package/dist/utils/actions/item-update.d.ts.map +1 -0
- package/dist/utils/actions/item-update.js +37 -0
- package/dist/utils/actions/item-update.js.map +1 -0
- package/dist/utils/actions/receive-damaged-return-item.d.ts +1 -0
- package/dist/utils/actions/receive-damaged-return-item.d.ts.map +1 -0
- package/dist/utils/actions/receive-damaged-return-item.js +11 -37
- package/dist/utils/actions/receive-damaged-return-item.js.map +1 -1
- package/dist/utils/actions/receive-return-item.d.ts +1 -0
- package/dist/utils/actions/receive-return-item.d.ts.map +1 -0
- package/dist/utils/actions/receive-return-item.js +9 -38
- package/dist/utils/actions/receive-return-item.js.map +1 -1
- package/dist/utils/actions/reinstate-item.d.ts +2 -0
- package/dist/utils/actions/reinstate-item.d.ts.map +1 -0
- package/dist/utils/actions/reinstate-item.js +32 -0
- package/dist/utils/actions/reinstate-item.js.map +1 -0
- package/dist/utils/actions/return-item.d.ts +1 -0
- package/dist/utils/actions/return-item.d.ts.map +1 -0
- package/dist/utils/actions/return-item.js +10 -15
- package/dist/utils/actions/return-item.js.map +1 -1
- package/dist/utils/actions/ship-item.d.ts +1 -0
- package/dist/utils/actions/ship-item.d.ts.map +1 -0
- package/dist/utils/actions/ship-item.js +8 -12
- package/dist/utils/actions/ship-item.js.map +1 -1
- package/dist/utils/actions/shipping-add.d.ts +1 -0
- package/dist/utils/actions/shipping-add.d.ts.map +1 -0
- package/dist/utils/actions/shipping-add.js +18 -18
- package/dist/utils/actions/shipping-add.js.map +1 -1
- package/dist/utils/actions/shipping-remove.d.ts +2 -0
- package/dist/utils/actions/shipping-remove.d.ts.map +1 -0
- package/dist/utils/actions/shipping-remove.js +22 -0
- package/dist/utils/actions/shipping-remove.js.map +1 -0
- package/dist/utils/actions/write-off-item.d.ts +1 -0
- package/dist/utils/actions/write-off-item.d.ts.map +1 -0
- package/dist/utils/actions/write-off-item.js +8 -12
- package/dist/utils/actions/write-off-item.js.map +1 -1
- package/dist/utils/apply-order-changes.d.ts +18 -0
- package/dist/utils/apply-order-changes.d.ts.map +1 -0
- package/dist/utils/apply-order-changes.js +98 -0
- package/dist/utils/apply-order-changes.js.map +1 -0
- package/dist/utils/base-repository-find.d.ts +3 -0
- package/dist/utils/base-repository-find.d.ts.map +1 -0
- package/dist/utils/base-repository-find.js +154 -0
- package/dist/utils/base-repository-find.js.map +1 -0
- package/dist/utils/calculate-order-change.d.ts +12 -6
- package/dist/utils/calculate-order-change.d.ts.map +1 -0
- package/dist/utils/calculate-order-change.js +56 -187
- package/dist/utils/calculate-order-change.js.map +1 -1
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/set-action-reference.d.ts +2 -0
- package/dist/utils/set-action-reference.d.ts.map +1 -0
- package/dist/utils/set-action-reference.js +10 -0
- package/dist/utils/set-action-reference.js.map +1 -0
- package/dist/utils/transform-order.d.ts +5 -4
- package/dist/utils/transform-order.d.ts.map +1 -0
- package/dist/utils/transform-order.js +138 -21
- package/dist/utils/transform-order.js.map +1 -1
- package/package.json +25 -26
- package/dist/module-definition.d.ts +0 -2
- package/dist/module-definition.js +0 -59
- package/dist/module-definition.js.map +0 -1
- package/dist/scripts/bin/run-seed.d.ts +0 -3
- package/dist/scripts/bin/run-seed.js +0 -49
- package/dist/scripts/bin/run-seed.js.map +0 -1
- package/dist/services/order-change-service.d.ts +0 -15
- package/dist/services/order-change-service.js +0 -96
- package/dist/services/order-change-service.js.map +0 -1
- package/dist/utils/action-key.d.ts +0 -13
- package/dist/utils/action-key.js +0 -18
- package/dist/utils/action-key.js.map +0 -1
- package/dist/utils/actions/cancel.d.ts +0 -1
- package/dist/utils/actions/cancel.js +0 -8
- package/dist/utils/actions/cancel.js.map +0 -1
@@ -1,96 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
13
|
-
};
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
const utils_1 = require("@medusajs/utils");
|
16
|
-
const _models_1 = require("../models");
|
17
|
-
class OrderChangeService extends utils_1.ModulesSdkUtils.internalModuleServiceFactory(_models_1.OrderChange) {
|
18
|
-
constructor(container) {
|
19
|
-
// @ts-ignore
|
20
|
-
super(...arguments);
|
21
|
-
this.orderChangeRepository_ = container.orderChangeRepository;
|
22
|
-
}
|
23
|
-
async listCurrentOrderChange(orderId, config = {}, sharedContext = {}) {
|
24
|
-
const allChanges = await super.list({ order_id: orderId }, config ?? {
|
25
|
-
select: ["order_id", "status", "version"],
|
26
|
-
order: {
|
27
|
-
order_id: "ASC",
|
28
|
-
version: "DESC",
|
29
|
-
},
|
30
|
-
});
|
31
|
-
if (!allChanges.length) {
|
32
|
-
return [];
|
33
|
-
}
|
34
|
-
const lastChanges = [];
|
35
|
-
const seen = new Set();
|
36
|
-
for (let i = 0; i < allChanges.length; i++) {
|
37
|
-
if (seen.has(allChanges[i].order_id)) {
|
38
|
-
continue;
|
39
|
-
}
|
40
|
-
seen.add(allChanges[i].order_id);
|
41
|
-
if (this.isActive(allChanges[i])) {
|
42
|
-
lastChanges.push(allChanges[i].id);
|
43
|
-
}
|
44
|
-
}
|
45
|
-
let orderChange;
|
46
|
-
if (allChanges?.length > 0) {
|
47
|
-
if (this.isActive(allChanges[0])) {
|
48
|
-
orderChange = allChanges[0];
|
49
|
-
}
|
50
|
-
}
|
51
|
-
if (!orderChange) {
|
52
|
-
return [];
|
53
|
-
}
|
54
|
-
const relations = (0, utils_1.deduplicate)([...(config.relations ?? []), "actions"]);
|
55
|
-
config.relations = relations;
|
56
|
-
const queryConfig = utils_1.ModulesSdkUtils.buildQuery({
|
57
|
-
id: lastChanges,
|
58
|
-
order: {
|
59
|
-
items: {
|
60
|
-
version: orderChange.version,
|
61
|
-
},
|
62
|
-
},
|
63
|
-
}, config);
|
64
|
-
return await this.orderChangeRepository_.find(queryConfig, sharedContext);
|
65
|
-
}
|
66
|
-
isActive(orderChange) {
|
67
|
-
return (orderChange.status === utils_1.OrderChangeStatus.PENDING ||
|
68
|
-
orderChange.status === utils_1.OrderChangeStatus.REQUESTED);
|
69
|
-
}
|
70
|
-
async create(data, sharedContext = {}) {
|
71
|
-
const dataArr = Array.isArray(data) ? data : [data];
|
72
|
-
const activeOrderEdit = await this.listCurrentOrderChange(dataArr.map((d) => d.order_id), {}, sharedContext);
|
73
|
-
if (activeOrderEdit.length > 0) {
|
74
|
-
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `An active order change already exists for the order(s) ${activeOrderEdit
|
75
|
-
.map((a) => a.order_id)
|
76
|
-
.join(",")}`);
|
77
|
-
}
|
78
|
-
return await super.create(dataArr, sharedContext);
|
79
|
-
}
|
80
|
-
}
|
81
|
-
exports.default = OrderChangeService;
|
82
|
-
__decorate([
|
83
|
-
(0, utils_1.InjectManager)("orderChangeRepository_"),
|
84
|
-
__param(2, (0, utils_1.MedusaContext)()),
|
85
|
-
__metadata("design:type", Function),
|
86
|
-
__metadata("design:paramtypes", [Object, Object, Object]),
|
87
|
-
__metadata("design:returntype", Promise)
|
88
|
-
], OrderChangeService.prototype, "listCurrentOrderChange", null);
|
89
|
-
__decorate([
|
90
|
-
(0, utils_1.InjectTransactionManager)("orderChangeRepository_"),
|
91
|
-
__param(1, (0, utils_1.MedusaContext)()),
|
92
|
-
__metadata("design:type", Function),
|
93
|
-
__metadata("design:paramtypes", [Object, Object]),
|
94
|
-
__metadata("design:returntype", Promise)
|
95
|
-
], OrderChangeService.prototype, "create", null);
|
96
|
-
//# sourceMappingURL=order-change-service.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"order-change-service.js","sourceRoot":"","sources":["../../src/services/order-change-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAOA,2CAQwB;AACxB,qCAAqC;AAMrC,MAAqB,kBAEnB,SAAQ,uBAAe,CAAC,4BAA4B,CACpD,qBAAW,CACH;IAGR,YAAY,SAA+B;QACzC,aAAa;QACb,KAAK,CAAC,GAAG,SAAS,CAAC,CAAA;QACnB,IAAI,CAAC,sBAAsB,GAAG,SAAS,CAAC,qBAAqB,CAAA;IAC/D,CAAC;IAGK,AAAN,KAAK,CAAC,sBAAsB,CAC1B,OAA0B,EAC1B,SAAoC,EAAE,EACrB,gBAAyB,EAAE;QAE5C,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,IAAI,CACjC,EAAE,QAAQ,EAAE,OAAO,EAAE,EACrB,MAAM,I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,IAAA,gCAAwB,EAAC,wBAAwB,CAAC;IAGhD,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;gDAmBjB"}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
export declare enum ChangeActionType {
|
2
|
-
CANCEL = "CANCEL",
|
3
|
-
CANCEL_RETURN = "CANCEL_RETURN",
|
4
|
-
FULFILL_ITEM = "FULFILL_ITEM",
|
5
|
-
ITEM_ADD = "ITEM_ADD",
|
6
|
-
ITEM_REMOVE = "ITEM_REMOVE",
|
7
|
-
RECEIVE_DAMAGED_RETURN_ITEM = "RECEIVE_DAMAGED_RETURN_ITEM",
|
8
|
-
RECEIVE_RETURN_ITEM = "RECEIVE_RETURN_ITEM",
|
9
|
-
RETURN_ITEM = "RETURN_ITEM",
|
10
|
-
SHIPPING_ADD = "SHIPPING_ADD",
|
11
|
-
SHIP_ITEM = "SHIP_ITEM",
|
12
|
-
WRITE_OFF_ITEM = "WRITE_OFF_ITEM"
|
13
|
-
}
|
package/dist/utils/action-key.js
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ChangeActionType = void 0;
|
4
|
-
var ChangeActionType;
|
5
|
-
(function (ChangeActionType) {
|
6
|
-
ChangeActionType["CANCEL"] = "CANCEL";
|
7
|
-
ChangeActionType["CANCEL_RETURN"] = "CANCEL_RETURN";
|
8
|
-
ChangeActionType["FULFILL_ITEM"] = "FULFILL_ITEM";
|
9
|
-
ChangeActionType["ITEM_ADD"] = "ITEM_ADD";
|
10
|
-
ChangeActionType["ITEM_REMOVE"] = "ITEM_REMOVE";
|
11
|
-
ChangeActionType["RECEIVE_DAMAGED_RETURN_ITEM"] = "RECEIVE_DAMAGED_RETURN_ITEM";
|
12
|
-
ChangeActionType["RECEIVE_RETURN_ITEM"] = "RECEIVE_RETURN_ITEM";
|
13
|
-
ChangeActionType["RETURN_ITEM"] = "RETURN_ITEM";
|
14
|
-
ChangeActionType["SHIPPING_ADD"] = "SHIPPING_ADD";
|
15
|
-
ChangeActionType["SHIP_ITEM"] = "SHIP_ITEM";
|
16
|
-
ChangeActionType["WRITE_OFF_ITEM"] = "WRITE_OFF_ITEM";
|
17
|
-
})(ChangeActionType || (exports.ChangeActionType = ChangeActionType = {}));
|
18
|
-
//# sourceMappingURL=action-key.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"action-key.js","sourceRoot":"","sources":["../../src/utils/action-key.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAYX;AAZD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,mDAA+B,CAAA;IAC/B,iDAA6B,CAAA;IAC7B,yCAAqB,CAAA;IACrB,+CAA2B,CAAA;IAC3B,+EAA2D,CAAA;IAC3D,+DAA2C,CAAA;IAC3C,+CAA2B,CAAA;IAC3B,iDAA6B,CAAA;IAC7B,2CAAuB,CAAA;IACvB,qDAAiC,CAAA;AACnC,CAAC,EAZW,gBAAgB,gCAAhB,gBAAgB,QAY3B"}
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,8 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const action_key_1 = require("../action-key");
|
4
|
-
const calculate_order_change_1 = require("../calculate-order-change");
|
5
|
-
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.CANCEL, {
|
6
|
-
void: true,
|
7
|
-
});
|
8
|
-
//# sourceMappingURL=cancel.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../src/utils/actions/cancel.ts"],"names":[],"mappings":";;AAAA,8CAAgD;AAChD,sEAAiE;AAEjE,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,MAAM,EAAE;IAChE,IAAI,EAAE,IAAI;CACX,CAAC,CAAA"}
|