@unchainedshop/mongodb 5.0.0-alpha.2 → 5.0.0-alpha.4
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,21 +7,21 @@ const extendSelectorWithLocale = (selector, locale) => {
|
|
|
7
7
|
};
|
|
8
8
|
export const findLocalizedText = async (collection, selector, locale) => {
|
|
9
9
|
const exactTranslation = await collection.findOne(extendSelectorWithLocale(selector, locale), {
|
|
10
|
-
sort: { updated: -1 },
|
|
10
|
+
sort: { updated: -1, _id: -1 },
|
|
11
11
|
});
|
|
12
12
|
if (exactTranslation) {
|
|
13
13
|
return exactTranslation;
|
|
14
14
|
}
|
|
15
15
|
if (systemLocale.baseName !== locale.baseName) {
|
|
16
16
|
const fallbackTranslation = await collection.findOne(extendSelectorWithLocale(selector, systemLocale), {
|
|
17
|
-
sort: { updated: -1 },
|
|
17
|
+
sort: { updated: -1, _id: -1 },
|
|
18
18
|
});
|
|
19
19
|
if (fallbackTranslation) {
|
|
20
20
|
return fallbackTranslation;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
const foundText = await collection.findOne(selector, {
|
|
24
|
-
sort: { updated: -1 },
|
|
24
|
+
sort: { updated: -1, _id: -1 },
|
|
25
25
|
});
|
|
26
26
|
return foundText;
|
|
27
27
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/mongodb",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.4",
|
|
4
4
|
"description": "MongoDB database abstraction layer for the Unchained Engine",
|
|
5
5
|
"main": "lib/mongodb-index.js",
|
|
6
6
|
"types": "lib/mongodb-index.d.ts",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"@unchainedshop/logger": "^5.0.0-alpha.1",
|
|
36
37
|
"@unchainedshop/utils": "^5.0.0-alpha.1"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
}
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
|
-
"@types/node": "^
|
|
56
|
-
"typescript": "^
|
|
56
|
+
"@types/node": "^26.2.0",
|
|
57
|
+
"typescript": "^6.0.3"
|
|
57
58
|
}
|
|
58
59
|
}
|