@animaapp/anima-sdk 0.4.4 → 0.5.0
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.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -5
- package/dist/index.js +814 -802
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
var xr = Object.defineProperty, kr = Object.defineProperties;
|
|
2
2
|
var Tr = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Pt = Object.getOwnPropertySymbols;
|
|
4
|
-
var Sr = Object.prototype.hasOwnProperty,
|
|
4
|
+
var Sr = Object.prototype.hasOwnProperty, Er = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var Ft = (r) => {
|
|
6
6
|
throw TypeError(r);
|
|
7
7
|
};
|
|
8
|
-
var $t = (r, e, t) => e in r ? xr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t,
|
|
8
|
+
var $t = (r, e, t) => e in r ? xr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, u = (r, e) => {
|
|
9
9
|
for (var t in e || (e = {}))
|
|
10
10
|
Sr.call(e, t) && $t(r, t, e[t]);
|
|
11
11
|
if (Pt)
|
|
12
12
|
for (var t of Pt(e))
|
|
13
|
-
|
|
13
|
+
Er.call(e, t) && $t(r, t, e[t]);
|
|
14
14
|
return r;
|
|
15
15
|
}, g = (r, e) => kr(r, Tr(e));
|
|
16
|
-
var
|
|
17
|
-
var
|
|
16
|
+
var ft = (r, e, t) => e.has(r) || Ft("Cannot " + t);
|
|
17
|
+
var M = (r, e, t) => (ft(r, e, "read from private field"), t ? t.call(r) : e.get(r)), Ye = (r, e, t) => e.has(r) ? Ft("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), ht = (r, e, t, s) => (ft(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t), Qe = (r, e, t) => (ft(r, e, "access private method"), t);
|
|
18
18
|
var C = (r, e, t) => new Promise((s, n) => {
|
|
19
19
|
var a = (c) => {
|
|
20
20
|
try {
|
|
21
21
|
o(t.next(c));
|
|
22
|
-
} catch (
|
|
23
|
-
n(
|
|
22
|
+
} catch (d) {
|
|
23
|
+
n(d);
|
|
24
24
|
}
|
|
25
25
|
}, i = (c) => {
|
|
26
26
|
try {
|
|
27
27
|
o(t.throw(c));
|
|
28
|
-
} catch (
|
|
29
|
-
n(
|
|
28
|
+
} catch (d) {
|
|
29
|
+
n(d);
|
|
30
30
|
}
|
|
31
31
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
32
32
|
o((t = t.apply(r, e)).next());
|
|
33
33
|
});
|
|
34
|
-
class
|
|
34
|
+
class de extends Error {
|
|
35
35
|
constructor({
|
|
36
36
|
name: e,
|
|
37
37
|
reason: t,
|
|
@@ -42,7 +42,7 @@ class oe extends Error {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
const Xt = "Figma Token Issue";
|
|
45
|
-
class
|
|
45
|
+
class Ar extends Error {
|
|
46
46
|
constructor({
|
|
47
47
|
fileKey: e,
|
|
48
48
|
reason: t,
|
|
@@ -52,13 +52,13 @@ class Er extends Error {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
const Yt = "Rate Limit Exceeded";
|
|
55
|
-
class
|
|
55
|
+
class Or extends Error {
|
|
56
56
|
constructor({ fileKey: e, cause: t }) {
|
|
57
57
|
super(Yt), this.fileKey = e, this.cause = t;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
const Qt = "Request Too Large";
|
|
61
|
-
class
|
|
61
|
+
class Cr extends Error {
|
|
62
62
|
constructor({ fileKey: e, cause: t }) {
|
|
63
63
|
super(Qt), this.fileKey = e, this.cause = t;
|
|
64
64
|
}
|
|
@@ -85,17 +85,17 @@ const Gn = (r) => r.message === tr, Rr = (r) => r.message === Yt, Zr = (r) => [X
|
|
|
85
85
|
if (((s = r == null ? void 0 : r.cause) == null ? void 0 : s.message) === "Fetch Error") {
|
|
86
86
|
const { err: n, status: a } = r.cause.body;
|
|
87
87
|
if (a === 403)
|
|
88
|
-
return new
|
|
88
|
+
return new Ar({
|
|
89
89
|
fileKey: e,
|
|
90
90
|
reason: n,
|
|
91
91
|
cause: r
|
|
92
92
|
});
|
|
93
93
|
if (a === 429)
|
|
94
|
-
return new
|
|
94
|
+
return new Or({ fileKey: e, cause: r });
|
|
95
95
|
if (a === 404)
|
|
96
96
|
return new Nr({ fileKey: e, cause: r });
|
|
97
97
|
if (a === 400 && n.includes("Request too large"))
|
|
98
|
-
return new
|
|
98
|
+
return new Cr({ fileKey: e, cause: r });
|
|
99
99
|
}
|
|
100
100
|
return new jr({ fileKey: e, cause: r });
|
|
101
101
|
}, Kn = (r) => Ir(r) ? "NotFound" : Rr(r) ? "RateLimitExceeded" : Zr(r) ? "FigmaTokenIssue" : Mr(r) ? "RequestTooLarge" : "UnknownFigmaApiException";
|
|
@@ -108,74 +108,74 @@ var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwn
|
|
|
108
108
|
for (var t of Lt(e))
|
|
109
109
|
Vr.call(e, t) && Dt(r, t, e[t]);
|
|
110
110
|
return r;
|
|
111
|
-
},
|
|
111
|
+
}, jt = (r, e) => $r(r, Fr(e)), Rt = (r, e, t) => e.has(r) || sr("Cannot " + t), T = (r, e, t) => (Rt(r, e, "read from private field"), t ? t.call(r) : e.get(r)), B = (r, e, t) => e.has(r) ? sr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), j = (r, e, t, s) => (Rt(r, e, "write to private field"), e.set(r, t), t), Q = (r, e, t) => (Rt(r, e, "access private method"), t), O = (r, e, t) => new Promise((s, n) => {
|
|
112
112
|
var a = (c) => {
|
|
113
113
|
try {
|
|
114
114
|
o(t.next(c));
|
|
115
|
-
} catch (
|
|
116
|
-
n(
|
|
115
|
+
} catch (d) {
|
|
116
|
+
n(d);
|
|
117
117
|
}
|
|
118
118
|
}, i = (c) => {
|
|
119
119
|
try {
|
|
120
120
|
o(t.throw(c));
|
|
121
|
-
} catch (
|
|
122
|
-
n(
|
|
121
|
+
} catch (d) {
|
|
122
|
+
n(d);
|
|
123
123
|
}
|
|
124
124
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
125
125
|
o((t = t.apply(r, e)).next());
|
|
126
|
-
}), Dr = (r, e, t) => (e = r[Vt("asyncIterator")]) ? e.call(r) : (r = r[Vt("iterator")](), e = {}, t = (s, n) => (n = r[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = n.call(r, a), c = a.done, Promise.resolve(a.value).then((
|
|
126
|
+
}), Dr = (r, e, t) => (e = r[Vt("asyncIterator")]) ? e.call(r) : (r = r[Vt("iterator")](), e = {}, t = (s, n) => (n = r[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = n.call(r, a), c = a.done, Promise.resolve(a.value).then((d) => i({ value: d, done: c }), o)))), t("next"), t("return"), e), Ur = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
127
127
|
function zr(r) {
|
|
128
128
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
129
129
|
}
|
|
130
|
-
var
|
|
130
|
+
var vt = { exports: {} }, Wr = vt.exports, Ut;
|
|
131
131
|
function Br() {
|
|
132
132
|
return Ut || (Ut = 1, function(r, e) {
|
|
133
133
|
(function(t, s) {
|
|
134
134
|
r.exports = s();
|
|
135
135
|
})(Wr, function() {
|
|
136
|
-
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ur, n = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined",
|
|
137
|
-
function
|
|
138
|
-
var
|
|
139
|
-
if (
|
|
140
|
-
return
|
|
141
|
-
if (
|
|
136
|
+
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ur, n = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = n && typeof Symbol.iterator != "undefined", v = n && typeof Symbol.toStringTag != "undefined", N = i && typeof Set.prototype.entries == "function", Z = a && typeof Map.prototype.entries == "function", F = N && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), W = Z && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), se = f && typeof Array.prototype[Symbol.iterator] == "function", me = se && Object.getPrototypeOf([][Symbol.iterator]()), ce = f && typeof String.prototype[Symbol.iterator] == "function", V = ce && Object.getPrototypeOf(""[Symbol.iterator]()), K = 8, q = -1;
|
|
137
|
+
function Ne(A) {
|
|
138
|
+
var k = typeof A;
|
|
139
|
+
if (k !== "object")
|
|
140
|
+
return k;
|
|
141
|
+
if (A === null)
|
|
142
142
|
return "null";
|
|
143
|
-
if (
|
|
143
|
+
if (A === s)
|
|
144
144
|
return "global";
|
|
145
|
-
if (Array.isArray(
|
|
145
|
+
if (Array.isArray(A) && (v === !1 || !(Symbol.toStringTag in A)))
|
|
146
146
|
return "Array";
|
|
147
147
|
if (typeof window == "object" && window !== null) {
|
|
148
|
-
if (typeof window.location == "object" &&
|
|
148
|
+
if (typeof window.location == "object" && A === window.location)
|
|
149
149
|
return "Location";
|
|
150
|
-
if (typeof window.document == "object" &&
|
|
150
|
+
if (typeof window.document == "object" && A === window.document)
|
|
151
151
|
return "Document";
|
|
152
152
|
if (typeof window.navigator == "object") {
|
|
153
|
-
if (typeof window.navigator.mimeTypes == "object" &&
|
|
153
|
+
if (typeof window.navigator.mimeTypes == "object" && A === window.navigator.mimeTypes)
|
|
154
154
|
return "MimeTypeArray";
|
|
155
|
-
if (typeof window.navigator.plugins == "object" &&
|
|
155
|
+
if (typeof window.navigator.plugins == "object" && A === window.navigator.plugins)
|
|
156
156
|
return "PluginArray";
|
|
157
157
|
}
|
|
158
|
-
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") &&
|
|
159
|
-
if (
|
|
158
|
+
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && A instanceof window.HTMLElement) {
|
|
159
|
+
if (A.tagName === "BLOCKQUOTE")
|
|
160
160
|
return "HTMLQuoteElement";
|
|
161
|
-
if (
|
|
161
|
+
if (A.tagName === "TD")
|
|
162
162
|
return "HTMLTableDataCellElement";
|
|
163
|
-
if (
|
|
163
|
+
if (A.tagName === "TH")
|
|
164
164
|
return "HTMLTableHeaderCellElement";
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
var
|
|
168
|
-
if (typeof
|
|
169
|
-
return
|
|
170
|
-
var D = Object.getPrototypeOf(
|
|
171
|
-
return D === RegExp.prototype ? "RegExp" : D === Date.prototype ? "Date" : t && D === Promise.prototype ? "Promise" : i && D === Set.prototype ? "Set" : a && D === Map.prototype ? "Map" : c && D === WeakSet.prototype ? "WeakSet" : o && D === WeakMap.prototype ? "WeakMap" :
|
|
167
|
+
var lt = v && A[Symbol.toStringTag];
|
|
168
|
+
if (typeof lt == "string")
|
|
169
|
+
return lt;
|
|
170
|
+
var D = Object.getPrototypeOf(A);
|
|
171
|
+
return D === RegExp.prototype ? "RegExp" : D === Date.prototype ? "Date" : t && D === Promise.prototype ? "Promise" : i && D === Set.prototype ? "Set" : a && D === Map.prototype ? "Map" : c && D === WeakSet.prototype ? "WeakSet" : o && D === WeakMap.prototype ? "WeakMap" : d && D === DataView.prototype ? "DataView" : a && D === W ? "Map Iterator" : i && D === F ? "Set Iterator" : se && D === me ? "Array Iterator" : ce && D === V ? "String Iterator" : D === null ? "Object" : Object.prototype.toString.call(A).slice(K, q);
|
|
172
172
|
}
|
|
173
|
-
return
|
|
173
|
+
return Ne;
|
|
174
174
|
});
|
|
175
|
-
}(
|
|
175
|
+
}(vt)), vt.exports;
|
|
176
176
|
}
|
|
177
177
|
var qr = Br();
|
|
178
|
-
const Hr = /* @__PURE__ */ zr(qr),
|
|
178
|
+
const Hr = /* @__PURE__ */ zr(qr), Zt = typeof Buffer != "undefined", Jr = Zt && typeof Buffer.from != "undefined", Gr = Zt ? (
|
|
179
179
|
/**
|
|
180
180
|
* is value is Buffer?
|
|
181
181
|
*
|
|
@@ -206,7 +206,7 @@ const Hr = /* @__PURE__ */ zr(qr), Rt = typeof Buffer != "undefined", Jr = Rt &&
|
|
|
206
206
|
function(r) {
|
|
207
207
|
return Buffer.from(r);
|
|
208
208
|
}
|
|
209
|
-
) :
|
|
209
|
+
) : Zt ? (
|
|
210
210
|
/**
|
|
211
211
|
* copy Buffer
|
|
212
212
|
*
|
|
@@ -231,7 +231,7 @@ const Hr = /* @__PURE__ */ zr(qr), Rt = typeof Buffer != "undefined", Jr = Rt &&
|
|
|
231
231
|
return r;
|
|
232
232
|
}
|
|
233
233
|
);
|
|
234
|
-
function
|
|
234
|
+
function Ee(r) {
|
|
235
235
|
return Gr(r) ? "Buffer" : Hr(r);
|
|
236
236
|
}
|
|
237
237
|
const Xr = /* @__PURE__ */ new Set([
|
|
@@ -242,7 +242,7 @@ const Xr = /* @__PURE__ */ new Set([
|
|
|
242
242
|
"Set"
|
|
243
243
|
]);
|
|
244
244
|
function Yr(r, e, t = null) {
|
|
245
|
-
switch (t ||
|
|
245
|
+
switch (t || Ee(r)) {
|
|
246
246
|
case "Arguments":
|
|
247
247
|
case "Array":
|
|
248
248
|
case "Object":
|
|
@@ -253,11 +253,11 @@ function Yr(r, e, t = null) {
|
|
|
253
253
|
return e;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function _t(r) {
|
|
257
257
|
return Xr.has(r);
|
|
258
258
|
}
|
|
259
259
|
function zt(r, e, t, s = null) {
|
|
260
|
-
switch (s ||
|
|
260
|
+
switch (s || Ee(r)) {
|
|
261
261
|
case "Arguments":
|
|
262
262
|
case "Array":
|
|
263
263
|
case "Object":
|
|
@@ -272,7 +272,7 @@ function zt(r, e, t, s = null) {
|
|
|
272
272
|
}
|
|
273
273
|
return r;
|
|
274
274
|
}
|
|
275
|
-
const Qr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, es = typeof global != "undefined" && global !== null && global.Object === Object && global, ts = typeof self != "undefined" && self !== null && self.Object === Object && self,
|
|
275
|
+
const Qr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, es = typeof global != "undefined" && global !== null && global.Object === Object && global, ts = typeof self != "undefined" && self !== null && self.Object === Object && self, pt = Qr || es || ts || Function("return this")();
|
|
276
276
|
function rs(r) {
|
|
277
277
|
return r.slice(0);
|
|
278
278
|
}
|
|
@@ -297,10 +297,10 @@ function cs(r) {
|
|
|
297
297
|
function ds(r) {
|
|
298
298
|
return new String(r);
|
|
299
299
|
}
|
|
300
|
-
function
|
|
301
|
-
return
|
|
300
|
+
function ne(r, e) {
|
|
301
|
+
return pt[e].from ? pt[e].from(r) : new pt[e](r);
|
|
302
302
|
}
|
|
303
|
-
function
|
|
303
|
+
function P(r) {
|
|
304
304
|
return r;
|
|
305
305
|
}
|
|
306
306
|
function Wt() {
|
|
@@ -327,33 +327,33 @@ const hs = /* @__PURE__ */ new Map([
|
|
|
327
327
|
["String", ds],
|
|
328
328
|
// typed arrays
|
|
329
329
|
// TODO: pass bound function
|
|
330
|
-
["Float32Array",
|
|
331
|
-
["Float64Array",
|
|
332
|
-
["Int16Array",
|
|
333
|
-
["Int32Array",
|
|
334
|
-
["Int8Array",
|
|
335
|
-
["Uint16Array",
|
|
336
|
-
["Uint32Array",
|
|
337
|
-
["Uint8Array",
|
|
338
|
-
["Uint8ClampedArray",
|
|
330
|
+
["Float32Array", ne],
|
|
331
|
+
["Float64Array", ne],
|
|
332
|
+
["Int16Array", ne],
|
|
333
|
+
["Int32Array", ne],
|
|
334
|
+
["Int8Array", ne],
|
|
335
|
+
["Uint16Array", ne],
|
|
336
|
+
["Uint32Array", ne],
|
|
337
|
+
["Uint8Array", ne],
|
|
338
|
+
["Uint8ClampedArray", ne],
|
|
339
339
|
// shallow copy
|
|
340
|
-
["Array Iterator",
|
|
341
|
-
["Map Iterator",
|
|
342
|
-
["Promise",
|
|
343
|
-
["Set Iterator",
|
|
344
|
-
["String Iterator",
|
|
345
|
-
["function",
|
|
346
|
-
["global",
|
|
340
|
+
["Array Iterator", P],
|
|
341
|
+
["Map Iterator", P],
|
|
342
|
+
["Promise", P],
|
|
343
|
+
["Set Iterator", P],
|
|
344
|
+
["String Iterator", P],
|
|
345
|
+
["function", P],
|
|
346
|
+
["global", P],
|
|
347
347
|
// NOTE: WeakMap and WeakSet cannot get entries
|
|
348
|
-
["WeakMap",
|
|
349
|
-
["WeakSet",
|
|
348
|
+
["WeakMap", P],
|
|
349
|
+
["WeakSet", P],
|
|
350
350
|
// primitives
|
|
351
|
-
["boolean",
|
|
352
|
-
["null",
|
|
353
|
-
["number",
|
|
354
|
-
["string",
|
|
355
|
-
["symbol",
|
|
356
|
-
["undefined",
|
|
351
|
+
["boolean", P],
|
|
352
|
+
["null", P],
|
|
353
|
+
["number", P],
|
|
354
|
+
["string", P],
|
|
355
|
+
["symbol", P],
|
|
356
|
+
["undefined", P],
|
|
357
357
|
// collections
|
|
358
358
|
// NOTE: return empty value, because recursively copy later.
|
|
359
359
|
["Arguments", Wt],
|
|
@@ -374,9 +374,9 @@ const hs = /* @__PURE__ */ new Map([
|
|
|
374
374
|
]);
|
|
375
375
|
function ps() {
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function bt(r, e = null, t = ps) {
|
|
378
378
|
arguments.length === 2 && typeof e == "function" && (t = e, e = null);
|
|
379
|
-
const s = e ||
|
|
379
|
+
const s = e || Ee(r), n = hs.get(s);
|
|
380
380
|
if (s === "Object") {
|
|
381
381
|
const a = t(r, s);
|
|
382
382
|
if (a !== void 0)
|
|
@@ -384,7 +384,7 @@ function _t(r, e = null, t = ps) {
|
|
|
384
384
|
}
|
|
385
385
|
return n ? n(r, s) : r;
|
|
386
386
|
}
|
|
387
|
-
function
|
|
387
|
+
function Ie(r, e = {}) {
|
|
388
388
|
typeof e == "function" && (e = {
|
|
389
389
|
customizer: e
|
|
390
390
|
});
|
|
@@ -393,15 +393,15 @@ function Ne(r, e = {}) {
|
|
|
393
393
|
customizer: t
|
|
394
394
|
// TODO: max depth
|
|
395
395
|
// depth = Infinity,
|
|
396
|
-
} = e, s =
|
|
397
|
-
if (!
|
|
398
|
-
return
|
|
399
|
-
const n =
|
|
400
|
-
return
|
|
396
|
+
} = e, s = Ee(r);
|
|
397
|
+
if (!_t(s))
|
|
398
|
+
return wt(r, null, null, null);
|
|
399
|
+
const n = bt(r, s, t), a = new WeakMap([[r, n]]), i = new WeakSet([r]);
|
|
400
|
+
return wt(r, n, a, i);
|
|
401
401
|
}
|
|
402
|
-
function
|
|
403
|
-
const a =
|
|
404
|
-
if (!
|
|
402
|
+
function wt(r, e, t, s, n) {
|
|
403
|
+
const a = Ee(r), i = bt(r, a);
|
|
404
|
+
if (!_t(a))
|
|
405
405
|
return i;
|
|
406
406
|
let o;
|
|
407
407
|
switch (a) {
|
|
@@ -418,16 +418,16 @@ function bt(r, e, t, s, n) {
|
|
|
418
418
|
break;
|
|
419
419
|
}
|
|
420
420
|
for (let c of o) {
|
|
421
|
-
const
|
|
422
|
-
if (s.has(
|
|
423
|
-
zt(e, c, t.get(
|
|
421
|
+
const d = Yr(r, c, a);
|
|
422
|
+
if (s.has(d))
|
|
423
|
+
zt(e, c, t.get(d), a);
|
|
424
424
|
else {
|
|
425
|
-
const f =
|
|
426
|
-
|
|
425
|
+
const f = Ee(d), v = bt(d, f);
|
|
426
|
+
_t(f) && (t.set(d, v), s.add(d)), zt(
|
|
427
427
|
e,
|
|
428
428
|
c,
|
|
429
|
-
|
|
430
|
-
|
|
429
|
+
wt(
|
|
430
|
+
d,
|
|
431
431
|
v,
|
|
432
432
|
t,
|
|
433
433
|
s
|
|
@@ -439,32 +439,32 @@ function bt(r, e, t, s, n) {
|
|
|
439
439
|
return e;
|
|
440
440
|
}
|
|
441
441
|
const ms = (r) => new Promise((e) => setTimeout(e, r));
|
|
442
|
-
var
|
|
442
|
+
var et, ge, tt, xt, nr;
|
|
443
443
|
class gs {
|
|
444
444
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
445
|
-
B(this,
|
|
445
|
+
B(this, xt), B(this, et), B(this, ge), B(this, tt), j(this, et, e), j(this, tt, t), j(this, ge, 0);
|
|
446
446
|
}
|
|
447
447
|
run() {
|
|
448
|
-
return
|
|
448
|
+
return O(this, null, function* () {
|
|
449
449
|
try {
|
|
450
|
-
return yield T(this,
|
|
450
|
+
return yield T(this, tt).call(this);
|
|
451
451
|
} catch (e) {
|
|
452
|
-
if (
|
|
452
|
+
if (j(this, ge, T(this, ge) + 1), T(this, ge) > T(this, et))
|
|
453
453
|
throw console.error("Max attempts reached"), e;
|
|
454
|
-
const t =
|
|
454
|
+
const t = Q(this, xt, nr).call(this);
|
|
455
455
|
return yield ms(t), yield this.run();
|
|
456
456
|
}
|
|
457
457
|
});
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
|
|
461
|
-
return T(this,
|
|
460
|
+
et = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), xt = /* @__PURE__ */ new WeakSet(), nr = function() {
|
|
461
|
+
return T(this, ge) * 1e3 * 1.5;
|
|
462
462
|
};
|
|
463
463
|
function ys() {
|
|
464
464
|
return typeof CompressionStream != "undefined";
|
|
465
465
|
}
|
|
466
466
|
function vs(r) {
|
|
467
|
-
return
|
|
467
|
+
return O(this, null, function* () {
|
|
468
468
|
const e = new Blob([r]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
|
|
469
469
|
try {
|
|
470
470
|
for (var s = Dr(e), n, a, i; n = !(a = yield s.next()).done; n = !1) {
|
|
@@ -485,7 +485,7 @@ function vs(r) {
|
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
487
|
function _s(r) {
|
|
488
|
-
return
|
|
488
|
+
return O(this, null, function* () {
|
|
489
489
|
const e = yield new Blob(r).arrayBuffer();
|
|
490
490
|
return new Uint8Array(e);
|
|
491
491
|
});
|
|
@@ -496,8 +496,8 @@ class bs extends Error {
|
|
|
496
496
|
for (const [i, o] of Object.entries(n))
|
|
497
497
|
if (typeof Headers != "undefined" && o instanceof Headers) {
|
|
498
498
|
const c = {};
|
|
499
|
-
o.forEach((
|
|
500
|
-
c[f] =
|
|
499
|
+
o.forEach((d, f) => {
|
|
500
|
+
c[f] = d;
|
|
501
501
|
}), this.causeProperties[i] = c;
|
|
502
502
|
} else
|
|
503
503
|
this.causeProperties[i] = o;
|
|
@@ -523,7 +523,7 @@ class Bt extends Error {
|
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
class
|
|
526
|
+
class je extends Error {
|
|
527
527
|
constructor(e = {}) {
|
|
528
528
|
const { canceled: t = !1 } = e;
|
|
529
529
|
super("Abort Error"), this.name = "Abort Error", this.canceled = t;
|
|
@@ -534,7 +534,7 @@ class ws extends Error {
|
|
|
534
534
|
super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
-
class
|
|
537
|
+
class mt extends Error {
|
|
538
538
|
constructor(e) {
|
|
539
539
|
super(e), this.name = "Request Validation Error";
|
|
540
540
|
}
|
|
@@ -545,14 +545,14 @@ function ar() {
|
|
|
545
545
|
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
546
546
|
).join("");
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function kt() {
|
|
549
549
|
return Math.floor(Date.now() / 1e3).toString();
|
|
550
550
|
}
|
|
551
551
|
const xs = 5 * 60 * 1e3, ks = 1 * 1e3;
|
|
552
|
-
var
|
|
552
|
+
var ye, L, X, Tt, St, Re;
|
|
553
553
|
class Ts {
|
|
554
554
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
555
|
-
B(this,
|
|
555
|
+
B(this, X), B(this, ye), B(this, L), this.baseAddress = t, j(this, ye, e), j(this, L, {}), this.plugins = [];
|
|
556
556
|
}
|
|
557
557
|
get headers() {
|
|
558
558
|
throw new Error("Missing implementation");
|
|
@@ -564,60 +564,60 @@ class Ts {
|
|
|
564
564
|
this.plugins = this.plugins.filter((t) => t.name !== e);
|
|
565
565
|
}
|
|
566
566
|
withOptions(e = {}) {
|
|
567
|
-
return
|
|
567
|
+
return j(this, L, e), this;
|
|
568
568
|
}
|
|
569
569
|
get(e) {
|
|
570
|
-
return
|
|
570
|
+
return O(this, arguments, function* (t, s = {}) {
|
|
571
571
|
const { overrideBaseAddress: n, overrideDefaultHeaders: a } = s, i = n != null ? n : this.baseAddress;
|
|
572
572
|
let o = a != null ? a : this.headers;
|
|
573
|
-
const c =
|
|
574
|
-
return
|
|
573
|
+
const c = Ie(T(this, L));
|
|
574
|
+
return j(this, L, {}), c.extraHeaders && (o = U(U({}, o), c.extraHeaders)), c.requestValidation && (o = jt(U({}, o), { "X-Request-Nonce": ar(), "X-Request-Timestamp": kt() })), c.async ? yield Q(this, X, St).call(this, `${i}${t}`, c.async, { headers: o }) : yield Q(this, X, Tt).call(this, `${i}${t}`, c, { headers: o });
|
|
575
575
|
});
|
|
576
576
|
}
|
|
577
577
|
post(e, t) {
|
|
578
|
-
return
|
|
579
|
-
const i =
|
|
580
|
-
return
|
|
578
|
+
return O(this, arguments, function* (s, n, a = {}) {
|
|
579
|
+
const i = Ie(T(this, L));
|
|
580
|
+
return j(this, L, {}), Q(this, X, Re).call(this, s, "POST", n, a, i);
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
583
|
put(e, t) {
|
|
584
|
-
return
|
|
585
|
-
const i =
|
|
586
|
-
return
|
|
584
|
+
return O(this, arguments, function* (s, n, a = {}) {
|
|
585
|
+
const i = Ie(T(this, L));
|
|
586
|
+
return j(this, L, {}), Q(this, X, Re).call(this, s, "PUT", n, a, i);
|
|
587
587
|
});
|
|
588
588
|
}
|
|
589
589
|
delete(e, t) {
|
|
590
|
-
return
|
|
591
|
-
const i =
|
|
592
|
-
return
|
|
590
|
+
return O(this, arguments, function* (s, n, a = {}) {
|
|
591
|
+
const i = Ie(T(this, L));
|
|
592
|
+
return j(this, L, {}), Q(this, X, Re).call(this, s, "DELETE", n, a, i);
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
595
|
patch(e, t) {
|
|
596
|
-
return
|
|
597
|
-
const i =
|
|
598
|
-
return
|
|
596
|
+
return O(this, arguments, function* (s, n, a = {}) {
|
|
597
|
+
const i = Ie(T(this, L));
|
|
598
|
+
return j(this, L, {}), Q(this, X, Re).call(this, s, "PATCH", n, a, i);
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
|
-
|
|
603
|
-
return
|
|
604
|
-
const s = () =>
|
|
605
|
-
var c,
|
|
602
|
+
ye = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakSet(), Tt = function(r, e, t) {
|
|
603
|
+
return O(this, null, function* () {
|
|
604
|
+
const s = () => O(this, null, function* () {
|
|
605
|
+
var c, d;
|
|
606
606
|
try {
|
|
607
|
-
return yield T(this,
|
|
607
|
+
return yield T(this, ye).call(this, r, U(U({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
608
608
|
} catch (f) {
|
|
609
|
-
throw f instanceof Error && f.name === "AbortError" ? new
|
|
609
|
+
throw f instanceof Error && f.name === "AbortError" ? new je({ canceled: (d = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? d : !1 }) : f;
|
|
610
610
|
}
|
|
611
|
-
}), { headers: n } = t != null ? t : {}, a = (c,
|
|
611
|
+
}), { headers: n } = t != null ? t : {}, a = (c, d) => {
|
|
612
612
|
var f, v;
|
|
613
|
-
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(
|
|
614
|
-
}, i = (c) =>
|
|
615
|
-
var
|
|
613
|
+
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(d)) || ((v = c == null ? void 0 : c.headersObject) == null ? void 0 : v[d]) || "";
|
|
614
|
+
}, i = (c) => O(this, null, function* () {
|
|
615
|
+
var d;
|
|
616
616
|
if (!c.ok) {
|
|
617
617
|
const v = yield c.text().catch();
|
|
618
618
|
throw new Bt({
|
|
619
619
|
url: r,
|
|
620
|
-
method: (
|
|
620
|
+
method: (d = t == null ? void 0 : t.method) != null ? d : "GET",
|
|
621
621
|
statusCode: c.status,
|
|
622
622
|
requestHeaders: n,
|
|
623
623
|
responseHeaders: c.headers,
|
|
@@ -626,15 +626,15 @@ me = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), G = /* @_
|
|
|
626
626
|
}
|
|
627
627
|
if (e.requestValidation && process.env.UI_TESTS !== !0)
|
|
628
628
|
try {
|
|
629
|
-
const v = a(c, "x-response-nonce"),
|
|
630
|
-
if (!v || v !==
|
|
631
|
-
throw new
|
|
632
|
-
const
|
|
633
|
-
if (isNaN(
|
|
634
|
-
throw new
|
|
629
|
+
const v = a(c, "x-response-nonce"), N = n == null ? void 0 : n["X-Request-Nonce"];
|
|
630
|
+
if (!v || v !== N)
|
|
631
|
+
throw new mt("Response nonce mismatch");
|
|
632
|
+
const Z = Number(a(c, "x-response-timestamp")), F = Number(kt()), W = 60 * 60 * 24;
|
|
633
|
+
if (isNaN(Z) || Math.abs(F - Z) > W)
|
|
634
|
+
throw new mt("Invalid response timestamp");
|
|
635
635
|
} catch (v) {
|
|
636
|
-
const
|
|
637
|
-
throw new
|
|
636
|
+
const N = v instanceof Error ? v.message : "Request validation failed";
|
|
637
|
+
throw new mt(N);
|
|
638
638
|
}
|
|
639
639
|
let f = yield c.text();
|
|
640
640
|
try {
|
|
@@ -653,81 +653,81 @@ me = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), G = /* @_
|
|
|
653
653
|
const o = yield s();
|
|
654
654
|
return yield i(o);
|
|
655
655
|
});
|
|
656
|
-
},
|
|
657
|
-
return
|
|
656
|
+
}, St = function(r, e, t) {
|
|
657
|
+
return O(this, null, function* () {
|
|
658
658
|
var s, n;
|
|
659
659
|
const {
|
|
660
660
|
onProgress: a,
|
|
661
661
|
abortSignal: i,
|
|
662
662
|
pollingInterval: o = () => ks,
|
|
663
663
|
maxTimeout: c = xs
|
|
664
|
-
} = e,
|
|
664
|
+
} = e, d = `${r}/async`, f = `${r}/async/job`;
|
|
665
665
|
let v;
|
|
666
666
|
try {
|
|
667
|
-
v = yield T(this,
|
|
668
|
-
} catch (
|
|
669
|
-
throw
|
|
667
|
+
v = yield T(this, ye).call(this, d, U(U({}, t), i && { signal: i }));
|
|
668
|
+
} catch (F) {
|
|
669
|
+
throw F instanceof Error && F.name === "AbortError" ? new je({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : F;
|
|
670
670
|
}
|
|
671
671
|
if (!v.ok) {
|
|
672
|
-
const
|
|
672
|
+
const F = yield v.text().catch();
|
|
673
673
|
throw new Bt({
|
|
674
674
|
url: r,
|
|
675
675
|
method: (n = t == null ? void 0 : t.method) != null ? n : "GET",
|
|
676
676
|
statusCode: v.status,
|
|
677
677
|
requestHeaders: this.headers,
|
|
678
678
|
responseHeaders: v.headers,
|
|
679
|
-
body:
|
|
679
|
+
body: F
|
|
680
680
|
});
|
|
681
681
|
}
|
|
682
|
-
const
|
|
683
|
-
if (!
|
|
682
|
+
const N = yield v.json(), { job_id: Z } = N;
|
|
683
|
+
if (!Z)
|
|
684
684
|
throw new Error("Job ID not found in response");
|
|
685
|
-
return new Promise((
|
|
686
|
-
const
|
|
685
|
+
return new Promise((F, W) => O(this, null, function* () {
|
|
686
|
+
const se = setTimeout(() => {
|
|
687
687
|
W(new Error("Job timed out"));
|
|
688
|
-
}, c),
|
|
688
|
+
}, c), me = (ce = 0) => O(this, null, function* () {
|
|
689
689
|
if (i != null && i.aborted) {
|
|
690
|
-
clearTimeout(
|
|
691
|
-
W(new
|
|
692
|
-
}).catch((
|
|
693
|
-
W(new
|
|
690
|
+
clearTimeout(se), T(this, ye).call(this, `${f}/${Z}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
691
|
+
W(new je({ canceled: !0 }));
|
|
692
|
+
}).catch((V) => {
|
|
693
|
+
W(new je({ canceled: !1 }));
|
|
694
694
|
});
|
|
695
695
|
return;
|
|
696
696
|
}
|
|
697
697
|
try {
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
700
|
-
clearTimeout(
|
|
701
|
-
const
|
|
702
|
-
|
|
703
|
-
} else if (
|
|
704
|
-
clearTimeout(
|
|
698
|
+
const V = yield (yield T(this, ye).call(this, `${f}/${Z}`, { headers: this.headers })).json();
|
|
699
|
+
if (V.status === "success") {
|
|
700
|
+
clearTimeout(se);
|
|
701
|
+
const K = V.response_json;
|
|
702
|
+
F(K);
|
|
703
|
+
} else if (V.status === "failed")
|
|
704
|
+
clearTimeout(se), W(new ws(V.response_json));
|
|
705
705
|
else {
|
|
706
|
-
a && a(
|
|
707
|
-
const
|
|
708
|
-
setTimeout(() =>
|
|
706
|
+
a && a(V.response_json);
|
|
707
|
+
const K = o(ce);
|
|
708
|
+
setTimeout(() => me(ce + 1), K);
|
|
709
709
|
}
|
|
710
|
-
} catch (
|
|
711
|
-
W(
|
|
710
|
+
} catch (V) {
|
|
711
|
+
W(V);
|
|
712
712
|
}
|
|
713
713
|
});
|
|
714
|
-
|
|
714
|
+
me();
|
|
715
715
|
}));
|
|
716
716
|
});
|
|
717
|
-
},
|
|
718
|
-
return
|
|
717
|
+
}, Re = function(r, e, t, s, n) {
|
|
718
|
+
return O(this, null, function* () {
|
|
719
719
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
720
720
|
let c = i != null ? i : this.headers;
|
|
721
|
-
n.extraHeaders && (c = U(U({}, c), n.extraHeaders)), n.requestValidation && (c =
|
|
722
|
-
let
|
|
723
|
-
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (
|
|
721
|
+
n.extraHeaders && (c = U(U({}, c), n.extraHeaders)), n.requestValidation && (c = jt(U({}, c), { "X-Request-Nonce": ar(), "X-Request-Timestamp": kt() }));
|
|
722
|
+
let d = t;
|
|
723
|
+
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (d = s.skipBodyJsonStringify ? t : JSON.stringify(t), n.compress && ys() && (c["Content-Encoding"] = "gzip", d = yield vs(d))), n.async ? yield Q(this, X, St).call(this, `${o}${r}`, n.async, {
|
|
724
724
|
method: e,
|
|
725
725
|
headers: c,
|
|
726
|
-
body:
|
|
727
|
-
}) : yield
|
|
726
|
+
body: d
|
|
727
|
+
}) : yield Q(this, X, Tt).call(this, `${o}${r}`, n, { method: e, headers: c, body: d });
|
|
728
728
|
});
|
|
729
729
|
};
|
|
730
|
-
const qt = (r, e, t, s) => r instanceof
|
|
730
|
+
const qt = (r, e, t, s) => r instanceof je ? r : new bs({ resource: e, api: String(t), args: s, cause: r }), gt = (r, e) => new Proxy(e, {
|
|
731
731
|
get(t, s) {
|
|
732
732
|
return (...n) => {
|
|
733
733
|
var a;
|
|
@@ -748,148 +748,154 @@ const qt = (r, e, t, s) => r instanceof Ie ? r : new bs({ resource: e, api: Stri
|
|
|
748
748
|
};
|
|
749
749
|
}
|
|
750
750
|
});
|
|
751
|
-
var
|
|
751
|
+
var Ze;
|
|
752
752
|
class Ss {
|
|
753
753
|
constructor(e) {
|
|
754
|
-
B(this,
|
|
754
|
+
B(this, Ze), this.resourceName = "Files", j(this, Ze, e);
|
|
755
755
|
}
|
|
756
756
|
get(e) {
|
|
757
|
-
return
|
|
757
|
+
return O(this, arguments, function* ({ fileKey: t, params: s = {} }) {
|
|
758
758
|
const n = new URLSearchParams(U({
|
|
759
759
|
plugin_data: "857346721138427857"
|
|
760
760
|
}, s)).toString(), a = `v1/files/${t}?${n}`;
|
|
761
|
-
return yield T(this,
|
|
761
|
+
return yield T(this, Ze).get(a);
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
getImageFills(e) {
|
|
765
|
-
return
|
|
765
|
+
return O(this, arguments, function* ({ fileKey: t }) {
|
|
766
766
|
var s, n;
|
|
767
767
|
const a = `v1/files/${t}/images`;
|
|
768
|
-
return (n = (s = (yield T(this,
|
|
768
|
+
return (n = (s = (yield T(this, Ze).get(a)).meta) == null ? void 0 : s.images) != null ? n : {};
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
|
-
|
|
773
|
-
const
|
|
772
|
+
Ze = /* @__PURE__ */ new WeakMap();
|
|
773
|
+
const Es = (r, e, t) => {
|
|
774
774
|
const s = e.sort();
|
|
775
775
|
return `${r}-${s.join("-")}-${t}`;
|
|
776
|
-
},
|
|
777
|
-
var
|
|
778
|
-
class
|
|
776
|
+
}, As = (r) => r ? r.ts > Date.now() - 1e3 * 30 : !1;
|
|
777
|
+
var Y, Et, ir;
|
|
778
|
+
class Os {
|
|
779
779
|
constructor(e) {
|
|
780
|
-
B(this,
|
|
780
|
+
B(this, Et), B(this, Y), this.resourceName = "Images", j(this, Y, e);
|
|
781
781
|
}
|
|
782
782
|
/**
|
|
783
783
|
* Return the URL for the _layer_ images for the given nodes.
|
|
784
784
|
* Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
|
|
785
785
|
*/
|
|
786
786
|
get(e) {
|
|
787
|
-
return
|
|
788
|
-
const i =
|
|
789
|
-
if (
|
|
787
|
+
return O(this, arguments, function* ({ fileKey: t, nodeIds: s, format: n = "jpg", scale: a }) {
|
|
788
|
+
const i = Es(t, s, n), o = T(this, Y).cache.images.entries.get(i);
|
|
789
|
+
if (As(o))
|
|
790
790
|
return o.result;
|
|
791
|
-
o && T(this,
|
|
792
|
-
const c = T(this,
|
|
791
|
+
o && T(this, Y).cache.images.entries.delete(i);
|
|
792
|
+
const c = T(this, Y).cache.images.pendingRequests.get(i);
|
|
793
793
|
if (c)
|
|
794
794
|
return c;
|
|
795
|
-
const
|
|
796
|
-
T(this,
|
|
795
|
+
const d = Q(this, Et, ir).call(this, i, t, s, n, a);
|
|
796
|
+
T(this, Y).cache.images.pendingRequests.set(i, d);
|
|
797
797
|
try {
|
|
798
|
-
return yield
|
|
798
|
+
return yield d;
|
|
799
799
|
} finally {
|
|
800
|
-
T(this,
|
|
800
|
+
T(this, Y).cache.images.pendingRequests.delete(i);
|
|
801
801
|
}
|
|
802
802
|
});
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
|
-
|
|
806
|
-
return
|
|
807
|
-
const a = yield T(this,
|
|
805
|
+
Y = /* @__PURE__ */ new WeakMap(), Et = /* @__PURE__ */ new WeakSet(), ir = function(r, e, t, s, n) {
|
|
806
|
+
return O(this, null, function* () {
|
|
807
|
+
const a = yield T(this, Y).get(
|
|
808
808
|
`v1/images/${e}?ids=${t}&format=${s}${n ? `&scale=${n}` : ""}`
|
|
809
809
|
);
|
|
810
|
-
return T(this,
|
|
810
|
+
return T(this, Y).cache.images.entries.set(r, {
|
|
811
811
|
result: a,
|
|
812
812
|
ts: Date.now()
|
|
813
813
|
}), a;
|
|
814
814
|
});
|
|
815
815
|
};
|
|
816
|
-
var
|
|
817
|
-
class
|
|
816
|
+
var rt;
|
|
817
|
+
class Cs {
|
|
818
818
|
constructor(e) {
|
|
819
|
-
B(this,
|
|
819
|
+
B(this, rt), this.resourceName = "Nodes", j(this, rt, e);
|
|
820
820
|
}
|
|
821
821
|
get(e) {
|
|
822
|
-
return
|
|
823
|
-
const a =
|
|
822
|
+
return O(this, arguments, function* ({ fileKey: t, nodeIds: s, params: n = {} }) {
|
|
823
|
+
const a = jt(U({}, n), {
|
|
824
824
|
ids: s.join(",")
|
|
825
825
|
}), i = new URLSearchParams(U({
|
|
826
826
|
plugin_data: "857346721138427857"
|
|
827
827
|
}, a)).toString(), o = `v1/files/${t}/nodes?${i}`;
|
|
828
|
-
return yield T(this,
|
|
828
|
+
return yield T(this, rt).get(o);
|
|
829
829
|
});
|
|
830
830
|
}
|
|
831
831
|
}
|
|
832
|
-
|
|
833
|
-
var
|
|
832
|
+
rt = /* @__PURE__ */ new WeakMap();
|
|
833
|
+
var ue;
|
|
834
834
|
class or extends Ts {
|
|
835
835
|
constructor({
|
|
836
836
|
baseAddress: e = "https://api.figma.com/",
|
|
837
837
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
838
838
|
} = {}) {
|
|
839
|
-
super({ fetch: t, baseAddress: e }), B(this,
|
|
839
|
+
super({ fetch: t, baseAddress: e }), B(this, ue, ""), this.cache = {
|
|
840
840
|
images: {
|
|
841
841
|
entries: /* @__PURE__ */ new Map(),
|
|
842
842
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
843
843
|
}
|
|
844
|
-
}, this.files =
|
|
844
|
+
}, this.files = gt(this, new Ss(this)), this.nodes = gt(this, new Cs(this)), this.images = gt(this, new Os(this));
|
|
845
845
|
}
|
|
846
846
|
set token(e) {
|
|
847
847
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
848
848
|
throw new Error("Invalid Figma access token");
|
|
849
|
-
|
|
849
|
+
j(this, ue, e);
|
|
850
850
|
}
|
|
851
851
|
get token() {
|
|
852
|
-
return T(this,
|
|
852
|
+
return T(this, ue);
|
|
853
853
|
}
|
|
854
854
|
get headers() {
|
|
855
855
|
const e = {
|
|
856
856
|
"Content-Type": "application/json"
|
|
857
857
|
};
|
|
858
|
-
return T(this,
|
|
858
|
+
return T(this, ue).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = T(this, ue) : T(this, ue).startsWith("figu_") && (e.Authorization = `Bearer ${T(this, ue)}`), e;
|
|
859
859
|
}
|
|
860
860
|
}
|
|
861
|
-
|
|
862
|
-
const Ns = (
|
|
861
|
+
ue = /* @__PURE__ */ new WeakMap();
|
|
862
|
+
const Ns = (a) => C(void 0, [a], function* ({
|
|
863
863
|
fileKey: r,
|
|
864
864
|
authToken: e,
|
|
865
865
|
figmaRestApi: t = new or(),
|
|
866
|
-
params: s = {}
|
|
866
|
+
params: s = {},
|
|
867
|
+
signal: n
|
|
867
868
|
}) {
|
|
868
869
|
e && (t.token = e);
|
|
869
870
|
try {
|
|
870
|
-
return yield t.
|
|
871
|
+
return yield t.withOptions({
|
|
872
|
+
abortSignal: n
|
|
873
|
+
}).files.get({
|
|
871
874
|
fileKey: r,
|
|
872
875
|
params: s
|
|
873
876
|
});
|
|
874
|
-
} catch (
|
|
875
|
-
throw console.error(
|
|
877
|
+
} catch (i) {
|
|
878
|
+
throw i instanceof Error && i.name === "AbortError" ? i : (console.error(i), rr(i, r));
|
|
876
879
|
}
|
|
877
|
-
}), Xn = (
|
|
880
|
+
}), Xn = (i) => C(void 0, [i], function* ({
|
|
878
881
|
fileKey: r,
|
|
879
882
|
authToken: e,
|
|
880
883
|
nodeIds: t,
|
|
881
884
|
figmaRestApi: s = new or(),
|
|
882
|
-
params: n = {}
|
|
885
|
+
params: n = {},
|
|
886
|
+
signal: a
|
|
883
887
|
}) {
|
|
884
888
|
e && (s.token = e);
|
|
885
889
|
try {
|
|
886
|
-
return (yield s.
|
|
890
|
+
return (yield s.withOptions({
|
|
891
|
+
abortSignal: a
|
|
892
|
+
}).nodes.get({
|
|
887
893
|
fileKey: r,
|
|
888
894
|
nodeIds: t,
|
|
889
|
-
params:
|
|
895
|
+
params: u({}, n)
|
|
890
896
|
})).nodes;
|
|
891
|
-
} catch (
|
|
892
|
-
throw rr(
|
|
897
|
+
} catch (o) {
|
|
898
|
+
throw o instanceof Error && o.name === "AbortError" ? o : rr(o, r);
|
|
893
899
|
}
|
|
894
900
|
}), cr = (r, e) => {
|
|
895
901
|
if (r.id === e)
|
|
@@ -902,7 +908,7 @@ const Ns = (n) => C(void 0, [n], function* ({
|
|
|
902
908
|
}
|
|
903
909
|
return null;
|
|
904
910
|
};
|
|
905
|
-
var
|
|
911
|
+
var x;
|
|
906
912
|
(function(r) {
|
|
907
913
|
r.assertEqual = (n) => n;
|
|
908
914
|
function e(n) {
|
|
@@ -937,12 +943,12 @@ var k;
|
|
|
937
943
|
return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
938
944
|
}
|
|
939
945
|
r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
|
|
940
|
-
})(
|
|
946
|
+
})(x || (x = {}));
|
|
941
947
|
var At;
|
|
942
948
|
(function(r) {
|
|
943
|
-
r.mergeShapes = (e, t) =>
|
|
949
|
+
r.mergeShapes = (e, t) => u(u({}, e), t);
|
|
944
950
|
})(At || (At = {}));
|
|
945
|
-
const p =
|
|
951
|
+
const p = x.arrayToEnum([
|
|
946
952
|
"string",
|
|
947
953
|
"nan",
|
|
948
954
|
"number",
|
|
@@ -963,7 +969,7 @@ const p = k.arrayToEnum([
|
|
|
963
969
|
"never",
|
|
964
970
|
"map",
|
|
965
971
|
"set"
|
|
966
|
-
]),
|
|
972
|
+
]), ie = (r) => {
|
|
967
973
|
switch (typeof r) {
|
|
968
974
|
case "undefined":
|
|
969
975
|
return p.undefined;
|
|
@@ -984,7 +990,7 @@ const p = k.arrayToEnum([
|
|
|
984
990
|
default:
|
|
985
991
|
return p.unknown;
|
|
986
992
|
}
|
|
987
|
-
}, l =
|
|
993
|
+
}, l = x.arrayToEnum([
|
|
988
994
|
"invalid_type",
|
|
989
995
|
"invalid_literal",
|
|
990
996
|
"custom",
|
|
@@ -1031,8 +1037,8 @@ class z extends Error {
|
|
|
1031
1037
|
else {
|
|
1032
1038
|
let o = s, c = 0;
|
|
1033
1039
|
for (; c < i.path.length; ) {
|
|
1034
|
-
const
|
|
1035
|
-
c === i.path.length - 1 ? (o[
|
|
1040
|
+
const d = i.path[c];
|
|
1041
|
+
c === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(t(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], c++;
|
|
1036
1042
|
}
|
|
1037
1043
|
}
|
|
1038
1044
|
};
|
|
@@ -1046,7 +1052,7 @@ class z extends Error {
|
|
|
1046
1052
|
return this.message;
|
|
1047
1053
|
}
|
|
1048
1054
|
get message() {
|
|
1049
|
-
return JSON.stringify(this.issues,
|
|
1055
|
+
return JSON.stringify(this.issues, x.jsonStringifyReplacer, 2);
|
|
1050
1056
|
}
|
|
1051
1057
|
get isEmpty() {
|
|
1052
1058
|
return this.issues.length === 0;
|
|
@@ -1069,19 +1075,19 @@ const Ae = (r, e) => {
|
|
|
1069
1075
|
r.received === p.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
1070
1076
|
break;
|
|
1071
1077
|
case l.invalid_literal:
|
|
1072
|
-
t = `Invalid literal value, expected ${JSON.stringify(r.expected,
|
|
1078
|
+
t = `Invalid literal value, expected ${JSON.stringify(r.expected, x.jsonStringifyReplacer)}`;
|
|
1073
1079
|
break;
|
|
1074
1080
|
case l.unrecognized_keys:
|
|
1075
|
-
t = `Unrecognized key(s) in object: ${
|
|
1081
|
+
t = `Unrecognized key(s) in object: ${x.joinValues(r.keys, ", ")}`;
|
|
1076
1082
|
break;
|
|
1077
1083
|
case l.invalid_union:
|
|
1078
1084
|
t = "Invalid input";
|
|
1079
1085
|
break;
|
|
1080
1086
|
case l.invalid_union_discriminator:
|
|
1081
|
-
t = `Invalid discriminator value. Expected ${
|
|
1087
|
+
t = `Invalid discriminator value. Expected ${x.joinValues(r.options)}`;
|
|
1082
1088
|
break;
|
|
1083
1089
|
case l.invalid_enum_value:
|
|
1084
|
-
t = `Invalid enum value. Expected ${
|
|
1090
|
+
t = `Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;
|
|
1085
1091
|
break;
|
|
1086
1092
|
case l.invalid_arguments:
|
|
1087
1093
|
t = "Invalid function arguments";
|
|
@@ -1093,7 +1099,7 @@ const Ae = (r, e) => {
|
|
|
1093
1099
|
t = "Invalid date";
|
|
1094
1100
|
break;
|
|
1095
1101
|
case l.invalid_string:
|
|
1096
|
-
typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` :
|
|
1102
|
+
typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : x.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
|
|
1097
1103
|
break;
|
|
1098
1104
|
case l.too_small:
|
|
1099
1105
|
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
|
|
@@ -1114,7 +1120,7 @@ const Ae = (r, e) => {
|
|
|
1114
1120
|
t = "Number must be finite";
|
|
1115
1121
|
break;
|
|
1116
1122
|
default:
|
|
1117
|
-
t = e.defaultError,
|
|
1123
|
+
t = e.defaultError, x.assertNever(r);
|
|
1118
1124
|
}
|
|
1119
1125
|
return { message: t };
|
|
1120
1126
|
};
|
|
@@ -1122,29 +1128,29 @@ let dr = Ae;
|
|
|
1122
1128
|
function js(r) {
|
|
1123
1129
|
dr = r;
|
|
1124
1130
|
}
|
|
1125
|
-
function
|
|
1131
|
+
function st() {
|
|
1126
1132
|
return dr;
|
|
1127
1133
|
}
|
|
1128
|
-
const
|
|
1129
|
-
const { data: e, path: t, errorMaps: s, issueData: n } = r, a = [...t, ...n.path || []], i = g(
|
|
1134
|
+
const nt = (r) => {
|
|
1135
|
+
const { data: e, path: t, errorMaps: s, issueData: n } = r, a = [...t, ...n.path || []], i = g(u({}, n), {
|
|
1130
1136
|
path: a
|
|
1131
1137
|
});
|
|
1132
1138
|
if (n.message !== void 0)
|
|
1133
|
-
return g(
|
|
1139
|
+
return g(u({}, n), {
|
|
1134
1140
|
path: a,
|
|
1135
1141
|
message: n.message
|
|
1136
1142
|
});
|
|
1137
1143
|
let o = "";
|
|
1138
|
-
const c = s.filter((
|
|
1139
|
-
for (const
|
|
1140
|
-
o =
|
|
1141
|
-
return g(
|
|
1144
|
+
const c = s.filter((d) => !!d).slice().reverse();
|
|
1145
|
+
for (const d of c)
|
|
1146
|
+
o = d(i, { data: e, defaultError: o }).message;
|
|
1147
|
+
return g(u({}, n), {
|
|
1142
1148
|
path: a,
|
|
1143
1149
|
message: o
|
|
1144
1150
|
});
|
|
1145
1151
|
}, Rs = [];
|
|
1146
1152
|
function h(r, e) {
|
|
1147
|
-
const t =
|
|
1153
|
+
const t = st(), s = nt({
|
|
1148
1154
|
issueData: e,
|
|
1149
1155
|
data: r.data,
|
|
1150
1156
|
path: r.path,
|
|
@@ -1161,7 +1167,7 @@ function h(r, e) {
|
|
|
1161
1167
|
});
|
|
1162
1168
|
r.common.issues.push(s);
|
|
1163
1169
|
}
|
|
1164
|
-
class
|
|
1170
|
+
class R {
|
|
1165
1171
|
constructor() {
|
|
1166
1172
|
this.value = "valid";
|
|
1167
1173
|
}
|
|
@@ -1190,7 +1196,7 @@ class j {
|
|
|
1190
1196
|
value: i
|
|
1191
1197
|
});
|
|
1192
1198
|
}
|
|
1193
|
-
return
|
|
1199
|
+
return R.mergeObjectSync(e, s);
|
|
1194
1200
|
});
|
|
1195
1201
|
}
|
|
1196
1202
|
static mergeObjectSync(e, t) {
|
|
@@ -1206,8 +1212,8 @@ class j {
|
|
|
1206
1212
|
}
|
|
1207
1213
|
const _ = Object.freeze({
|
|
1208
1214
|
status: "aborted"
|
|
1209
|
-
}),
|
|
1210
|
-
function
|
|
1215
|
+
}), Te = (r) => ({ status: "dirty", value: r }), $ = (r) => ({ status: "valid", value: r }), Ot = (r) => r.status === "aborted", Ct = (r) => r.status === "dirty", _e = (r) => r.status === "valid", $e = (r) => typeof Promise != "undefined" && r instanceof Promise;
|
|
1216
|
+
function at(r, e, t, s) {
|
|
1211
1217
|
if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1212
1218
|
return e.get(r);
|
|
1213
1219
|
}
|
|
@@ -1219,8 +1225,8 @@ var m;
|
|
|
1219
1225
|
(function(r) {
|
|
1220
1226
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
1221
1227
|
})(m || (m = {}));
|
|
1222
|
-
var
|
|
1223
|
-
class
|
|
1228
|
+
var Me, Pe;
|
|
1229
|
+
class te {
|
|
1224
1230
|
constructor(e, t, s, n) {
|
|
1225
1231
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
|
|
1226
1232
|
}
|
|
@@ -1229,7 +1235,7 @@ class Q {
|
|
|
1229
1235
|
}
|
|
1230
1236
|
}
|
|
1231
1237
|
const Ht = (r, e) => {
|
|
1232
|
-
if (
|
|
1238
|
+
if (_e(e))
|
|
1233
1239
|
return { success: !0, data: e.value };
|
|
1234
1240
|
if (!r.common.issues.length)
|
|
1235
1241
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -1243,30 +1249,30 @@ const Ht = (r, e) => {
|
|
|
1243
1249
|
}
|
|
1244
1250
|
};
|
|
1245
1251
|
};
|
|
1246
|
-
function
|
|
1252
|
+
function b(r) {
|
|
1247
1253
|
if (!r)
|
|
1248
1254
|
return {};
|
|
1249
1255
|
const { errorMap: e, invalid_type_error: t, required_error: s, description: n } = r;
|
|
1250
1256
|
if (e && (t || s))
|
|
1251
1257
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
1252
1258
|
return e ? { errorMap: e, description: n } : { errorMap: (i, o) => {
|
|
1253
|
-
var c,
|
|
1259
|
+
var c, d;
|
|
1254
1260
|
const { message: f } = r;
|
|
1255
|
-
return i.code === "invalid_enum_value" ? { message: f != null ? f : o.defaultError } : typeof o.data == "undefined" ? { message: (c = f != null ? f : s) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (
|
|
1261
|
+
return i.code === "invalid_enum_value" ? { message: f != null ? f : o.defaultError } : typeof o.data == "undefined" ? { message: (c = f != null ? f : s) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (d = f != null ? f : t) !== null && d !== void 0 ? d : o.defaultError };
|
|
1256
1262
|
}, description: n };
|
|
1257
1263
|
}
|
|
1258
|
-
class
|
|
1264
|
+
class w {
|
|
1259
1265
|
get description() {
|
|
1260
1266
|
return this._def.description;
|
|
1261
1267
|
}
|
|
1262
1268
|
_getType(e) {
|
|
1263
|
-
return
|
|
1269
|
+
return ie(e.data);
|
|
1264
1270
|
}
|
|
1265
1271
|
_getOrReturnCtx(e, t) {
|
|
1266
1272
|
return t || {
|
|
1267
1273
|
common: e.parent.common,
|
|
1268
1274
|
data: e.data,
|
|
1269
|
-
parsedType:
|
|
1275
|
+
parsedType: ie(e.data),
|
|
1270
1276
|
schemaErrorMap: this._def.errorMap,
|
|
1271
1277
|
path: e.path,
|
|
1272
1278
|
parent: e.parent
|
|
@@ -1274,11 +1280,11 @@ class x {
|
|
|
1274
1280
|
}
|
|
1275
1281
|
_processInputParams(e) {
|
|
1276
1282
|
return {
|
|
1277
|
-
status: new
|
|
1283
|
+
status: new R(),
|
|
1278
1284
|
ctx: {
|
|
1279
1285
|
common: e.parent.common,
|
|
1280
1286
|
data: e.data,
|
|
1281
|
-
parsedType:
|
|
1287
|
+
parsedType: ie(e.data),
|
|
1282
1288
|
schemaErrorMap: this._def.errorMap,
|
|
1283
1289
|
path: e.path,
|
|
1284
1290
|
parent: e.parent
|
|
@@ -1287,7 +1293,7 @@ class x {
|
|
|
1287
1293
|
}
|
|
1288
1294
|
_parseSync(e) {
|
|
1289
1295
|
const t = this._parse(e);
|
|
1290
|
-
if (
|
|
1296
|
+
if ($e(t))
|
|
1291
1297
|
throw new Error("Synchronous parse encountered promise.");
|
|
1292
1298
|
return t;
|
|
1293
1299
|
}
|
|
@@ -1313,7 +1319,7 @@ class x {
|
|
|
1313
1319
|
schemaErrorMap: this._def.errorMap,
|
|
1314
1320
|
parent: null,
|
|
1315
1321
|
data: e,
|
|
1316
|
-
parsedType:
|
|
1322
|
+
parsedType: ie(e)
|
|
1317
1323
|
}, a = this._parseSync({ data: e, path: n.path, parent: n });
|
|
1318
1324
|
return Ht(n, a);
|
|
1319
1325
|
}
|
|
@@ -1328,12 +1334,12 @@ class x {
|
|
|
1328
1334
|
schemaErrorMap: this._def.errorMap,
|
|
1329
1335
|
parent: null,
|
|
1330
1336
|
data: e,
|
|
1331
|
-
parsedType:
|
|
1337
|
+
parsedType: ie(e)
|
|
1332
1338
|
};
|
|
1333
1339
|
if (!this["~standard"].async)
|
|
1334
1340
|
try {
|
|
1335
1341
|
const a = this._parseSync({ data: e, path: [], parent: n });
|
|
1336
|
-
return
|
|
1342
|
+
return _e(a) ? {
|
|
1337
1343
|
value: a.value
|
|
1338
1344
|
} : {
|
|
1339
1345
|
issues: n.common.issues
|
|
@@ -1344,7 +1350,7 @@ class x {
|
|
|
1344
1350
|
async: !0
|
|
1345
1351
|
};
|
|
1346
1352
|
}
|
|
1347
|
-
return this._parseAsync({ data: e, path: [], parent: n }).then((a) =>
|
|
1353
|
+
return this._parseAsync({ data: e, path: [], parent: n }).then((a) => _e(a) ? {
|
|
1348
1354
|
value: a.value
|
|
1349
1355
|
} : {
|
|
1350
1356
|
issues: n.common.issues
|
|
@@ -1370,15 +1376,15 @@ class x {
|
|
|
1370
1376
|
schemaErrorMap: this._def.errorMap,
|
|
1371
1377
|
parent: null,
|
|
1372
1378
|
data: e,
|
|
1373
|
-
parsedType:
|
|
1374
|
-
}, n = this._parse({ data: e, path: s.path, parent: s }), a = yield
|
|
1379
|
+
parsedType: ie(e)
|
|
1380
|
+
}, n = this._parse({ data: e, path: s.path, parent: s }), a = yield $e(n) ? n : Promise.resolve(n);
|
|
1375
1381
|
return Ht(s, a);
|
|
1376
1382
|
});
|
|
1377
1383
|
}
|
|
1378
1384
|
refine(e, t) {
|
|
1379
1385
|
const s = (n) => typeof t == "string" || typeof t == "undefined" ? { message: t } : typeof t == "function" ? t(n) : t;
|
|
1380
1386
|
return this._refinement((n, a) => {
|
|
1381
|
-
const i = e(n), o = () => a.addIssue(
|
|
1387
|
+
const i = e(n), o = () => a.addIssue(u({
|
|
1382
1388
|
code: l.custom
|
|
1383
1389
|
}, s(n)));
|
|
1384
1390
|
return typeof Promise != "undefined" && i instanceof Promise ? i.then((c) => c ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
@@ -1388,7 +1394,7 @@ class x {
|
|
|
1388
1394
|
return this._refinement((s, n) => e(s) ? !0 : (n.addIssue(typeof t == "function" ? t(s, n) : t), !1));
|
|
1389
1395
|
}
|
|
1390
1396
|
_refinement(e) {
|
|
1391
|
-
return new
|
|
1397
|
+
return new G({
|
|
1392
1398
|
schema: this,
|
|
1393
1399
|
typeName: y.ZodEffects,
|
|
1394
1400
|
effect: { type: "refinement", refinement: e }
|
|
@@ -1405,28 +1411,28 @@ class x {
|
|
|
1405
1411
|
};
|
|
1406
1412
|
}
|
|
1407
1413
|
optional() {
|
|
1408
|
-
return
|
|
1414
|
+
return ee.create(this, this._def);
|
|
1409
1415
|
}
|
|
1410
1416
|
nullable() {
|
|
1411
|
-
return
|
|
1417
|
+
return pe.create(this, this._def);
|
|
1412
1418
|
}
|
|
1413
1419
|
nullish() {
|
|
1414
1420
|
return this.nullable().optional();
|
|
1415
1421
|
}
|
|
1416
1422
|
array() {
|
|
1417
|
-
return
|
|
1423
|
+
return J.create(this);
|
|
1418
1424
|
}
|
|
1419
1425
|
promise() {
|
|
1420
1426
|
return Ce.create(this, this._def);
|
|
1421
1427
|
}
|
|
1422
1428
|
or(e) {
|
|
1423
|
-
return
|
|
1429
|
+
return De.create([this, e], this._def);
|
|
1424
1430
|
}
|
|
1425
1431
|
and(e) {
|
|
1426
|
-
return
|
|
1432
|
+
return Ue.create(this, e, this._def);
|
|
1427
1433
|
}
|
|
1428
1434
|
transform(e) {
|
|
1429
|
-
return new
|
|
1435
|
+
return new G(g(u({}, b(this._def)), {
|
|
1430
1436
|
schema: this,
|
|
1431
1437
|
typeName: y.ZodEffects,
|
|
1432
1438
|
effect: { type: "transform", transform: e }
|
|
@@ -1434,21 +1440,21 @@ class x {
|
|
|
1434
1440
|
}
|
|
1435
1441
|
default(e) {
|
|
1436
1442
|
const t = typeof e == "function" ? e : () => e;
|
|
1437
|
-
return new
|
|
1443
|
+
return new He(g(u({}, b(this._def)), {
|
|
1438
1444
|
innerType: this,
|
|
1439
1445
|
defaultValue: t,
|
|
1440
1446
|
typeName: y.ZodDefault
|
|
1441
1447
|
}));
|
|
1442
1448
|
}
|
|
1443
1449
|
brand() {
|
|
1444
|
-
return new
|
|
1450
|
+
return new Mt(u({
|
|
1445
1451
|
typeName: y.ZodBranded,
|
|
1446
1452
|
type: this
|
|
1447
|
-
},
|
|
1453
|
+
}, b(this._def)));
|
|
1448
1454
|
}
|
|
1449
1455
|
catch(e) {
|
|
1450
1456
|
const t = typeof e == "function" ? e : () => e;
|
|
1451
|
-
return new
|
|
1457
|
+
return new Je(g(u({}, b(this._def)), {
|
|
1452
1458
|
innerType: this,
|
|
1453
1459
|
catchValue: t,
|
|
1454
1460
|
typeName: y.ZodCatch
|
|
@@ -1456,15 +1462,15 @@ class x {
|
|
|
1456
1462
|
}
|
|
1457
1463
|
describe(e) {
|
|
1458
1464
|
const t = this.constructor;
|
|
1459
|
-
return new t(g(
|
|
1465
|
+
return new t(g(u({}, this._def), {
|
|
1460
1466
|
description: e
|
|
1461
1467
|
}));
|
|
1462
1468
|
}
|
|
1463
1469
|
pipe(e) {
|
|
1464
|
-
return
|
|
1470
|
+
return Xe.create(this, e);
|
|
1465
1471
|
}
|
|
1466
1472
|
readonly() {
|
|
1467
|
-
return
|
|
1473
|
+
return Ge.create(this);
|
|
1468
1474
|
}
|
|
1469
1475
|
isOptional() {
|
|
1470
1476
|
return this.safeParse(void 0).success;
|
|
@@ -1474,7 +1480,7 @@ class x {
|
|
|
1474
1480
|
}
|
|
1475
1481
|
}
|
|
1476
1482
|
const Zs = /^c[^\s-]{8,}$/i, Ms = /^[0-9a-z]+$/, Ps = /^[0-9A-HJKMNP-TV-Z]{26}$/i, $s = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Fs = /^[a-z0-9_-]{21}$/i, Ls = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Vs = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ds = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Us = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1477
|
-
let
|
|
1483
|
+
let yt;
|
|
1478
1484
|
const zs = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Ws = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Bs = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, qs = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Hs = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Js = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, lr = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Gs = new RegExp(`^${lr}$`);
|
|
1479
1485
|
function fr(r) {
|
|
1480
1486
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
@@ -1504,7 +1510,7 @@ function Ys(r, e) {
|
|
|
1504
1510
|
function Qs(r, e) {
|
|
1505
1511
|
return !!((e === "v4" || !e) && Ws.test(r) || (e === "v6" || !e) && qs.test(r));
|
|
1506
1512
|
}
|
|
1507
|
-
class
|
|
1513
|
+
class H extends w {
|
|
1508
1514
|
_parse(e) {
|
|
1509
1515
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
|
|
1510
1516
|
const a = this._getOrReturnCtx(e);
|
|
@@ -1514,7 +1520,7 @@ class q extends x {
|
|
|
1514
1520
|
received: a.parsedType
|
|
1515
1521
|
}), _;
|
|
1516
1522
|
}
|
|
1517
|
-
const s = new
|
|
1523
|
+
const s = new R();
|
|
1518
1524
|
let n;
|
|
1519
1525
|
for (const a of this._def.checks)
|
|
1520
1526
|
if (a.kind === "min")
|
|
@@ -1559,7 +1565,7 @@ class q extends x {
|
|
|
1559
1565
|
message: a.message
|
|
1560
1566
|
}), s.dirty());
|
|
1561
1567
|
else if (a.kind === "emoji")
|
|
1562
|
-
|
|
1568
|
+
yt || (yt = new RegExp(Us, "u")), yt.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1563
1569
|
validation: "emoji",
|
|
1564
1570
|
code: l.invalid_string,
|
|
1565
1571
|
message: a.message
|
|
@@ -1656,60 +1662,60 @@ class q extends x {
|
|
|
1656
1662
|
validation: "base64url",
|
|
1657
1663
|
code: l.invalid_string,
|
|
1658
1664
|
message: a.message
|
|
1659
|
-
}), s.dirty()) :
|
|
1665
|
+
}), s.dirty()) : x.assertNever(a);
|
|
1660
1666
|
return { status: s.value, value: e.data };
|
|
1661
1667
|
}
|
|
1662
1668
|
_regex(e, t, s) {
|
|
1663
|
-
return this.refinement((n) => e.test(n),
|
|
1669
|
+
return this.refinement((n) => e.test(n), u({
|
|
1664
1670
|
validation: t,
|
|
1665
1671
|
code: l.invalid_string
|
|
1666
1672
|
}, m.errToObj(s)));
|
|
1667
1673
|
}
|
|
1668
1674
|
_addCheck(e) {
|
|
1669
|
-
return new
|
|
1675
|
+
return new H(g(u({}, this._def), {
|
|
1670
1676
|
checks: [...this._def.checks, e]
|
|
1671
1677
|
}));
|
|
1672
1678
|
}
|
|
1673
1679
|
email(e) {
|
|
1674
|
-
return this._addCheck(
|
|
1680
|
+
return this._addCheck(u({ kind: "email" }, m.errToObj(e)));
|
|
1675
1681
|
}
|
|
1676
1682
|
url(e) {
|
|
1677
|
-
return this._addCheck(
|
|
1683
|
+
return this._addCheck(u({ kind: "url" }, m.errToObj(e)));
|
|
1678
1684
|
}
|
|
1679
1685
|
emoji(e) {
|
|
1680
|
-
return this._addCheck(
|
|
1686
|
+
return this._addCheck(u({ kind: "emoji" }, m.errToObj(e)));
|
|
1681
1687
|
}
|
|
1682
1688
|
uuid(e) {
|
|
1683
|
-
return this._addCheck(
|
|
1689
|
+
return this._addCheck(u({ kind: "uuid" }, m.errToObj(e)));
|
|
1684
1690
|
}
|
|
1685
1691
|
nanoid(e) {
|
|
1686
|
-
return this._addCheck(
|
|
1692
|
+
return this._addCheck(u({ kind: "nanoid" }, m.errToObj(e)));
|
|
1687
1693
|
}
|
|
1688
1694
|
cuid(e) {
|
|
1689
|
-
return this._addCheck(
|
|
1695
|
+
return this._addCheck(u({ kind: "cuid" }, m.errToObj(e)));
|
|
1690
1696
|
}
|
|
1691
1697
|
cuid2(e) {
|
|
1692
|
-
return this._addCheck(
|
|
1698
|
+
return this._addCheck(u({ kind: "cuid2" }, m.errToObj(e)));
|
|
1693
1699
|
}
|
|
1694
1700
|
ulid(e) {
|
|
1695
|
-
return this._addCheck(
|
|
1701
|
+
return this._addCheck(u({ kind: "ulid" }, m.errToObj(e)));
|
|
1696
1702
|
}
|
|
1697
1703
|
base64(e) {
|
|
1698
|
-
return this._addCheck(
|
|
1704
|
+
return this._addCheck(u({ kind: "base64" }, m.errToObj(e)));
|
|
1699
1705
|
}
|
|
1700
1706
|
base64url(e) {
|
|
1701
|
-
return this._addCheck(
|
|
1707
|
+
return this._addCheck(u({
|
|
1702
1708
|
kind: "base64url"
|
|
1703
1709
|
}, m.errToObj(e)));
|
|
1704
1710
|
}
|
|
1705
1711
|
jwt(e) {
|
|
1706
|
-
return this._addCheck(
|
|
1712
|
+
return this._addCheck(u({ kind: "jwt" }, m.errToObj(e)));
|
|
1707
1713
|
}
|
|
1708
1714
|
ip(e) {
|
|
1709
|
-
return this._addCheck(
|
|
1715
|
+
return this._addCheck(u({ kind: "ip" }, m.errToObj(e)));
|
|
1710
1716
|
}
|
|
1711
1717
|
cidr(e) {
|
|
1712
|
-
return this._addCheck(
|
|
1718
|
+
return this._addCheck(u({ kind: "cidr" }, m.errToObj(e)));
|
|
1713
1719
|
}
|
|
1714
1720
|
datetime(e) {
|
|
1715
1721
|
var t, s;
|
|
@@ -1719,7 +1725,7 @@ class q extends x {
|
|
|
1719
1725
|
offset: !1,
|
|
1720
1726
|
local: !1,
|
|
1721
1727
|
message: e
|
|
1722
|
-
}) : this._addCheck(
|
|
1728
|
+
}) : this._addCheck(u({
|
|
1723
1729
|
kind: "datetime",
|
|
1724
1730
|
precision: typeof (e == null ? void 0 : e.precision) == "undefined" ? null : e == null ? void 0 : e.precision,
|
|
1725
1731
|
offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
|
|
@@ -1734,53 +1740,53 @@ class q extends x {
|
|
|
1734
1740
|
kind: "time",
|
|
1735
1741
|
precision: null,
|
|
1736
1742
|
message: e
|
|
1737
|
-
}) : this._addCheck(
|
|
1743
|
+
}) : this._addCheck(u({
|
|
1738
1744
|
kind: "time",
|
|
1739
1745
|
precision: typeof (e == null ? void 0 : e.precision) == "undefined" ? null : e == null ? void 0 : e.precision
|
|
1740
1746
|
}, m.errToObj(e == null ? void 0 : e.message)));
|
|
1741
1747
|
}
|
|
1742
1748
|
duration(e) {
|
|
1743
|
-
return this._addCheck(
|
|
1749
|
+
return this._addCheck(u({ kind: "duration" }, m.errToObj(e)));
|
|
1744
1750
|
}
|
|
1745
1751
|
regex(e, t) {
|
|
1746
|
-
return this._addCheck(
|
|
1752
|
+
return this._addCheck(u({
|
|
1747
1753
|
kind: "regex",
|
|
1748
1754
|
regex: e
|
|
1749
1755
|
}, m.errToObj(t)));
|
|
1750
1756
|
}
|
|
1751
1757
|
includes(e, t) {
|
|
1752
|
-
return this._addCheck(
|
|
1758
|
+
return this._addCheck(u({
|
|
1753
1759
|
kind: "includes",
|
|
1754
1760
|
value: e,
|
|
1755
1761
|
position: t == null ? void 0 : t.position
|
|
1756
1762
|
}, m.errToObj(t == null ? void 0 : t.message)));
|
|
1757
1763
|
}
|
|
1758
1764
|
startsWith(e, t) {
|
|
1759
|
-
return this._addCheck(
|
|
1765
|
+
return this._addCheck(u({
|
|
1760
1766
|
kind: "startsWith",
|
|
1761
1767
|
value: e
|
|
1762
1768
|
}, m.errToObj(t)));
|
|
1763
1769
|
}
|
|
1764
1770
|
endsWith(e, t) {
|
|
1765
|
-
return this._addCheck(
|
|
1771
|
+
return this._addCheck(u({
|
|
1766
1772
|
kind: "endsWith",
|
|
1767
1773
|
value: e
|
|
1768
1774
|
}, m.errToObj(t)));
|
|
1769
1775
|
}
|
|
1770
1776
|
min(e, t) {
|
|
1771
|
-
return this._addCheck(
|
|
1777
|
+
return this._addCheck(u({
|
|
1772
1778
|
kind: "min",
|
|
1773
1779
|
value: e
|
|
1774
1780
|
}, m.errToObj(t)));
|
|
1775
1781
|
}
|
|
1776
1782
|
max(e, t) {
|
|
1777
|
-
return this._addCheck(
|
|
1783
|
+
return this._addCheck(u({
|
|
1778
1784
|
kind: "max",
|
|
1779
1785
|
value: e
|
|
1780
1786
|
}, m.errToObj(t)));
|
|
1781
1787
|
}
|
|
1782
1788
|
length(e, t) {
|
|
1783
|
-
return this._addCheck(
|
|
1789
|
+
return this._addCheck(u({
|
|
1784
1790
|
kind: "length",
|
|
1785
1791
|
value: e
|
|
1786
1792
|
}, m.errToObj(t)));
|
|
@@ -1792,17 +1798,17 @@ class q extends x {
|
|
|
1792
1798
|
return this.min(1, m.errToObj(e));
|
|
1793
1799
|
}
|
|
1794
1800
|
trim() {
|
|
1795
|
-
return new
|
|
1801
|
+
return new H(g(u({}, this._def), {
|
|
1796
1802
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1797
1803
|
}));
|
|
1798
1804
|
}
|
|
1799
1805
|
toLowerCase() {
|
|
1800
|
-
return new
|
|
1806
|
+
return new H(g(u({}, this._def), {
|
|
1801
1807
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1802
1808
|
}));
|
|
1803
1809
|
}
|
|
1804
1810
|
toUpperCase() {
|
|
1805
|
-
return new
|
|
1811
|
+
return new H(g(u({}, this._def), {
|
|
1806
1812
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1807
1813
|
}));
|
|
1808
1814
|
}
|
|
@@ -1867,19 +1873,19 @@ class q extends x {
|
|
|
1867
1873
|
return e;
|
|
1868
1874
|
}
|
|
1869
1875
|
}
|
|
1870
|
-
|
|
1876
|
+
H.create = (r) => {
|
|
1871
1877
|
var e;
|
|
1872
|
-
return new
|
|
1878
|
+
return new H(u({
|
|
1873
1879
|
checks: [],
|
|
1874
1880
|
typeName: y.ZodString,
|
|
1875
1881
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1
|
|
1876
|
-
},
|
|
1882
|
+
}, b(r)));
|
|
1877
1883
|
};
|
|
1878
1884
|
function en(r, e) {
|
|
1879
1885
|
const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, a = parseInt(r.toFixed(n).replace(".", "")), i = parseInt(e.toFixed(n).replace(".", ""));
|
|
1880
1886
|
return a % i / Math.pow(10, n);
|
|
1881
1887
|
}
|
|
1882
|
-
class
|
|
1888
|
+
class le extends w {
|
|
1883
1889
|
constructor() {
|
|
1884
1890
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1885
1891
|
}
|
|
@@ -1893,9 +1899,9 @@ class de extends x {
|
|
|
1893
1899
|
}), _;
|
|
1894
1900
|
}
|
|
1895
1901
|
let s;
|
|
1896
|
-
const n = new
|
|
1902
|
+
const n = new R();
|
|
1897
1903
|
for (const a of this._def.checks)
|
|
1898
|
-
a.kind === "int" ?
|
|
1904
|
+
a.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1899
1905
|
code: l.invalid_type,
|
|
1900
1906
|
expected: "integer",
|
|
1901
1907
|
received: "float",
|
|
@@ -1921,7 +1927,7 @@ class de extends x {
|
|
|
1921
1927
|
}), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1922
1928
|
code: l.not_finite,
|
|
1923
1929
|
message: a.message
|
|
1924
|
-
}), n.dirty()) :
|
|
1930
|
+
}), n.dirty()) : x.assertNever(a);
|
|
1925
1931
|
return { status: n.value, value: e.data };
|
|
1926
1932
|
}
|
|
1927
1933
|
gte(e, t) {
|
|
@@ -1937,7 +1943,7 @@ class de extends x {
|
|
|
1937
1943
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
1938
1944
|
}
|
|
1939
1945
|
setLimit(e, t, s, n) {
|
|
1940
|
-
return new
|
|
1946
|
+
return new le(g(u({}, this._def), {
|
|
1941
1947
|
checks: [
|
|
1942
1948
|
...this._def.checks,
|
|
1943
1949
|
{
|
|
@@ -1950,7 +1956,7 @@ class de extends x {
|
|
|
1950
1956
|
}));
|
|
1951
1957
|
}
|
|
1952
1958
|
_addCheck(e) {
|
|
1953
|
-
return new
|
|
1959
|
+
return new le(g(u({}, this._def), {
|
|
1954
1960
|
checks: [...this._def.checks, e]
|
|
1955
1961
|
}));
|
|
1956
1962
|
}
|
|
@@ -2031,7 +2037,7 @@ class de extends x {
|
|
|
2031
2037
|
return e;
|
|
2032
2038
|
}
|
|
2033
2039
|
get isInt() {
|
|
2034
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
2040
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && x.isInteger(e.value));
|
|
2035
2041
|
}
|
|
2036
2042
|
get isFinite() {
|
|
2037
2043
|
let e = null, t = null;
|
|
@@ -2043,12 +2049,12 @@ class de extends x {
|
|
|
2043
2049
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
2044
2050
|
}
|
|
2045
2051
|
}
|
|
2046
|
-
|
|
2052
|
+
le.create = (r) => new le(u({
|
|
2047
2053
|
checks: [],
|
|
2048
2054
|
typeName: y.ZodNumber,
|
|
2049
2055
|
coerce: (r == null ? void 0 : r.coerce) || !1
|
|
2050
|
-
},
|
|
2051
|
-
class
|
|
2056
|
+
}, b(r)));
|
|
2057
|
+
class fe extends w {
|
|
2052
2058
|
constructor() {
|
|
2053
2059
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
2054
2060
|
}
|
|
@@ -2062,7 +2068,7 @@ class ue extends x {
|
|
|
2062
2068
|
if (this._getType(e) !== p.bigint)
|
|
2063
2069
|
return this._getInvalidInput(e);
|
|
2064
2070
|
let s;
|
|
2065
|
-
const n = new
|
|
2071
|
+
const n = new R();
|
|
2066
2072
|
for (const a of this._def.checks)
|
|
2067
2073
|
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
2068
2074
|
code: l.too_small,
|
|
@@ -2080,7 +2086,7 @@ class ue extends x {
|
|
|
2080
2086
|
code: l.not_multiple_of,
|
|
2081
2087
|
multipleOf: a.value,
|
|
2082
2088
|
message: a.message
|
|
2083
|
-
}), n.dirty()) :
|
|
2089
|
+
}), n.dirty()) : x.assertNever(a);
|
|
2084
2090
|
return { status: n.value, value: e.data };
|
|
2085
2091
|
}
|
|
2086
2092
|
_getInvalidInput(e) {
|
|
@@ -2104,7 +2110,7 @@ class ue extends x {
|
|
|
2104
2110
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
2105
2111
|
}
|
|
2106
2112
|
setLimit(e, t, s, n) {
|
|
2107
|
-
return new
|
|
2113
|
+
return new fe(g(u({}, this._def), {
|
|
2108
2114
|
checks: [
|
|
2109
2115
|
...this._def.checks,
|
|
2110
2116
|
{
|
|
@@ -2117,7 +2123,7 @@ class ue extends x {
|
|
|
2117
2123
|
}));
|
|
2118
2124
|
}
|
|
2119
2125
|
_addCheck(e) {
|
|
2120
|
-
return new
|
|
2126
|
+
return new fe(g(u({}, this._def), {
|
|
2121
2127
|
checks: [...this._def.checks, e]
|
|
2122
2128
|
}));
|
|
2123
2129
|
}
|
|
@@ -2173,15 +2179,15 @@ class ue extends x {
|
|
|
2173
2179
|
return e;
|
|
2174
2180
|
}
|
|
2175
2181
|
}
|
|
2176
|
-
|
|
2182
|
+
fe.create = (r) => {
|
|
2177
2183
|
var e;
|
|
2178
|
-
return new
|
|
2184
|
+
return new fe(u({
|
|
2179
2185
|
checks: [],
|
|
2180
2186
|
typeName: y.ZodBigInt,
|
|
2181
2187
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1
|
|
2182
|
-
},
|
|
2188
|
+
}, b(r)));
|
|
2183
2189
|
};
|
|
2184
|
-
class
|
|
2190
|
+
class Fe extends w {
|
|
2185
2191
|
_parse(e) {
|
|
2186
2192
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
|
|
2187
2193
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2191,14 +2197,14 @@ class $e extends x {
|
|
|
2191
2197
|
received: s.parsedType
|
|
2192
2198
|
}), _;
|
|
2193
2199
|
}
|
|
2194
|
-
return
|
|
2200
|
+
return $(e.data);
|
|
2195
2201
|
}
|
|
2196
2202
|
}
|
|
2197
|
-
|
|
2203
|
+
Fe.create = (r) => new Fe(u({
|
|
2198
2204
|
typeName: y.ZodBoolean,
|
|
2199
2205
|
coerce: (r == null ? void 0 : r.coerce) || !1
|
|
2200
|
-
},
|
|
2201
|
-
class
|
|
2206
|
+
}, b(r)));
|
|
2207
|
+
class be extends w {
|
|
2202
2208
|
_parse(e) {
|
|
2203
2209
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
2204
2210
|
const a = this._getOrReturnCtx(e);
|
|
@@ -2214,7 +2220,7 @@ class ve extends x {
|
|
|
2214
2220
|
code: l.invalid_date
|
|
2215
2221
|
}), _;
|
|
2216
2222
|
}
|
|
2217
|
-
const s = new
|
|
2223
|
+
const s = new R();
|
|
2218
2224
|
let n;
|
|
2219
2225
|
for (const a of this._def.checks)
|
|
2220
2226
|
a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
@@ -2231,14 +2237,14 @@ class ve extends x {
|
|
|
2231
2237
|
exact: !1,
|
|
2232
2238
|
maximum: a.value,
|
|
2233
2239
|
type: "date"
|
|
2234
|
-
}), s.dirty()) :
|
|
2240
|
+
}), s.dirty()) : x.assertNever(a);
|
|
2235
2241
|
return {
|
|
2236
2242
|
status: s.value,
|
|
2237
2243
|
value: new Date(e.data.getTime())
|
|
2238
2244
|
};
|
|
2239
2245
|
}
|
|
2240
2246
|
_addCheck(e) {
|
|
2241
|
-
return new
|
|
2247
|
+
return new be(g(u({}, this._def), {
|
|
2242
2248
|
checks: [...this._def.checks, e]
|
|
2243
2249
|
}));
|
|
2244
2250
|
}
|
|
@@ -2269,12 +2275,12 @@ class ve extends x {
|
|
|
2269
2275
|
return e != null ? new Date(e) : null;
|
|
2270
2276
|
}
|
|
2271
2277
|
}
|
|
2272
|
-
|
|
2278
|
+
be.create = (r) => new be(u({
|
|
2273
2279
|
checks: [],
|
|
2274
2280
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
2275
2281
|
typeName: y.ZodDate
|
|
2276
|
-
},
|
|
2277
|
-
class
|
|
2282
|
+
}, b(r)));
|
|
2283
|
+
class it extends w {
|
|
2278
2284
|
_parse(e) {
|
|
2279
2285
|
if (this._getType(e) !== p.symbol) {
|
|
2280
2286
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2284,13 +2290,13 @@ class at extends x {
|
|
|
2284
2290
|
received: s.parsedType
|
|
2285
2291
|
}), _;
|
|
2286
2292
|
}
|
|
2287
|
-
return
|
|
2293
|
+
return $(e.data);
|
|
2288
2294
|
}
|
|
2289
2295
|
}
|
|
2290
|
-
|
|
2296
|
+
it.create = (r) => new it(u({
|
|
2291
2297
|
typeName: y.ZodSymbol
|
|
2292
|
-
},
|
|
2293
|
-
class
|
|
2298
|
+
}, b(r)));
|
|
2299
|
+
class Le extends w {
|
|
2294
2300
|
_parse(e) {
|
|
2295
2301
|
if (this._getType(e) !== p.undefined) {
|
|
2296
2302
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2300,13 +2306,13 @@ class Fe extends x {
|
|
|
2300
2306
|
received: s.parsedType
|
|
2301
2307
|
}), _;
|
|
2302
2308
|
}
|
|
2303
|
-
return
|
|
2309
|
+
return $(e.data);
|
|
2304
2310
|
}
|
|
2305
2311
|
}
|
|
2306
|
-
|
|
2312
|
+
Le.create = (r) => new Le(u({
|
|
2307
2313
|
typeName: y.ZodUndefined
|
|
2308
|
-
},
|
|
2309
|
-
class
|
|
2314
|
+
}, b(r)));
|
|
2315
|
+
class Ve extends w {
|
|
2310
2316
|
_parse(e) {
|
|
2311
2317
|
if (this._getType(e) !== p.null) {
|
|
2312
2318
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2316,35 +2322,35 @@ class Le extends x {
|
|
|
2316
2322
|
received: s.parsedType
|
|
2317
2323
|
}), _;
|
|
2318
2324
|
}
|
|
2319
|
-
return
|
|
2325
|
+
return $(e.data);
|
|
2320
2326
|
}
|
|
2321
2327
|
}
|
|
2322
|
-
|
|
2328
|
+
Ve.create = (r) => new Ve(u({
|
|
2323
2329
|
typeName: y.ZodNull
|
|
2324
|
-
},
|
|
2325
|
-
class
|
|
2330
|
+
}, b(r)));
|
|
2331
|
+
class Oe extends w {
|
|
2326
2332
|
constructor() {
|
|
2327
2333
|
super(...arguments), this._any = !0;
|
|
2328
2334
|
}
|
|
2329
2335
|
_parse(e) {
|
|
2330
|
-
return
|
|
2336
|
+
return $(e.data);
|
|
2331
2337
|
}
|
|
2332
2338
|
}
|
|
2333
|
-
|
|
2339
|
+
Oe.create = (r) => new Oe(u({
|
|
2334
2340
|
typeName: y.ZodAny
|
|
2335
|
-
},
|
|
2336
|
-
class
|
|
2341
|
+
}, b(r)));
|
|
2342
|
+
class ve extends w {
|
|
2337
2343
|
constructor() {
|
|
2338
2344
|
super(...arguments), this._unknown = !0;
|
|
2339
2345
|
}
|
|
2340
2346
|
_parse(e) {
|
|
2341
|
-
return
|
|
2347
|
+
return $(e.data);
|
|
2342
2348
|
}
|
|
2343
2349
|
}
|
|
2344
|
-
|
|
2350
|
+
ve.create = (r) => new ve(u({
|
|
2345
2351
|
typeName: y.ZodUnknown
|
|
2346
|
-
},
|
|
2347
|
-
class
|
|
2352
|
+
}, b(r)));
|
|
2353
|
+
class oe extends w {
|
|
2348
2354
|
_parse(e) {
|
|
2349
2355
|
const t = this._getOrReturnCtx(e);
|
|
2350
2356
|
return h(t, {
|
|
@@ -2354,10 +2360,10 @@ class ae extends x {
|
|
|
2354
2360
|
}), _;
|
|
2355
2361
|
}
|
|
2356
2362
|
}
|
|
2357
|
-
|
|
2363
|
+
oe.create = (r) => new oe(u({
|
|
2358
2364
|
typeName: y.ZodNever
|
|
2359
|
-
},
|
|
2360
|
-
class
|
|
2365
|
+
}, b(r)));
|
|
2366
|
+
class ot extends w {
|
|
2361
2367
|
_parse(e) {
|
|
2362
2368
|
if (this._getType(e) !== p.undefined) {
|
|
2363
2369
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2367,13 +2373,13 @@ class it extends x {
|
|
|
2367
2373
|
received: s.parsedType
|
|
2368
2374
|
}), _;
|
|
2369
2375
|
}
|
|
2370
|
-
return
|
|
2376
|
+
return $(e.data);
|
|
2371
2377
|
}
|
|
2372
2378
|
}
|
|
2373
|
-
|
|
2379
|
+
ot.create = (r) => new ot(u({
|
|
2374
2380
|
typeName: y.ZodVoid
|
|
2375
|
-
},
|
|
2376
|
-
class
|
|
2381
|
+
}, b(r)));
|
|
2382
|
+
class J extends w {
|
|
2377
2383
|
_parse(e) {
|
|
2378
2384
|
const { ctx: t, status: s } = this._processInputParams(e), n = this._def;
|
|
2379
2385
|
if (t.parsedType !== p.array)
|
|
@@ -2409,25 +2415,25 @@ class H extends x {
|
|
|
2409
2415
|
exact: !1,
|
|
2410
2416
|
message: n.maxLength.message
|
|
2411
2417
|
}), s.dirty()), t.common.async)
|
|
2412
|
-
return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new
|
|
2413
|
-
const a = [...t.data].map((i, o) => n.type._parseSync(new
|
|
2414
|
-
return
|
|
2418
|
+
return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new te(t, i, t.path, o)))).then((i) => R.mergeArray(s, i));
|
|
2419
|
+
const a = [...t.data].map((i, o) => n.type._parseSync(new te(t, i, t.path, o)));
|
|
2420
|
+
return R.mergeArray(s, a);
|
|
2415
2421
|
}
|
|
2416
2422
|
get element() {
|
|
2417
2423
|
return this._def.type;
|
|
2418
2424
|
}
|
|
2419
2425
|
min(e, t) {
|
|
2420
|
-
return new
|
|
2426
|
+
return new J(g(u({}, this._def), {
|
|
2421
2427
|
minLength: { value: e, message: m.toString(t) }
|
|
2422
2428
|
}));
|
|
2423
2429
|
}
|
|
2424
2430
|
max(e, t) {
|
|
2425
|
-
return new
|
|
2431
|
+
return new J(g(u({}, this._def), {
|
|
2426
2432
|
maxLength: { value: e, message: m.toString(t) }
|
|
2427
2433
|
}));
|
|
2428
2434
|
}
|
|
2429
2435
|
length(e, t) {
|
|
2430
|
-
return new
|
|
2436
|
+
return new J(g(u({}, this._def), {
|
|
2431
2437
|
exactLength: { value: e, message: m.toString(t) }
|
|
2432
2438
|
}));
|
|
2433
2439
|
}
|
|
@@ -2435,81 +2441,81 @@ class H extends x {
|
|
|
2435
2441
|
return this.min(1, e);
|
|
2436
2442
|
}
|
|
2437
2443
|
}
|
|
2438
|
-
|
|
2444
|
+
J.create = (r, e) => new J(u({
|
|
2439
2445
|
type: r,
|
|
2440
2446
|
minLength: null,
|
|
2441
2447
|
maxLength: null,
|
|
2442
2448
|
exactLength: null,
|
|
2443
2449
|
typeName: y.ZodArray
|
|
2444
|
-
},
|
|
2445
|
-
function
|
|
2446
|
-
if (r instanceof
|
|
2450
|
+
}, b(e)));
|
|
2451
|
+
function ke(r) {
|
|
2452
|
+
if (r instanceof E) {
|
|
2447
2453
|
const e = {};
|
|
2448
2454
|
for (const t in r.shape) {
|
|
2449
2455
|
const s = r.shape[t];
|
|
2450
|
-
e[t] =
|
|
2456
|
+
e[t] = ee.create(ke(s));
|
|
2451
2457
|
}
|
|
2452
|
-
return new
|
|
2458
|
+
return new E(g(u({}, r._def), {
|
|
2453
2459
|
shape: () => e
|
|
2454
2460
|
}));
|
|
2455
|
-
} else return r instanceof
|
|
2456
|
-
type:
|
|
2457
|
-
})) : r instanceof
|
|
2461
|
+
} else return r instanceof J ? new J(g(u({}, r._def), {
|
|
2462
|
+
type: ke(r.element)
|
|
2463
|
+
})) : r instanceof ee ? ee.create(ke(r.unwrap())) : r instanceof pe ? pe.create(ke(r.unwrap())) : r instanceof re ? re.create(r.items.map((e) => ke(e))) : r;
|
|
2458
2464
|
}
|
|
2459
|
-
class
|
|
2465
|
+
class E extends w {
|
|
2460
2466
|
constructor() {
|
|
2461
2467
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2462
2468
|
}
|
|
2463
2469
|
_getCached() {
|
|
2464
2470
|
if (this._cached !== null)
|
|
2465
2471
|
return this._cached;
|
|
2466
|
-
const e = this._def.shape(), t =
|
|
2472
|
+
const e = this._def.shape(), t = x.objectKeys(e);
|
|
2467
2473
|
return this._cached = { shape: e, keys: t };
|
|
2468
2474
|
}
|
|
2469
2475
|
_parse(e) {
|
|
2470
2476
|
if (this._getType(e) !== p.object) {
|
|
2471
|
-
const
|
|
2472
|
-
return h(
|
|
2477
|
+
const d = this._getOrReturnCtx(e);
|
|
2478
|
+
return h(d, {
|
|
2473
2479
|
code: l.invalid_type,
|
|
2474
2480
|
expected: p.object,
|
|
2475
|
-
received:
|
|
2481
|
+
received: d.parsedType
|
|
2476
2482
|
}), _;
|
|
2477
2483
|
}
|
|
2478
2484
|
const { status: s, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
2479
|
-
if (!(this._def.catchall instanceof
|
|
2480
|
-
for (const
|
|
2481
|
-
i.includes(
|
|
2485
|
+
if (!(this._def.catchall instanceof oe && this._def.unknownKeys === "strip"))
|
|
2486
|
+
for (const d in n.data)
|
|
2487
|
+
i.includes(d) || o.push(d);
|
|
2482
2488
|
const c = [];
|
|
2483
|
-
for (const
|
|
2484
|
-
const f = a[
|
|
2489
|
+
for (const d of i) {
|
|
2490
|
+
const f = a[d], v = n.data[d];
|
|
2485
2491
|
c.push({
|
|
2486
|
-
key: { status: "valid", value:
|
|
2487
|
-
value: f._parse(new
|
|
2488
|
-
alwaysSet:
|
|
2492
|
+
key: { status: "valid", value: d },
|
|
2493
|
+
value: f._parse(new te(n, v, n.path, d)),
|
|
2494
|
+
alwaysSet: d in n.data
|
|
2489
2495
|
});
|
|
2490
2496
|
}
|
|
2491
|
-
if (this._def.catchall instanceof
|
|
2492
|
-
const
|
|
2493
|
-
if (
|
|
2497
|
+
if (this._def.catchall instanceof oe) {
|
|
2498
|
+
const d = this._def.unknownKeys;
|
|
2499
|
+
if (d === "passthrough")
|
|
2494
2500
|
for (const f of o)
|
|
2495
2501
|
c.push({
|
|
2496
2502
|
key: { status: "valid", value: f },
|
|
2497
2503
|
value: { status: "valid", value: n.data[f] }
|
|
2498
2504
|
});
|
|
2499
|
-
else if (
|
|
2505
|
+
else if (d === "strict")
|
|
2500
2506
|
o.length > 0 && (h(n, {
|
|
2501
2507
|
code: l.unrecognized_keys,
|
|
2502
2508
|
keys: o
|
|
2503
2509
|
}), s.dirty());
|
|
2504
|
-
else if (
|
|
2510
|
+
else if (d !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
2505
2511
|
} else {
|
|
2506
|
-
const
|
|
2512
|
+
const d = this._def.catchall;
|
|
2507
2513
|
for (const f of o) {
|
|
2508
2514
|
const v = n.data[f];
|
|
2509
2515
|
c.push({
|
|
2510
2516
|
key: { status: "valid", value: f },
|
|
2511
|
-
value:
|
|
2512
|
-
new
|
|
2517
|
+
value: d._parse(
|
|
2518
|
+
new te(n, v, n.path, f)
|
|
2513
2519
|
//, ctx.child(key), value, getParsedType(value)
|
|
2514
2520
|
),
|
|
2515
2521
|
alwaysSet: f in n.data
|
|
@@ -2517,23 +2523,23 @@ class A extends x {
|
|
|
2517
2523
|
}
|
|
2518
2524
|
}
|
|
2519
2525
|
return n.common.async ? Promise.resolve().then(() => C(this, null, function* () {
|
|
2520
|
-
const
|
|
2526
|
+
const d = [];
|
|
2521
2527
|
for (const f of c) {
|
|
2522
|
-
const v = yield f.key,
|
|
2523
|
-
|
|
2528
|
+
const v = yield f.key, N = yield f.value;
|
|
2529
|
+
d.push({
|
|
2524
2530
|
key: v,
|
|
2525
|
-
value:
|
|
2531
|
+
value: N,
|
|
2526
2532
|
alwaysSet: f.alwaysSet
|
|
2527
2533
|
});
|
|
2528
2534
|
}
|
|
2529
|
-
return
|
|
2530
|
-
})).then((
|
|
2535
|
+
return d;
|
|
2536
|
+
})).then((d) => R.mergeObjectSync(s, d)) : R.mergeObjectSync(s, c);
|
|
2531
2537
|
}
|
|
2532
2538
|
get shape() {
|
|
2533
2539
|
return this._def.shape();
|
|
2534
2540
|
}
|
|
2535
2541
|
strict(e) {
|
|
2536
|
-
return m.errToObj, new
|
|
2542
|
+
return m.errToObj, new E(u(g(u({}, this._def), {
|
|
2537
2543
|
unknownKeys: "strict"
|
|
2538
2544
|
}), e !== void 0 ? {
|
|
2539
2545
|
errorMap: (t, s) => {
|
|
@@ -2548,12 +2554,12 @@ class A extends x {
|
|
|
2548
2554
|
} : {}));
|
|
2549
2555
|
}
|
|
2550
2556
|
strip() {
|
|
2551
|
-
return new
|
|
2557
|
+
return new E(g(u({}, this._def), {
|
|
2552
2558
|
unknownKeys: "strip"
|
|
2553
2559
|
}));
|
|
2554
2560
|
}
|
|
2555
2561
|
passthrough() {
|
|
2556
|
-
return new
|
|
2562
|
+
return new E(g(u({}, this._def), {
|
|
2557
2563
|
unknownKeys: "passthrough"
|
|
2558
2564
|
}));
|
|
2559
2565
|
}
|
|
@@ -2575,8 +2581,8 @@ class A extends x {
|
|
|
2575
2581
|
// }) as any;
|
|
2576
2582
|
// };
|
|
2577
2583
|
extend(e) {
|
|
2578
|
-
return new
|
|
2579
|
-
shape: () =>
|
|
2584
|
+
return new E(g(u({}, this._def), {
|
|
2585
|
+
shape: () => u(u({}, this._def.shape()), e)
|
|
2580
2586
|
}));
|
|
2581
2587
|
}
|
|
2582
2588
|
/**
|
|
@@ -2585,10 +2591,10 @@ class A extends x {
|
|
|
2585
2591
|
* upgrade if you are experiencing issues.
|
|
2586
2592
|
*/
|
|
2587
2593
|
merge(e) {
|
|
2588
|
-
return new
|
|
2594
|
+
return new E({
|
|
2589
2595
|
unknownKeys: e._def.unknownKeys,
|
|
2590
2596
|
catchall: e._def.catchall,
|
|
2591
|
-
shape: () =>
|
|
2597
|
+
shape: () => u(u({}, this._def.shape()), e._def.shape()),
|
|
2592
2598
|
typeName: y.ZodObject
|
|
2593
2599
|
});
|
|
2594
2600
|
}
|
|
@@ -2652,23 +2658,23 @@ class A extends x {
|
|
|
2652
2658
|
// return merged;
|
|
2653
2659
|
// }
|
|
2654
2660
|
catchall(e) {
|
|
2655
|
-
return new
|
|
2661
|
+
return new E(g(u({}, this._def), {
|
|
2656
2662
|
catchall: e
|
|
2657
2663
|
}));
|
|
2658
2664
|
}
|
|
2659
2665
|
pick(e) {
|
|
2660
2666
|
const t = {};
|
|
2661
|
-
return
|
|
2667
|
+
return x.objectKeys(e).forEach((s) => {
|
|
2662
2668
|
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
2663
|
-
}), new
|
|
2669
|
+
}), new E(g(u({}, this._def), {
|
|
2664
2670
|
shape: () => t
|
|
2665
2671
|
}));
|
|
2666
2672
|
}
|
|
2667
2673
|
omit(e) {
|
|
2668
2674
|
const t = {};
|
|
2669
|
-
return
|
|
2675
|
+
return x.objectKeys(this.shape).forEach((s) => {
|
|
2670
2676
|
e[s] || (t[s] = this.shape[s]);
|
|
2671
|
-
}), new
|
|
2677
|
+
}), new E(g(u({}, this._def), {
|
|
2672
2678
|
shape: () => t
|
|
2673
2679
|
}));
|
|
2674
2680
|
}
|
|
@@ -2676,55 +2682,55 @@ class A extends x {
|
|
|
2676
2682
|
* @deprecated
|
|
2677
2683
|
*/
|
|
2678
2684
|
deepPartial() {
|
|
2679
|
-
return
|
|
2685
|
+
return ke(this);
|
|
2680
2686
|
}
|
|
2681
2687
|
partial(e) {
|
|
2682
2688
|
const t = {};
|
|
2683
|
-
return
|
|
2689
|
+
return x.objectKeys(this.shape).forEach((s) => {
|
|
2684
2690
|
const n = this.shape[s];
|
|
2685
2691
|
e && !e[s] ? t[s] = n : t[s] = n.optional();
|
|
2686
|
-
}), new
|
|
2692
|
+
}), new E(g(u({}, this._def), {
|
|
2687
2693
|
shape: () => t
|
|
2688
2694
|
}));
|
|
2689
2695
|
}
|
|
2690
2696
|
required(e) {
|
|
2691
2697
|
const t = {};
|
|
2692
|
-
return
|
|
2698
|
+
return x.objectKeys(this.shape).forEach((s) => {
|
|
2693
2699
|
if (e && !e[s])
|
|
2694
2700
|
t[s] = this.shape[s];
|
|
2695
2701
|
else {
|
|
2696
2702
|
let a = this.shape[s];
|
|
2697
|
-
for (; a instanceof
|
|
2703
|
+
for (; a instanceof ee; )
|
|
2698
2704
|
a = a._def.innerType;
|
|
2699
2705
|
t[s] = a;
|
|
2700
2706
|
}
|
|
2701
|
-
}), new
|
|
2707
|
+
}), new E(g(u({}, this._def), {
|
|
2702
2708
|
shape: () => t
|
|
2703
2709
|
}));
|
|
2704
2710
|
}
|
|
2705
2711
|
keyof() {
|
|
2706
|
-
return pr(
|
|
2712
|
+
return pr(x.objectKeys(this.shape));
|
|
2707
2713
|
}
|
|
2708
2714
|
}
|
|
2709
|
-
|
|
2715
|
+
E.create = (r, e) => new E(u({
|
|
2710
2716
|
shape: () => r,
|
|
2711
2717
|
unknownKeys: "strip",
|
|
2712
|
-
catchall:
|
|
2718
|
+
catchall: oe.create(),
|
|
2713
2719
|
typeName: y.ZodObject
|
|
2714
|
-
},
|
|
2715
|
-
|
|
2720
|
+
}, b(e)));
|
|
2721
|
+
E.strictCreate = (r, e) => new E(u({
|
|
2716
2722
|
shape: () => r,
|
|
2717
2723
|
unknownKeys: "strict",
|
|
2718
|
-
catchall:
|
|
2724
|
+
catchall: oe.create(),
|
|
2719
2725
|
typeName: y.ZodObject
|
|
2720
|
-
},
|
|
2721
|
-
|
|
2726
|
+
}, b(e)));
|
|
2727
|
+
E.lazycreate = (r, e) => new E(u({
|
|
2722
2728
|
shape: r,
|
|
2723
2729
|
unknownKeys: "strip",
|
|
2724
|
-
catchall:
|
|
2730
|
+
catchall: oe.create(),
|
|
2725
2731
|
typeName: y.ZodObject
|
|
2726
|
-
},
|
|
2727
|
-
class
|
|
2732
|
+
}, b(e)));
|
|
2733
|
+
class De extends w {
|
|
2728
2734
|
_parse(e) {
|
|
2729
2735
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
2730
2736
|
function n(a) {
|
|
@@ -2742,8 +2748,8 @@ class Ve extends x {
|
|
|
2742
2748
|
}
|
|
2743
2749
|
if (t.common.async)
|
|
2744
2750
|
return Promise.all(s.map((a) => C(this, null, function* () {
|
|
2745
|
-
const i = g(
|
|
2746
|
-
common: g(
|
|
2751
|
+
const i = g(u({}, t), {
|
|
2752
|
+
common: g(u({}, t.common), {
|
|
2747
2753
|
issues: []
|
|
2748
2754
|
}),
|
|
2749
2755
|
parent: null
|
|
@@ -2761,19 +2767,19 @@ class Ve extends x {
|
|
|
2761
2767
|
let a;
|
|
2762
2768
|
const i = [];
|
|
2763
2769
|
for (const c of s) {
|
|
2764
|
-
const
|
|
2765
|
-
common: g(
|
|
2770
|
+
const d = g(u({}, t), {
|
|
2771
|
+
common: g(u({}, t.common), {
|
|
2766
2772
|
issues: []
|
|
2767
2773
|
}),
|
|
2768
2774
|
parent: null
|
|
2769
2775
|
}), f = c._parseSync({
|
|
2770
2776
|
data: t.data,
|
|
2771
2777
|
path: t.path,
|
|
2772
|
-
parent:
|
|
2778
|
+
parent: d
|
|
2773
2779
|
});
|
|
2774
2780
|
if (f.status === "valid")
|
|
2775
2781
|
return f;
|
|
2776
|
-
f.status === "dirty" && !a && (a = { result: f, ctx:
|
|
2782
|
+
f.status === "dirty" && !a && (a = { result: f, ctx: d }), d.common.issues.length && i.push(d.common.issues);
|
|
2777
2783
|
}
|
|
2778
2784
|
if (a)
|
|
2779
2785
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
@@ -2788,12 +2794,12 @@ class Ve extends x {
|
|
|
2788
2794
|
return this._def.options;
|
|
2789
2795
|
}
|
|
2790
2796
|
}
|
|
2791
|
-
|
|
2797
|
+
De.create = (r, e) => new De(u({
|
|
2792
2798
|
options: r,
|
|
2793
2799
|
typeName: y.ZodUnion
|
|
2794
|
-
},
|
|
2795
|
-
const
|
|
2796
|
-
class
|
|
2800
|
+
}, b(e)));
|
|
2801
|
+
const ae = (r) => r instanceof We ? ae(r.schema) : r instanceof G ? ae(r.innerType()) : r instanceof Be ? [r.value] : r instanceof he ? r.options : r instanceof qe ? x.objectValues(r.enum) : r instanceof He ? ae(r._def.innerType) : r instanceof Le ? [void 0] : r instanceof Ve ? [null] : r instanceof ee ? [void 0, ...ae(r.unwrap())] : r instanceof pe ? [null, ...ae(r.unwrap())] : r instanceof Mt || r instanceof Ge ? ae(r.unwrap()) : r instanceof Je ? ae(r._def.innerType) : [];
|
|
2802
|
+
class ut extends w {
|
|
2797
2803
|
_parse(e) {
|
|
2798
2804
|
const { ctx: t } = this._processInputParams(e);
|
|
2799
2805
|
if (t.parsedType !== p.object)
|
|
@@ -2837,7 +2843,7 @@ class dt extends x {
|
|
|
2837
2843
|
static create(e, t, s) {
|
|
2838
2844
|
const n = /* @__PURE__ */ new Map();
|
|
2839
2845
|
for (const a of t) {
|
|
2840
|
-
const i =
|
|
2846
|
+
const i = ae(a.shape[e]);
|
|
2841
2847
|
if (!i.length)
|
|
2842
2848
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2843
2849
|
for (const o of i) {
|
|
@@ -2846,22 +2852,22 @@ class dt extends x {
|
|
|
2846
2852
|
n.set(o, a);
|
|
2847
2853
|
}
|
|
2848
2854
|
}
|
|
2849
|
-
return new
|
|
2855
|
+
return new ut(u({
|
|
2850
2856
|
typeName: y.ZodDiscriminatedUnion,
|
|
2851
2857
|
discriminator: e,
|
|
2852
2858
|
options: t,
|
|
2853
2859
|
optionsMap: n
|
|
2854
|
-
},
|
|
2860
|
+
}, b(s)));
|
|
2855
2861
|
}
|
|
2856
2862
|
}
|
|
2857
|
-
function
|
|
2858
|
-
const t =
|
|
2863
|
+
function Nt(r, e) {
|
|
2864
|
+
const t = ie(r), s = ie(e);
|
|
2859
2865
|
if (r === e)
|
|
2860
2866
|
return { valid: !0, data: r };
|
|
2861
2867
|
if (t === p.object && s === p.object) {
|
|
2862
|
-
const n =
|
|
2868
|
+
const n = x.objectKeys(e), a = x.objectKeys(r).filter((o) => n.indexOf(o) !== -1), i = u(u({}, r), e);
|
|
2863
2869
|
for (const o of a) {
|
|
2864
|
-
const c =
|
|
2870
|
+
const c = Nt(r[o], e[o]);
|
|
2865
2871
|
if (!c.valid)
|
|
2866
2872
|
return { valid: !1 };
|
|
2867
2873
|
i[o] = c.data;
|
|
@@ -2872,7 +2878,7 @@ function Ot(r, e) {
|
|
|
2872
2878
|
return { valid: !1 };
|
|
2873
2879
|
const n = [];
|
|
2874
2880
|
for (let a = 0; a < r.length; a++) {
|
|
2875
|
-
const i = r[a], o = e[a], c =
|
|
2881
|
+
const i = r[a], o = e[a], c = Nt(i, o);
|
|
2876
2882
|
if (!c.valid)
|
|
2877
2883
|
return { valid: !1 };
|
|
2878
2884
|
n.push(c.data);
|
|
@@ -2880,12 +2886,12 @@ function Ot(r, e) {
|
|
|
2880
2886
|
return { valid: !0, data: n };
|
|
2881
2887
|
} else return t === p.date && s === p.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
2882
2888
|
}
|
|
2883
|
-
class
|
|
2889
|
+
class Ue extends w {
|
|
2884
2890
|
_parse(e) {
|
|
2885
2891
|
const { status: t, ctx: s } = this._processInputParams(e), n = (a, i) => {
|
|
2886
|
-
if (
|
|
2892
|
+
if (Ot(a) || Ot(i))
|
|
2887
2893
|
return _;
|
|
2888
|
-
const o =
|
|
2894
|
+
const o = Nt(a.value, i.value);
|
|
2889
2895
|
return o.valid ? ((Ct(a) || Ct(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
|
|
2890
2896
|
code: l.invalid_intersection_types
|
|
2891
2897
|
}), _);
|
|
@@ -2912,12 +2918,12 @@ class De extends x {
|
|
|
2912
2918
|
}));
|
|
2913
2919
|
}
|
|
2914
2920
|
}
|
|
2915
|
-
|
|
2921
|
+
Ue.create = (r, e, t) => new Ue(u({
|
|
2916
2922
|
left: r,
|
|
2917
2923
|
right: e,
|
|
2918
2924
|
typeName: y.ZodIntersection
|
|
2919
|
-
},
|
|
2920
|
-
class
|
|
2925
|
+
}, b(t)));
|
|
2926
|
+
class re extends w {
|
|
2921
2927
|
_parse(e) {
|
|
2922
2928
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2923
2929
|
if (s.parsedType !== p.array)
|
|
@@ -2943,29 +2949,29 @@ class ee extends x {
|
|
|
2943
2949
|
}), t.dirty());
|
|
2944
2950
|
const a = [...s.data].map((i, o) => {
|
|
2945
2951
|
const c = this._def.items[o] || this._def.rest;
|
|
2946
|
-
return c ? c._parse(new
|
|
2952
|
+
return c ? c._parse(new te(s, i, s.path, o)) : null;
|
|
2947
2953
|
}).filter((i) => !!i);
|
|
2948
|
-
return s.common.async ? Promise.all(a).then((i) =>
|
|
2954
|
+
return s.common.async ? Promise.all(a).then((i) => R.mergeArray(t, i)) : R.mergeArray(t, a);
|
|
2949
2955
|
}
|
|
2950
2956
|
get items() {
|
|
2951
2957
|
return this._def.items;
|
|
2952
2958
|
}
|
|
2953
2959
|
rest(e) {
|
|
2954
|
-
return new
|
|
2960
|
+
return new re(g(u({}, this._def), {
|
|
2955
2961
|
rest: e
|
|
2956
2962
|
}));
|
|
2957
2963
|
}
|
|
2958
2964
|
}
|
|
2959
|
-
|
|
2965
|
+
re.create = (r, e) => {
|
|
2960
2966
|
if (!Array.isArray(r))
|
|
2961
2967
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2962
|
-
return new
|
|
2968
|
+
return new re(u({
|
|
2963
2969
|
items: r,
|
|
2964
2970
|
typeName: y.ZodTuple,
|
|
2965
2971
|
rest: null
|
|
2966
|
-
},
|
|
2972
|
+
}, b(e)));
|
|
2967
2973
|
};
|
|
2968
|
-
class
|
|
2974
|
+
class ze extends w {
|
|
2969
2975
|
get keySchema() {
|
|
2970
2976
|
return this._def.keyType;
|
|
2971
2977
|
}
|
|
@@ -2983,28 +2989,28 @@ class Ue extends x {
|
|
|
2983
2989
|
const n = [], a = this._def.keyType, i = this._def.valueType;
|
|
2984
2990
|
for (const o in s.data)
|
|
2985
2991
|
n.push({
|
|
2986
|
-
key: a._parse(new
|
|
2987
|
-
value: i._parse(new
|
|
2992
|
+
key: a._parse(new te(s, o, s.path, o)),
|
|
2993
|
+
value: i._parse(new te(s, s.data[o], s.path, o)),
|
|
2988
2994
|
alwaysSet: o in s.data
|
|
2989
2995
|
});
|
|
2990
|
-
return s.common.async ?
|
|
2996
|
+
return s.common.async ? R.mergeObjectAsync(t, n) : R.mergeObjectSync(t, n);
|
|
2991
2997
|
}
|
|
2992
2998
|
get element() {
|
|
2993
2999
|
return this._def.valueType;
|
|
2994
3000
|
}
|
|
2995
3001
|
static create(e, t, s) {
|
|
2996
|
-
return t instanceof
|
|
3002
|
+
return t instanceof w ? new ze(u({
|
|
2997
3003
|
keyType: e,
|
|
2998
3004
|
valueType: t,
|
|
2999
3005
|
typeName: y.ZodRecord
|
|
3000
|
-
},
|
|
3001
|
-
keyType:
|
|
3006
|
+
}, b(s))) : new ze(u({
|
|
3007
|
+
keyType: H.create(),
|
|
3002
3008
|
valueType: e,
|
|
3003
3009
|
typeName: y.ZodRecord
|
|
3004
|
-
},
|
|
3010
|
+
}, b(t)));
|
|
3005
3011
|
}
|
|
3006
3012
|
}
|
|
3007
|
-
class
|
|
3013
|
+
class ct extends w {
|
|
3008
3014
|
get keySchema() {
|
|
3009
3015
|
return this._def.keyType;
|
|
3010
3016
|
}
|
|
@@ -3019,39 +3025,39 @@ class ot extends x {
|
|
|
3019
3025
|
expected: p.map,
|
|
3020
3026
|
received: s.parsedType
|
|
3021
3027
|
}), _;
|
|
3022
|
-
const n = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c],
|
|
3023
|
-
key: n._parse(new
|
|
3024
|
-
value: a._parse(new
|
|
3028
|
+
const n = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], d) => ({
|
|
3029
|
+
key: n._parse(new te(s, o, s.path, [d, "key"])),
|
|
3030
|
+
value: a._parse(new te(s, c, s.path, [d, "value"]))
|
|
3025
3031
|
}));
|
|
3026
3032
|
if (s.common.async) {
|
|
3027
3033
|
const o = /* @__PURE__ */ new Map();
|
|
3028
3034
|
return Promise.resolve().then(() => C(this, null, function* () {
|
|
3029
3035
|
for (const c of i) {
|
|
3030
|
-
const
|
|
3031
|
-
if (
|
|
3036
|
+
const d = yield c.key, f = yield c.value;
|
|
3037
|
+
if (d.status === "aborted" || f.status === "aborted")
|
|
3032
3038
|
return _;
|
|
3033
|
-
(
|
|
3039
|
+
(d.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(d.value, f.value);
|
|
3034
3040
|
}
|
|
3035
3041
|
return { status: t.value, value: o };
|
|
3036
3042
|
}));
|
|
3037
3043
|
} else {
|
|
3038
3044
|
const o = /* @__PURE__ */ new Map();
|
|
3039
3045
|
for (const c of i) {
|
|
3040
|
-
const
|
|
3041
|
-
if (
|
|
3046
|
+
const d = c.key, f = c.value;
|
|
3047
|
+
if (d.status === "aborted" || f.status === "aborted")
|
|
3042
3048
|
return _;
|
|
3043
|
-
(
|
|
3049
|
+
(d.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(d.value, f.value);
|
|
3044
3050
|
}
|
|
3045
3051
|
return { status: t.value, value: o };
|
|
3046
3052
|
}
|
|
3047
3053
|
}
|
|
3048
3054
|
}
|
|
3049
|
-
|
|
3055
|
+
ct.create = (r, e, t) => new ct(u({
|
|
3050
3056
|
valueType: e,
|
|
3051
3057
|
keyType: r,
|
|
3052
3058
|
typeName: y.ZodMap
|
|
3053
|
-
},
|
|
3054
|
-
class
|
|
3059
|
+
}, b(t)));
|
|
3060
|
+
class we extends w {
|
|
3055
3061
|
_parse(e) {
|
|
3056
3062
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3057
3063
|
if (s.parsedType !== p.set)
|
|
@@ -3078,24 +3084,24 @@ class _e extends x {
|
|
|
3078
3084
|
}), t.dirty());
|
|
3079
3085
|
const a = this._def.valueType;
|
|
3080
3086
|
function i(c) {
|
|
3081
|
-
const
|
|
3087
|
+
const d = /* @__PURE__ */ new Set();
|
|
3082
3088
|
for (const f of c) {
|
|
3083
3089
|
if (f.status === "aborted")
|
|
3084
3090
|
return _;
|
|
3085
|
-
f.status === "dirty" && t.dirty(),
|
|
3091
|
+
f.status === "dirty" && t.dirty(), d.add(f.value);
|
|
3086
3092
|
}
|
|
3087
|
-
return { status: t.value, value:
|
|
3093
|
+
return { status: t.value, value: d };
|
|
3088
3094
|
}
|
|
3089
|
-
const o = [...s.data.values()].map((c,
|
|
3095
|
+
const o = [...s.data.values()].map((c, d) => a._parse(new te(s, c, s.path, d)));
|
|
3090
3096
|
return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
3091
3097
|
}
|
|
3092
3098
|
min(e, t) {
|
|
3093
|
-
return new
|
|
3099
|
+
return new we(g(u({}, this._def), {
|
|
3094
3100
|
minSize: { value: e, message: m.toString(t) }
|
|
3095
3101
|
}));
|
|
3096
3102
|
}
|
|
3097
3103
|
max(e, t) {
|
|
3098
|
-
return new
|
|
3104
|
+
return new we(g(u({}, this._def), {
|
|
3099
3105
|
maxSize: { value: e, message: m.toString(t) }
|
|
3100
3106
|
}));
|
|
3101
3107
|
}
|
|
@@ -3106,13 +3112,13 @@ class _e extends x {
|
|
|
3106
3112
|
return this.min(1, e);
|
|
3107
3113
|
}
|
|
3108
3114
|
}
|
|
3109
|
-
|
|
3115
|
+
we.create = (r, e) => new we(u({
|
|
3110
3116
|
valueType: r,
|
|
3111
3117
|
minSize: null,
|
|
3112
3118
|
maxSize: null,
|
|
3113
3119
|
typeName: y.ZodSet
|
|
3114
|
-
},
|
|
3115
|
-
class
|
|
3120
|
+
}, b(e)));
|
|
3121
|
+
class Se extends w {
|
|
3116
3122
|
constructor() {
|
|
3117
3123
|
super(...arguments), this.validate = this.implement;
|
|
3118
3124
|
}
|
|
@@ -3125,15 +3131,15 @@ class Te extends x {
|
|
|
3125
3131
|
received: t.parsedType
|
|
3126
3132
|
}), _;
|
|
3127
3133
|
function s(o, c) {
|
|
3128
|
-
return
|
|
3134
|
+
return nt({
|
|
3129
3135
|
data: o,
|
|
3130
3136
|
path: t.path,
|
|
3131
3137
|
errorMaps: [
|
|
3132
3138
|
t.common.contextualErrorMap,
|
|
3133
3139
|
t.schemaErrorMap,
|
|
3134
|
-
|
|
3140
|
+
st(),
|
|
3135
3141
|
Ae
|
|
3136
|
-
].filter((
|
|
3142
|
+
].filter((d) => !!d),
|
|
3137
3143
|
issueData: {
|
|
3138
3144
|
code: l.invalid_arguments,
|
|
3139
3145
|
argumentsError: c
|
|
@@ -3141,15 +3147,15 @@ class Te extends x {
|
|
|
3141
3147
|
});
|
|
3142
3148
|
}
|
|
3143
3149
|
function n(o, c) {
|
|
3144
|
-
return
|
|
3150
|
+
return nt({
|
|
3145
3151
|
data: o,
|
|
3146
3152
|
path: t.path,
|
|
3147
3153
|
errorMaps: [
|
|
3148
3154
|
t.common.contextualErrorMap,
|
|
3149
3155
|
t.schemaErrorMap,
|
|
3150
|
-
|
|
3156
|
+
st(),
|
|
3151
3157
|
Ae
|
|
3152
|
-
].filter((
|
|
3158
|
+
].filter((d) => !!d),
|
|
3153
3159
|
issueData: {
|
|
3154
3160
|
code: l.invalid_return_type,
|
|
3155
3161
|
returnTypeError: c
|
|
@@ -3159,23 +3165,23 @@ class Te extends x {
|
|
|
3159
3165
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
3160
3166
|
if (this._def.returns instanceof Ce) {
|
|
3161
3167
|
const o = this;
|
|
3162
|
-
return
|
|
3168
|
+
return $(function(...c) {
|
|
3163
3169
|
return C(this, null, function* () {
|
|
3164
|
-
const
|
|
3165
|
-
throw
|
|
3170
|
+
const d = new z([]), f = yield o._def.args.parseAsync(c, a).catch((Z) => {
|
|
3171
|
+
throw d.addIssue(s(c, Z)), d;
|
|
3166
3172
|
}), v = yield Reflect.apply(i, this, f);
|
|
3167
|
-
return yield o._def.returns._def.type.parseAsync(v, a).catch((
|
|
3168
|
-
throw
|
|
3173
|
+
return yield o._def.returns._def.type.parseAsync(v, a).catch((Z) => {
|
|
3174
|
+
throw d.addIssue(n(v, Z)), d;
|
|
3169
3175
|
});
|
|
3170
3176
|
});
|
|
3171
3177
|
});
|
|
3172
3178
|
} else {
|
|
3173
3179
|
const o = this;
|
|
3174
|
-
return
|
|
3175
|
-
const
|
|
3176
|
-
if (!
|
|
3177
|
-
throw new z([s(c,
|
|
3178
|
-
const f = Reflect.apply(i, this,
|
|
3180
|
+
return $(function(...c) {
|
|
3181
|
+
const d = o._def.args.safeParse(c, a);
|
|
3182
|
+
if (!d.success)
|
|
3183
|
+
throw new z([s(c, d.error)]);
|
|
3184
|
+
const f = Reflect.apply(i, this, d.data), v = o._def.returns.safeParse(f, a);
|
|
3179
3185
|
if (!v.success)
|
|
3180
3186
|
throw new z([n(f, v.error)]);
|
|
3181
3187
|
return v.data;
|
|
@@ -3189,12 +3195,12 @@ class Te extends x {
|
|
|
3189
3195
|
return this._def.returns;
|
|
3190
3196
|
}
|
|
3191
3197
|
args(...e) {
|
|
3192
|
-
return new
|
|
3193
|
-
args:
|
|
3198
|
+
return new Se(g(u({}, this._def), {
|
|
3199
|
+
args: re.create(e).rest(ve.create())
|
|
3194
3200
|
}));
|
|
3195
3201
|
}
|
|
3196
3202
|
returns(e) {
|
|
3197
|
-
return new
|
|
3203
|
+
return new Se(g(u({}, this._def), {
|
|
3198
3204
|
returns: e
|
|
3199
3205
|
}));
|
|
3200
3206
|
}
|
|
@@ -3205,14 +3211,14 @@ class Te extends x {
|
|
|
3205
3211
|
return this.parse(e);
|
|
3206
3212
|
}
|
|
3207
3213
|
static create(e, t, s) {
|
|
3208
|
-
return new
|
|
3209
|
-
args: e ||
|
|
3210
|
-
returns: t ||
|
|
3214
|
+
return new Se(u({
|
|
3215
|
+
args: e || re.create([]).rest(ve.create()),
|
|
3216
|
+
returns: t || ve.create(),
|
|
3211
3217
|
typeName: y.ZodFunction
|
|
3212
|
-
},
|
|
3218
|
+
}, b(s)));
|
|
3213
3219
|
}
|
|
3214
3220
|
}
|
|
3215
|
-
class
|
|
3221
|
+
class We extends w {
|
|
3216
3222
|
get schema() {
|
|
3217
3223
|
return this._def.getter();
|
|
3218
3224
|
}
|
|
@@ -3221,11 +3227,11 @@ class ze extends x {
|
|
|
3221
3227
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
3222
3228
|
}
|
|
3223
3229
|
}
|
|
3224
|
-
|
|
3230
|
+
We.create = (r, e) => new We(u({
|
|
3225
3231
|
getter: r,
|
|
3226
3232
|
typeName: y.ZodLazy
|
|
3227
|
-
},
|
|
3228
|
-
class
|
|
3233
|
+
}, b(e)));
|
|
3234
|
+
class Be extends w {
|
|
3229
3235
|
_parse(e) {
|
|
3230
3236
|
if (e.data !== this._def.value) {
|
|
3231
3237
|
const t = this._getOrReturnCtx(e);
|
|
@@ -3241,30 +3247,30 @@ class We extends x {
|
|
|
3241
3247
|
return this._def.value;
|
|
3242
3248
|
}
|
|
3243
3249
|
}
|
|
3244
|
-
|
|
3250
|
+
Be.create = (r, e) => new Be(u({
|
|
3245
3251
|
value: r,
|
|
3246
3252
|
typeName: y.ZodLiteral
|
|
3247
|
-
},
|
|
3253
|
+
}, b(e)));
|
|
3248
3254
|
function pr(r, e) {
|
|
3249
|
-
return new
|
|
3255
|
+
return new he(u({
|
|
3250
3256
|
values: r,
|
|
3251
3257
|
typeName: y.ZodEnum
|
|
3252
|
-
},
|
|
3258
|
+
}, b(e)));
|
|
3253
3259
|
}
|
|
3254
|
-
class
|
|
3260
|
+
class he extends w {
|
|
3255
3261
|
constructor() {
|
|
3256
|
-
super(...arguments),
|
|
3262
|
+
super(...arguments), Me.set(this, void 0);
|
|
3257
3263
|
}
|
|
3258
3264
|
_parse(e) {
|
|
3259
3265
|
if (typeof e.data != "string") {
|
|
3260
3266
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
3261
3267
|
return h(t, {
|
|
3262
|
-
expected:
|
|
3268
|
+
expected: x.joinValues(s),
|
|
3263
3269
|
received: t.parsedType,
|
|
3264
3270
|
code: l.invalid_type
|
|
3265
3271
|
}), _;
|
|
3266
3272
|
}
|
|
3267
|
-
if (
|
|
3273
|
+
if (at(this, Me) || ur(this, Me, new Set(this._def.values)), !at(this, Me).has(e.data)) {
|
|
3268
3274
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
3269
3275
|
return h(t, {
|
|
3270
3276
|
received: t.data,
|
|
@@ -3272,7 +3278,7 @@ class le extends x {
|
|
|
3272
3278
|
options: s
|
|
3273
3279
|
}), _;
|
|
3274
3280
|
}
|
|
3275
|
-
return
|
|
3281
|
+
return $(e.data);
|
|
3276
3282
|
}
|
|
3277
3283
|
get options() {
|
|
3278
3284
|
return this._def.values;
|
|
@@ -3296,48 +3302,48 @@ class le extends x {
|
|
|
3296
3302
|
return e;
|
|
3297
3303
|
}
|
|
3298
3304
|
extract(e, t = this._def) {
|
|
3299
|
-
return
|
|
3305
|
+
return he.create(e, u(u({}, this._def), t));
|
|
3300
3306
|
}
|
|
3301
3307
|
exclude(e, t = this._def) {
|
|
3302
|
-
return
|
|
3308
|
+
return he.create(this.options.filter((s) => !e.includes(s)), u(u({}, this._def), t));
|
|
3303
3309
|
}
|
|
3304
3310
|
}
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
class
|
|
3311
|
+
Me = /* @__PURE__ */ new WeakMap();
|
|
3312
|
+
he.create = pr;
|
|
3313
|
+
class qe extends w {
|
|
3308
3314
|
constructor() {
|
|
3309
|
-
super(...arguments),
|
|
3315
|
+
super(...arguments), Pe.set(this, void 0);
|
|
3310
3316
|
}
|
|
3311
3317
|
_parse(e) {
|
|
3312
|
-
const t =
|
|
3318
|
+
const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
3313
3319
|
if (s.parsedType !== p.string && s.parsedType !== p.number) {
|
|
3314
|
-
const n =
|
|
3320
|
+
const n = x.objectValues(t);
|
|
3315
3321
|
return h(s, {
|
|
3316
|
-
expected:
|
|
3322
|
+
expected: x.joinValues(n),
|
|
3317
3323
|
received: s.parsedType,
|
|
3318
3324
|
code: l.invalid_type
|
|
3319
3325
|
}), _;
|
|
3320
3326
|
}
|
|
3321
|
-
if (
|
|
3322
|
-
const n =
|
|
3327
|
+
if (at(this, Pe) || ur(this, Pe, new Set(x.getValidEnumValues(this._def.values))), !at(this, Pe).has(e.data)) {
|
|
3328
|
+
const n = x.objectValues(t);
|
|
3323
3329
|
return h(s, {
|
|
3324
3330
|
received: s.data,
|
|
3325
3331
|
code: l.invalid_enum_value,
|
|
3326
3332
|
options: n
|
|
3327
3333
|
}), _;
|
|
3328
3334
|
}
|
|
3329
|
-
return
|
|
3335
|
+
return $(e.data);
|
|
3330
3336
|
}
|
|
3331
3337
|
get enum() {
|
|
3332
3338
|
return this._def.values;
|
|
3333
3339
|
}
|
|
3334
3340
|
}
|
|
3335
|
-
|
|
3336
|
-
|
|
3341
|
+
Pe = /* @__PURE__ */ new WeakMap();
|
|
3342
|
+
qe.create = (r, e) => new qe(u({
|
|
3337
3343
|
values: r,
|
|
3338
3344
|
typeName: y.ZodNativeEnum
|
|
3339
|
-
},
|
|
3340
|
-
class Ce extends
|
|
3345
|
+
}, b(e)));
|
|
3346
|
+
class Ce extends w {
|
|
3341
3347
|
unwrap() {
|
|
3342
3348
|
return this._def.type;
|
|
3343
3349
|
}
|
|
@@ -3350,17 +3356,17 @@ class Ce extends x {
|
|
|
3350
3356
|
received: t.parsedType
|
|
3351
3357
|
}), _;
|
|
3352
3358
|
const s = t.parsedType === p.promise ? t.data : Promise.resolve(t.data);
|
|
3353
|
-
return
|
|
3359
|
+
return $(s.then((n) => this._def.type.parseAsync(n, {
|
|
3354
3360
|
path: t.path,
|
|
3355
3361
|
errorMap: t.common.contextualErrorMap
|
|
3356
3362
|
})));
|
|
3357
3363
|
}
|
|
3358
3364
|
}
|
|
3359
|
-
Ce.create = (r, e) => new Ce(
|
|
3365
|
+
Ce.create = (r, e) => new Ce(u({
|
|
3360
3366
|
type: r,
|
|
3361
3367
|
typeName: y.ZodPromise
|
|
3362
|
-
},
|
|
3363
|
-
class
|
|
3368
|
+
}, b(e)));
|
|
3369
|
+
class G extends w {
|
|
3364
3370
|
innerType() {
|
|
3365
3371
|
return this._def.schema;
|
|
3366
3372
|
}
|
|
@@ -3387,7 +3393,7 @@ class J extends x {
|
|
|
3387
3393
|
path: s.path,
|
|
3388
3394
|
parent: s
|
|
3389
3395
|
});
|
|
3390
|
-
return c.status === "aborted" ? _ : c.status === "dirty" || t.value === "dirty" ?
|
|
3396
|
+
return c.status === "aborted" ? _ : c.status === "dirty" || t.value === "dirty" ? Te(c.value) : c;
|
|
3391
3397
|
}));
|
|
3392
3398
|
{
|
|
3393
3399
|
if (t.value === "aborted")
|
|
@@ -3397,7 +3403,7 @@ class J extends x {
|
|
|
3397
3403
|
path: s.path,
|
|
3398
3404
|
parent: s
|
|
3399
3405
|
});
|
|
3400
|
-
return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ?
|
|
3406
|
+
return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ? Te(o.value) : o;
|
|
3401
3407
|
}
|
|
3402
3408
|
}
|
|
3403
3409
|
if (n.type === "refinement") {
|
|
@@ -3426,52 +3432,52 @@ class J extends x {
|
|
|
3426
3432
|
path: s.path,
|
|
3427
3433
|
parent: s
|
|
3428
3434
|
});
|
|
3429
|
-
if (!
|
|
3435
|
+
if (!_e(i))
|
|
3430
3436
|
return i;
|
|
3431
3437
|
const o = n.transform(i.value, a);
|
|
3432
3438
|
if (o instanceof Promise)
|
|
3433
3439
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3434
3440
|
return { status: t.value, value: o };
|
|
3435
3441
|
} else
|
|
3436
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) =>
|
|
3437
|
-
|
|
3442
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => _e(i) ? Promise.resolve(n.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
3443
|
+
x.assertNever(n);
|
|
3438
3444
|
}
|
|
3439
3445
|
}
|
|
3440
|
-
|
|
3446
|
+
G.create = (r, e, t) => new G(u({
|
|
3441
3447
|
schema: r,
|
|
3442
3448
|
typeName: y.ZodEffects,
|
|
3443
3449
|
effect: e
|
|
3444
|
-
},
|
|
3445
|
-
|
|
3450
|
+
}, b(t)));
|
|
3451
|
+
G.createWithPreprocess = (r, e, t) => new G(u({
|
|
3446
3452
|
schema: e,
|
|
3447
3453
|
effect: { type: "preprocess", transform: r },
|
|
3448
3454
|
typeName: y.ZodEffects
|
|
3449
|
-
},
|
|
3450
|
-
class
|
|
3455
|
+
}, b(t)));
|
|
3456
|
+
class ee extends w {
|
|
3451
3457
|
_parse(e) {
|
|
3452
|
-
return this._getType(e) === p.undefined ?
|
|
3458
|
+
return this._getType(e) === p.undefined ? $(void 0) : this._def.innerType._parse(e);
|
|
3453
3459
|
}
|
|
3454
3460
|
unwrap() {
|
|
3455
3461
|
return this._def.innerType;
|
|
3456
3462
|
}
|
|
3457
3463
|
}
|
|
3458
|
-
|
|
3464
|
+
ee.create = (r, e) => new ee(u({
|
|
3459
3465
|
innerType: r,
|
|
3460
3466
|
typeName: y.ZodOptional
|
|
3461
|
-
},
|
|
3462
|
-
class
|
|
3467
|
+
}, b(e)));
|
|
3468
|
+
class pe extends w {
|
|
3463
3469
|
_parse(e) {
|
|
3464
|
-
return this._getType(e) === p.null ?
|
|
3470
|
+
return this._getType(e) === p.null ? $(null) : this._def.innerType._parse(e);
|
|
3465
3471
|
}
|
|
3466
3472
|
unwrap() {
|
|
3467
3473
|
return this._def.innerType;
|
|
3468
3474
|
}
|
|
3469
3475
|
}
|
|
3470
|
-
|
|
3476
|
+
pe.create = (r, e) => new pe(u({
|
|
3471
3477
|
innerType: r,
|
|
3472
3478
|
typeName: y.ZodNullable
|
|
3473
|
-
},
|
|
3474
|
-
class
|
|
3479
|
+
}, b(e)));
|
|
3480
|
+
class He extends w {
|
|
3475
3481
|
_parse(e) {
|
|
3476
3482
|
const { ctx: t } = this._processInputParams(e);
|
|
3477
3483
|
let s = t.data;
|
|
@@ -3485,23 +3491,23 @@ class qe extends x {
|
|
|
3485
3491
|
return this._def.innerType;
|
|
3486
3492
|
}
|
|
3487
3493
|
}
|
|
3488
|
-
|
|
3494
|
+
He.create = (r, e) => new He(u({
|
|
3489
3495
|
innerType: r,
|
|
3490
3496
|
typeName: y.ZodDefault,
|
|
3491
3497
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
3492
|
-
},
|
|
3493
|
-
class
|
|
3498
|
+
}, b(e)));
|
|
3499
|
+
class Je extends w {
|
|
3494
3500
|
_parse(e) {
|
|
3495
|
-
const { ctx: t } = this._processInputParams(e), s = g(
|
|
3496
|
-
common: g(
|
|
3501
|
+
const { ctx: t } = this._processInputParams(e), s = g(u({}, t), {
|
|
3502
|
+
common: g(u({}, t.common), {
|
|
3497
3503
|
issues: []
|
|
3498
3504
|
})
|
|
3499
3505
|
}), n = this._def.innerType._parse({
|
|
3500
3506
|
data: s.data,
|
|
3501
3507
|
path: s.path,
|
|
3502
|
-
parent:
|
|
3508
|
+
parent: u({}, s)
|
|
3503
3509
|
});
|
|
3504
|
-
return
|
|
3510
|
+
return $e(n) ? n.then((a) => ({
|
|
3505
3511
|
status: "valid",
|
|
3506
3512
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
3507
3513
|
get error() {
|
|
@@ -3523,12 +3529,12 @@ class He extends x {
|
|
|
3523
3529
|
return this._def.innerType;
|
|
3524
3530
|
}
|
|
3525
3531
|
}
|
|
3526
|
-
|
|
3532
|
+
Je.create = (r, e) => new Je(u({
|
|
3527
3533
|
innerType: r,
|
|
3528
3534
|
typeName: y.ZodCatch,
|
|
3529
3535
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
3530
|
-
},
|
|
3531
|
-
class
|
|
3536
|
+
}, b(e)));
|
|
3537
|
+
class dt extends w {
|
|
3532
3538
|
_parse(e) {
|
|
3533
3539
|
if (this._getType(e) !== p.nan) {
|
|
3534
3540
|
const s = this._getOrReturnCtx(e);
|
|
@@ -3541,11 +3547,11 @@ class ct extends x {
|
|
|
3541
3547
|
return { status: "valid", value: e.data };
|
|
3542
3548
|
}
|
|
3543
3549
|
}
|
|
3544
|
-
|
|
3550
|
+
dt.create = (r) => new dt(u({
|
|
3545
3551
|
typeName: y.ZodNaN
|
|
3546
|
-
},
|
|
3552
|
+
}, b(r)));
|
|
3547
3553
|
const tn = Symbol("zod_brand");
|
|
3548
|
-
class
|
|
3554
|
+
class Mt extends w {
|
|
3549
3555
|
_parse(e) {
|
|
3550
3556
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
3551
3557
|
return this._def.type._parse({
|
|
@@ -3558,7 +3564,7 @@ class Zt extends x {
|
|
|
3558
3564
|
return this._def.type;
|
|
3559
3565
|
}
|
|
3560
3566
|
}
|
|
3561
|
-
class
|
|
3567
|
+
class Xe extends w {
|
|
3562
3568
|
_parse(e) {
|
|
3563
3569
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3564
3570
|
if (s.common.async)
|
|
@@ -3568,7 +3574,7 @@ class Ke extends x {
|
|
|
3568
3574
|
path: s.path,
|
|
3569
3575
|
parent: s
|
|
3570
3576
|
});
|
|
3571
|
-
return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(),
|
|
3577
|
+
return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(), Te(a.value)) : this._def.out._parseAsync({
|
|
3572
3578
|
data: a.value,
|
|
3573
3579
|
path: s.path,
|
|
3574
3580
|
parent: s
|
|
@@ -3591,50 +3597,50 @@ class Ke extends x {
|
|
|
3591
3597
|
}
|
|
3592
3598
|
}
|
|
3593
3599
|
static create(e, t) {
|
|
3594
|
-
return new
|
|
3600
|
+
return new Xe({
|
|
3595
3601
|
in: e,
|
|
3596
3602
|
out: t,
|
|
3597
3603
|
typeName: y.ZodPipeline
|
|
3598
3604
|
});
|
|
3599
3605
|
}
|
|
3600
3606
|
}
|
|
3601
|
-
class
|
|
3607
|
+
class Ge extends w {
|
|
3602
3608
|
_parse(e) {
|
|
3603
|
-
const t = this._def.innerType._parse(e), s = (n) => (
|
|
3604
|
-
return
|
|
3609
|
+
const t = this._def.innerType._parse(e), s = (n) => (_e(n) && (n.value = Object.freeze(n.value)), n);
|
|
3610
|
+
return $e(t) ? t.then((n) => s(n)) : s(t);
|
|
3605
3611
|
}
|
|
3606
3612
|
unwrap() {
|
|
3607
3613
|
return this._def.innerType;
|
|
3608
3614
|
}
|
|
3609
3615
|
}
|
|
3610
|
-
|
|
3616
|
+
Ge.create = (r, e) => new Ge(u({
|
|
3611
3617
|
innerType: r,
|
|
3612
3618
|
typeName: y.ZodReadonly
|
|
3613
|
-
},
|
|
3619
|
+
}, b(e)));
|
|
3614
3620
|
function Jt(r, e) {
|
|
3615
3621
|
const t = typeof r == "function" ? r(e) : typeof r == "string" ? { message: r } : r;
|
|
3616
3622
|
return typeof t == "string" ? { message: t } : t;
|
|
3617
3623
|
}
|
|
3618
3624
|
function mr(r, e = {}, t) {
|
|
3619
|
-
return r ?
|
|
3625
|
+
return r ? Oe.create().superRefine((s, n) => {
|
|
3620
3626
|
var a, i;
|
|
3621
3627
|
const o = r(s);
|
|
3622
3628
|
if (o instanceof Promise)
|
|
3623
3629
|
return o.then((c) => {
|
|
3624
|
-
var
|
|
3630
|
+
var d, f;
|
|
3625
3631
|
if (!c) {
|
|
3626
|
-
const v = Jt(e, s),
|
|
3627
|
-
n.addIssue(g(
|
|
3632
|
+
const v = Jt(e, s), N = (f = (d = v.fatal) !== null && d !== void 0 ? d : t) !== null && f !== void 0 ? f : !0;
|
|
3633
|
+
n.addIssue(g(u({ code: "custom" }, v), { fatal: N }));
|
|
3628
3634
|
}
|
|
3629
3635
|
});
|
|
3630
3636
|
if (!o) {
|
|
3631
|
-
const c = Jt(e, s),
|
|
3632
|
-
n.addIssue(g(
|
|
3637
|
+
const c = Jt(e, s), d = (i = (a = c.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0;
|
|
3638
|
+
n.addIssue(g(u({ code: "custom" }, c), { fatal: d }));
|
|
3633
3639
|
}
|
|
3634
|
-
}) :
|
|
3640
|
+
}) : Oe.create();
|
|
3635
3641
|
}
|
|
3636
3642
|
const rn = {
|
|
3637
|
-
object:
|
|
3643
|
+
object: E.lazycreate
|
|
3638
3644
|
};
|
|
3639
3645
|
var y;
|
|
3640
3646
|
(function(r) {
|
|
@@ -3642,82 +3648,82 @@ var y;
|
|
|
3642
3648
|
})(y || (y = {}));
|
|
3643
3649
|
const sn = (r, e = {
|
|
3644
3650
|
message: `Input not instance of ${r.name}`
|
|
3645
|
-
}) => mr((t) => t instanceof r, e), gr =
|
|
3646
|
-
string: (r) =>
|
|
3647
|
-
number: (r) =>
|
|
3648
|
-
boolean: (r) =>
|
|
3651
|
+
}) => mr((t) => t instanceof r, e), gr = H.create, yr = le.create, nn = dt.create, an = fe.create, vr = Fe.create, on = be.create, cn = it.create, dn = Le.create, un = Ve.create, ln = Oe.create, fn = ve.create, hn = oe.create, pn = ot.create, mn = J.create, gn = E.create, yn = E.strictCreate, vn = De.create, _n = ut.create, bn = Ue.create, wn = re.create, xn = ze.create, kn = ct.create, Tn = we.create, Sn = Se.create, En = We.create, An = Be.create, On = he.create, Cn = qe.create, Nn = Ce.create, Gt = G.create, In = ee.create, jn = pe.create, Rn = G.createWithPreprocess, Zn = Xe.create, Mn = () => gr().optional(), Pn = () => yr().optional(), $n = () => vr().optional(), Fn = {
|
|
3652
|
+
string: (r) => H.create(g(u({}, r), { coerce: !0 })),
|
|
3653
|
+
number: (r) => le.create(g(u({}, r), { coerce: !0 })),
|
|
3654
|
+
boolean: (r) => Fe.create(g(u({}, r), {
|
|
3649
3655
|
coerce: !0
|
|
3650
3656
|
})),
|
|
3651
|
-
bigint: (r) =>
|
|
3652
|
-
date: (r) =>
|
|
3657
|
+
bigint: (r) => fe.create(g(u({}, r), { coerce: !0 })),
|
|
3658
|
+
date: (r) => be.create(g(u({}, r), { coerce: !0 }))
|
|
3653
3659
|
}, Ln = _;
|
|
3654
3660
|
var S = /* @__PURE__ */ Object.freeze({
|
|
3655
3661
|
__proto__: null,
|
|
3656
3662
|
defaultErrorMap: Ae,
|
|
3657
3663
|
setErrorMap: js,
|
|
3658
|
-
getErrorMap:
|
|
3659
|
-
makeIssue:
|
|
3664
|
+
getErrorMap: st,
|
|
3665
|
+
makeIssue: nt,
|
|
3660
3666
|
EMPTY_PATH: Rs,
|
|
3661
3667
|
addIssueToContext: h,
|
|
3662
|
-
ParseStatus:
|
|
3668
|
+
ParseStatus: R,
|
|
3663
3669
|
INVALID: _,
|
|
3664
|
-
DIRTY:
|
|
3665
|
-
OK:
|
|
3666
|
-
isAborted:
|
|
3670
|
+
DIRTY: Te,
|
|
3671
|
+
OK: $,
|
|
3672
|
+
isAborted: Ot,
|
|
3667
3673
|
isDirty: Ct,
|
|
3668
|
-
isValid:
|
|
3669
|
-
isAsync:
|
|
3674
|
+
isValid: _e,
|
|
3675
|
+
isAsync: $e,
|
|
3670
3676
|
get util() {
|
|
3671
|
-
return
|
|
3677
|
+
return x;
|
|
3672
3678
|
},
|
|
3673
3679
|
get objectUtil() {
|
|
3674
3680
|
return At;
|
|
3675
3681
|
},
|
|
3676
3682
|
ZodParsedType: p,
|
|
3677
|
-
getParsedType:
|
|
3678
|
-
ZodType:
|
|
3683
|
+
getParsedType: ie,
|
|
3684
|
+
ZodType: w,
|
|
3679
3685
|
datetimeRegex: hr,
|
|
3680
|
-
ZodString:
|
|
3681
|
-
ZodNumber:
|
|
3682
|
-
ZodBigInt:
|
|
3683
|
-
ZodBoolean:
|
|
3684
|
-
ZodDate:
|
|
3685
|
-
ZodSymbol:
|
|
3686
|
-
ZodUndefined:
|
|
3687
|
-
ZodNull:
|
|
3688
|
-
ZodAny:
|
|
3689
|
-
ZodUnknown:
|
|
3690
|
-
ZodNever:
|
|
3691
|
-
ZodVoid:
|
|
3692
|
-
ZodArray:
|
|
3693
|
-
ZodObject:
|
|
3694
|
-
ZodUnion:
|
|
3695
|
-
ZodDiscriminatedUnion:
|
|
3696
|
-
ZodIntersection:
|
|
3697
|
-
ZodTuple:
|
|
3698
|
-
ZodRecord:
|
|
3699
|
-
ZodMap:
|
|
3700
|
-
ZodSet:
|
|
3701
|
-
ZodFunction:
|
|
3702
|
-
ZodLazy:
|
|
3703
|
-
ZodLiteral:
|
|
3704
|
-
ZodEnum:
|
|
3705
|
-
ZodNativeEnum:
|
|
3686
|
+
ZodString: H,
|
|
3687
|
+
ZodNumber: le,
|
|
3688
|
+
ZodBigInt: fe,
|
|
3689
|
+
ZodBoolean: Fe,
|
|
3690
|
+
ZodDate: be,
|
|
3691
|
+
ZodSymbol: it,
|
|
3692
|
+
ZodUndefined: Le,
|
|
3693
|
+
ZodNull: Ve,
|
|
3694
|
+
ZodAny: Oe,
|
|
3695
|
+
ZodUnknown: ve,
|
|
3696
|
+
ZodNever: oe,
|
|
3697
|
+
ZodVoid: ot,
|
|
3698
|
+
ZodArray: J,
|
|
3699
|
+
ZodObject: E,
|
|
3700
|
+
ZodUnion: De,
|
|
3701
|
+
ZodDiscriminatedUnion: ut,
|
|
3702
|
+
ZodIntersection: Ue,
|
|
3703
|
+
ZodTuple: re,
|
|
3704
|
+
ZodRecord: ze,
|
|
3705
|
+
ZodMap: ct,
|
|
3706
|
+
ZodSet: we,
|
|
3707
|
+
ZodFunction: Se,
|
|
3708
|
+
ZodLazy: We,
|
|
3709
|
+
ZodLiteral: Be,
|
|
3710
|
+
ZodEnum: he,
|
|
3711
|
+
ZodNativeEnum: qe,
|
|
3706
3712
|
ZodPromise: Ce,
|
|
3707
|
-
ZodEffects:
|
|
3708
|
-
ZodTransformer:
|
|
3709
|
-
ZodOptional:
|
|
3710
|
-
ZodNullable:
|
|
3711
|
-
ZodDefault:
|
|
3712
|
-
ZodCatch:
|
|
3713
|
-
ZodNaN:
|
|
3713
|
+
ZodEffects: G,
|
|
3714
|
+
ZodTransformer: G,
|
|
3715
|
+
ZodOptional: ee,
|
|
3716
|
+
ZodNullable: pe,
|
|
3717
|
+
ZodDefault: He,
|
|
3718
|
+
ZodCatch: Je,
|
|
3719
|
+
ZodNaN: dt,
|
|
3714
3720
|
BRAND: tn,
|
|
3715
|
-
ZodBranded:
|
|
3716
|
-
ZodPipeline:
|
|
3717
|
-
ZodReadonly:
|
|
3721
|
+
ZodBranded: Mt,
|
|
3722
|
+
ZodPipeline: Xe,
|
|
3723
|
+
ZodReadonly: Ge,
|
|
3718
3724
|
custom: mr,
|
|
3719
|
-
Schema:
|
|
3720
|
-
ZodSchema:
|
|
3725
|
+
Schema: w,
|
|
3726
|
+
ZodSchema: w,
|
|
3721
3727
|
late: rn,
|
|
3722
3728
|
get ZodFirstPartyTypeKind() {
|
|
3723
3729
|
return y;
|
|
@@ -3730,15 +3736,15 @@ var S = /* @__PURE__ */ Object.freeze({
|
|
|
3730
3736
|
date: on,
|
|
3731
3737
|
discriminatedUnion: _n,
|
|
3732
3738
|
effect: Gt,
|
|
3733
|
-
enum:
|
|
3739
|
+
enum: On,
|
|
3734
3740
|
function: Sn,
|
|
3735
3741
|
instanceof: sn,
|
|
3736
3742
|
intersection: bn,
|
|
3737
|
-
lazy:
|
|
3738
|
-
literal:
|
|
3743
|
+
lazy: En,
|
|
3744
|
+
literal: An,
|
|
3739
3745
|
map: kn,
|
|
3740
3746
|
nan: nn,
|
|
3741
|
-
nativeEnum:
|
|
3747
|
+
nativeEnum: Cn,
|
|
3742
3748
|
never: hn,
|
|
3743
3749
|
null: un,
|
|
3744
3750
|
nullable: jn,
|
|
@@ -3797,7 +3803,8 @@ const Vn = S.object({
|
|
|
3797
3803
|
enableDisplayScreenModelId: S.boolean().optional(),
|
|
3798
3804
|
enableGeneratePackageLock: S.boolean().optional(),
|
|
3799
3805
|
enableAutoSplit: S.boolean().optional(),
|
|
3800
|
-
autoSplitThreshold: S.number().optional()
|
|
3806
|
+
autoSplitThreshold: S.number().optional(),
|
|
3807
|
+
codegenSettings: S.record(S.unknown()).optional()
|
|
3801
3808
|
}),
|
|
3802
3809
|
S.object({
|
|
3803
3810
|
framework: S.literal("html"),
|
|
@@ -3850,58 +3857,59 @@ const Vn = S.object({
|
|
|
3850
3857
|
reason: "Selected node type is not supported"
|
|
3851
3858
|
};
|
|
3852
3859
|
};
|
|
3853
|
-
var
|
|
3860
|
+
var I, Ke, xe, _r, It;
|
|
3854
3861
|
class Yn {
|
|
3855
3862
|
constructor({
|
|
3856
3863
|
auth: e,
|
|
3857
3864
|
apiBaseAddress: t = "https://public-api.animaapp.com"
|
|
3858
3865
|
} = {}) {
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3866
|
+
Ye(this, xe);
|
|
3867
|
+
Ye(this, I);
|
|
3868
|
+
Ye(this, Ke);
|
|
3869
|
+
ht(this, Ke, t), e && (this.auth = e);
|
|
3863
3870
|
}
|
|
3864
3871
|
hasAuth() {
|
|
3865
|
-
return !!
|
|
3872
|
+
return !!M(this, I);
|
|
3866
3873
|
}
|
|
3867
3874
|
set auth(e) {
|
|
3868
|
-
|
|
3875
|
+
ht(this, I, e);
|
|
3869
3876
|
}
|
|
3870
3877
|
get headers() {
|
|
3871
3878
|
const e = {
|
|
3872
3879
|
"Content-Type": "application/json"
|
|
3873
3880
|
};
|
|
3874
|
-
return
|
|
3875
|
-
}
|
|
3876
|
-
generateCode(
|
|
3877
|
-
return C(this, arguments, function* (e, t = {}) {
|
|
3878
|
-
var
|
|
3879
|
-
const
|
|
3880
|
-
e.figmaToken && (yield
|
|
3881
|
-
let
|
|
3882
|
-
|
|
3883
|
-
const
|
|
3884
|
-
tracking:
|
|
3881
|
+
return M(this, I) && (e.Authorization = `Bearer ${M(this, I).token}`, "teamId" in M(this, I) && (e["X-Team-Id"] = M(this, I).teamId)), e;
|
|
3882
|
+
}
|
|
3883
|
+
generateCode(n) {
|
|
3884
|
+
return C(this, arguments, function* (e, t = {}, s) {
|
|
3885
|
+
var c;
|
|
3886
|
+
const a = Dn(e.settings);
|
|
3887
|
+
e.figmaToken && (yield Qe(this, xe, _r).call(this, e.fileKey, e.figmaToken, e.nodesId, { allowAutoSelectFirstNode: (c = a.allowAutoSelectFirstNode) != null ? c : !0 }, s));
|
|
3888
|
+
let i = e.tracking;
|
|
3889
|
+
M(this, I) && "userId" in M(this, I) && M(this, I).userId && (i != null && i.externalId || (i = { externalId: M(this, I).userId }));
|
|
3890
|
+
const o = {
|
|
3891
|
+
tracking: i,
|
|
3885
3892
|
fileKey: e.fileKey,
|
|
3886
3893
|
figmaToken: e.figmaToken,
|
|
3887
3894
|
nodesId: e.nodesId,
|
|
3888
3895
|
assetsStorage: e.assetsStorage,
|
|
3889
|
-
language:
|
|
3890
|
-
model:
|
|
3891
|
-
framework:
|
|
3892
|
-
styling:
|
|
3893
|
-
uiLibrary:
|
|
3894
|
-
enableTranslation:
|
|
3895
|
-
enableUILibraryTheming:
|
|
3896
|
-
enableCompactStructure:
|
|
3897
|
-
enableAutoSplit:
|
|
3898
|
-
autoSplitThreshold:
|
|
3899
|
-
disableMarkedForExport:
|
|
3900
|
-
allowAutoSelectFirstNode:
|
|
3901
|
-
enableDisplayScreenModelId:
|
|
3902
|
-
enableGeneratePackageLock:
|
|
3896
|
+
language: a.language,
|
|
3897
|
+
model: a.model,
|
|
3898
|
+
framework: a.framework,
|
|
3899
|
+
styling: a.styling,
|
|
3900
|
+
uiLibrary: a.uiLibrary,
|
|
3901
|
+
enableTranslation: a.enableTranslation,
|
|
3902
|
+
enableUILibraryTheming: a.enableUILibraryTheming,
|
|
3903
|
+
enableCompactStructure: a.enableCompactStructure,
|
|
3904
|
+
enableAutoSplit: a.enableAutoSplit,
|
|
3905
|
+
autoSplitThreshold: a.autoSplitThreshold,
|
|
3906
|
+
disableMarkedForExport: a.disableMarkedForExport,
|
|
3907
|
+
allowAutoSelectFirstNode: a.allowAutoSelectFirstNode,
|
|
3908
|
+
enableDisplayScreenModelId: a.enableDisplayScreenModelId,
|
|
3909
|
+
enableGeneratePackageLock: a.enableGeneratePackageLock,
|
|
3910
|
+
codegenSettings: a.codegenSettings
|
|
3903
3911
|
};
|
|
3904
|
-
return
|
|
3912
|
+
return Qe(this, xe, It).call(this, "/v1/codegen", o, t, "codegen", s);
|
|
3905
3913
|
});
|
|
3906
3914
|
}
|
|
3907
3915
|
/**
|
|
@@ -3909,166 +3917,170 @@ class Yn {
|
|
|
3909
3917
|
* This API is experimental and may change or be removed in future releases.
|
|
3910
3918
|
* Link2Code (l2c) flow.
|
|
3911
3919
|
*/
|
|
3912
|
-
generateLink2Code(
|
|
3913
|
-
return C(this, arguments, function* (e, t = {}) {
|
|
3914
|
-
let
|
|
3915
|
-
|
|
3916
|
-
const
|
|
3917
|
-
tracking:
|
|
3920
|
+
generateLink2Code(n) {
|
|
3921
|
+
return C(this, arguments, function* (e, t = {}, s) {
|
|
3922
|
+
let a = e.tracking;
|
|
3923
|
+
M(this, I) && "userId" in M(this, I) && M(this, I).userId && (a != null && a.externalId || (a = { externalId: M(this, I).userId }));
|
|
3924
|
+
const i = {
|
|
3925
|
+
tracking: a,
|
|
3918
3926
|
assetsStorage: e.assetsStorage,
|
|
3919
3927
|
params: e.params
|
|
3920
3928
|
};
|
|
3921
|
-
return
|
|
3929
|
+
return Qe(this, xe, It).call(this, "/v1/l2c", i, t, "l2c", s);
|
|
3922
3930
|
});
|
|
3923
3931
|
}
|
|
3924
3932
|
}
|
|
3925
|
-
|
|
3933
|
+
I = new WeakMap(), Ke = new WeakMap(), xe = new WeakSet(), _r = function(e, t, s, n, a) {
|
|
3926
3934
|
return C(this, null, function* () {
|
|
3927
|
-
let
|
|
3935
|
+
let i;
|
|
3928
3936
|
try {
|
|
3929
|
-
|
|
3937
|
+
i = yield Ns({
|
|
3930
3938
|
fileKey: e,
|
|
3931
3939
|
authToken: t,
|
|
3932
3940
|
params: {
|
|
3933
3941
|
geometry: "paths"
|
|
3934
|
-
}
|
|
3942
|
+
},
|
|
3943
|
+
signal: a
|
|
3935
3944
|
});
|
|
3936
|
-
} catch (
|
|
3945
|
+
} catch (d) {
|
|
3946
|
+
if (d instanceof Error && d.name === "AbortError")
|
|
3947
|
+
throw d;
|
|
3937
3948
|
return;
|
|
3938
3949
|
}
|
|
3939
|
-
const
|
|
3940
|
-
(
|
|
3950
|
+
const c = s.map(
|
|
3951
|
+
(d) => Un(i, d, n)
|
|
3941
3952
|
).find(
|
|
3942
|
-
(
|
|
3953
|
+
(d) => !d.isValid
|
|
3943
3954
|
);
|
|
3944
|
-
if (
|
|
3945
|
-
throw new
|
|
3955
|
+
if (c)
|
|
3956
|
+
throw new de({
|
|
3946
3957
|
name: "Task Crashed",
|
|
3947
|
-
reason:
|
|
3958
|
+
reason: c.reason
|
|
3948
3959
|
});
|
|
3949
3960
|
});
|
|
3950
|
-
},
|
|
3961
|
+
}, It = function(e, t, s, n, a) {
|
|
3951
3962
|
return C(this, null, function* () {
|
|
3952
|
-
var
|
|
3963
|
+
var v, N, Z, F, W, se, me, ce, V;
|
|
3953
3964
|
if (this.hasAuth() === !1)
|
|
3954
3965
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
3955
|
-
const
|
|
3966
|
+
const i = {}, o = yield fetch(`${M(this, Ke)}${e}`, {
|
|
3956
3967
|
method: "POST",
|
|
3957
|
-
headers: g(
|
|
3968
|
+
headers: g(u({}, this.headers), {
|
|
3958
3969
|
Accept: "text/event-stream"
|
|
3959
3970
|
}),
|
|
3960
|
-
body: JSON.stringify(t)
|
|
3971
|
+
body: JSON.stringify(t),
|
|
3972
|
+
signal: a
|
|
3961
3973
|
});
|
|
3962
|
-
if (!
|
|
3963
|
-
const
|
|
3964
|
-
let
|
|
3974
|
+
if (!o.ok) {
|
|
3975
|
+
const K = yield o.text();
|
|
3976
|
+
let q;
|
|
3965
3977
|
try {
|
|
3966
|
-
|
|
3967
|
-
} catch (
|
|
3978
|
+
q = JSON.parse(K);
|
|
3979
|
+
} catch (Ne) {
|
|
3968
3980
|
}
|
|
3969
|
-
throw ((
|
|
3981
|
+
throw ((v = q == null ? void 0 : q.error) == null ? void 0 : v.name) === "ZodError" ? new de({
|
|
3970
3982
|
name: "HTTP error from Anima API",
|
|
3971
3983
|
reason: "Invalid body payload",
|
|
3972
|
-
detail:
|
|
3973
|
-
status:
|
|
3974
|
-
}) : typeof
|
|
3975
|
-
name: `Error "${
|
|
3984
|
+
detail: q.error.issues,
|
|
3985
|
+
status: o.status
|
|
3986
|
+
}) : typeof q == "object" ? new de({
|
|
3987
|
+
name: `Error "${q}"`,
|
|
3976
3988
|
reason: "Unknown",
|
|
3977
|
-
status:
|
|
3978
|
-
}) : new
|
|
3989
|
+
status: o.status
|
|
3990
|
+
}) : new de({
|
|
3979
3991
|
name: "HTTP error from Anima API",
|
|
3980
|
-
reason:
|
|
3981
|
-
status:
|
|
3992
|
+
reason: K,
|
|
3993
|
+
status: o.status
|
|
3982
3994
|
});
|
|
3983
3995
|
}
|
|
3984
|
-
if (!
|
|
3985
|
-
throw new
|
|
3996
|
+
if (!o.body)
|
|
3997
|
+
throw new de({
|
|
3986
3998
|
name: "Stream Error",
|
|
3987
3999
|
reason: "Response body is null",
|
|
3988
|
-
status:
|
|
4000
|
+
status: o.status
|
|
3989
4001
|
});
|
|
3990
|
-
const
|
|
3991
|
-
let
|
|
4002
|
+
const c = o.body.getReader(), d = new TextDecoder();
|
|
4003
|
+
let f = "";
|
|
3992
4004
|
try {
|
|
3993
4005
|
for (; ; ) {
|
|
3994
|
-
const { done:
|
|
3995
|
-
if (
|
|
4006
|
+
const { done: K, value: q } = yield c.read();
|
|
4007
|
+
if (K)
|
|
3996
4008
|
break;
|
|
3997
|
-
|
|
3998
|
-
const
|
|
4009
|
+
f += d.decode(q, { stream: !0 });
|
|
4010
|
+
const Ne = f.split(`
|
|
3999
4011
|
`);
|
|
4000
|
-
|
|
4001
|
-
for (const
|
|
4002
|
-
if (!(!
|
|
4003
|
-
let
|
|
4012
|
+
f = Ne.pop() || "";
|
|
4013
|
+
for (const A of Ne)
|
|
4014
|
+
if (!(!A.trim() || A.startsWith(":")) && A.startsWith("data: ")) {
|
|
4015
|
+
let k;
|
|
4004
4016
|
try {
|
|
4005
|
-
|
|
4006
|
-
} catch (
|
|
4017
|
+
k = JSON.parse(A.slice(6));
|
|
4018
|
+
} catch (lt) {
|
|
4007
4019
|
continue;
|
|
4008
4020
|
}
|
|
4009
|
-
switch (
|
|
4021
|
+
switch (k.type) {
|
|
4010
4022
|
case "queueing": {
|
|
4011
|
-
typeof s == "function" ? s(
|
|
4023
|
+
typeof s == "function" ? s(k) : (N = s.onQueueing) == null || N.call(s);
|
|
4012
4024
|
break;
|
|
4013
4025
|
}
|
|
4014
4026
|
case "start": {
|
|
4015
|
-
|
|
4027
|
+
i.sessionId = k.sessionId, typeof s == "function" ? s(k) : (Z = s.onStart) == null || Z.call(s, { sessionId: k.sessionId });
|
|
4016
4028
|
break;
|
|
4017
4029
|
}
|
|
4018
4030
|
case "pre_codegen": {
|
|
4019
|
-
n === "codegen" && (typeof s == "function" ? s(
|
|
4020
|
-
message:
|
|
4031
|
+
n === "codegen" && (typeof s == "function" ? s(k) : (F = s.onPreCodegen) == null || F.call(s, {
|
|
4032
|
+
message: k.message
|
|
4021
4033
|
}));
|
|
4022
4034
|
break;
|
|
4023
4035
|
}
|
|
4024
4036
|
case "assets_uploaded": {
|
|
4025
|
-
typeof s == "function" ? s(
|
|
4037
|
+
typeof s == "function" ? s(k) : (W = s.onAssetsUploaded) == null || W.call(s);
|
|
4026
4038
|
break;
|
|
4027
4039
|
}
|
|
4028
4040
|
case "assets_list": {
|
|
4029
|
-
|
|
4041
|
+
i.assets = k.payload.assets, typeof s == "function" ? s(k) : (se = s.onAssetsList) == null || se.call(s, k.payload);
|
|
4030
4042
|
break;
|
|
4031
4043
|
}
|
|
4032
4044
|
case "figma_metadata": {
|
|
4033
|
-
n === "codegen" && (
|
|
4034
|
-
figmaFileName:
|
|
4035
|
-
figmaSelectedFrameName:
|
|
4045
|
+
n === "codegen" && (i.figmaFileName = k.figmaFileName, i.figmaSelectedFrameName = k.figmaSelectedFrameName, typeof s == "function" ? s(k) : (me = s.onFigmaMetadata) == null || me.call(s, {
|
|
4046
|
+
figmaFileName: k.figmaFileName,
|
|
4047
|
+
figmaSelectedFrameName: k.figmaSelectedFrameName
|
|
4036
4048
|
}));
|
|
4037
4049
|
break;
|
|
4038
4050
|
}
|
|
4039
4051
|
case "generating_code": {
|
|
4040
|
-
|
|
4041
|
-
status:
|
|
4042
|
-
progress:
|
|
4043
|
-
files:
|
|
4052
|
+
k.payload.status === "success" && (i.files = k.payload.files), typeof s == "function" ? s(k) : (ce = s.onGeneratingCode) == null || ce.call(s, {
|
|
4053
|
+
status: k.payload.status,
|
|
4054
|
+
progress: k.payload.progress,
|
|
4055
|
+
files: k.payload.files
|
|
4044
4056
|
});
|
|
4045
4057
|
break;
|
|
4046
4058
|
}
|
|
4047
4059
|
case "codegen_completed":
|
|
4048
4060
|
case "generation_completed": {
|
|
4049
|
-
typeof s == "function" ? s(
|
|
4061
|
+
typeof s == "function" ? s(k) : (V = s.onCodegenCompleted) == null || V.call(s);
|
|
4050
4062
|
break;
|
|
4051
4063
|
}
|
|
4052
4064
|
case "error":
|
|
4053
|
-
throw new
|
|
4054
|
-
name:
|
|
4055
|
-
reason:
|
|
4065
|
+
throw new de({
|
|
4066
|
+
name: k.payload.errorName,
|
|
4067
|
+
reason: k.payload.reason
|
|
4056
4068
|
});
|
|
4057
4069
|
case "done": {
|
|
4058
|
-
if (!
|
|
4059
|
-
throw new
|
|
4070
|
+
if (!i.files)
|
|
4071
|
+
throw new de({
|
|
4060
4072
|
name: "Invalid response",
|
|
4061
4073
|
reason: "No code generated"
|
|
4062
4074
|
});
|
|
4063
|
-
return
|
|
4075
|
+
return i.tokenUsage = k.payload.tokenUsage, i;
|
|
4064
4076
|
}
|
|
4065
4077
|
}
|
|
4066
4078
|
}
|
|
4067
4079
|
}
|
|
4068
4080
|
} finally {
|
|
4069
|
-
|
|
4081
|
+
c.cancel();
|
|
4070
4082
|
}
|
|
4071
|
-
throw new
|
|
4083
|
+
throw new de({
|
|
4072
4084
|
name: "Connection",
|
|
4073
4085
|
reason: "Connection closed before the 'done' message",
|
|
4074
4086
|
status: 500
|
|
@@ -4116,8 +4128,8 @@ const ra = ({
|
|
|
4116
4128
|
try {
|
|
4117
4129
|
const c = Wn(a, o);
|
|
4118
4130
|
if (c.startsWith("src/")) {
|
|
4119
|
-
const
|
|
4120
|
-
Bn(r,
|
|
4131
|
+
const d = c.split("/").slice(0, -1).join("/");
|
|
4132
|
+
Bn(r, d).forEach((v) => {
|
|
4121
4133
|
s.has(v) || n(v);
|
|
4122
4134
|
});
|
|
4123
4135
|
}
|
|
@@ -4188,11 +4200,11 @@ const qn = (r, e) => br(
|
|
|
4188
4200
|
);
|
|
4189
4201
|
function wr(r) {
|
|
4190
4202
|
return C(this, null, function* () {
|
|
4191
|
-
var i, o, c,
|
|
4203
|
+
var i, o, c, d;
|
|
4192
4204
|
const [e, t] = r.tee(), s = yield e.getReader().read();
|
|
4193
4205
|
if (s.done || !s.value || s.value.type === "error" && ((i = s.value.payload) != null && i.status))
|
|
4194
4206
|
return new Response(JSON.stringify(s.value), {
|
|
4195
|
-
status: ((o = s.value) == null ? void 0 : o.type) === "error" && (
|
|
4207
|
+
status: ((o = s.value) == null ? void 0 : o.type) === "error" && (d = (c = s.value.payload) == null ? void 0 : c.status) != null ? d : 500,
|
|
4196
4208
|
headers: {
|
|
4197
4209
|
"Content-Type": "application/json"
|
|
4198
4210
|
}
|
|
@@ -4200,13 +4212,13 @@ function wr(r) {
|
|
|
4200
4212
|
const n = new TextEncoder(), a = t.pipeThrough(
|
|
4201
4213
|
new TransformStream({
|
|
4202
4214
|
transform(f, v) {
|
|
4203
|
-
const
|
|
4215
|
+
const N = `event: ${f.type}
|
|
4204
4216
|
data: ${JSON.stringify(
|
|
4205
4217
|
f
|
|
4206
4218
|
)}
|
|
4207
4219
|
|
|
4208
4220
|
`;
|
|
4209
|
-
v.enqueue(n.encode(
|
|
4221
|
+
v.enqueue(n.encode(N));
|
|
4210
4222
|
}
|
|
4211
4223
|
})
|
|
4212
4224
|
);
|
|
@@ -4233,11 +4245,11 @@ const sa = (r, e) => C(void 0, null, function* () {
|
|
|
4233
4245
|
});
|
|
4234
4246
|
export {
|
|
4235
4247
|
Yn as Anima,
|
|
4236
|
-
|
|
4237
|
-
|
|
4248
|
+
de as CodegenError,
|
|
4249
|
+
Ar as FigmaTokenIssue,
|
|
4238
4250
|
Nr as NotFound,
|
|
4239
|
-
|
|
4240
|
-
|
|
4251
|
+
Or as RateLimitExceeded,
|
|
4252
|
+
Cr as RequestTooLarge,
|
|
4241
4253
|
ta as ResponseError,
|
|
4242
4254
|
jr as UnknownFigmaApiException,
|
|
4243
4255
|
sa as createCodegenResponseEventStream,
|