@unchainedshop/core-orders 4.8.11 → 5.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/configureOrderDeliveriesModule.d.ts +0 -3
- package/lib/module/configureOrderDeliveriesModule.js +0 -5
- package/lib/module/configureOrderDiscountsModule.d.ts +1 -3
- package/lib/module/configureOrderDiscountsModule.js +3 -7
- package/lib/module/configureOrderPaymentsModule.d.ts +0 -3
- package/lib/module/configureOrderPaymentsModule.js +0 -5
- package/lib/module/configureOrderPositionsModule.d.ts +1 -3
- package/lib/module/configureOrderPositionsModule.js +3 -10
- package/lib/module/configureOrdersModule.d.ts +2 -12
- package/package.json +4 -4
|
@@ -8,9 +8,6 @@ export declare const configureOrderDeliveriesModule: ({ OrderDeliveries, }: {
|
|
|
8
8
|
findDelivery: ({ orderDeliveryId }: {
|
|
9
9
|
orderDeliveryId: string;
|
|
10
10
|
}, options?: mongodb.FindOptions) => Promise<OrderDelivery | null>;
|
|
11
|
-
findDeliveries: ({ orderDeliveryIds }: {
|
|
12
|
-
orderDeliveryIds: string[];
|
|
13
|
-
}, options?: mongodb.FindOptions) => Promise<OrderDelivery[]>;
|
|
14
11
|
findDeliveryByProvidersId: ({ deliveryProviderIds }: {
|
|
15
12
|
deliveryProviderIds: string[];
|
|
16
13
|
}, options?: mongodb.FindOptions) => Promise<OrderDelivery[]>;
|
|
@@ -32,11 +32,6 @@ export const configureOrderDeliveriesModule = ({ OrderDeliveries, }) => {
|
|
|
32
32
|
findDelivery: async ({ orderDeliveryId }, options) => {
|
|
33
33
|
return OrderDeliveries.findOne(buildFindByIdSelector(orderDeliveryId), options);
|
|
34
34
|
},
|
|
35
|
-
findDeliveries: async ({ orderDeliveryIds }, options) => {
|
|
36
|
-
if (!orderDeliveryIds?.length)
|
|
37
|
-
return [];
|
|
38
|
-
return OrderDeliveries.find({ _id: { $in: orderDeliveryIds } }, options).toArray();
|
|
39
|
-
},
|
|
40
35
|
findDeliveryByProvidersId: async ({ deliveryProviderIds }, options) => {
|
|
41
36
|
if (!deliveryProviderIds?.length)
|
|
42
37
|
return [];
|
|
@@ -7,10 +7,8 @@ export declare const configureOrderDiscountsModule: ({ OrderDiscounts, }: {
|
|
|
7
7
|
findOrderDiscount: ({ discountId }: {
|
|
8
8
|
discountId: string;
|
|
9
9
|
}, options?: mongodb.FindOptions) => Promise<OrderDiscount | null>;
|
|
10
|
-
findOrderDiscounts: (
|
|
10
|
+
findOrderDiscounts: ({ orderId }: {
|
|
11
11
|
orderId: string;
|
|
12
|
-
} | {
|
|
13
|
-
orderIds: string[];
|
|
14
12
|
}) => Promise<OrderDiscount[]>;
|
|
15
13
|
create: (doc: Omit<OrderDiscount, "_id" | "created" | "trigger"> & Pick<Partial<OrderDiscount>, "_id" | "created" | "trigger">) => Promise<OrderDiscount>;
|
|
16
14
|
delete: (orderDiscountId: string) => Promise<mongodb.WithId<OrderDiscount> | null>;
|
|
@@ -13,13 +13,9 @@ export const configureOrderDiscountsModule = ({ OrderDiscounts, }) => {
|
|
|
13
13
|
findOrderDiscount: async ({ discountId }, options) => {
|
|
14
14
|
return OrderDiscounts.findOne(buildFindOrderDiscountByIdSelector(discountId), options);
|
|
15
15
|
},
|
|
16
|
-
findOrderDiscounts: async (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return [];
|
|
20
|
-
return OrderDiscounts.find({ orderId: { $in: query.orderIds } }).toArray();
|
|
21
|
-
}
|
|
22
|
-
return OrderDiscounts.find({ orderId: query.orderId }).toArray();
|
|
16
|
+
findOrderDiscounts: async ({ orderId }) => {
|
|
17
|
+
const discounts = OrderDiscounts.find({ orderId });
|
|
18
|
+
return discounts.toArray();
|
|
23
19
|
},
|
|
24
20
|
create: async (doc) => {
|
|
25
21
|
const normalizedTrigger = doc.trigger || OrderDiscountTrigger.USER;
|
|
@@ -8,9 +8,6 @@ export declare const configureOrderPaymentsModule: ({ OrderPayments, }: {
|
|
|
8
8
|
findOrderPayment: ({ orderPaymentId, }: {
|
|
9
9
|
orderPaymentId: string;
|
|
10
10
|
}, options?: mongodb.FindOptions) => Promise<OrderPayment | null>;
|
|
11
|
-
findOrderPayments: ({ orderPaymentIds }: {
|
|
12
|
-
orderPaymentIds: string[];
|
|
13
|
-
}, options?: mongodb.FindOptions) => Promise<OrderPayment[]>;
|
|
14
11
|
findOrderPaymentsByProviderIds: ({ paymentProviderIds, }: {
|
|
15
12
|
paymentProviderIds: string[];
|
|
16
13
|
}, options?: mongodb.FindOptions) => Promise<OrderPayment[]>;
|
|
@@ -35,11 +35,6 @@ export const configureOrderPaymentsModule = ({ OrderPayments, }) => {
|
|
|
35
35
|
findOrderPayment: async ({ orderPaymentId, }, options) => {
|
|
36
36
|
return OrderPayments.findOne(buildFindOrderPaymentByIdSelector(orderPaymentId), options);
|
|
37
37
|
},
|
|
38
|
-
findOrderPayments: async ({ orderPaymentIds }, options) => {
|
|
39
|
-
if (!orderPaymentIds?.length)
|
|
40
|
-
return [];
|
|
41
|
-
return OrderPayments.find({ _id: { $in: orderPaymentIds } }, options).toArray();
|
|
42
|
-
},
|
|
43
38
|
findOrderPaymentsByProviderIds: async ({ paymentProviderIds, }, options) => {
|
|
44
39
|
if (!paymentProviderIds?.length)
|
|
45
40
|
return [];
|
|
@@ -23,10 +23,8 @@ export declare const configureOrderPositionsModule: ({ OrderPositions, }: {
|
|
|
23
23
|
findOrderPosition: ({ itemId }: {
|
|
24
24
|
itemId: string;
|
|
25
25
|
}, options?: mongodb.FindOptions) => Promise<OrderPosition | null>;
|
|
26
|
-
findOrderPositions: (
|
|
26
|
+
findOrderPositions: ({ orderId }: {
|
|
27
27
|
orderId: string;
|
|
28
|
-
} | {
|
|
29
|
-
orderIds: string[];
|
|
30
28
|
}) => Promise<OrderPosition[]>;
|
|
31
29
|
delete: (orderPositionId: string) => Promise<mongodb.WithId<OrderPosition> | null>;
|
|
32
30
|
removePositions: ({ orderId }: {
|
|
@@ -13,16 +13,9 @@ export const configureOrderPositionsModule = ({ OrderPositions, }) => {
|
|
|
13
13
|
findOrderPosition: async ({ itemId }, options) => {
|
|
14
14
|
return OrderPositions.findOne(buildFindOrderPositionByIdSelector(itemId), options);
|
|
15
15
|
},
|
|
16
|
-
findOrderPositions: async (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return [];
|
|
20
|
-
return OrderPositions.find({
|
|
21
|
-
orderId: { $in: query.orderIds },
|
|
22
|
-
quantity: { $gt: 0 },
|
|
23
|
-
}).toArray();
|
|
24
|
-
}
|
|
25
|
-
return OrderPositions.find({ orderId: query.orderId, quantity: { $gt: 0 } }).toArray();
|
|
16
|
+
findOrderPositions: async ({ orderId }) => {
|
|
17
|
+
const positions = OrderPositions.find({ orderId, quantity: { $gt: 0 } });
|
|
18
|
+
return positions.toArray();
|
|
26
19
|
},
|
|
27
20
|
delete: async (orderPositionId) => {
|
|
28
21
|
const selector = buildFindOrderPositionByIdSelector(orderPositionId);
|
|
@@ -6,9 +6,6 @@ export declare const configureOrdersModule: ({ db, migrationRepository, options:
|
|
|
6
6
|
findDelivery: ({ orderDeliveryId }: {
|
|
7
7
|
orderDeliveryId: string;
|
|
8
8
|
}, options?: mongodb.FindOptions) => Promise<import("../db/OrderDeliveriesCollection.ts").OrderDelivery | null>;
|
|
9
|
-
findDeliveries: ({ orderDeliveryIds }: {
|
|
10
|
-
orderDeliveryIds: string[];
|
|
11
|
-
}, options?: mongodb.FindOptions) => Promise<import("../db/OrderDeliveriesCollection.ts").OrderDelivery[]>;
|
|
12
9
|
findDeliveryByProvidersId: ({ deliveryProviderIds }: {
|
|
13
10
|
deliveryProviderIds: string[];
|
|
14
11
|
}, options?: mongodb.FindOptions) => Promise<import("../db/OrderDeliveriesCollection.ts").OrderDelivery[]>;
|
|
@@ -28,10 +25,8 @@ export declare const configureOrdersModule: ({ db, migrationRepository, options:
|
|
|
28
25
|
findOrderDiscount: ({ discountId }: {
|
|
29
26
|
discountId: string;
|
|
30
27
|
}, options?: mongodb.FindOptions) => Promise<import("../db/OrderDiscountsCollection.ts").OrderDiscount | null>;
|
|
31
|
-
findOrderDiscounts: (
|
|
28
|
+
findOrderDiscounts: ({ orderId }: {
|
|
32
29
|
orderId: string;
|
|
33
|
-
} | {
|
|
34
|
-
orderIds: string[];
|
|
35
30
|
}) => Promise<import("../db/OrderDiscountsCollection.ts").OrderDiscount[]>;
|
|
36
31
|
create: (doc: Omit<import("../db/OrderDiscountsCollection.ts").OrderDiscount, "_id" | "created" | "trigger"> & Pick<Partial<import("../db/OrderDiscountsCollection.ts").OrderDiscount>, "_id" | "created" | "trigger">) => Promise<import("../db/OrderDiscountsCollection.ts").OrderDiscount>;
|
|
37
32
|
delete: (orderDiscountId: string) => Promise<mongodb.WithId<import("../db/OrderDiscountsCollection.ts").OrderDiscount> | null>;
|
|
@@ -49,10 +44,8 @@ export declare const configureOrdersModule: ({ db, migrationRepository, options:
|
|
|
49
44
|
findOrderPosition: ({ itemId }: {
|
|
50
45
|
itemId: string;
|
|
51
46
|
}, options?: mongodb.FindOptions) => Promise<import("../db/OrderPositionsCollection.ts").OrderPosition | null>;
|
|
52
|
-
findOrderPositions: (
|
|
47
|
+
findOrderPositions: ({ orderId }: {
|
|
53
48
|
orderId: string;
|
|
54
|
-
} | {
|
|
55
|
-
orderIds: string[];
|
|
56
49
|
}) => Promise<import("../db/OrderPositionsCollection.ts").OrderPosition[]>;
|
|
57
50
|
delete: (orderPositionId: string) => Promise<mongodb.WithId<import("../db/OrderPositionsCollection.ts").OrderPosition> | null>;
|
|
58
51
|
removePositions: ({ orderId }: {
|
|
@@ -91,9 +84,6 @@ export declare const configureOrdersModule: ({ db, migrationRepository, options:
|
|
|
91
84
|
findOrderPayment: ({ orderPaymentId, }: {
|
|
92
85
|
orderPaymentId: string;
|
|
93
86
|
}, options?: mongodb.FindOptions) => Promise<import("../db/OrderPaymentsCollection.ts").OrderPayment | null>;
|
|
94
|
-
findOrderPayments: ({ orderPaymentIds }: {
|
|
95
|
-
orderPaymentIds: string[];
|
|
96
|
-
}, options?: mongodb.FindOptions) => Promise<import("../db/OrderPaymentsCollection.ts").OrderPayment[]>;
|
|
97
87
|
findOrderPaymentsByProviderIds: ({ paymentProviderIds, }: {
|
|
98
88
|
paymentProviderIds: string[];
|
|
99
89
|
}, options?: mongodb.FindOptions) => Promise<import("../db/OrderPaymentsCollection.ts").OrderPayment[]>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/core-orders",
|
|
3
3
|
"description": "Order management module for the Unchained Engine",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0-alpha.2",
|
|
5
5
|
"main": "lib/orders-index.js",
|
|
6
6
|
"types": "lib/orders-index.d.ts",
|
|
7
7
|
"type": "module",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@kontsedal/locco": "^1.1.0",
|
|
39
|
-
"@unchainedshop/events": "^
|
|
40
|
-
"@unchainedshop/logger": "^
|
|
41
|
-
"@unchainedshop/utils": "^
|
|
39
|
+
"@unchainedshop/events": "^5.0.0-alpha.1",
|
|
40
|
+
"@unchainedshop/logger": "^5.0.0-alpha.1",
|
|
41
|
+
"@unchainedshop/utils": "^5.0.0-alpha.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^25.0.0",
|