cantian-mongodb 0.0.22 → 0.0.24
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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/util.d.ts +4 -0
- package/dist/util.js +17 -0
- package/dist/util.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
|
package/dist/util.d.ts
ADDED
package/dist/util.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const normalizeModelSchema = async (options) => {
|
|
2
|
+
const { schema, deleteFields } = options;
|
|
3
|
+
const newSchema = structuredClone(schema);
|
|
4
|
+
if (newSchema.properties) {
|
|
5
|
+
if (newSchema.properties._id) {
|
|
6
|
+
newSchema.properties.id = newSchema.properties._id;
|
|
7
|
+
delete newSchema.properties._id;
|
|
8
|
+
}
|
|
9
|
+
if (deleteFields?.length) {
|
|
10
|
+
for (let deleteField of deleteFields) {
|
|
11
|
+
delete newSchema.properties[deleteField];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return newSchema;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=util.js.map
|
package/dist/util.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,OAA4C,EAAE,EAAE;IACzF,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IACzC,MAAM,SAAS,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,SAAS,CAAC,UAAU,EAAE,CAAC;QACzB,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;YAC7B,SAAS,CAAC,UAAU,CAAC,EAAE,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC;YACnD,OAAO,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC;QAClC,CAAC;QACD,IAAI,YAAY,EAAE,MAAM,EAAE,CAAC;YACzB,KAAK,IAAI,WAAW,IAAI,YAAY,EAAE,CAAC;gBACrC,OAAO,SAAS,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|