@unchainedshop/core-warehousing 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.
|
@@ -31,9 +31,7 @@ export declare const configureWarehousingModule: ({ db }: ModuleInput<Record<str
|
|
|
31
31
|
walletAddresses: string[];
|
|
32
32
|
}, options?: mongodb.FindOptions) => Promise<TokenSurrogate[]>;
|
|
33
33
|
findProviders: (query?: WarehousingProviderQuery, options?: mongodb.FindOptions) => Promise<WarehousingProvider[]>;
|
|
34
|
-
allProviders: (
|
|
35
|
-
clear: () => void;
|
|
36
|
-
};
|
|
34
|
+
allProviders: import("@unchainedshop/utils/lib/memoize-with-ttl.js").MemoizedWithTTL<[], mongodb.WithId<WarehousingProvider>[]>;
|
|
37
35
|
providerExists: ({ warehousingProviderId, }: {
|
|
38
36
|
warehousingProviderId: string;
|
|
39
37
|
}) => Promise<boolean>;
|
|
@@ -10,7 +10,6 @@ const WAREHOUSING_PROVIDER_EVENTS = [
|
|
|
10
10
|
'TOKEN_OWNERSHIP_CHANGED',
|
|
11
11
|
'TOKEN_INVALIDATED',
|
|
12
12
|
];
|
|
13
|
-
const allProvidersTtlMs = process.env.NODE_ENV === 'production' ? 60000 : 1;
|
|
14
13
|
export const buildFindSelector = ({ includeDeleted = false, queryString, warehousingProviderIds, type, } = {}) => {
|
|
15
14
|
const selector = includeDeleted ? {} : { deleted: null };
|
|
16
15
|
if (warehousingProviderIds) {
|
|
@@ -38,10 +37,8 @@ export const buildTokenFindSelector = ({ queryString, walletAddressExists, ...re
|
|
|
38
37
|
export const configureWarehousingModule = async ({ db }) => {
|
|
39
38
|
registerEvents(WAREHOUSING_PROVIDER_EVENTS);
|
|
40
39
|
const WarehousingProviders = await WarehousingProvidersCollection(db);
|
|
40
|
+
const allProviders = memoizeWithTTL(async () => WarehousingProviders.find({ deleted: null }, { sort: { created: 1 } }).toArray(), { ttl: process.env.NODE_ENV === 'production' ? 60000 : 1 });
|
|
41
41
|
const TokenSurrogates = await TokenSurrogateCollection(db);
|
|
42
|
-
const allProviders = memoizeWithTTL(async function () {
|
|
43
|
-
return WarehousingProviders.find({ deleted: null }, { sort: { created: 1 } }).toArray();
|
|
44
|
-
}, allProvidersTtlMs);
|
|
45
42
|
return {
|
|
46
43
|
count: async (query = {}) => {
|
|
47
44
|
const providerCount = await WarehousingProviders.countDocuments(buildFindSelector(query));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/core-warehousing",
|
|
3
3
|
"description": "Inventory and stock management module for the Unchained Engine",
|
|
4
|
-
"version": "5.0.0-alpha.
|
|
4
|
+
"version": "5.0.0-alpha.3",
|
|
5
5
|
"main": "lib/warehousing-index.js",
|
|
6
6
|
"types": "lib/warehousing-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
|
}
|