odm-client 0.0.12 → 0.0.14

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-n8c3gimq9.js +1 -0
  4. package/dist/deps/query-builder-h6B2D2BCoQ-nalndsxao.js +73 -0
  5. package/dist/generate.cjs +3 -3
  6. package/dist/generate.js +15 -15
  7. package/dist/mongodb.cjs +5 -5
  8. package/dist/mongodb.js +493 -493
  9. package/package.json +1 -1
  10. package/dist/deps/query-builder-h6B2D2BCoQ-kxfdtzdpf.js +0 -73
  11. package/dist/deps/query-builder-h6B2D2BCoQ-wcp4tk68m.js +0 -1
  12. /package/dist/deps/{_commonjsHelpers-KaVRbhAgd4-tl33na53h.js → _commonjsHelpers-KaVRbhAgd4-l722vj2gw.js} +0 -0
  13. /package/dist/deps/{_commonjsHelpers-KaVRbhAgd4-ikvxkuahc.js → _commonjsHelpers-KaVRbhAgd4-q7gfmdhp3.js} +0 -0
  14. /package/dist/deps/{acorn-DYjaOAP8Gz-z3tscz5ei.js → acorn-DYjaOAP8Gz-5od0nnc1n.js} +0 -0
  15. /package/dist/deps/{acorn-DYjaOAP8Gz-uk33c5cyt.js → acorn-DYjaOAP8Gz-iej25ud3i.js} +0 -0
  16. /package/dist/deps/{angular-1bp1uAROl4-vmgbkpcc4.js → angular-1bp1uAROl4-99vqmzbep.js} +0 -0
  17. /package/dist/deps/{angular-1bp1uAROl4-gtm2lvgsf.js → angular-1bp1uAROl4-v5b839cev.js} +0 -0
  18. /package/dist/deps/{babel-_P9jsDBVVy-vjqlci9b0.js → babel-_P9jsDBVVy-k1a77zds1.js} +0 -0
  19. /package/dist/deps/{babel-_P9jsDBVVy-aimapq343.js → babel-_P9jsDBVVy-ti7564w9u.js} +0 -0
  20. /package/dist/deps/{estree-Q-oFBmJEml-f4yzsva37.js → estree-Q-oFBmJEml-0kymgejhu.js} +0 -0
  21. /package/dist/deps/{estree-Q-oFBmJEml-af146fyk6.js → estree-Q-oFBmJEml-42jggp7mg.js} +0 -0
  22. /package/dist/deps/{flow-j77MFvzLrn-wxfbjld4y.js → flow-j77MFvzLrn-1z4r2fxkc.js} +0 -0
  23. /package/dist/deps/{flow-j77MFvzLrn-2fqhus1ch.js → flow-j77MFvzLrn-ap52320ei.js} +0 -0
  24. /package/dist/deps/{glimmer-ewQPb5nTUl-mkguoqlo3.js → glimmer-ewQPb5nTUl-frf19ac2y.js} +0 -0
  25. /package/dist/deps/{glimmer-ewQPb5nTUl-rrfdalt62.js → glimmer-ewQPb5nTUl-tlejerh1v.js} +0 -0
  26. /package/dist/deps/{graphql-8EXR1_taGG-55efhnqes.js → graphql-8EXR1_taGG-fv5wbvhoe.js} +0 -0
  27. /package/dist/deps/{graphql-8EXR1_taGG-rf47bs55b.js → graphql-8EXR1_taGG-qww14lfra.js} +0 -0
  28. /package/dist/deps/{html-dGbiW_CFWL-p0ywmijjf.js → html-dGbiW_CFWL-6sh6qc1c9.js} +0 -0
  29. /package/dist/deps/{html-dGbiW_CFWL-ghspsfha5.js → html-dGbiW_CFWL-e3g5yo4bj.js} +0 -0
  30. /package/dist/deps/{markdown-vAYIRClyWZ-bhap5opjr.js → markdown-vAYIRClyWZ-m14zzly75.js} +0 -0
  31. /package/dist/deps/{markdown-vAYIRClyWZ-h3abl11br.js → markdown-vAYIRClyWZ-u392edgb6.js} +0 -0
  32. /package/dist/deps/{meriyah-d5_qqf88x--8044094pk.js → meriyah-d5_qqf88x--cmow47h4z.js} +0 -0
  33. /package/dist/deps/{meriyah-d5_qqf88x--pcvnciq2c.js → meriyah-d5_qqf88x--gj9iavf1v.js} +0 -0
  34. /package/dist/deps/{postcss-Vz5bDQ3hJO-ro4pnefgg.js → postcss-Vz5bDQ3hJO-7tkrnhrda.js} +0 -0
  35. /package/dist/deps/{postcss-Vz5bDQ3hJO-l00t96ehl.js → postcss-Vz5bDQ3hJO-usfw1m2p2.js} +0 -0
  36. /package/dist/deps/{typescript-2hCq12HCbJ-jwucnfl28.js → typescript-2hCq12HCbJ-7exuvkqr5.js} +0 -0
  37. /package/dist/deps/{typescript-2hCq12HCbJ-iza7mqr9w.js → typescript-2hCq12HCbJ-h7k0wrn1r.js} +0 -0
  38. /package/dist/deps/{yaml-I5o0CrcX7J-gkwhp2lxa.js → yaml-I5o0CrcX7J-23w6jqutg.js} +0 -0
  39. /package/dist/deps/{yaml-I5o0CrcX7J-xuhk07qnp.js → yaml-I5o0CrcX7J-qmecu827j.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "odm-client",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,73 +0,0 @@
1
- function Q(n) {
2
- if (!n || typeof n != "object")
3
- return !1;
4
- const t = Object.getPrototypeOf(n);
5
- return t === null || t === Object.prototype || Object.getPrototypeOf(t) === null ? Object.prototype.toString.call(n) === "[object Object]" : !1;
6
- }
7
- function D(n) {
8
- return typeof n == "string";
9
- }
10
- function j(n, t, r) {
11
- return typeof n == "function" ? n(t, r) : n;
12
- }
13
- function c(n, t, r) {
14
- const e = { ...n }, s = /* @__PURE__ */ new Date();
15
- for (const i of t.columns)
16
- if (!(e[i.name] !== void 0 && e[i.name] !== null)) {
17
- if (i.createdAt) {
18
- e[i.name] = s;
19
- continue;
20
- }
21
- if (i.updatedAt) {
22
- e[i.name] = s;
23
- continue;
24
- }
25
- if (i.type === "date" && D(e[i.name])) {
26
- e[i.name] = new Date(e[i.name]);
27
- continue;
28
- }
29
- i.default !== void 0 && (e[i.name] = j(i.default, n, r));
30
- }
31
- return e;
32
- }
33
- function S(n, t) {
34
- var s;
35
- const r = { ...n }, e = /* @__PURE__ */ new Date();
36
- return (s = t == null ? void 0 : t.columns) == null || s.forEach((i) => {
37
- i.updatedAt && (n[i.name] = e), i.type === "date" && D(r[i.name]) && (r[i.name] = new Date(r[i.name]));
38
- }), r;
39
- }
40
- const d = "_id";
41
- function p(n, t, r, e) {
42
- var s, i;
43
- return Q(t) ? ((s = r == null ? void 0 : r[n]) == null ? void 0 : s.type) === "date" || n === d ? Object.entries(t).reduce((f, [y, o]) => {
44
- var w;
45
- return y === "$not" ? f[y] = p(n, o, r, e) : Array.isArray(o) ? f[y] = o.map((O) => p(n, O, r, e)) : D(o) && ((w = r == null ? void 0 : r[n]) == null ? void 0 : w.type) === "date" ? f[y] = new Date(o) : D(o) && n === d && e ? f[y] = e(o) : f[y] = o, f;
46
- }, {}) : t : ((i = r == null ? void 0 : r[n]) == null ? void 0 : i.type) === "date" && D(t) ? new Date(t) : t;
47
- }
48
- function P(n, t, r, e) {
49
- return n === "$and" ? Array.isArray(t) ? t.map((s) => A(s, r, e)) : A(t, r, e) : n === "$or" ? Array.isArray(t) ? t.map((s) => A(s, r, e)) : A(t, r, e) : p(n, t, r, e);
50
- }
51
- function A(n, t, r) {
52
- return Object.entries(n).reduce((s, [i, u]) => (s[i] = P(i, u, t, r), s), {});
53
- }
54
- class g {
55
- static buildCloudBaseQuery(t, r) {
56
- return A(t ?? {}, r);
57
- }
58
- static buildMongodbQuery(t, r, e) {
59
- return A(t ?? {}, r, e);
60
- }
61
- static getOrderByArray(t) {
62
- return Object.entries(t ?? {}).map(([r, e]) => ({
63
- fieldName: r,
64
- order: e
65
- }));
66
- }
67
- }
68
- export {
69
- g as Q,
70
- c as a,
71
- S as b,
72
- Q as i
73
- };
@@ -1 +0,0 @@
1
- "use strict";function O(n){if(!n||typeof n!="object")return!1;const t=Object.getPrototypeOf(n);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(n)==="[object Object]":!1}function p(n){return typeof n=="string"}function Q(n,t,r){return typeof n=="function"?n(t,r):n}function c(n,t,r){const e={...n},s=new Date;for(const i of t.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"&&p(e[i.name])){e[i.name]=new Date(e[i.name]);continue}i.default!==void 0&&(e[i.name]=Q(i.default,n,r))}return e}function P(n,t){var s;const r={...n},e=new Date;return(s=t==null?void 0:t.columns)==null||s.forEach(i=>{i.updatedAt&&(n[i.name]=e),i.type==="date"&&p(r[i.name])&&(r[i.name]=new Date(r[i.name]))}),r}const w="_id";function D(n,t,r,e){var s,i;return O(t)?((s=r==null?void 0:r[n])==null?void 0:s.type)==="date"||n===w?Object.entries(t).reduce((f,[y,o])=>{var d;return y==="$not"?f[y]=D(n,o,r,e):Array.isArray(o)?f[y]=o.map(j=>D(n,j,r,e)):p(o)&&((d=r==null?void 0:r[n])==null?void 0:d.type)==="date"?f[y]=new Date(o):p(o)&&n===w&&e?f[y]=e(o):f[y]=o,f},{}):t:((i=r==null?void 0:r[n])==null?void 0:i.type)==="date"&&p(t)?new Date(t):t}function B(n,t,r,e){return n==="$and"?Array.isArray(t)?t.map(s=>u(s,r,e)):u(t,r,e):n==="$or"?Array.isArray(t)?t.map(s=>u(s,r,e)):u(t,r,e):D(n,t,r,e)}function u(n,t,r){return Object.entries(n).reduce((s,[i,A])=>(s[i]=B(i,A,t,r),s),{})}class S{static buildCloudBaseQuery(t,r){return u(t??{},r)}static buildMongodbQuery(t,r,e){return u(t??{},r,e)}static getOrderByArray(t){return Object.entries(t??{}).map(([r,e])=>({fieldName:r,order:e}))}}exports.QueryBuilder=S;exports.applyDefaultValues=c;exports.applyUpdateValues=P;exports.isPlainObject=O;