odm-client 0.0.8 → 0.0.10
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/client/mongodb-client.d.ts +1 -0
- package/dist/cloudbase.cjs +1 -1
- package/dist/cloudbase.js +54 -53
- package/dist/generate.cjs +5 -4
- package/dist/generate.js +17 -16
- package/dist/mongodb.cjs +2 -2
- package/dist/mongodb.js +13 -4
- package/package.json +1 -1
- /package/dist/deps/{_commonjsHelpers-KaVRbhAgd4-uxdx7xq2m.js → _commonjsHelpers-KaVRbhAgd4-a8k2fqw31.js} +0 -0
- /package/dist/deps/{_commonjsHelpers-KaVRbhAgd4-luyi60el4.js → _commonjsHelpers-KaVRbhAgd4-mga7jd0ze.js} +0 -0
- /package/dist/deps/{acorn-DYjaOAP8Gz-fc8a5vd6f.js → acorn-DYjaOAP8Gz-g4ehe2gfz.js} +0 -0
- /package/dist/deps/{acorn-DYjaOAP8Gz-mmbac6k56.js → acorn-DYjaOAP8Gz-x6ajsvtb2.js} +0 -0
- /package/dist/deps/{angular-1bp1uAROl4-nu7ubqcdq.js → angular-1bp1uAROl4-2i9hzxv58.js} +0 -0
- /package/dist/deps/{angular-1bp1uAROl4-392hcgq9j.js → angular-1bp1uAROl4-2ubs96ieo.js} +0 -0
- /package/dist/deps/{babel-_P9jsDBVVy-oseohiw1b.js → babel-_P9jsDBVVy-16r0pqsdt.js} +0 -0
- /package/dist/deps/{babel-_P9jsDBVVy-ny5fugicw.js → babel-_P9jsDBVVy-gh2vq1p0l.js} +0 -0
- /package/dist/deps/{estree-Q-oFBmJEml-vqrstqunn.js → estree-Q-oFBmJEml-02ft0csn0.js} +0 -0
- /package/dist/deps/{estree-Q-oFBmJEml-d2f6a4nek.js → estree-Q-oFBmJEml-ozxa7qs9w.js} +0 -0
- /package/dist/deps/{flow-j77MFvzLrn-bzfofy2wu.js → flow-j77MFvzLrn-054ccsp9a.js} +0 -0
- /package/dist/deps/{flow-j77MFvzLrn-6tjv6t0kh.js → flow-j77MFvzLrn-j81s8tqu7.js} +0 -0
- /package/dist/deps/{glimmer-ewQPb5nTUl-f3nhh3bgt.js → glimmer-ewQPb5nTUl-lsozazwkg.js} +0 -0
- /package/dist/deps/{glimmer-ewQPb5nTUl-79i0tvwqi.js → glimmer-ewQPb5nTUl-vxy036ug3.js} +0 -0
- /package/dist/deps/{graphql-8EXR1_taGG-lws2cspdc.js → graphql-8EXR1_taGG-388i9ghx7.js} +0 -0
- /package/dist/deps/{graphql-8EXR1_taGG-hplrxo4fy.js → graphql-8EXR1_taGG-89yqkympb.js} +0 -0
- /package/dist/deps/{html-dGbiW_CFWL-ney778lgh.js → html-dGbiW_CFWL-pmayc2i5f.js} +0 -0
- /package/dist/deps/{html-dGbiW_CFWL-0lmlt42z5.js → html-dGbiW_CFWL-vc919fxil.js} +0 -0
- /package/dist/deps/{markdown-vAYIRClyWZ-o2ueqpioi.js → markdown-vAYIRClyWZ-9eai9344f.js} +0 -0
- /package/dist/deps/{markdown-vAYIRClyWZ-e7ndhqf52.js → markdown-vAYIRClyWZ-w6ksprgj0.js} +0 -0
- /package/dist/deps/{meriyah-d5_qqf88x--v93a4a260.js → meriyah-d5_qqf88x--0cr0u8nmc.js} +0 -0
- /package/dist/deps/{meriyah-d5_qqf88x--vl5irnno3.js → meriyah-d5_qqf88x--m056v4ew1.js} +0 -0
- /package/dist/deps/{postcss-Vz5bDQ3hJO-rtvn3lj4a.js → postcss-Vz5bDQ3hJO-ctr64l869.js} +0 -0
- /package/dist/deps/{postcss-Vz5bDQ3hJO-kz4viqh8k.js → postcss-Vz5bDQ3hJO-h1pxmmxt0.js} +0 -0
- /package/dist/deps/{query-builder-h6B2D2BCoQ-cdzloxcwh.js → query-builder-h6B2D2BCoQ-1gooxlu5t.js} +0 -0
- /package/dist/deps/{query-builder-h6B2D2BCoQ-uo54lu0fc.js → query-builder-h6B2D2BCoQ-jb2qh701s.js} +0 -0
- /package/dist/deps/{typescript-2hCq12HCbJ-deifaq0ac.js → typescript-2hCq12HCbJ-4coepgj2x.js} +0 -0
- /package/dist/deps/{typescript-2hCq12HCbJ-yk0uhwb78.js → typescript-2hCq12HCbJ-74w9843g8.js} +0 -0
- /package/dist/deps/{yaml-I5o0CrcX7J-89hx547ee.js → yaml-I5o0CrcX7J-qeyjhwb04.js} +0 -0
- /package/dist/deps/{yaml-I5o0CrcX7J-jmlyfocsv.js → yaml-I5o0CrcX7J-tsutz4duh.js} +0 -0
package/dist/mongodb.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var $l = Object.defineProperty;
|
|
2
2
|
var e2 = (e, t, r) => t in e ? $l(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var se = (e, t, r) => e2(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { Q as ir, a as t2, b as Ru } from "./deps/query-builder-h6B2D2BCoQ-
|
|
4
|
+
import { Q as ir, a as t2, b as Ru } from "./deps/query-builder-h6B2D2BCoQ-jb2qh701s.js";
|
|
5
5
|
import gn from "timers";
|
|
6
6
|
import Fc from "crypto";
|
|
7
7
|
import D1 from "fs";
|
|
@@ -13,7 +13,7 @@ import i2 from "util";
|
|
|
13
13
|
import Rc from "timers/promises";
|
|
14
14
|
import T1 from "dns";
|
|
15
15
|
import Nc from "os";
|
|
16
|
-
import { g as pr, c as xt } from "./deps/_commonjsHelpers-KaVRbhAgd4-
|
|
16
|
+
import { g as pr, c as xt } from "./deps/_commonjsHelpers-KaVRbhAgd4-a8k2fqw31.js";
|
|
17
17
|
import o2 from "url";
|
|
18
18
|
import Ic from "zlib";
|
|
19
19
|
import B1 from "net";
|
|
@@ -71051,8 +71051,16 @@ class Z4 {
|
|
|
71051
71051
|
const n = this.getCollection(t), i = t2(r, this.schemaMeta[t], this.context);
|
|
71052
71052
|
return { _id: (await n.insertOne(i, { session: this.session })).insertedId.toString() };
|
|
71053
71053
|
}
|
|
71054
|
+
// 将所有操作符之外的数据转换为$set
|
|
71055
|
+
transformUpdateData(t) {
|
|
71056
|
+
const r = ["$set", "$inc", "$mul", "$remove", "$push", "$pop", "$unshift", "$shift"];
|
|
71057
|
+
return Object.entries(t ?? []).reduce(
|
|
71058
|
+
(n, [i, o]) => (i === "$set" || (r.includes(i) ? n[i] = o : n.$set[i] = o), n),
|
|
71059
|
+
{ $set: { ...(t == null ? void 0 : t.$set) ?? {} } }
|
|
71060
|
+
);
|
|
71061
|
+
}
|
|
71054
71062
|
async update(t, { where: r, data: n }) {
|
|
71055
|
-
const i = this.getCollection(t), o = Ru(n, this.schemaMeta[t]), u = Object.keys(r ?? {});
|
|
71063
|
+
const i = this.getCollection(t), o = this.transformUpdateData(Ru(n, this.schemaMeta[t])), u = Object.keys(r ?? {});
|
|
71056
71064
|
if (u.length === 1 && u[0] === this.idField) {
|
|
71057
71065
|
const s = { [this.idField]: this.normalizeId(r[this.idField]) };
|
|
71058
71066
|
await i.updateOne(s, o, { session: this.session });
|
|
@@ -71062,7 +71070,7 @@ class Z4 {
|
|
|
71062
71070
|
await i.updateMany(c, o, { session: this.session });
|
|
71063
71071
|
}
|
|
71064
71072
|
async updateAndReturn(t, { where: r, data: n }) {
|
|
71065
|
-
const i = this.getCollection(t), o = Ru(n, this.schemaMeta[t]), u = ir.buildMongodbQuery(r, this.fieldMetaMap[t], this.getObjectId);
|
|
71073
|
+
const i = this.getCollection(t), o = this.transformUpdateData(Ru(n, this.schemaMeta[t])), u = ir.buildMongodbQuery(r, this.fieldMetaMap[t], this.getObjectId);
|
|
71066
71074
|
return await i.findOneAndUpdate(u, o, { session: this.session, returnDocument: "after" }) ?? null;
|
|
71067
71075
|
}
|
|
71068
71076
|
async delete(t, { where: r }) {
|
|
@@ -71099,6 +71107,7 @@ function Hl(e, t, r, n) {
|
|
|
71099
71107
|
findPage: (c) => i.findPage(u, c),
|
|
71100
71108
|
create: (c) => i.create(u, c),
|
|
71101
71109
|
update: (c) => i.update(u, c),
|
|
71110
|
+
updateMany: (c) => i.update(u, c),
|
|
71102
71111
|
updateAndReturn: (c) => i.updateAndReturn(u, c),
|
|
71103
71112
|
delete: (c) => i.delete(u, c),
|
|
71104
71113
|
count: (c) => i.count(u, c),
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/deps/{query-builder-h6B2D2BCoQ-cdzloxcwh.js → query-builder-h6B2D2BCoQ-1gooxlu5t.js}
RENAMED
|
File without changes
|
/package/dist/deps/{query-builder-h6B2D2BCoQ-uo54lu0fc.js → query-builder-h6B2D2BCoQ-jb2qh701s.js}
RENAMED
|
File without changes
|
/package/dist/deps/{typescript-2hCq12HCbJ-deifaq0ac.js → typescript-2hCq12HCbJ-4coepgj2x.js}
RENAMED
|
File without changes
|
/package/dist/deps/{typescript-2hCq12HCbJ-yk0uhwb78.js → typescript-2hCq12HCbJ-74w9843g8.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|