@bedrockio/model 0.20.0 → 0.20.1
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 +4 -0
- package/dist/cjs/schema.js +7 -1
- package/package.json +1 -1
- package/src/schema.js +7 -1
- package/types/generated/schema.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cjs/schema.js
CHANGED
|
@@ -84,7 +84,13 @@ function normalizeAttributes(arg, path = []) {
|
|
|
84
84
|
} else if (typeof arg === 'object') {
|
|
85
85
|
const attributes = {};
|
|
86
86
|
for (let [key, val] of Object.entries(arg)) {
|
|
87
|
-
|
|
87
|
+
if (key === '_id' && val === false) {
|
|
88
|
+
// This is a special case in Mongoose that allows disabling
|
|
89
|
+
// the _id field for array objects so perserve it here.
|
|
90
|
+
attributes[key] = val;
|
|
91
|
+
} else {
|
|
92
|
+
attributes[key] = normalizeAttributes(val, [...path, key]);
|
|
93
|
+
}
|
|
88
94
|
}
|
|
89
95
|
return attributes;
|
|
90
96
|
}
|
package/package.json
CHANGED
package/src/schema.js
CHANGED
|
@@ -89,7 +89,13 @@ export function normalizeAttributes(arg, path = []) {
|
|
|
89
89
|
} else if (typeof arg === 'object') {
|
|
90
90
|
const attributes = {};
|
|
91
91
|
for (let [key, val] of Object.entries(arg)) {
|
|
92
|
-
|
|
92
|
+
if (key === '_id' && val === false) {
|
|
93
|
+
// This is a special case in Mongoose that allows disabling
|
|
94
|
+
// the _id field for array objects so perserve it here.
|
|
95
|
+
attributes[key] = val;
|
|
96
|
+
} else {
|
|
97
|
+
attributes[key] = normalizeAttributes(val, [...path, key]);
|
|
98
|
+
}
|
|
93
99
|
}
|
|
94
100
|
return attributes;
|
|
95
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/schema.js"],"names":[],"mappings":"AAyBA;;;;;;;GAOG;AACH,yCAJW,MAAM,YACN,QAAQ,CAAC,aAAa,GACpB,QAAQ,CAAC,MAAM,CAgD3B;AAED,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/schema.js"],"names":[],"mappings":"AAyBA;;;;;;;GAOG;AACH,yCAJW,MAAM,YACN,QAAQ,CAAC,aAAa,GACpB,QAAQ,CAAC,MAAM,CAgD3B;AAED,iEAoBC;qBApGoB,UAAU"}
|