@unchainedshop/core-assortments 4.4.0 → 4.5.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.
- package/lib/module/configureAssortmentMediaModule.d.ts +7 -3
- package/lib/module/configureAssortmentMediaModule.js +17 -4
- package/lib/module/configureAssortmentTextsModule.d.ts +5 -1
- package/lib/module/configureAssortmentTextsModule.js +11 -1
- package/lib/module/configureAssortmentsModule.d.ts +12 -4
- package/package.json +5 -5
|
@@ -4,8 +4,9 @@ export declare const configureAssortmentMediaModule: ({ db }: ModuleInput<Record
|
|
|
4
4
|
findAssortmentMedia: ({ assortmentMediaId }: {
|
|
5
5
|
assortmentMediaId: string;
|
|
6
6
|
}) => Promise<mongodb.WithId<AssortmentMediaType> | null>;
|
|
7
|
-
findAssortmentMedias: ({ assortmentId, tags, offset, limit, }: {
|
|
8
|
-
assortmentId?:
|
|
7
|
+
findAssortmentMedias: ({ assortmentId, assortmentIds, tags, offset, limit, }: {
|
|
8
|
+
assortmentId?: string;
|
|
9
|
+
assortmentIds?: string[];
|
|
9
10
|
limit?: number;
|
|
10
11
|
offset?: number;
|
|
11
12
|
tags?: string[];
|
|
@@ -25,7 +26,10 @@ export declare const configureAssortmentMediaModule: ({ db }: ModuleInput<Record
|
|
|
25
26
|
}[];
|
|
26
27
|
}) => Promise<AssortmentMediaType[]>;
|
|
27
28
|
texts: {
|
|
28
|
-
findMediaTexts: (
|
|
29
|
+
findMediaTexts: (query: {
|
|
30
|
+
assortmentMediaId?: string;
|
|
31
|
+
assortmentMediaIds?: string[];
|
|
32
|
+
}, options?: mongodb.FindOptions) => Promise<AssortmentMediaText[]>;
|
|
29
33
|
findLocalizedMediaText: ({ assortmentMediaId, locale, }: {
|
|
30
34
|
assortmentMediaId: string;
|
|
31
35
|
locale: Intl.Locale;
|
|
@@ -40,8 +40,14 @@ export const configureAssortmentMediaModule = async ({ db }) => {
|
|
|
40
40
|
findAssortmentMedia: async ({ assortmentMediaId }) => {
|
|
41
41
|
return AssortmentMedia.findOne(generateDbFilterById(assortmentMediaId), {});
|
|
42
42
|
},
|
|
43
|
-
findAssortmentMedias: async ({ assortmentId, tags, offset, limit, }, options) => {
|
|
44
|
-
const selector =
|
|
43
|
+
findAssortmentMedias: async ({ assortmentId, assortmentIds, tags, offset, limit, }, options) => {
|
|
44
|
+
const selector = {};
|
|
45
|
+
if (assortmentId) {
|
|
46
|
+
selector.assortmentId = assortmentId;
|
|
47
|
+
}
|
|
48
|
+
if (assortmentIds) {
|
|
49
|
+
selector.assortmentId = { $in: assortmentIds };
|
|
50
|
+
}
|
|
45
51
|
if (tags && tags.length > 0) {
|
|
46
52
|
selector.tags = { $all: tags };
|
|
47
53
|
}
|
|
@@ -126,8 +132,15 @@ export const configureAssortmentMediaModule = async ({ db }) => {
|
|
|
126
132
|
return assortmentMedias;
|
|
127
133
|
},
|
|
128
134
|
texts: {
|
|
129
|
-
findMediaTexts: async (
|
|
130
|
-
|
|
135
|
+
findMediaTexts: async (query, options) => {
|
|
136
|
+
const selector = {};
|
|
137
|
+
if (query.assortmentMediaId) {
|
|
138
|
+
selector.assortmentMediaId = query.assortmentMediaId;
|
|
139
|
+
}
|
|
140
|
+
if (query.assortmentMediaIds) {
|
|
141
|
+
selector.assortmentMediaId = { $in: query.assortmentMediaIds };
|
|
142
|
+
}
|
|
143
|
+
return AssortmentMediaTexts.find(selector, options).toArray();
|
|
131
144
|
},
|
|
132
145
|
findLocalizedMediaText: async ({ assortmentMediaId, locale, }) => {
|
|
133
146
|
const text = await findLocalizedText(AssortmentMediaTexts, { assortmentMediaId }, locale);
|
|
@@ -4,7 +4,11 @@ export declare const configureAssortmentTextsModule: ({ Assortments, AssortmentT
|
|
|
4
4
|
Assortments: mongodb.Collection<Assortment>;
|
|
5
5
|
AssortmentTexts: mongodb.Collection<AssortmentText>;
|
|
6
6
|
}) => {
|
|
7
|
-
findTexts: (query:
|
|
7
|
+
findTexts: (query: {
|
|
8
|
+
assortmentId?: string;
|
|
9
|
+
assortmentIds?: string[];
|
|
10
|
+
queryString?: string;
|
|
11
|
+
}, options?: mongodb.FindOptions) => Promise<AssortmentText[]>;
|
|
8
12
|
findLocalizedText: ({ assortmentId, locale, }: {
|
|
9
13
|
assortmentId: string;
|
|
10
14
|
locale: Intl.Locale;
|
|
@@ -74,7 +74,17 @@ export const configureAssortmentTextsModule = ({ Assortments, AssortmentTexts, }
|
|
|
74
74
|
};
|
|
75
75
|
return {
|
|
76
76
|
findTexts: async (query, options) => {
|
|
77
|
-
const
|
|
77
|
+
const selector = {};
|
|
78
|
+
if (query.assortmentId) {
|
|
79
|
+
selector.assortmentId = query.assortmentId;
|
|
80
|
+
}
|
|
81
|
+
if (query.assortmentIds) {
|
|
82
|
+
selector.assortmentId = { $in: query.assortmentIds };
|
|
83
|
+
}
|
|
84
|
+
if (query.queryString) {
|
|
85
|
+
selector.$text = { $search: query.queryString };
|
|
86
|
+
}
|
|
87
|
+
const texts = AssortmentTexts.find(selector, options);
|
|
78
88
|
return texts.toArray();
|
|
79
89
|
},
|
|
80
90
|
findLocalizedText: async ({ assortmentId, locale, }) => {
|
|
@@ -66,8 +66,9 @@ export declare const configureAssortmentsModule: (moduleInput: ModuleInput<Assor
|
|
|
66
66
|
findAssortmentMedia: ({ assortmentMediaId }: {
|
|
67
67
|
assortmentMediaId: string;
|
|
68
68
|
}) => Promise<mongodb.WithId<import("../assortments-index.ts").AssortmentMediaType> | null>;
|
|
69
|
-
findAssortmentMedias: ({ assortmentId, tags, offset, limit, }: {
|
|
70
|
-
assortmentId?:
|
|
69
|
+
findAssortmentMedias: ({ assortmentId, assortmentIds, tags, offset, limit, }: {
|
|
70
|
+
assortmentId?: string;
|
|
71
|
+
assortmentIds?: string[];
|
|
71
72
|
limit?: number;
|
|
72
73
|
offset?: number;
|
|
73
74
|
tags?: string[];
|
|
@@ -87,7 +88,10 @@ export declare const configureAssortmentsModule: (moduleInput: ModuleInput<Assor
|
|
|
87
88
|
}[];
|
|
88
89
|
}) => Promise<import("../assortments-index.ts").AssortmentMediaType[]>;
|
|
89
90
|
texts: {
|
|
90
|
-
findMediaTexts: (
|
|
91
|
+
findMediaTexts: (query: {
|
|
92
|
+
assortmentMediaId?: string;
|
|
93
|
+
assortmentMediaIds?: string[];
|
|
94
|
+
}, options?: mongodb.FindOptions) => Promise<import("../assortments-index.ts").AssortmentMediaText[]>;
|
|
91
95
|
findLocalizedMediaText: ({ assortmentMediaId, locale, }: {
|
|
92
96
|
assortmentMediaId: string;
|
|
93
97
|
locale: Intl.Locale;
|
|
@@ -201,7 +205,11 @@ export declare const configureAssortmentsModule: (moduleInput: ModuleInput<Assor
|
|
|
201
205
|
}) => Promise<AssortmentProduct[]>;
|
|
202
206
|
};
|
|
203
207
|
texts: {
|
|
204
|
-
findTexts: (query:
|
|
208
|
+
findTexts: (query: {
|
|
209
|
+
assortmentId?: string;
|
|
210
|
+
assortmentIds?: string[];
|
|
211
|
+
queryString?: string;
|
|
212
|
+
}, options?: mongodb.FindOptions) => Promise<import("../db/AssortmentsCollection.ts").AssortmentText[]>;
|
|
205
213
|
findLocalizedText: ({ assortmentId, locale, }: {
|
|
206
214
|
assortmentId: string;
|
|
207
215
|
locale: Intl.Locale;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/core-assortments",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"main": "lib/assortments-index.js",
|
|
5
5
|
"types": "lib/assortments-index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@unchainedshop/events": "^4.
|
|
38
|
-
"@unchainedshop/file-upload": "^4.
|
|
39
|
-
"@unchainedshop/logger": "^4.
|
|
40
|
-
"@unchainedshop/utils": "^4.
|
|
37
|
+
"@unchainedshop/events": "^4.5.0",
|
|
38
|
+
"@unchainedshop/file-upload": "^4.5.0",
|
|
39
|
+
"@unchainedshop/logger": "^4.5.0",
|
|
40
|
+
"@unchainedshop/utils": "^4.5.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^25.0.0",
|