@feathersjs/mongodb 5.0.48 → 5.0.50
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/CHANGELOG.md +12 -0
- package/lib/converters.d.ts +1 -2
- package/lib/converters.js +17 -1
- package/lib/converters.js.map +1 -1
- package/package.json +9 -9
- package/src/converters.ts +25 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [5.0.50](https://github.com/feathersjs/feathers/compare/v5.0.49...v5.0.50) (2026-09-11)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- Update dependencies ([#3703](https://github.com/feathersjs/feathers/issues/3703)) ([4dd36da](https://github.com/feathersjs/feathers/commit/4dd36da8599ace88cc284e6a5f06d6a3e984a883))
|
|
11
|
+
|
|
12
|
+
## [5.0.49](https://github.com/feathersjs/feathers/compare/v5.0.48...v5.0.49) (2026-08-14)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- **adapter-commons:** validate query operators nested in arrays ([#3700](https://github.com/feathersjs/feathers/issues/3700)) ([304a1aa](https://github.com/feathersjs/feathers/commit/304a1aacd7a4808804d6a16204ea83e72eee669e))
|
|
17
|
+
|
|
6
18
|
## [5.0.48](https://github.com/feathersjs/feathers/compare/v5.0.47...v5.0.48) (2026-08-11)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @feathersjs/mongodb
|
package/lib/converters.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export declare function resolveQueryObjectId(value: IdQueryObject<ObjectIdParam>
|
|
|
10
10
|
export declare function resolveQueryObjectId(value: ObjectIdParam): Promise<ObjectId>;
|
|
11
11
|
export declare const keywordObjectId: {
|
|
12
12
|
readonly keyword: "objectid";
|
|
13
|
-
readonly type: "string";
|
|
14
13
|
readonly modifying: true;
|
|
15
|
-
readonly compile: (schemaVal: boolean) => (value:
|
|
14
|
+
readonly compile: (schemaVal: boolean) => (value: any, obj: any) => boolean;
|
|
16
15
|
};
|
package/lib/converters.js
CHANGED
|
@@ -27,14 +27,30 @@ async function resolveQueryObjectId(value) {
|
|
|
27
27
|
}
|
|
28
28
|
return convertedObject;
|
|
29
29
|
}
|
|
30
|
+
const isObjectId = (value) => {
|
|
31
|
+
if (value == null || typeof value !== 'object') {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (value instanceof mongodb_1.ObjectId) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
// Another mongodb/bson copy of ObjectId (instanceof fails across duplicates).
|
|
38
|
+
// Reject plain JSON such as `{ _bsontype: 'ObjectId' }`.
|
|
39
|
+
return (value._bsontype === 'ObjectId' && value.constructor !== Object && typeof value.toHexString === 'function');
|
|
40
|
+
};
|
|
30
41
|
exports.keywordObjectId = {
|
|
31
42
|
keyword: 'objectid',
|
|
32
|
-
type: 'string',
|
|
33
43
|
modifying: true,
|
|
34
44
|
compile(schemaVal) {
|
|
35
45
|
if (!schemaVal)
|
|
36
46
|
return () => true;
|
|
37
47
|
return function (value, obj) {
|
|
48
|
+
if (isObjectId(value)) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
if (typeof value !== 'string') {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
38
54
|
const { parentData, parentDataProperty } = obj;
|
|
39
55
|
try {
|
|
40
56
|
parentData[parentDataProperty] = new mongodb_1.ObjectId(value);
|
package/lib/converters.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converters.js","sourceRoot":"","sources":["../src/converters.ts"],"names":[],"mappings":";;;AAYA,0CAEC;AAMD,oDAwBC;AA5CD,qCAAkC;AAUlC,MAAM,UAAU,GAAG,CAAC,KAAoB,EAAE,EAAE,CAAC,IAAI,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UAAU,CAC1G,CAAA;AACH,CAAC,CAAA;AAEY,QAAA,eAAe,GAAG;IAC7B,OAAO,EAAE,UAAU;IACnB,SAAS,EAAE,IAAI;IACf,OAAO,CAAC,SAAkB;QACxB,IAAI,CAAC,SAAS;YAAE,OAAO,GAAG,EAAE,CAAC,IAAI,CAAA;QAEjC,OAAO,UAAU,KAAU,EAAE,GAAQ;YACnC,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;gBACtB,OAAO,IAAI,CAAA;YACb,CAAC;YAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,OAAO,KAAK,CAAA;YACd,CAAC;YAED,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,GAAG,GAAG,CAAA;YAC9C,IAAI,CAAC;gBACH,UAAU,CAAC,kBAAkB,CAAC,GAAG,IAAI,kBAAQ,CAAC,KAAK,CAAC,CAAA;gBACpD,OAAO,IAAI,CAAA;YACb,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,KAAK,CAAA;YACd,CAAC;QACH,CAAC,CAAA;IACH,CAAC;CACO,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/mongodb",
|
|
3
3
|
"description": "Feathers MongoDB service adapter",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.50",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
6
|
"main": "lib/",
|
|
7
7
|
"keywords": [
|
|
@@ -51,23 +51,23 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@feathersjs/adapter-commons": "^5.0.
|
|
55
|
-
"@feathersjs/commons": "^5.0.
|
|
56
|
-
"@feathersjs/errors": "^5.0.
|
|
57
|
-
"@feathersjs/feathers": "^5.0.
|
|
54
|
+
"@feathersjs/adapter-commons": "^5.0.50",
|
|
55
|
+
"@feathersjs/commons": "^5.0.50",
|
|
56
|
+
"@feathersjs/errors": "^5.0.50",
|
|
57
|
+
"@feathersjs/feathers": "^5.0.50"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"mongodb": "^6.19.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@feathersjs/adapter-tests": "^5.0.
|
|
64
|
-
"@feathersjs/schema": "^5.0.
|
|
63
|
+
"@feathersjs/adapter-tests": "^5.0.50",
|
|
64
|
+
"@feathersjs/schema": "^5.0.50",
|
|
65
65
|
"@types/mocha": "^10.0.10",
|
|
66
66
|
"@types/node": "^26.0.0",
|
|
67
|
-
"mocha": "^
|
|
67
|
+
"mocha": "^12.0.1",
|
|
68
68
|
"mongodb-memory-server": "^11.2.0",
|
|
69
69
|
"shx": "^0.4.0",
|
|
70
70
|
"typescript": "^5.9.3"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "4b042aaf6adc1abcb053a85427418d2682d80c5f"
|
|
73
73
|
}
|
package/src/converters.ts
CHANGED
|
@@ -44,14 +44,37 @@ export async function resolveQueryObjectId(value: ObjectIdParam | IdQueryObject<
|
|
|
44
44
|
return convertedObject
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
const isObjectId = (value: any): value is ObjectId => {
|
|
48
|
+
if (value == null || typeof value !== 'object') {
|
|
49
|
+
return false
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (value instanceof ObjectId) {
|
|
53
|
+
return true
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Another mongodb/bson copy of ObjectId (instanceof fails across duplicates).
|
|
57
|
+
// Reject plain JSON such as `{ _bsontype: 'ObjectId' }`.
|
|
58
|
+
return (
|
|
59
|
+
value._bsontype === 'ObjectId' && value.constructor !== Object && typeof value.toHexString === 'function'
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
47
63
|
export const keywordObjectId = {
|
|
48
64
|
keyword: 'objectid',
|
|
49
|
-
type: 'string',
|
|
50
65
|
modifying: true,
|
|
51
66
|
compile(schemaVal: boolean) {
|
|
52
67
|
if (!schemaVal) return () => true
|
|
53
68
|
|
|
54
|
-
return function (value:
|
|
69
|
+
return function (value: any, obj: any) {
|
|
70
|
+
if (isObjectId(value)) {
|
|
71
|
+
return true
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (typeof value !== 'string') {
|
|
75
|
+
return false
|
|
76
|
+
}
|
|
77
|
+
|
|
55
78
|
const { parentData, parentDataProperty } = obj
|
|
56
79
|
try {
|
|
57
80
|
parentData[parentDataProperty] = new ObjectId(value)
|