odm-client 0.0.14 → 0.0.16

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.
Files changed (39) hide show
  1. package/dist/cloudbase.cjs +1 -1
  2. package/dist/cloudbase.js +1 -1
  3. package/dist/deps/query-builder-h6B2D2BCoQ-7giim23mn.js +84 -0
  4. package/dist/deps/query-builder-h6B2D2BCoQ-bwaada3m9.js +1 -0
  5. package/dist/generate.cjs +3 -3
  6. package/dist/generate.js +15 -15
  7. package/dist/mongodb.cjs +2 -2
  8. package/dist/mongodb.js +6 -3
  9. package/package.json +1 -1
  10. package/dist/deps/query-builder-h6B2D2BCoQ-n8c3gimq9.js +0 -1
  11. package/dist/deps/query-builder-h6B2D2BCoQ-nalndsxao.js +0 -73
  12. /package/dist/deps/{_commonjsHelpers-KaVRbhAgd4-q7gfmdhp3.js → _commonjsHelpers-KaVRbhAgd4-kwqqnd90q.js} +0 -0
  13. /package/dist/deps/{_commonjsHelpers-KaVRbhAgd4-l722vj2gw.js → _commonjsHelpers-KaVRbhAgd4-uxndobs5x.js} +0 -0
  14. /package/dist/deps/{acorn-DYjaOAP8Gz-5od0nnc1n.js → acorn-DYjaOAP8Gz-sr5trw9bz.js} +0 -0
  15. /package/dist/deps/{acorn-DYjaOAP8Gz-iej25ud3i.js → acorn-DYjaOAP8Gz-weix73v9o.js} +0 -0
  16. /package/dist/deps/{angular-1bp1uAROl4-v5b839cev.js → angular-1bp1uAROl4-kkul3g7k1.js} +0 -0
  17. /package/dist/deps/{angular-1bp1uAROl4-99vqmzbep.js → angular-1bp1uAROl4-uxw5bvpbe.js} +0 -0
  18. /package/dist/deps/{babel-_P9jsDBVVy-k1a77zds1.js → babel-_P9jsDBVVy-d9o8122jb.js} +0 -0
  19. /package/dist/deps/{babel-_P9jsDBVVy-ti7564w9u.js → babel-_P9jsDBVVy-e51b05qlm.js} +0 -0
  20. /package/dist/deps/{estree-Q-oFBmJEml-0kymgejhu.js → estree-Q-oFBmJEml-095ahwwn9.js} +0 -0
  21. /package/dist/deps/{estree-Q-oFBmJEml-42jggp7mg.js → estree-Q-oFBmJEml-rbvoy6q8n.js} +0 -0
  22. /package/dist/deps/{flow-j77MFvzLrn-ap52320ei.js → flow-j77MFvzLrn-4oj033zoo.js} +0 -0
  23. /package/dist/deps/{flow-j77MFvzLrn-1z4r2fxkc.js → flow-j77MFvzLrn-sp1y6qk5l.js} +0 -0
  24. /package/dist/deps/{glimmer-ewQPb5nTUl-frf19ac2y.js → glimmer-ewQPb5nTUl-7dpdjtcg6.js} +0 -0
  25. /package/dist/deps/{glimmer-ewQPb5nTUl-tlejerh1v.js → glimmer-ewQPb5nTUl-obzq5iqnx.js} +0 -0
  26. /package/dist/deps/{graphql-8EXR1_taGG-qww14lfra.js → graphql-8EXR1_taGG-d4n3ijlu7.js} +0 -0
  27. /package/dist/deps/{graphql-8EXR1_taGG-fv5wbvhoe.js → graphql-8EXR1_taGG-ttfpz98wm.js} +0 -0
  28. /package/dist/deps/{html-dGbiW_CFWL-6sh6qc1c9.js → html-dGbiW_CFWL-1mrzazr55.js} +0 -0
  29. /package/dist/deps/{html-dGbiW_CFWL-e3g5yo4bj.js → html-dGbiW_CFWL-37edeoo0g.js} +0 -0
  30. /package/dist/deps/{markdown-vAYIRClyWZ-u392edgb6.js → markdown-vAYIRClyWZ-l8aqxsikz.js} +0 -0
  31. /package/dist/deps/{markdown-vAYIRClyWZ-m14zzly75.js → markdown-vAYIRClyWZ-wxn4kepwg.js} +0 -0
  32. /package/dist/deps/{meriyah-d5_qqf88x--cmow47h4z.js → meriyah-d5_qqf88x--fkvizjiqk.js} +0 -0
  33. /package/dist/deps/{meriyah-d5_qqf88x--gj9iavf1v.js → meriyah-d5_qqf88x--go5pilywm.js} +0 -0
  34. /package/dist/deps/{postcss-Vz5bDQ3hJO-usfw1m2p2.js → postcss-Vz5bDQ3hJO-60f1hv67i.js} +0 -0
  35. /package/dist/deps/{postcss-Vz5bDQ3hJO-7tkrnhrda.js → postcss-Vz5bDQ3hJO-fh9978xkx.js} +0 -0
  36. /package/dist/deps/{typescript-2hCq12HCbJ-h7k0wrn1r.js → typescript-2hCq12HCbJ-1sr037fji.js} +0 -0
  37. /package/dist/deps/{typescript-2hCq12HCbJ-7exuvkqr5.js → typescript-2hCq12HCbJ-5wh6qyzi4.js} +0 -0
  38. /package/dist/deps/{yaml-I5o0CrcX7J-qmecu827j.js → yaml-I5o0CrcX7J-b9q6ewwot.js} +0 -0
  39. /package/dist/deps/{yaml-I5o0CrcX7J-23w6jqutg.js → yaml-I5o0CrcX7J-lxy54h7g9.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, i as t2, a as r2, b as Ru } from "./deps/query-builder-h6B2D2BCoQ-nalndsxao.js";
