@unchainedshop/core-assortments 4.5.0 → 4.6.0
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,5 +7,5 @@ export interface AssortmentsSettings {
|
|
|
7
7
|
getCachedProductIds: (assortmentId: string) => Promise<string[] | undefined>;
|
|
8
8
|
configureSettings: (options: AssortmentsSettingsOptions, db: mongodb.Db) => void;
|
|
9
9
|
}
|
|
10
|
-
export type AssortmentsSettingsOptions = Partial<
|
|
10
|
+
export type AssortmentsSettingsOptions = Omit<Partial<AssortmentsSettings>, 'configureSettings'>;
|
|
11
11
|
export declare const assortmentsSettings: AssortmentsSettings;
|
|
@@ -44,7 +44,7 @@ export declare const configureAssortmentsModule: (moduleInput: ModuleInput<Assor
|
|
|
44
44
|
}) => Promise<{
|
|
45
45
|
links: AssortmentPathLink[];
|
|
46
46
|
}[]>;
|
|
47
|
-
create: ({ _id, isActive,
|
|
47
|
+
create: ({ _id, isActive, isRoot, meta, sequence, ...rest }: Omit<Assortment, "_id" | "created"> & Pick<Partial<Assortment>, "_id">) => Promise<Assortment>;
|
|
48
48
|
update: (assortmentId: string, doc: Partial<Assortment>, options?: {
|
|
49
49
|
skipInvalidation?: boolean;
|
|
50
50
|
}) => Promise<mongodb.WithId<Assortment> | null>;
|
|
@@ -52,7 +52,6 @@ export declare const configureAssortmentsModule: (moduleInput: ModuleInput<Assor
|
|
|
52
52
|
skipInvalidation?: boolean;
|
|
53
53
|
}) => Promise<mongodb.WithId<Assortment> | null>;
|
|
54
54
|
invalidateCache: InvalidateCacheFn;
|
|
55
|
-
setBase: (assortmentId: string) => Promise<void>;
|
|
56
55
|
search: {
|
|
57
56
|
findFilteredAssortments: ({ limit, offset, assortmentIds, assortmentSelector, sort, }: {
|
|
58
57
|
assortmentIds: string[];
|
|
@@ -11,12 +11,7 @@ import { configureAssortmentTextsModule } from "./configureAssortmentTextsModule
|
|
|
11
11
|
import { configureAssortmentMediaModule } from "./configureAssortmentMediaModule.js";
|
|
12
12
|
import { makeAssortmentBreadcrumbsBuilder } from "../utils/breadcrumbs/makeAssortmentBreadcrumbsBuilder.js";
|
|
13
13
|
const logger = createLogger('unchained:core');
|
|
14
|
-
const ASSORTMENT_EVENTS = [
|
|
15
|
-
'ASSORTMENT_CREATE',
|
|
16
|
-
'ASSORTMENT_REMOVE',
|
|
17
|
-
'ASSORTMENT_SET_BASE',
|
|
18
|
-
'ASSORTMENT_UPDATE',
|
|
19
|
-
];
|
|
14
|
+
const ASSORTMENT_EVENTS = ['ASSORTMENT_CREATE', 'ASSORTMENT_REMOVE', 'ASSORTMENT_UPDATE'];
|
|
20
15
|
export const buildFindSelector = ({ assortmentIds, assortmentSelector, slugs, tags, includeLeaves = false, includeInactive = false, queryString, }) => {
|
|
21
16
|
const selector = assortmentSelector || {};
|
|
22
17
|
selector.deleted = null;
|
|
@@ -202,14 +197,13 @@ export const configureAssortmentsModule = async (moduleInput) => {
|
|
|
202
197
|
});
|
|
203
198
|
return buildBreadcrumbs(params);
|
|
204
199
|
},
|
|
205
|
-
create: async ({ _id, isActive = true,
|
|
200
|
+
create: async ({ _id, isActive = true, isRoot = false, meta = {}, sequence, ...rest }) => {
|
|
206
201
|
if (_id)
|
|
207
202
|
await Assortments.deleteOne({ _id, deleted: { $ne: null } });
|
|
208
203
|
const { insertedId: assortmentId } = await Assortments.insertOne({
|
|
209
204
|
_id: _id || generateDbObjectId(),
|
|
210
205
|
created: new Date(),
|
|
211
206
|
sequence: sequence || (await Assortments.countDocuments({})) + 10,
|
|
212
|
-
isBase,
|
|
213
207
|
isActive,
|
|
214
208
|
isRoot,
|
|
215
209
|
meta,
|
|
@@ -256,21 +250,6 @@ export const configureAssortmentsModule = async (moduleInput) => {
|
|
|
256
250
|
return deletedAssortment;
|
|
257
251
|
},
|
|
258
252
|
invalidateCache,
|
|
259
|
-
setBase: async (assortmentId) => {
|
|
260
|
-
await Assortments.updateMany({ isBase: true }, {
|
|
261
|
-
$set: {
|
|
262
|
-
isBase: false,
|
|
263
|
-
updated: new Date(),
|
|
264
|
-
},
|
|
265
|
-
});
|
|
266
|
-
await Assortments.updateOne(generateDbFilterById(assortmentId), {
|
|
267
|
-
$set: {
|
|
268
|
-
isBase: true,
|
|
269
|
-
updated: new Date(),
|
|
270
|
-
},
|
|
271
|
-
});
|
|
272
|
-
await emit('ASSORTMENT_SET_BASE', { assortmentId });
|
|
273
|
-
},
|
|
274
253
|
search: {
|
|
275
254
|
findFilteredAssortments: async ({ limit, offset, assortmentIds, assortmentSelector, sort, }) => {
|
|
276
255
|
const assortments = await findPreservingIds(Assortments)(assortmentSelector, assortmentIds, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/core-assortments",
|
|
3
|
-
"
|
|
3
|
+
"description": "Assortment and category management module for the Unchained Engine",
|
|
4
|
+
"version": "4.6.0",
|
|
4
5
|
"main": "lib/assortments-index.js",
|
|
5
6
|
"types": "lib/assortments-index.d.ts",
|
|
6
7
|
"type": "module",
|
|
@@ -34,10 +35,10 @@
|
|
|
34
35
|
},
|
|
35
36
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@unchainedshop/events": "^4.
|
|
38
|
-
"@unchainedshop/file-upload": "^4.
|
|
39
|
-
"@unchainedshop/logger": "^4.
|
|
40
|
-
"@unchainedshop/utils": "^4.
|
|
38
|
+
"@unchainedshop/events": "^4.6.0",
|
|
39
|
+
"@unchainedshop/file-upload": "^4.6.0",
|
|
40
|
+
"@unchainedshop/logger": "^4.6.0",
|
|
41
|
+
"@unchainedshop/utils": "^4.6.0"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@types/node": "^25.0.0",
|