@medusajs/order 0.1.3-snapshot-20240607093839 → 0.1.3-snapshot-20240701122250
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/joiner-config.d.ts +1 -3
- package/dist/joiner-config.js +4 -42
- package/dist/joiner-config.js.map +1 -1
- package/dist/migrations/Migration20240604100512.d.ts +4 -0
- package/dist/migrations/Migration20240604100512.js +364 -0
- package/dist/migrations/Migration20240604100512.js.map +1 -0
- package/dist/models/claim-item-image.d.ts +18 -0
- package/dist/models/claim-item-image.js +108 -0
- package/dist/models/claim-item-image.js.map +1 -0
- package/dist/models/claim-item.d.ts +28 -0
- package/dist/models/claim-item.js +156 -0
- package/dist/models/claim-item.js.map +1 -0
- package/dist/models/claim.d.ts +35 -0
- package/dist/models/claim.js +196 -0
- package/dist/models/claim.js.map +1 -0
- package/dist/models/exchange-item.d.ts +23 -0
- package/dist/models/exchange-item.js +138 -0
- package/dist/models/exchange-item.js.map +1 -0
- package/dist/models/exchange.d.ts +33 -0
- package/dist/models/exchange.js +189 -0
- package/dist/models/exchange.js.map +1 -0
- package/dist/models/index.d.ts +7 -0
- package/dist/models/index.js +15 -1
- package/dist/models/index.js.map +1 -1
- package/dist/models/line-item-adjustment.d.ts +2 -1
- package/dist/models/line-item-adjustment.js +1 -1
- package/dist/models/line-item-adjustment.js.map +1 -1
- package/dist/models/line-item-tax-line.d.ts +2 -1
- package/dist/models/line-item-tax-line.js +1 -1
- package/dist/models/line-item-tax-line.js.map +1 -1
- package/dist/models/line-item.d.ts +1 -1
- package/dist/models/line-item.js +3 -3
- package/dist/models/line-item.js.map +1 -1
- package/dist/models/order-change-action.d.ts +13 -3
- package/dist/models/order-change-action.js +94 -0
- package/dist/models/order-change-action.js.map +1 -1
- package/dist/models/order-change.d.ts +14 -3
- package/dist/models/order-change.js +107 -3
- package/dist/models/order-change.js.map +1 -1
- package/dist/models/order-item.d.ts +3 -3
- package/dist/models/order-item.js +7 -7
- package/dist/models/order-item.js.map +1 -1
- package/dist/models/order-shipping-method.d.ts +12 -3
- package/dist/models/order-shipping-method.js +83 -7
- package/dist/models/order-shipping-method.js.map +1 -1
- package/dist/models/order-summary.d.ts +3 -2
- package/dist/models/order-summary.js +7 -4
- package/dist/models/order-summary.js.map +1 -1
- package/dist/models/order.d.ts +3 -3
- package/dist/models/order.js +1 -1
- package/dist/models/order.js.map +1 -1
- package/dist/models/return-item.d.ts +28 -0
- package/dist/models/return-item.js +170 -0
- package/dist/models/return-item.js.map +1 -0
- package/dist/models/return-reason.d.ts +3 -3
- package/dist/models/return-reason.js.map +1 -1
- package/dist/models/return.d.ts +38 -0
- package/dist/models/return.js +213 -0
- package/dist/models/return.js.map +1 -0
- package/dist/models/shipping-method-adjustment.d.ts +2 -1
- package/dist/models/shipping-method-adjustment.js +1 -1
- package/dist/models/shipping-method-adjustment.js.map +1 -1
- package/dist/models/shipping-method-tax-line.d.ts +2 -1
- package/dist/models/shipping-method-tax-line.js +1 -1
- package/dist/models/shipping-method-tax-line.js.map +1 -1
- package/dist/models/shipping-method.js +1 -1
- package/dist/models/shipping-method.js.map +1 -1
- package/dist/models/tax-line.js.map +1 -1
- package/dist/models/transaction.d.ts +11 -2
- package/dist/models/transaction.js +80 -1
- package/dist/models/transaction.js.map +1 -1
- package/dist/repositories/claim.d.ts +8 -0
- package/dist/repositories/claim.js +11 -0
- package/dist/repositories/claim.js.map +1 -0
- package/dist/repositories/exchange.d.ts +8 -0
- package/dist/repositories/exchange.js +11 -0
- package/dist/repositories/exchange.js.map +1 -0
- package/dist/repositories/index.d.ts +3 -1
- package/dist/repositories/index.js +7 -16
- package/dist/repositories/index.js.map +1 -1
- package/dist/repositories/order.d.ts +0 -3
- package/dist/repositories/order.js +2 -83
- package/dist/repositories/order.js.map +1 -1
- package/dist/repositories/return.d.ts +8 -0
- package/dist/repositories/return.js +11 -0
- package/dist/repositories/return.js.map +1 -0
- package/dist/services/actions/cancel-fulfillment.d.ts +2 -0
- package/dist/services/actions/cancel-fulfillment.js +32 -0
- package/dist/services/actions/cancel-fulfillment.js.map +1 -0
- package/dist/services/actions/create-claim.d.ts +2 -0
- package/dist/services/actions/create-claim.js +229 -0
- package/dist/services/actions/create-claim.js.map +1 -0
- package/dist/services/actions/create-exchange.d.ts +2 -0
- package/dist/services/actions/create-exchange.js +194 -0
- package/dist/services/actions/create-exchange.js.map +1 -0
- package/dist/services/actions/create-return.d.ts +2 -0
- package/dist/services/actions/create-return.js +98 -0
- package/dist/services/actions/create-return.js.map +1 -0
- package/dist/services/actions/index.d.ts +7 -0
- package/dist/services/actions/index.js +24 -0
- package/dist/services/actions/index.js.map +1 -0
- package/dist/services/actions/receive-return.d.ts +2 -0
- package/dist/services/actions/receive-return.js +75 -0
- package/dist/services/actions/receive-return.js.map +1 -0
- package/dist/services/actions/register-fulfillment.d.ts +2 -0
- package/dist/services/actions/register-fulfillment.js +30 -0
- package/dist/services/actions/register-fulfillment.js.map +1 -0
- package/dist/services/actions/register-shipment.d.ts +2 -0
- package/dist/services/actions/register-shipment.js +38 -0
- package/dist/services/actions/register-shipment.js.map +1 -0
- package/dist/services/order-change-service.d.ts +6 -6
- package/dist/services/order-change-service.js +4 -3
- package/dist/services/order-change-service.js.map +1 -1
- package/dist/services/order-module-service.d.ts +101 -64
- package/dist/services/order-module-service.js +458 -295
- package/dist/services/order-module-service.js.map +1 -1
- package/dist/services/order-service.d.ts +4 -4
- package/dist/services/order-service.js +1 -1
- package/dist/services/order-service.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/order-change.d.ts +32 -0
- package/dist/types/order-change.js +34 -0
- package/dist/types/order-change.js.map +1 -0
- package/dist/types/utils/index.d.ts +25 -1
- package/dist/types/utils/index.js.map +1 -1
- package/dist/utils/actions/cancel-item-fulfillment.js +2 -0
- package/dist/utils/actions/cancel-item-fulfillment.js.map +1 -1
- package/dist/utils/actions/cancel-return.js +2 -0
- package/dist/utils/actions/cancel-return.js.map +1 -1
- package/dist/utils/actions/fulfill-item.js +2 -0
- package/dist/utils/actions/fulfill-item.js.map +1 -1
- package/dist/utils/actions/index.d.ts +1 -0
- package/dist/utils/actions/index.js +1 -0
- package/dist/utils/actions/index.js.map +1 -1
- package/dist/utils/actions/item-add.js +10 -7
- package/dist/utils/actions/item-add.js.map +1 -1
- package/dist/utils/actions/item-remove.js +6 -4
- package/dist/utils/actions/item-remove.js.map +1 -1
- package/dist/utils/actions/receive-damaged-return-item.js +2 -0
- package/dist/utils/actions/receive-damaged-return-item.js.map +1 -1
- package/dist/utils/actions/receive-return-item.js +2 -0
- package/dist/utils/actions/receive-return-item.js.map +1 -1
- package/dist/utils/actions/return-item.js +2 -0
- package/dist/utils/actions/return-item.js.map +1 -1
- package/dist/utils/actions/ship-item.js +2 -0
- package/dist/utils/actions/ship-item.js.map +1 -1
- package/dist/utils/actions/shipping-add.js +6 -2
- package/dist/utils/actions/shipping-add.js.map +1 -1
- package/dist/utils/actions/write-off-item.js +2 -0
- package/dist/utils/actions/write-off-item.js.map +1 -1
- package/dist/utils/apply-order-changes.d.ts +14 -0
- package/dist/utils/apply-order-changes.js +74 -0
- package/dist/utils/apply-order-changes.js.map +1 -0
- package/dist/utils/base-repository-find.d.ts +2 -0
- package/dist/utils/base-repository-find.js +117 -0
- package/dist/utils/base-repository-find.js.map +1 -0
- package/dist/utils/calculate-order-change.js +5 -1
- package/dist/utils/calculate-order-change.js.map +1 -1
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/set-action-reference.d.ts +1 -0
- package/dist/utils/set-action-reference.js +11 -0
- package/dist/utils/set-action-reference.js.map +1 -0
- package/dist/utils/transform-order.d.ts +3 -2
- package/dist/utils/transform-order.js +84 -17
- package/dist/utils/transform-order.js.map +1 -1
- package/package.json +7 -11
- package/dist/module-definition.d.ts +0 -2
- package/dist/module-definition.js +0 -9
- 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
@@ -3,35 +3,37 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("@medusajs/utils");
|
4
4
|
const action_key_1 = require("../action-key");
|
5
5
|
const calculate_order_change_1 = require("../calculate-order-change");
|
6
|
+
const set_action_reference_1 = require("../set-action-reference");
|
6
7
|
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.ITEM_REMOVE, {
|
7
8
|
isDeduction: true,
|
8
9
|
operation({ action, currentOrder }) {
|
9
|
-
const existingIndex = currentOrder.items.findIndex((item) => item.id === action.reference_id);
|
10
|
+
const existingIndex = currentOrder.items.findIndex((item) => item.id === action.details.reference_id);
|
10
11
|
const existing = currentOrder.items[existingIndex];
|
11
12
|
existing.detail.quantity ??= 0;
|
12
13
|
existing.quantity = utils_1.MathBN.sub(existing.quantity, action.details.quantity);
|
13
14
|
existing.detail.quantity = utils_1.MathBN.sub(existing.detail.quantity, action.details.quantity);
|
15
|
+
(0, set_action_reference_1.setActionReference)(existing, action);
|
14
16
|
if (utils_1.MathBN.lte(existing.quantity, 0)) {
|
15
17
|
currentOrder.items.splice(existingIndex, 1);
|
16
18
|
}
|
17
19
|
return utils_1.MathBN.mult(existing.unit_price, action.details.quantity);
|
18
20
|
},
|
19
21
|
revert({ action, currentOrder }) {
|
20
|
-
const existing = currentOrder.items.find((item) => item.id === action.reference_id);
|
22
|
+
const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
|
21
23
|
if (existing) {
|
22
24
|
existing.quantity = utils_1.MathBN.add(existing.quantity, action.details.quantity);
|
23
25
|
existing.detail.quantity = utils_1.MathBN.add(existing.detail.quantity, action.details.quantity);
|
24
26
|
}
|
25
27
|
else {
|
26
28
|
currentOrder.items.push({
|
27
|
-
id: action.reference_id,
|
29
|
+
id: action.details.reference_id,
|
28
30
|
unit_price: action.details.unit_price,
|
29
31
|
quantity: action.details.quantity,
|
30
32
|
});
|
31
33
|
}
|
32
34
|
},
|
33
35
|
validate({ action, currentOrder }) {
|
34
|
-
const refId = action.reference_id;
|
36
|
+
const refId = action.details?.reference_id;
|
35
37
|
if (!(0, utils_1.isDefined)(refId)) {
|
36
38
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "Reference ID is required.");
|
37
39
|
}
|
@@ -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;
|
1
|
+
{"version":3,"file":"item-remove.js","sourceRoot":"","sources":["../../../src/utils/actions/item-remove.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAEhE,8CAAgD;AAChD,sEAAiE;AACjE,kEAA4D;AAE5D,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,MAAM,CAAC,OAAO,CAAC,YAAY,CAClD,CAAA;QAED,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QAElD,QAAQ,CAAC,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAA;QAE9B,QAAQ,CAAC,QAAQ,GAAG,cAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QAC1E,QAAQ,CAAC,MAAM,CAAC,QAAQ,GAAG,cAAM,CAAC,GAAG,CACnC,QAAQ,CAAC,MAAM,CAAC,QAAQ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AkB,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"}
|
@@ -4,6 +4,7 @@ const utils_1 = require("@medusajs/utils");
|
|
4
4
|
const _types_1 = require("../../types");
|
5
5
|
const action_key_1 = require("../action-key");
|
6
6
|
const calculate_order_change_1 = require("../calculate-order-change");
|
7
|
+
const set_action_reference_1 = require("../set-action-reference");
|
7
8
|
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.RECEIVE_DAMAGED_RETURN_ITEM, {
|
8
9
|
isDeduction: true,
|
9
10
|
commitsAction: "return_item",
|
@@ -14,6 +15,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
14
15
|
existing.detail.return_requested_quantity ??= 0;
|
15
16
|
existing.detail.return_dismissed_quantity = utils_1.MathBN.add(existing.detail.return_dismissed_quantity, toReturn);
|
16
17
|
existing.detail.return_requested_quantity = utils_1.MathBN.sub(existing.detail.return_requested_quantity, toReturn);
|
18
|
+
(0, set_action_reference_1.setActionReference)(existing, action);
|
17
19
|
if (previousEvents) {
|
18
20
|
for (const previousEvent of previousEvents) {
|
19
21
|
previousEvent.original_ = JSON.parse(JSON.stringify(previousEvent));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"receive-damaged-return-item.js","sourceRoot":"","sources":["../../../src/utils/actions/receive-damaged-return-item.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,mCAAqC;AACrC,8CAAgD;AAChD,sEAAiE;
|
1
|
+
{"version":3,"file":"receive-damaged-return-item.js","sourceRoot":"","sources":["../../../src/utils/actions/receive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const utils_1 = require("@medusajs/utils");
|
|
4
4
|
const _types_1 = require("../../types");
|
5
5
|
const action_key_1 = require("../action-key");
|
6
6
|
const calculate_order_change_1 = require("../calculate-order-change");
|
7
|
+
const set_action_reference_1 = require("../set-action-reference");
|
7
8
|
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.RECEIVE_RETURN_ITEM, {
|
8
9
|
isDeduction: true,
|
9
10
|
commitsAction: "return_item",
|
@@ -14,6 +15,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
14
15
|
existing.detail.return_requested_quantity ??= 0;
|
15
16
|
existing.detail.return_received_quantity = utils_1.MathBN.add(existing.detail.return_received_quantity, toReturn);
|
16
17
|
existing.detail.return_requested_quantity = utils_1.MathBN.sub(existing.detail.return_requested_quantity, toReturn);
|
18
|
+
(0, set_action_reference_1.setActionReference)(existing, action);
|
17
19
|
if (previousEvents) {
|
18
20
|
for (const previousEvent of previousEvents) {
|
19
21
|
previousEvent.original_ = JSON.parse(JSON.stringify(previousEvent));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"receive-return-item.js","sourceRoot":"","sources":["../../../src/utils/actions/receive-return-item.ts"],"names":[],"mappings":";;AAAA,2CAKwB;AACxB,mCAAqC;AACrC,8CAAgD;AAChD,sEAAiE;
|
1
|
+
{"version":3,"file":"receive-return-item.js","sourceRoot":"","sources":["../../../src/utils/actions/receive-return-item.ts"],"names":[],"mappings":";;AAAA,2CAKwB;AACxB,mCAAqC;AACrC,8CAAgD;AAChD,sEAAiE;AACjE,kEAA4D;AAE5D,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,mBAAmB,EAAE;IAC7E,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE;QAChD,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CACtC,CAAC,IAAI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AC,OAAO,EAAE,YAAY,CAAA;QAC1C,IAAI,CAAC,IAAA,iBAAS,EAAC,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,mCAAmC,CACpC,CAAA;QACH,CAAC;QAED,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,KAAK,CAAC,CAAA;QAErE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,YAAY,KAAK,cAAc,CAChC,CAAA;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,sCAAsC,KAAK,eAAe,CAC3D,CAAA;QACH,CAAC;QAED,MAAM,iBAAiB,GAAG,QAAQ,EAAE,MAAM,EAAE,yBAAyB,IAAI,CAAC,CAAA;QAE1E,MAAM,OAAO,GAAG,cAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;QACtE,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,6EAA6E,KAAK,GAAG,CACtF,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("@medusajs/utils");
|
4
4
|
const action_key_1 = require("../action-key");
|
5
5
|
const calculate_order_change_1 = require("../calculate-order-change");
|
6
|
+
const set_action_reference_1 = require("../set-action-reference");
|
6
7
|
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.RETURN_ITEM, {
|
7
8
|
isDeduction: true,
|
8
9
|
awaitRequired: true,
|
@@ -10,6 +11,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
10
11
|
const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
|
11
12
|
existing.detail.return_requested_quantity ??= 0;
|
12
13
|
existing.detail.return_requested_quantity = utils_1.MathBN.add(existing.detail.return_requested_quantity, action.details.quantity);
|
14
|
+
(0, set_action_reference_1.setActionReference)(existing, action);
|
13
15
|
return utils_1.MathBN.mult(existing.unit_price, action.details.quantity);
|
14
16
|
},
|
15
17
|
revert({ action, currentOrder }) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"return-item.js","sourceRoot":"","sources":["../../../src/utils/actions/return-item.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,8CAAgD;AAChD,sEAAiE;
|
1
|
+
{"version":3,"file":"return-item.js","sourceRoot":"","sources":["../../../src/utils/actions/return-item.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,8CAAgD;AAChD,sEAAiE;AACjE,kEAA4D;AAE5D,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,WAAW,EAAE;IACrE,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;IACnB,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,QAAQ,CAAC,MAAM,CAAC,yBAAyB,KAAK,CAAC,CAAA;QAC/C,QAAQ,CAAC,MAAM,CAAC,yBAAyB,GAAG,cAAM,CAAC,GAAG,CACpD,QAAQ,CAAC,MAAM,CAAC,yBAAyB,EACzC,MAAM,CAAC,OAAO,CAAC,QAAQ,CACxB,CAA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AA8B,KAAK,eAAe,CACnD,CAAA;QACH,CAAC;QAED,MAAM,iBAAiB,GAAG,cAAM,CAAC,GAAG,CAClC,QAAS,CAAC,MAAM,EAAE,gBAAgB,IAAI,CAAC,EACvC,QAAS,CAAC,MAAM,EAAE,yBAAyB,IAAI,CAAC,CACjD,CAAA;QAED,MAAM,OAAO,GAAG,cAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;QACtE,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,sEAAsE,KAAK,GAAG,CAC/E,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("@medusajs/utils");
|
4
4
|
const action_key_1 = require("../action-key");
|
5
5
|
const calculate_order_change_1 = require("../calculate-order-change");
|
6
|
+
const set_action_reference_1 = require("../set-action-reference");
|
6
7
|
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.SHIP_ITEM, {
|
7
8
|
operation({ action, currentOrder }) {
|
8
9
|
const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
|
9
10
|
existing.detail.shipped_quantity ??= 0;
|
10
11
|
existing.detail.shipped_quantity = utils_1.MathBN.add(existing.detail.shipped_quantity, action.details.quantity);
|
12
|
+
(0, set_action_reference_1.setActionReference)(existing, action);
|
11
13
|
},
|
12
14
|
revert({ action, currentOrder }) {
|
13
15
|
const existing = currentOrder.items.find((item) => item.id === action.reference_id);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ship-item.js","sourceRoot":"","sources":["../../../src/utils/actions/ship-item.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,8CAAgD;AAChD,sEAAiE;
|
1
|
+
{"version":3,"file":"ship-item.js","sourceRoot":"","sources":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Order.shipping_methods];
|
11
11
|
shipping.push({
|
12
|
-
|
12
|
+
shipping_method_id: action.reference_id,
|
13
|
+
order_id: currentOrder.id,
|
14
|
+
return_id: action.return_id,
|
15
|
+
claim_id: action.claim_id,
|
16
|
+
exchange_id: action.exchange_id,
|
13
17
|
price: action.amount,
|
14
18
|
});
|
15
19
|
currentOrder.shipping_methods = shipping;
|
@@ -18,7 +22,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
18
22
|
const shipping = Array.isArray(currentOrder.shipping_methods)
|
19
23
|
? currentOrder.shipping_methods
|
20
24
|
: [currentOrder.shipping_methods];
|
21
|
-
const existingIndex = shipping.findIndex((item) => item.
|
25
|
+
const existingIndex = shipping.findIndex((item) => item.shipping_method_id === action.reference_id);
|
22
26
|
if (existingIndex > -1) {
|
23
27
|
shipping.splice(existingIndex, 1);
|
24
28
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"shipping-add.js","sourceRoot":"","sources":["../../../src/utils/actions/shipping-add.ts"],"names":[],"mappings":";;AAAA,2CAAwD;AACxD,8CAAgD;AAChD,sEAAiE;AAEjE,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,YAAY,EAAE;IACtE,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE;QAChC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC;YAC3D,CAAC,CAAC,YAAY,CAAC,gBAAgB;YAC/B,CAAC,CAAC,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAA;QAEnC,QAAQ,CAAC,IAAI,CAAC;YACZ,
|
1
|
+
{"version":3,"file":"shipping-add.js","sourceRoot":"","sources":["../../../src/utils/actions/shipping-add.ts"],"names":[],"mappings":";;AAAA,2CAAwD;AACxD,8CAAgD;AAChD,sEAAiE;AAEjE,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,YAAY,EAAE;IACtE,SAAS,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I,CAAC,IAAA,iBAAS,EAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,qBAAqB,CACtB,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("@medusajs/utils");
|
4
4
|
const action_key_1 = require("../action-key");
|
5
5
|
const calculate_order_change_1 = require("../calculate-order-change");
|
6
|
+
const set_action_reference_1 = require("../set-action-reference");
|
6
7
|
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.WRITE_OFF_ITEM, {
|
7
8
|
operation({ action, currentOrder }) {
|
8
9
|
const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
|
9
10
|
existing.detail.written_off_quantity ??= 0;
|
10
11
|
existing.detail.written_off_quantity = utils_1.MathBN.add(existing.detail.written_off_quantity, action.details.quantity);
|
12
|
+
(0, set_action_reference_1.setActionReference)(existing, action);
|
11
13
|
},
|
12
14
|
revert({ action, currentOrder }) {
|
13
15
|
const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"write-off-item.js","sourceRoot":"","sources":["../../../src/utils/actions/write-off-item.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,8CAAgD;AAChD,sEAAiE;
|
1
|
+
{"version":3,"file":"write-off-item.js","sourceRoot":"","sources":["../../../src/utils/actions/write-off-item.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,8CAAgD;AAChD,sEAAiE;AACjE,kEAA4D;AAE5D,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,cAAc,EAAE;IACxE,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE;QAChC,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CACtC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AC,KAAK,CAAC,YAAY,EAC9B,YAAY,KAAK,cAAc,CAChC,CAAA;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,8BAA8B,KAAK,eAAe,CACnD,CAAA;QACH,CAAC;QAED,MAAM,iBAAiB,GAAG,QAAS,CAAC,QAAQ,IAAI,CAAC,CAAA;QACjD,MAAM,OAAO,GAAG,cAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;QACtE,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,gDAAgD,CACjD,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { OrderChangeActionDTO } from "@medusajs/types";
|
2
|
+
import { OrderItem, OrderShippingMethod } from "../models";
|
3
|
+
export interface ApplyOrderChangeDTO extends OrderChangeActionDTO {
|
4
|
+
id: string;
|
5
|
+
order_id: string;
|
6
|
+
version: number;
|
7
|
+
applied: boolean;
|
8
|
+
}
|
9
|
+
export declare function applyChangesToOrder(orders: any[], actionsMap: Record<string, any[]>): {
|
10
|
+
itemsToUpsert: OrderItem[];
|
11
|
+
shippingMethodsToInsert: OrderShippingMethod[];
|
12
|
+
summariesToUpsert: any[];
|
13
|
+
orderToUpdate: any[];
|
14
|
+
};
|
@@ -0,0 +1,74 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.applyChangesToOrder = void 0;
|
4
|
+
const utils_1 = require("@medusajs/utils");
|
5
|
+
const calculate_order_change_1 = require("./calculate-order-change");
|
6
|
+
function applyChangesToOrder(orders, actionsMap) {
|
7
|
+
const itemsToUpsert = [];
|
8
|
+
const shippingMethodsToInsert = [];
|
9
|
+
const summariesToUpsert = [];
|
10
|
+
const orderToUpdate = [];
|
11
|
+
for (const order of orders) {
|
12
|
+
const calculated = (0, calculate_order_change_1.calculateOrderChange)({
|
13
|
+
order: order,
|
14
|
+
actions: actionsMap[order.id],
|
15
|
+
transactions: order.transactions ?? [],
|
16
|
+
});
|
17
|
+
(0, utils_1.createRawPropertiesFromBigNumber)(calculated);
|
18
|
+
const version = actionsMap[order.id][0].version ?? 1;
|
19
|
+
for (const item of calculated.order.items) {
|
20
|
+
const orderItem = item.detail ?? item;
|
21
|
+
const itemId = item.detail ? orderItem.item_id : item.id;
|
22
|
+
itemsToUpsert.push({
|
23
|
+
id: orderItem.version === version ? orderItem.id : undefined,
|
24
|
+
item_id: itemId,
|
25
|
+
order_id: order.id,
|
26
|
+
version,
|
27
|
+
quantity: orderItem.quantity,
|
28
|
+
fulfilled_quantity: orderItem.fulfilled_quantity,
|
29
|
+
shipped_quantity: orderItem.shipped_quantity,
|
30
|
+
return_requested_quantity: orderItem.return_requested_quantity,
|
31
|
+
return_received_quantity: orderItem.return_received_quantity,
|
32
|
+
return_dismissed_quantity: orderItem.return_dismissed_quantity,
|
33
|
+
written_off_quantity: orderItem.written_off_quantity,
|
34
|
+
metadata: orderItem.metadata,
|
35
|
+
});
|
36
|
+
}
|
37
|
+
const orderSummary = order.summary;
|
38
|
+
summariesToUpsert.push({
|
39
|
+
id: orderSummary?.version === version ? orderSummary.id : undefined,
|
40
|
+
order_id: order.id,
|
41
|
+
version,
|
42
|
+
totals: calculated.summary,
|
43
|
+
});
|
44
|
+
if (version > order.version) {
|
45
|
+
for (const shippingMethod of calculated.order.shipping_methods ?? []) {
|
46
|
+
if (!shippingMethod) {
|
47
|
+
continue;
|
48
|
+
}
|
49
|
+
const sm = {
|
50
|
+
...(shippingMethod.detail ?? shippingMethod),
|
51
|
+
version,
|
52
|
+
};
|
53
|
+
delete sm.id;
|
54
|
+
shippingMethodsToInsert.push(sm);
|
55
|
+
}
|
56
|
+
orderToUpdate.push({
|
57
|
+
selector: {
|
58
|
+
id: order.id,
|
59
|
+
},
|
60
|
+
data: {
|
61
|
+
version,
|
62
|
+
},
|
63
|
+
});
|
64
|
+
}
|
65
|
+
}
|
66
|
+
return {
|
67
|
+
itemsToUpsert,
|
68
|
+
shippingMethodsToInsert,
|
69
|
+
summariesToUpsert,
|
70
|
+
orderToUpdate,
|
71
|
+
};
|
72
|
+
}
|
73
|
+
exports.applyChangesToOrder = applyChangesToOrder;
|
74
|
+
//# sourceMappingURL=apply-order-changes.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"apply-order-changes.js","sourceRoot":"","sources":["../../src/utils/apply-order-changes.ts"],"names":[],"mappings":";;;AACA,2CAAkE;AAElE,qEAA+D;AAS/D,SAAgB,mBAAmB,CACjC,MAAa,EACb,UAAiC;IAEjC,MAAM,aAAa,GAAgB,EAAE,CAAA;IACrC,MAAM,uBAAuB,GAA0B,EAAE,CAAA;IACzD,MAAM,iBAAiB,GAAU,EAAE,CAAA;IACnC,MAAM,aAAa,GAAU,EAAE,CAAA;IAE/B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,UAAU,GAAG,IAAA,6CAAoB,EAAC;YACtC,KAAK,EAAE,KAAY;YACnB,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,YAAY,EAAE,KAAK,CAAC,YAAY,IAAI,EAAE;SACvC,CAAC,CAAA;QAEF,IAAA,wCAAgC,EAAC,UAAU,CAAC,CAAA;QAE5C,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAA;QAEpD,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAC1C,MAAM,SAAS,GAAI,IAAI,CAAC,MAAc,IAAI,IAAI,CAAA;YAC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G,CAAE,cAAsB,CAAC,MAAM,IAAI,cAAc,CAAC;oBACrD,OAAO;iBACR,CAAA;gBACD,OAAO,EAAE,CAAC,EAAE,CAAA;gBACZ,uBAAuB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAClC,CAAC;YAED,aAAa,CAAC,IAAI,CAAC;gBACjB,QAAQ,EAAE;oBACR,EAAE,EAAE,KAAK,CAAC,EAAE;iBACb;gBACD,IAAI,EAAE;oBACJ,OAAO;iBACR;aACF,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED,OAAO;QACL,aAAa;QACb,uBAAuB;QACvB,iBAAiB;QACjB,aAAa;KACd,CAAA;AACH,CAAC;AA/ED,kDA+EC"}
|
@@ -0,0 +1,117 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.setFindMethods = void 0;
|
4
|
+
const core_1 = require("@mikro-orm/core");
|
5
|
+
const _models_1 = require("../models");
|
6
|
+
const _1 = require(".");
|
7
|
+
function setFindMethods(klass, entity) {
|
8
|
+
klass.prototype.find = async function find(options, context) {
|
9
|
+
const manager = this.getActiveManager(context);
|
10
|
+
const knex = manager.getKnex();
|
11
|
+
const findOptions_ = { ...options };
|
12
|
+
findOptions_.options ??= {};
|
13
|
+
findOptions_.where ??= {};
|
14
|
+
findOptions_.populate ??= [];
|
15
|
+
if (!("strategy" in findOptions_.options)) {
|
16
|
+
if (findOptions_.options.limit != null || findOptions_.options.offset) {
|
17
|
+
Object.assign(findOptions_.options, {
|
18
|
+
strategy: core_1.LoadStrategy.SELECT_IN,
|
19
|
+
});
|
20
|
+
}
|
21
|
+
else {
|
22
|
+
Object.assign(findOptions_.options, {
|
23
|
+
strategy: core_1.LoadStrategy.JOINED,
|
24
|
+
});
|
25
|
+
}
|
26
|
+
}
|
27
|
+
const isRelatedEntity = entity !== _models_1.Order;
|
28
|
+
const config = (0, _1.mapRepositoryToOrderModel)(findOptions_, isRelatedEntity);
|
29
|
+
let orderAlias = "o0";
|
30
|
+
if (isRelatedEntity) {
|
31
|
+
// first relation is always order if the entity is not Order
|
32
|
+
config.options.populate.unshift("order");
|
33
|
+
orderAlias = "o1";
|
34
|
+
config.options.populate.unshift("order.items");
|
35
|
+
}
|
36
|
+
let defaultVersion = knex.raw(`"${orderAlias}"."version"`);
|
37
|
+
const strategy = config.options.strategy ?? core_1.LoadStrategy.JOINED;
|
38
|
+
if (strategy === core_1.LoadStrategy.SELECT_IN) {
|
39
|
+
const sql = manager
|
40
|
+
.qb(_models_1.Order, "_sub0")
|
41
|
+
.select("version")
|
42
|
+
.where({ id: knex.raw(`"${orderAlias}"."order_id"`) })
|
43
|
+
.getKnexQuery()
|
44
|
+
.toString();
|
45
|
+
defaultVersion = knex.raw(`(${sql})`);
|
46
|
+
}
|
47
|
+
const version = config.where.version ?? defaultVersion;
|
48
|
+
delete config.where?.version;
|
49
|
+
config.options.populateWhere ??= {};
|
50
|
+
const popWhere = config.options.populateWhere;
|
51
|
+
if (isRelatedEntity) {
|
52
|
+
popWhere.order ??= {};
|
53
|
+
}
|
54
|
+
const orderWhere = isRelatedEntity ? popWhere.order : popWhere;
|
55
|
+
orderWhere.summary ??= {};
|
56
|
+
orderWhere.summary.version = version;
|
57
|
+
orderWhere.items ??= {};
|
58
|
+
orderWhere.items.version = version;
|
59
|
+
popWhere.shipping_methods ??= {};
|
60
|
+
popWhere.shipping_methods.version = version;
|
61
|
+
if (!config.options.orderBy) {
|
62
|
+
config.options.orderBy = { id: "ASC" };
|
63
|
+
}
|
64
|
+
return await manager.find(entity, config.where, config.options);
|
65
|
+
};
|
66
|
+
klass.prototype.findAndCount = async function findAndCount(findOptions = { where: {} }, context = {}) {
|
67
|
+
const manager = this.getActiveManager(context);
|
68
|
+
const knex = manager.getKnex();
|
69
|
+
const findOptions_ = { ...findOptions };
|
70
|
+
findOptions_.options ??= {};
|
71
|
+
findOptions_.where ??= {};
|
72
|
+
if (!("strategy" in findOptions_.options)) {
|
73
|
+
Object.assign(findOptions_.options, {
|
74
|
+
strategy: core_1.LoadStrategy.SELECT_IN,
|
75
|
+
});
|
76
|
+
}
|
77
|
+
const isRelatedEntity = entity !== _models_1.Order;
|
78
|
+
const config = (0, _1.mapRepositoryToOrderModel)(findOptions_, isRelatedEntity);
|
79
|
+
let orderAlias = "o0";
|
80
|
+
if (isRelatedEntity) {
|
81
|
+
// first relation is always order if entity is not Order
|
82
|
+
config.options.populate.unshift("order");
|
83
|
+
orderAlias = "o1";
|
84
|
+
}
|
85
|
+
let defaultVersion = knex.raw(`"${orderAlias}"."version"`);
|
86
|
+
const strategy = config.options.strategy ?? core_1.LoadStrategy.JOINED;
|
87
|
+
if (strategy === core_1.LoadStrategy.SELECT_IN) {
|
88
|
+
const sql = manager
|
89
|
+
.qb(_models_1.Order, "_sub0")
|
90
|
+
.select("version")
|
91
|
+
.where({ id: knex.raw(`"${orderAlias}"."order_id"`) })
|
92
|
+
.getKnexQuery()
|
93
|
+
.toString();
|
94
|
+
defaultVersion = knex.raw(`(${sql})`);
|
95
|
+
}
|
96
|
+
const version = config.where.version ?? defaultVersion;
|
97
|
+
delete config.where.version;
|
98
|
+
config.options.populateWhere ??= {};
|
99
|
+
const popWhere = config.options.populateWhere;
|
100
|
+
if (isRelatedEntity) {
|
101
|
+
popWhere.order ??= {};
|
102
|
+
}
|
103
|
+
const orderWhere = isRelatedEntity ? popWhere.order : popWhere;
|
104
|
+
orderWhere.summary ??= {};
|
105
|
+
orderWhere.summary.version = version;
|
106
|
+
orderWhere.items ??= {};
|
107
|
+
orderWhere.items.version = version;
|
108
|
+
popWhere.shipping_methods ??= {};
|
109
|
+
popWhere.shipping_methods.version = version;
|
110
|
+
if (!config.options.orderBy) {
|
111
|
+
config.options.orderBy = { id: "ASC" };
|
112
|
+
}
|
113
|
+
return await manager.findAndCount(entity, config.where, config.options);
|
114
|
+
};
|
115
|
+
}
|
116
|
+
exports.setFindMethods = setFindMethods;
|
117
|
+
//# sourceMappingURL=base-repository-find.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,UAAU,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAA;QAEpC,UAAU,CAAC,KAAK,KAAK,EAAE,CAAA;QACvB,UAAU,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAA;QAElC,QAAQ,CAAC,gBAAgB,KAAK,EAAE,CAAA;QAChC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,GAAG,OAAO,CAAA;QAE3C,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC5B,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,CAAA;QACxC,CAAC;QAED,OAAO,MAAM,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;IACzE,CAAC,CAAA;AACH,CAAC;AAnJD,wCAmJC"}
|
@@ -98,9 +98,13 @@ class OrderChangeProcessing {
|
|
98
98
|
summary.pending_difference = utils_1.MathBN.sub(summary.current_order_total, summary.transaction_total);
|
99
99
|
}
|
100
100
|
processAction_(action, isReplay = false) {
|
101
|
+
const definedType = OrderChangeProcessing.typeDefinition[action.action];
|
102
|
+
if (!(0, utils_1.isPresent)(definedType)) {
|
103
|
+
throw new Error(`Action type ${action.action} is not defined`);
|
104
|
+
}
|
101
105
|
const type = {
|
102
106
|
...OrderChangeProcessing.defaultConfig,
|
103
|
-
...
|
107
|
+
...definedType,
|
104
108
|
};
|
105
109
|
this.actionsProcessed[action.action] ??= [];
|
106
110
|
if (!isReplay) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"calculate-order-change.js","sourceRoot":"","sources":["../../src/utils/calculate-order-change.ts"],"names":[],"mappings":";;;AACA,2CAKwB;AACxB,mCAQe;AAMf,MAAa,qBAAqB;IAezB,MAAM,CAAC,kBAAkB,CAAC,GAAW,EAAE,IAA0B;QACtE,qBAAqB,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,IA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AE/B,OAAO,YAAY,CAAA;IACrB,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;;AAzWH,sDA0WC;AAzWgB,oCAAc,GAA4C,EAAE,AAA9C,CAA8C;AAC5D,mCAAa,GAAG;IAC7B,aAAa,EAAE,KAAK;IACpB,WAAW,EAAE,KAAK;CACnB,AAH2B,CAG3B;AAuWH,SAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,YAAY,GAAG,EAAE,EACjB,OAAO,GAAG,EAAE,GAKb;IACC,MAAM,IAAI,GAAG,IAAI,qBAAqB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,CAAA;IACxE,IAAI,CAAC,cAAc,EAAE,CAAA;IAErB,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE;QAC1B,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE;KAC9B,CAAA;AACH,CAAC;AAhBD,oDAgBC"}
|
1
|
+
{"version":3,"file":"calculate-order-change.js","sourceRoot":"","sources":["../../src/utils/calculate-order-change.ts"],"names":[],"mappings":";;;AACA,2CAMwB;AACxB,mCAQe;AAMf,MAAa,qBAAqB;IAezB,MAAM,CAAC,kBAAkB,CAAC,GAAW,EAAE,IAA0B;QACtE,qBAAqB,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;IAClD,CAAC;IAED,YAAY,EACV,KAAK,EACL,YAAY,EACZ,OAAO,GAKR;QAhBO,qBAAgB,GAAkD,EAAE,CAAA;QACpE,eAAU,GAAmC,EAAE,CAAA;QAgBrD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;QAC9C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,CAAA;QAClE,IAAI,CAAC,OAA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AAK;IACpB,WAAW,EAAE,KAAK;CACnB,AAH2B,CAG3B;AA4WH,SAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,YAAY,GAAG,EAAE,EACjB,OAAO,GAAG,EAAE,GAKb;IACC,MAAM,IAAI,GAAG,IAAI,qBAAqB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,CAAA;IACxE,IAAI,CAAC,cAAc,EAAE,CAAA;IAErB,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE;QAC1B,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE;KAC9B,CAAA;AACH,CAAC;AAhBD,oDAgBC"}
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
@@ -16,5 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./action-key"), exports);
|
18
18
|
__exportStar(require("./actions"), exports);
|
19
|
+
__exportStar(require("./apply-order-changes"), exports);
|
19
20
|
__exportStar(require("./calculate-order-change"), exports);
|
21
|
+
__exportStar(require("./set-action-reference"), exports);
|
22
|
+
__exportStar(require("./transform-order"), exports);
|
20
23
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,4CAAyB;AACzB,2DAAwC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,4CAAyB;AACzB,wDAAqC;AACrC,2DAAwC;AACxC,yDAAsC;AACtC,oDAAiC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function setActionReference(existing: any, action: any): void;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.setActionReference = void 0;
|
4
|
+
function setActionReference(existing, action) {
|
5
|
+
existing.detail.order_id ??= action.order_id;
|
6
|
+
existing.detail.return_id ??= action.return_id;
|
7
|
+
existing.detail.claim_id ??= action.claim_id;
|
8
|
+
existing.detail.exchange_id ??= action.exchange_id;
|
9
|
+
}
|
10
|
+
exports.setActionReference = setActionReference;
|
11
|
+
//# sourceMappingURL=set-action-reference.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"set-action-reference.js","sourceRoot":"","sources":["../../src/utils/set-action-reference.ts"],"names":[],"mappings":";;;AAAA,SAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM;IACjD,QAAQ,CAAC,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAA;IAC5C,QAAQ,CAAC,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,SAAS,CAAA;IAC9C,QAAQ,CAAC,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAA;IAC5C,QAAQ,CAAC,MAAM,CAAC,WAAW,KAAK,MAAM,CAAC,WAAW,CAAA;AACpD,CAAC;AALD,gDAKC"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { OrderTypes } from "@medusajs/types";
|
2
2
|
export declare function formatOrder(order: any, options: {
|
3
|
+
entity: any;
|
3
4
|
includeTotals?: boolean;
|
4
|
-
}): OrderTypes.OrderDTO | OrderTypes.OrderDTO[];
|
5
|
-
export declare function mapRepositoryToOrderModel(config: any): any;
|
5
|
+
}): Partial<OrderTypes.OrderDTO> | Partial<OrderTypes.OrderDTO>[];
|
6
|
+
export declare function mapRepositoryToOrderModel(config: any, isRelatedEntity?: boolean): any;
|