4
+ import { Q as ir, i as t2, a as r2, b as Ru } from "./deps/query-builder-h6B2D2BCoQ-7giim23mn.js";
5
5
  import gn from "timers";
6
6
  import Fc from "crypto";
7
7
  import D1 from "fs";
@@ -13,7 +13,7 @@ import o2 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 jt } from "./deps/_commonjsHelpers-KaVRbhAgd4-l722vj2gw.js";
16
+ import { g as pr, c as jt } from "./deps/_commonjsHelpers-KaVRbhAgd4-uxndobs5x.js";
17
17
  import s2 from "url";
18
18
  import Ic from "zlib";
19
19
  import B1 from "net";
@@ -71009,7 +71009,10 @@ class $4 {
71009
71009
  }
71010
71010
  // 将 ObjectId 转换为字符串
71011
71011
  transformResultData(t) {
71012
- return t && t2(t) ? Object.entries(t).reduce((r, [n, i]) => (n === this.idField && typeof i == "object" ? r[n] = i.toString() : r[n] = i, r), {}) : t;
71012
+ return t && t2(t) ? Object.entries(t).reduce((r, [n, i]) => {
71013
+ var o;
71014
+ return n === this.idField && typeof i == "object" && i ? r[n] = ((o = i == null ? void 0 : i.toString) == null ? void 0 : o.call(i)) ?? i : r[n] = i, r;
71015
+ }, {}) : t;
71013
71016
  }
