@blue-labs/shared-utils 1.20.0 → 1.21.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/dist/deepFreeze/deepFreeze.d.ts +8 -0
- package/dist/deepFreeze/deepFreeze.d.ts.map +1 -0
- package/dist/deepFreeze/index.d.ts +2 -0
- package/dist/deepFreeze/index.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +43 -31
- package/package.json +5 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepFreeze.d.ts","sourceRoot":"","sources":["../../src/deepFreeze/deepFreeze.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAevC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deepFreeze/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("zod");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("zod");function d(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var u,j;function g(){return j||(j=1,u=function r(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var s,t,i;if(Array.isArray(e)){if(s=e.length,s!=n.length)return!1;for(t=s;t--!==0;)if(!r(e[t],n[t]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(t of e.entries())if(!n.has(t[0]))return!1;for(t of e.entries())if(!r(t[1],n.get(t[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(t of e.entries())if(!n.has(t[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(s=e.length,s!=n.length)return!1;for(t=s;t--!==0;)if(e[t]!==n[t])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),s=i.length,s!==Object.keys(n).length)return!1;for(t=s;t--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[t]))return!1;for(t=s;t--!==0;){var f=i[t];if(!r(e[f],n[f]))return!1}return!0}return e!==e&&n!==n}),u}var P=g();const v=d(P);function a(r,e){if(e===null||typeof e!="object"||e instanceof Date||e instanceof RegExp)return v(r,e);if(e instanceof Set){if(!(r instanceof Set))return!1;for(const s of e)if(!r.has(s))return!1;return!0}if(e instanceof Map){if(!(r instanceof Map))return!1;for(const[s,t]of e)if(!r.has(s)||!a(r.get(s),t))return!1;return!0}if(Array.isArray(e))return Array.isArray(r)?e.every(s=>r.some(t=>a(t,s))):!1;if(r===null||typeof r!="object"||Array.isArray(r))return!1;const n=r;return Object.entries(e).every(([s,t])=>s in n&&a(n[s],t))}const N=(r,e)=>r.safeParse(e).success,p=r=>r!=null,h=r=>r==null,m=r=>Array.isArray(r);function S(r){if(Object.isFrozen(r))return r;Object.freeze(r);for(const e of Object.getOwnPropertyNames(r)){const n=r[e];p(n)&&typeof n=="object"&&S(n)}return r}const z=(r,e)=>{const n=(s,t=[])=>{e(s,t),Array.isArray(s)||m(s)?s.forEach((i,f)=>n(i,[...t,f.toString()])):typeof s=="object"&&s!==null&&Object.entries(s).forEach(([i,f])=>n(f,[...t,i]))};n(r)},R=(r,e)=>{const n=[];return z(r,(s,t)=>{e(s,t)&&n.push({value:s,path:t})}),n},E=[o.z.string(),o.z.number(),o.z.boolean(),o.z.null()],O=o.z.union(E),l=o.z.lazy(()=>o.z.record(c)),y=o.z.lazy(()=>o.z.union([o.z.array(c),o.z.array(c).readonly()])),c=o.z.lazy(()=>o.z.union([O,l,y])),V=r=>typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r===null,F=r=>l.safeParse(r).success,T=r=>y.safeParse(r).success,A=r=>!isNaN(Number(r))&&isFinite(Number(r)),J=r=>A(r)?Number(r).toString()===r:!1;exports.deepContains=a;exports.deepFreeze=S;exports.isGivenTypeSchema=N;exports.isJsonArray=T;exports.isJsonObject=F;exports.isJsonPrimitive=V;exports.isNonNullable=p;exports.isNullable=h;exports.isNumberString=A;exports.isPreciseNumberString=J;exports.isReadonlyArray=m;exports.jsonArraySchema=y;exports.jsonObjectSchema=l;exports.jsonPrimitiveSchema=O;exports.jsonTraverse=z;exports.jsonTraverseAndFind=R;exports.jsonValueSchema=c;
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z as o } from "zod";
|
|
2
|
-
function
|
|
2
|
+
function j(r) {
|
|
3
3
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
4
4
|
}
|
|
5
|
-
var
|
|
5
|
+
var u, l;
|
|
6
6
|
function m() {
|
|
7
|
-
return l || (l = 1,
|
|
7
|
+
return l || (l = 1, u = function r(e, t) {
|
|
8
8
|
if (e === t) return !0;
|
|
9
9
|
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
10
10
|
if (e.constructor !== t.constructor) return !1;
|
|
@@ -48,13 +48,13 @@ function m() {
|
|
|
48
48
|
return !0;
|
|
49
49
|
}
|
|
50
50
|
return e !== e && t !== t;
|
|
51
|
-
}),
|
|
51
|
+
}), u;
|
|
52
52
|
}
|
|
53
|
-
var
|
|
54
|
-
const
|
|
55
|
-
function
|
|
53
|
+
var O = m();
|
|
54
|
+
const A = /* @__PURE__ */ j(O);
|
|
55
|
+
function a(r, e) {
|
|
56
56
|
if (e === null || typeof e != "object" || e instanceof Date || e instanceof RegExp)
|
|
57
|
-
return
|
|
57
|
+
return A(r, e);
|
|
58
58
|
if (e instanceof Set) {
|
|
59
59
|
if (!(r instanceof Set)) return !1;
|
|
60
60
|
for (const s of e) if (!r.has(s)) return !1;
|
|
@@ -63,21 +63,32 @@ function u(r, e) {
|
|
|
63
63
|
if (e instanceof Map) {
|
|
64
64
|
if (!(r instanceof Map)) return !1;
|
|
65
65
|
for (const [s, n] of e)
|
|
66
|
-
if (!r.has(s) || !
|
|
66
|
+
if (!r.has(s) || !a(r.get(s), n)) return !1;
|
|
67
67
|
return !0;
|
|
68
68
|
}
|
|
69
69
|
if (Array.isArray(e))
|
|
70
70
|
return Array.isArray(r) ? e.every(
|
|
71
|
-
(s) => r.some((n) =>
|
|
71
|
+
(s) => r.some((n) => a(n, s))
|
|
72
72
|
) : !1;
|
|
73
73
|
if (r === null || typeof r != "object" || Array.isArray(r))
|
|
74
74
|
return !1;
|
|
75
75
|
const t = r;
|
|
76
76
|
return Object.entries(e).every(
|
|
77
|
-
([s, n]) => s in t &&
|
|
77
|
+
([s, n]) => s in t && a(t[s], n)
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
|
-
const
|
|
80
|
+
const E = (r, e) => r.safeParse(e).success, g = (r) => r != null, R = (r) => r == null, S = (r) => Array.isArray(r);
|
|
81
|
+
function P(r) {
|
|
82
|
+
if (Object.isFrozen(r))
|
|
83
|
+
return r;
|
|
84
|
+
Object.freeze(r);
|
|
85
|
+
for (const e of Object.getOwnPropertyNames(r)) {
|
|
86
|
+
const t = r[e];
|
|
87
|
+
g(t) && typeof t == "object" && P(t);
|
|
88
|
+
}
|
|
89
|
+
return r;
|
|
90
|
+
}
|
|
91
|
+
const d = (r, e) => {
|
|
81
92
|
const t = (s, n = []) => {
|
|
82
93
|
e(s, n), Array.isArray(s) || S(s) ? s.forEach(
|
|
83
94
|
(f, i) => t(f, [...n, i.toString()])
|
|
@@ -86,33 +97,34 @@ const v = (r, e) => r.safeParse(e).success, z = (r) => r != null, E = (r) => r =
|
|
|
86
97
|
);
|
|
87
98
|
};
|
|
88
99
|
t(r);
|
|
89
|
-
},
|
|
100
|
+
}, V = (r, e) => {
|
|
90
101
|
const t = [];
|
|
91
|
-
return
|
|
102
|
+
return d(r, (s, n) => {
|
|
92
103
|
e(s, n) && t.push({ value: s, path: n });
|
|
93
104
|
}), t;
|
|
94
|
-
},
|
|
105
|
+
}, z = [o.string(), o.number(), o.boolean(), o.null()], N = o.union(z), y = o.lazy(
|
|
95
106
|
() => o.record(c)
|
|
96
|
-
),
|
|
107
|
+
), p = o.lazy(
|
|
97
108
|
() => o.union([o.array(c), o.array(c).readonly()])
|
|
98
109
|
), c = o.lazy(
|
|
99
|
-
() => o.union([
|
|
100
|
-
),
|
|
110
|
+
() => o.union([N, y, p])
|
|
111
|
+
), w = (r) => typeof r == "string" || typeof r == "number" || typeof r == "boolean" || r === null, F = (r) => y.safeParse(r).success, M = (r) => p.safeParse(r).success, v = (r) => !isNaN(Number(r)) && isFinite(Number(r)), q = (r) => v(r) ? Number(r).toString() === r : !1;
|
|
101
112
|
export {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
M as
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
a as deepContains,
|
|
114
|
+
P as deepFreeze,
|
|
115
|
+
E as isGivenTypeSchema,
|
|
116
|
+
M as isJsonArray,
|
|
117
|
+
F as isJsonObject,
|
|
118
|
+
w as isJsonPrimitive,
|
|
119
|
+
g as isNonNullable,
|
|
120
|
+
R as isNullable,
|
|
121
|
+
v as isNumberString,
|
|
122
|
+
q as isPreciseNumberString,
|
|
111
123
|
S as isReadonlyArray,
|
|
112
|
-
|
|
124
|
+
p as jsonArraySchema,
|
|
113
125
|
y as jsonObjectSchema,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
126
|
+
N as jsonPrimitiveSchema,
|
|
127
|
+
d as jsonTraverse,
|
|
128
|
+
V as jsonTraverseAndFind,
|
|
117
129
|
c as jsonValueSchema
|
|
118
130
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blue-labs/shared-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.1",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"fast-deep-equal": "3.1.3"
|
|
6
|
-
"zod": "3.23.8"
|
|
5
|
+
"fast-deep-equal": "^3.1.3"
|
|
7
6
|
},
|
|
8
7
|
"main": "./dist/index.js",
|
|
9
8
|
"module": "./dist/index.mjs",
|
|
@@ -27,5 +26,8 @@
|
|
|
27
26
|
"import": "./dist/index.mjs",
|
|
28
27
|
"require": "./dist/index.js"
|
|
29
28
|
}
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"zod": "^3.20.0"
|
|
30
32
|
}
|
|
31
33
|
}
|