@unchainedshop/core-payment 5.0.0-alpha.2 → 5.0.0-alpha.3
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.
|
@@ -7,9 +7,7 @@ export declare const configurePaymentModule: ({ db, options: paymentOptions, }:
|
|
|
7
7
|
paymentProviderId: string;
|
|
8
8
|
}, options?: import("mongodb").FindOptions) => Promise<import("../db/PaymentProvidersCollection.ts").PaymentProvider | null>;
|
|
9
9
|
findProviders: (query?: import("./configurePaymentProvidersModule.ts").PaymentProviderQuery, options?: import("mongodb").FindOptions) => Promise<import("../db/PaymentProvidersCollection.ts").PaymentProvider[]>;
|
|
10
|
-
allProviders: (
|
|
11
|
-
clear: () => void;
|
|
12
|
-
};
|
|
10
|
+
allProviders: import("@unchainedshop/utils/lib/memoize-with-ttl.js").MemoizedWithTTL<[], import("mongodb").WithId<import("../db/PaymentProvidersCollection.ts").PaymentProvider>[]>;
|
|
13
11
|
providerExists: ({ paymentProviderId }: {
|
|
14
12
|
paymentProviderId: string;
|
|
15
13
|
}) => Promise<boolean>;
|
|
@@ -18,9 +18,7 @@ export declare const configurePaymentProvidersModule: (PaymentProviders: mongodb
|
|
|
18
18
|
paymentProviderId: string;
|
|
19
19
|
}, options?: mongodb.FindOptions) => Promise<PaymentProvider | null>;
|
|
20
20
|
findProviders: (query?: PaymentProviderQuery, options?: mongodb.FindOptions) => Promise<PaymentProvider[]>;
|
|
21
|
-
allProviders: (
|
|
22
|
-
clear: () => void;
|
|
23
|
-
};
|
|
21
|
+
allProviders: import("@unchainedshop/utils/lib/memoize-with-ttl.js").MemoizedWithTTL<[], mongodb.WithId<PaymentProvider>[]>;
|
|
24
22
|
providerExists: ({ paymentProviderId }: {
|
|
25
23
|
paymentProviderId: string;
|
|
26
24
|
}) => Promise<boolean>;
|
|
@@ -6,7 +6,6 @@ const PAYMENT_PROVIDER_EVENTS = [
|
|
|
6
6
|
'PAYMENT_PROVIDER_UPDATE',
|
|
7
7
|
'PAYMENT_PROVIDER_REMOVE',
|
|
8
8
|
];
|
|
9
|
-
const allProvidersTtlMs = process.env.NODE_ENV === 'production' ? 60000 : 1;
|
|
10
9
|
export const buildFindSelector = ({ includeDeleted = false, queryString, paymentProviderIds, type, } = {}) => {
|
|
11
10
|
const selector = includeDeleted ? {} : { deleted: null };
|
|
12
11
|
if (paymentProviderIds) {
|
|
@@ -23,9 +22,7 @@ export const buildFindSelector = ({ includeDeleted = false, queryString, payment
|
|
|
23
22
|
};
|
|
24
23
|
export const configurePaymentProvidersModule = (PaymentProviders) => {
|
|
25
24
|
registerEvents(PAYMENT_PROVIDER_EVENTS);
|
|
26
|
-
const allProviders = memoizeWithTTL(async
|
|
27
|
-
return PaymentProviders.find({ deleted: null }, { sort: { created: 1 } }).toArray();
|
|
28
|
-
}, allProvidersTtlMs);
|
|
25
|
+
const allProviders = memoizeWithTTL(async () => PaymentProviders.find({ deleted: null }, { sort: { created: 1 } }).toArray(), { ttl: process.env.NODE_ENV === 'production' ? 60000 : 1 });
|
|
29
26
|
return {
|
|
30
27
|
count: async (query = {}) => {
|
|
31
28
|
const providerCount = await PaymentProviders.countDocuments(buildFindSelector(query));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/core-payment",
|
|
3
3
|
"description": "Payment provider management module for the Unchained Engine",
|
|
4
|
-
"version": "5.0.0-alpha.
|
|
4
|
+
"version": "5.0.0-alpha.3",
|
|
5
5
|
"main": "lib/payment-index.js",
|
|
6
6
|
"types": "lib/payment-index.d.ts",
|
|
7
7
|
"type": "module",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@unchainedshop/events": "^5.0.0-alpha.1",
|
|
39
|
-
"@unchainedshop/
|
|
39
|
+
"@unchainedshop/mongodb": "^5.0.0-alpha.1",
|
|
40
40
|
"@unchainedshop/utils": "^5.0.0-alpha.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@types/node": "^
|
|
43
|
+
"@types/node": "^26.2.0",
|
|
44
44
|
"typescript": "^5.8.3"
|
|
45
45
|
}
|
|
46
46
|
}
|