71014
71017
  async findUnique(t, { where: r, select: n }) {
71015
71018
  const i = this.getCollection(t), o = Object.keys(r ?? {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "odm-client",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1 +0,0 @@
1
- "use strict";function O(n){if(!n||typeof n!="object")return!1;const r=Object.getPrototypeOf(n);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null?Object.prototype.toString.call(n)==="[object Object]":!1}function u(n){return typeof n=="string"}function j(n,r,t){return typeof n=="function"?n(r,t):n}function P(n,r,t){const e={...n},s=new Date;for(const i of r.columns)if(!(e[i.name]!==void 0&&e[i.name]!==null)){if(i.createdAt){e[i.name]=s;continue}if(i.updatedAt){e[i.name]=s;continue}if(i.type==="date"&&u(e[i.name])){e[i.name]=new Date(e[i.name]);continue}i.default!==void 0&&(e[i.name]=j(i.default,n,t))}return e}function c(n,r){var s;const t={...n},e=new Date;return(s=r==null?void 0:r.columns)==null||s.forEach(i=>{i.updatedAt&&(n[i.name]=e),i.type==="date"&&u(t[i.name])&&(t[i.name]=new Date(t[i.name]))}),t}const D="_id";function A(n,r,t,e){var s,i;return O(r)?((s=t==null?void 0:t[n])==null?void 0:s.type)==="date"||n===D?Object.entries(r).reduce((f,[y,o])=>{var d;return y==="$not"?f[y]=A(n,o,t,e):Array.isArray(o)?f[y]=o.map(Q=>A(n,Q,t,e)):u(o)&&((d=t==null?void 0:t[n])==null?void 0:d.type)==="date"?f[y]=new Date(o):u(o)&&n===D&&e?f[y]=e(o):f[y]=o,f},{}):r:((i=t==null?void 0:t[n])==null?void 0:i.type)==="date"&&u(r)?new Date(r):n===D&&u(r)?e(r):r}function B(n,r,t,e){return n==="$and"?Array.isArray(r)?r.map(s=>p(s,t,e)):p(r,t,e):n==="$or"?Array.isArray(r)?r.map(s=>p(s,t,e)):p(r,t,e):A(n,r,t,e)}function p(n,r,t){return Object.entries(n).reduce((s,[i,w])=>(s[i]=B(i,w,r,t),s),{})}class S{static buildCloudBaseQuery(r,t){return p(r??{},t)}static buildMongodbQuery(r,t,e){return p(r??{},t,e)}static getOrderByArray(r){return Object.entries(r??{}).map(([t,e])=>({fieldName:t,order:e}))}}exports.QueryBuilder=S;exports.applyDefaultValues=P;exports.applyUpdateValues=c;exports.isPlainObject=O;
@@ -1,73 +0,0 @@
1
- function d(n) {
2
- if (!n || typeof n != "object")
3
- return !1;
4
- const r = Object.getPrototypeOf(n);
5
- return r === null || r === Object.prototype || Object.getPrototypeOf(r) === null ? Object.prototype.toString.call(n) === "[object Object]" : !1;
6
- }
7
- function A(n) {
8
- return typeof n == "string";
9
- }
10
- function j(n, r, t) {
11
- return typeof n == "function" ? n(r, t) : n;
12
- }
13
- function S(n, r, t) {
14
- const i = { ...n }, s = /* @__PURE__ */ new Date();
15
- for (const e of r.columns)
16
- if (!(i[e.name] !== void 0 && i[e.name] !== null)) {
17
- if (e.createdAt) {
18
- i[e.name] = s;
19
- continue;
20
- }
21
- if (e.updatedAt) {
22
- i[e.name] = s;
23
- continue;
24
- }
25
- if (e.type === "date" && A(i[e.name])) {
26
- i[e.name] = new Date(i[e.name]);
27
- continue;
28
- }
29
- e.default !== void 0 && (i[e.name] = j(e.default, n, t));
30
- }
31
- return i;
32
- }
33
- function c(n, r) {
34
- var s;
35
- const t = { ...n }, i = /* @__PURE__ */ new Date();
36
- return (s = r == null ? void 0 : r.columns) == null || s.forEach((e) => {
37
- e.updatedAt && (n[e.name] = i), e.type === "date" && A(t[e.name]) && (t[e.name] = new Date(t[e.name]));
38
- }), t;
39
- }
40
- const p = "_id";
41
- function u(n, r, t, i) {
42
- var s, e;
43
- return d(r) ? ((s = t == null ? void 0 : t[n]) == null ? void 0 : s.type) === "date" || n === p ? Object.entries(r).reduce((f, [y, o]) => {
44
- var Q;
45
- return y === "$not" ? f[y] = u(n, o, t, i) : Array.isArray(o) ? f[y] = o.map((O) => u(n, O, t, i)) : A(o) && ((Q = t == null ? void 0 : t[n]) == null ? void 0 : Q.type) === "date" ? f[y] = new Date(o) : A(o) && n === p && i ? f[y] = i(o) : f[y] = o, f;
46
- }, {}) : r : ((e = t == null ? void 0 : t[n]) == null ? void 0 : e.type) === "date" && A(r) ? new Date(r) : n === p && A(r) ? i(r) : r;
47
- }
48
- function P(n, r, t, i) {
49
- return n === "$and" ? Array.isArray(r) ? r.map((s) => D(s, t, i)) : D(r, t, i) : n === "$or" ? Array.isArray(r) ? r.map((s) => D(s, t, i)) : D(r, t, i) : u(n, r, t, i);
50
- }
51
- function D(n, r, t) {
52
- return Object.entries(n).reduce((s, [e, w]) => (s[e] = P(e, w, r, t), s), {});
53
- }
54
- class h {
55
- static buildCloudBaseQuery(r, t) {
56
- return D(r ?? {}, t);
57
- }
58
- static buildMongodbQuery(r, t, i) {
59
- return D(r ?? {}, t, i);
60
- }
61
- static getOrderByArray(r) {
62
- return Object.entries(r ?? {}).map(([t, i]) => ({
63
- fieldName: t,
64
- order: i
65
- }));
66
- }
67
- }
68
- export {
69
- h as Q,
70
- S as a,
71
- c as b,
72
- d as i
73
- };