@unchainedshop/core-languages 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.
|
@@ -2,11 +2,12 @@ import { type ModuleInput } from '@unchainedshop/mongodb';
|
|
|
2
2
|
import { mongodb } from '@unchainedshop/mongodb';
|
|
3
3
|
import { type SortOption } from '@unchainedshop/utils';
|
|
4
4
|
import { type Language } from '../db/LanguagesCollection.ts';
|
|
5
|
-
export
|
|
5
|
+
export interface LanguageQuery {
|
|
6
6
|
includeInactive?: boolean;
|
|
7
7
|
queryString?: string;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
isoCodes?: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare const buildFindSelector: ({ includeInactive, queryString, isoCodes }: LanguageQuery) => mongodb.Filter<Language>;
|
|
10
11
|
export declare const configureLanguagesModule: ({ db }: ModuleInput<Record<string, never>>) => Promise<{
|
|
11
12
|
findLanguage: (params: {
|
|
12
13
|
languageId: string;
|
|
@@ -5,10 +5,13 @@ import { SortDirection } from '@unchainedshop/utils';
|
|
|
5
5
|
import { systemLocale } from '@unchainedshop/utils';
|
|
6
6
|
import { LanguagesCollection } from "../db/LanguagesCollection.js";
|
|
7
7
|
const LANGUAGE_EVENTS = ['LANGUAGE_CREATE', 'LANGUAGE_UPDATE', 'LANGUAGE_REMOVE'];
|
|
8
|
-
export const buildFindSelector = ({ includeInactive = false, queryString,
|
|
9
|
-
const selector = { deleted: null
|
|
8
|
+
export const buildFindSelector = ({ includeInactive = false, queryString, isoCodes }) => {
|
|
9
|
+
const selector = { deleted: null };
|
|
10
10
|
if (!includeInactive)
|
|
11
11
|
selector.isActive = true;
|
|
12
|
+
if (isoCodes) {
|
|
13
|
+
selector.isoCode = { $in: isoCodes };
|
|
14
|
+
}
|
|
12
15
|
if (queryString) {
|
|
13
16
|
assertDocumentDBCompatMode();
|
|
14
17
|
selector.$text = { $search: queryString };
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/core-languages",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"main": "lib/languages-index.js",
|
|
5
5
|
"types": "lib/languages-index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
7
8
|
"scripts": {
|
|
8
9
|
"clean": "tsc -b --clean",
|
|
9
10
|
"build": "tsc -b",
|
|
@@ -33,8 +34,8 @@
|
|
|
33
34
|
},
|
|
34
35
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@unchainedshop/events": "^4.
|
|
37
|
-
"@unchainedshop/utils": "^4.
|
|
37
|
+
"@unchainedshop/events": "^4.5.0",
|
|
38
|
+
"@unchainedshop/utils": "^4.5.0"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@types/node": "^25.0.0",
|