@datapos/datapos-development 0.3.84 → 0.3.86

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.
@@ -1,2241 +1,202 @@
1
- import { exec as qn } from "child_process";
2
- import { promises as h } from "fs";
3
- import { nanoid as Yn } from "nanoid";
4
- import { promisify as Xn } from "util";
5
- const Qn = ["createObject", "dropObject", "removeRecords", "upsertRecords"], nt = ["findObject", "getRecord", "listNodes", "previewObject", "retrieveRecords"];
6
- function a(n, t, e) {
7
- function o(c, u) {
8
- var d;
9
- Object.defineProperty(c, "_zod", {
10
- value: c._zod ?? {},
11
- enumerable: !1
12
- }), (d = c._zod).traits ?? (d.traits = /* @__PURE__ */ new Set()), c._zod.traits.add(n), t(c, u);
13
- for (const l in s.prototype)
14
- l in c || Object.defineProperty(c, l, { value: s.prototype[l].bind(c) });
15
- c._zod.constr = s, c._zod.def = u;
16
- }
17
- const r = e?.Parent ?? Object;
18
- class i extends r {
19
- }
20
- Object.defineProperty(i, "name", { value: n });
21
- function s(c) {
22
- var u;
23
- const d = e?.Parent ? new i() : this;
24
- o(d, c), (u = d._zod).deferred ?? (u.deferred = []);
25
- for (const l of d._zod.deferred)
26
- l();
27
- return d;
28
- }
29
- return Object.defineProperty(s, "init", { value: o }), Object.defineProperty(s, Symbol.hasInstance, {
30
- value: (c) => e?.Parent && c instanceof e.Parent ? !0 : c?._zod?.traits?.has(n)
31
- }), Object.defineProperty(s, "name", { value: n }), s;
32
- }
33
- class I extends Error {
34
- constructor() {
35
- super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
36
- }
37
- }
38
- class On extends Error {
39
- constructor(t) {
40
- super(`Encountered unidirectional transform during encode: ${t}`), this.name = "ZodEncodeError";
41
- }
42
- }
43
- const xn = {};
44
- function x(n) {
45
- return xn;
46
- }
47
- function tt(n) {
48
- const t = Object.values(n).filter((e) => typeof e == "number");
49
- return Object.entries(n).filter(([e, o]) => t.indexOf(+e) === -1).map(([e, o]) => o);
50
- }
51
- function q(n, t) {
52
- return typeof t == "bigint" ? t.toString() : t;
53
- }
54
- function nn(n) {
55
- return {
56
- get value() {
57
- {
58
- const t = n();
59
- return Object.defineProperty(this, "value", { value: t }), t;
60
- }
61
- }
62
- };
63
- }
64
- function tn(n) {
65
- return n == null;
66
- }
67
- function en(n) {
68
- const t = n.startsWith("^") ? 1 : 0, e = n.endsWith("$") ? n.length - 1 : n.length;
69
- return n.slice(t, e);
70
- }
71
- const un = Symbol("evaluating");
72
- function g(n, t, e) {
73
- let o;
74
- Object.defineProperty(n, t, {
75
- get() {
76
- if (o !== un)
77
- return o === void 0 && (o = un, o = e()), o;
78
- },
79
- set(r) {
80
- Object.defineProperty(n, t, {
81
- value: r
82
- // configurable: true,
83
- });
84
- },
85
- configurable: !0
86
- });
87
- }
88
- function E(n, t, e) {
89
- Object.defineProperty(n, t, {
90
- value: e,
91
- writable: !0,
92
- enumerable: !0,
93
- configurable: !0
94
- });
95
- }
96
- function S(...n) {
97
- const t = {};
98
- for (const e of n) {
99
- const o = Object.getOwnPropertyDescriptors(e);
100
- Object.assign(t, o);
101
- }
102
- return Object.defineProperties({}, t);
103
- }
104
- function dn(n) {
105
- return JSON.stringify(n);
106
- }
107
- const jn = "captureStackTrace" in Error ? Error.captureStackTrace : (...n) => {
108
- };
109
- function L(n) {
110
- return typeof n == "object" && n !== null && !Array.isArray(n);
111
- }
112
- const et = nn(() => {
113
- if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
114
- return !1;
115
- try {
116
- const n = Function;
117
- return new n(""), !0;
118
- } catch {
119
- return !1;
120
- }
121
- });
122
- function F(n) {
123
- if (L(n) === !1)
124
- return !1;
125
- const t = n.constructor;
126
- if (t === void 0)
127
- return !0;
128
- const e = t.prototype;
129
- return !(L(e) === !1 || Object.prototype.hasOwnProperty.call(e, "isPrototypeOf") === !1);
130
- }
131
- function En(n) {
132
- return F(n) ? { ...n } : Array.isArray(n) ? [...n] : n;
133
- }
134
- const ot = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
135
- function B(n) {
136
- return n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
137
- }
138
- function O(n, t, e) {
139
- const o = new n._zod.constr(t ?? n._zod.def);
140
- return (!t || e?.parent) && (o._zod.parent = n), o;
141
- }
142
- function f(n) {
143
- const t = n;
144
- if (!t)
145
- return {};
146
- if (typeof t == "string")
147
- return { error: () => t };
148
- if (t?.message !== void 0) {
149
- if (t?.error !== void 0)
150
- throw new Error("Cannot specify both `message` and `error` params");
151
- t.error = t.message;
152
- }
153
- return delete t.message, typeof t.error == "string" ? { ...t, error: () => t.error } : t;
154
- }
155
- function rt(n) {
156
- return Object.keys(n).filter((t) => n[t]._zod.optin === "optional" && n[t]._zod.optout === "optional");
157
- }
158
- function it(n, t) {
159
- const e = n._zod.def, o = S(n._zod.def, {
160
- get shape() {
161
- const r = {};
162
- for (const i in t) {
163
- if (!(i in e.shape))
164
- throw new Error(`Unrecognized key: "${i}"`);
165
- t[i] && (r[i] = e.shape[i]);
166
- }
167
- return E(this, "shape", r), r;
168
- },
169
- checks: []
170
- });
171
- return O(n, o);
172
- }
173
- function st(n, t) {
174
- const e = n._zod.def, o = S(n._zod.def, {
175
- get shape() {
176
- const r = { ...n._zod.def.shape };
177
- for (const i in t) {
178
- if (!(i in e.shape))
179
- throw new Error(`Unrecognized key: "${i}"`);
180
- t[i] && delete r[i];
181
- }
182
- return E(this, "shape", r), r;
183
- },
184
- checks: []
185
- });
186
- return O(n, o);
187
- }
188
- function at(n, t) {
189
- if (!F(t))
190
- throw new Error("Invalid input to extend: expected a plain object");
191
- const e = n._zod.def.checks;
192
- if (e && e.length > 0)
193
- throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
194
- const o = S(n._zod.def, {
195
- get shape() {
196
- const r = { ...n._zod.def.shape, ...t };
197
- return E(this, "shape", r), r;
198
- },
199
- checks: []
200
- });
201
- return O(n, o);
202
- }
203
- function ct(n, t) {
204
- if (!F(t))
205
- throw new Error("Invalid input to safeExtend: expected a plain object");
206
- const e = {
207
- ...n._zod.def,
208
- get shape() {
209
- const o = { ...n._zod.def.shape, ...t };
210
- return E(this, "shape", o), o;
211
- },
212
- checks: n._zod.def.checks
213
- };
214
- return O(n, e);
215
- }
216
- function ut(n, t) {
217
- const e = S(n._zod.def, {
218
- get shape() {
219
- const o = { ...n._zod.def.shape, ...t._zod.def.shape };
220
- return E(this, "shape", o), o;
221
- },
222
- get catchall() {
223
- return t._zod.def.catchall;
224
- },
225
- checks: []
226
- // delete existing checks
227
- });
228
- return O(n, e);
229
- }
230
- function dt(n, t, e) {
231
- const o = S(t._zod.def, {
232
- get shape() {
233
- const r = t._zod.def.shape, i = { ...r };
234
- if (e)
235
- for (const s in e) {
236
- if (!(s in r))
237
- throw new Error(`Unrecognized key: "${s}"`);
238
- e[s] && (i[s] = n ? new n({
239
- type: "optional",
240
- innerType: r[s]
241
- }) : r[s]);
242
- }
243
- else
244
- for (const s in r)
245
- i[s] = n ? new n({
246
- type: "optional",
247
- innerType: r[s]
248
- }) : r[s];
249
- return E(this, "shape", i), i;
250
- },
251
- checks: []
252
- });
253
- return O(t, o);
254
- }
255
- function ft(n, t, e) {
256
- const o = S(t._zod.def, {
257
- get shape() {
258
- const r = t._zod.def.shape, i = { ...r };
259
- if (e)
260
- for (const s in e) {
261
- if (!(s in i))
262
- throw new Error(`Unrecognized key: "${s}"`);
263
- e[s] && (i[s] = new n({
264
- type: "nonoptional",
265
- innerType: r[s]
266
- }));
267
- }
268
- else
269
- for (const s in r)
270
- i[s] = new n({
271
- type: "nonoptional",
272
- innerType: r[s]
273
- });
274
- return E(this, "shape", i), i;
275
- },
276
- checks: []
277
- });
278
- return O(t, o);
279
- }
280
- function P(n, t = 0) {
281
- if (n.aborted === !0)
282
- return !0;
283
- for (let e = t; e < n.issues.length; e++)
284
- if (n.issues[e]?.continue !== !0)
285
- return !0;
286
- return !1;
287
- }
288
- function Sn(n, t) {
289
- return t.map((e) => {
290
- var o;
291
- return (o = e).path ?? (o.path = []), e.path.unshift(n), e;
292
- });
293
- }
294
- function R(n) {
295
- return typeof n == "string" ? n : n?.message;
296
- }
297
- function j(n, t, e) {
298
- const o = { ...n, path: n.path ?? [] };
299
- if (!n.message) {
300
- const r = R(n.inst?._zod.def?.error?.(n)) ?? R(t?.error?.(n)) ?? R(e.customError?.(n)) ?? R(e.localeError?.(n)) ?? "Invalid input";
301
- o.message = r;
302
- }
303
- return delete o.inst, delete o.continue, t?.reportInput || delete o.input, o;
304
- }
305
- function on(n) {
306
- return Array.isArray(n) ? "array" : typeof n == "string" ? "string" : "unknown";
307
- }
308
- function C(...n) {
309
- const [t, e, o] = n;
310
- return typeof t == "string" ? {
311
- message: t,
312
- code: "custom",
313
- input: e,
314
- inst: o
315
- } : { ...t };
316
- }
317
- const Pn = (n, t) => {
318
- n.name = "$ZodError", Object.defineProperty(n, "_zod", {
319
- value: n._zod,
320
- enumerable: !1
321
- }), Object.defineProperty(n, "issues", {
322
- value: t,
323
- enumerable: !1
324
- }), n.message = JSON.stringify(t, q, 2), Object.defineProperty(n, "toString", {
325
- value: () => n.message,
326
- enumerable: !1
327
- });
328
- }, An = a("$ZodError", Pn), In = a("$ZodError", Pn, { Parent: Error });
329
- function lt(n, t = (e) => e.message) {
330
- const e = {}, o = [];
331
- for (const r of n.issues)
332
- r.path.length > 0 ? (e[r.path[0]] = e[r.path[0]] || [], e[r.path[0]].push(t(r))) : o.push(t(r));
333
- return { formErrors: o, fieldErrors: e };
334
- }
335
- function pt(n, t = (e) => e.message) {
336
- const e = { _errors: [] }, o = (r) => {
337
- for (const i of r.issues)
338
- if (i.code === "invalid_union" && i.errors.length)
339
- i.errors.map((s) => o({ issues: s }));
340
- else if (i.code === "invalid_key")
341
- o({ issues: i.issues });
342
- else if (i.code === "invalid_element")
343
- o({ issues: i.issues });
344
- else if (i.path.length === 0)
345
- e._errors.push(t(i));
346
- else {
347
- let s = e, c = 0;
348
- for (; c < i.path.length; ) {
349
- const u = i.path[c];
350
- c === i.path.length - 1 ? (s[u] = s[u] || { _errors: [] }, s[u]._errors.push(t(i))) : s[u] = s[u] || { _errors: [] }, s = s[u], c++;
351
- }
352
- }
353
- };
354
- return o(n), e;
355
- }
356
- const rn = (n) => (t, e, o, r) => {
357
- const i = o ? Object.assign(o, { async: !1 }) : { async: !1 }, s = t._zod.run({ value: e, issues: [] }, i);
358
- if (s instanceof Promise)
359
- throw new I();
360
- if (s.issues.length) {
361
- const c = new (r?.Err ?? n)(s.issues.map((u) => j(u, i, x())));
362
- throw jn(c, r?.callee), c;
363
- }
364
- return s.value;
365
- }, sn = (n) => async (t, e, o, r) => {
366
- const i = o ? Object.assign(o, { async: !0 }) : { async: !0 };
367
- let s = t._zod.run({ value: e, issues: [] }, i);
368
- if (s instanceof Promise && (s = await s), s.issues.length) {
369
- const c = new (r?.Err ?? n)(s.issues.map((u) => j(u, i, x())));
370
- throw jn(c, r?.callee), c;
371
- }
372
- return s.value;
373
- }, K = (n) => (t, e, o) => {
374
- const r = o ? { ...o, async: !1 } : { async: !1 }, i = t._zod.run({ value: e, issues: [] }, r);
375
- if (i instanceof Promise)
376
- throw new I();
377
- return i.issues.length ? {
378
- success: !1,
379
- error: new (n ?? An)(i.issues.map((s) => j(s, r, x())))
380
- } : { success: !0, data: i.value };
381
- }, ht = /* @__PURE__ */ K(In), G = (n) => async (t, e, o) => {
382
- const r = o ? Object.assign(o, { async: !0 }) : { async: !0 };
383
- let i = t._zod.run({ value: e, issues: [] }, r);
384
- return i instanceof Promise && (i = await i), i.issues.length ? {
385
- success: !1,
386
- error: new n(i.issues.map((s) => j(s, r, x())))
387
- } : { success: !0, data: i.value };
388
- }, mt = /* @__PURE__ */ G(In), gt = (n) => (t, e, o) => {
389
- const r = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
390
- return rn(n)(t, e, r);
391
- }, vt = (n) => (t, e, o) => rn(n)(t, e, o), yt = (n) => async (t, e, o) => {
392
- const r = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
393
- return sn(n)(t, e, r);
394
- }, _t = (n) => async (t, e, o) => sn(n)(t, e, o), wt = (n) => (t, e, o) => {
395
- const r = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
396
- return K(n)(t, e, r);
397
- }, zt = (n) => (t, e, o) => K(n)(t, e, o), bt = (n) => async (t, e, o) => {
398
- const r = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
399
- return G(n)(t, e, r);
400
- }, kt = (n) => async (t, e, o) => G(n)(t, e, o), $t = /^[cC][^\s-]{8,}$/, Zt = /^[0-9a-z]+$/, Ot = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, xt = /^[0-9a-vA-V]{20}$/, jt = /^[A-Za-z0-9]{27}$/, Et = /^[a-zA-Z0-9_-]{21}$/, St = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Pt = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, fn = (n) => n ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, At = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, It = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
401
- function Tt() {
402
- return new RegExp(It, "u");
403
- }
404
- const Nt = /^(?:(?: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])$/, Ft = /^(([0-9a-fA-F]{1,4}:){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}|:))$/, Ct = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/, Jt = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Rt = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, Tn = /^[A-Za-z0-9_-]*$/, Dt = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/, Ut = /^\+(?:[0-9]){6,14}[0-9]$/, Nn = "(?:(?:\\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])))", Vt = /* @__PURE__ */ new RegExp(`^${Nn}$`);
405
- function Fn(n) {
406
- const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
407
- return typeof n.precision == "number" ? n.precision === -1 ? `${t}` : n.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${n.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
408
- }
409
- function Lt(n) {
410
- return new RegExp(`^${Fn(n)}$`);
411
- }
412
- function Wt(n) {
413
- const t = Fn({ precision: n.precision }), e = ["Z"];
414
- n.local && e.push(""), n.offset && e.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
415
- const o = `${t}(?:${e.join("|")})`;
416
- return new RegExp(`^${Nn}T(?:${o})$`);
417
- }
418
- const Mt = (n) => {
419
- const t = n ? `[\\s\\S]{${n?.minimum ?? 0},${n?.maximum ?? ""}}` : "[\\s\\S]*";
420
- return new RegExp(`^${t}$`);
421
- }, Bt = /^[^A-Z]*$/, Kt = /^[^a-z]*$/, $ = /* @__PURE__ */ a("$ZodCheck", (n, t) => {
422
- var e;
423
- n._zod ?? (n._zod = {}), n._zod.def = t, (e = n._zod).onattach ?? (e.onattach = []);
424
- }), Gt = /* @__PURE__ */ a("$ZodCheckMaxLength", (n, t) => {
425
- var e;
426
- $.init(n, t), (e = n._zod.def).when ?? (e.when = (o) => {
427
- const r = o.value;
428
- return !tn(r) && r.length !== void 0;
429
- }), n._zod.onattach.push((o) => {
430
- const r = o._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
431
- t.maximum < r && (o._zod.bag.maximum = t.maximum);
432
- }), n._zod.check = (o) => {
433
- const r = o.value;
434
- if (r.length <= t.maximum)
435
- return;
436
- const i = on(r);
437
- o.issues.push({
438
- origin: i,
439
- code: "too_big",
440
- maximum: t.maximum,
441
- inclusive: !0,
442
- input: r,
443
- inst: n,
444
- continue: !t.abort
445
- });
446
- };
447
- }), Ht = /* @__PURE__ */ a("$ZodCheckMinLength", (n, t) => {
448
- var e;
449
- $.init(n, t), (e = n._zod.def).when ?? (e.when = (o) => {
450
- const r = o.value;
451
- return !tn(r) && r.length !== void 0;
452
- }), n._zod.onattach.push((o) => {
453
- const r = o._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
454
- t.minimum > r && (o._zod.bag.minimum = t.minimum);
455
- }), n._zod.check = (o) => {
456
- const r = o.value;
457
- if (r.length >= t.minimum)
458
- return;
459
- const i = on(r);
460
- o.issues.push({
461
- origin: i,
462
- code: "too_small",
463
- minimum: t.minimum,
464
- inclusive: !0,
465
- input: r,
466
- inst: n,
467
- continue: !t.abort
468
- });
469
- };
470
- }), qt = /* @__PURE__ */ a("$ZodCheckLengthEquals", (n, t) => {
471
- var e;
472
- $.init(n, t), (e = n._zod.def).when ?? (e.when = (o) => {
473
- const r = o.value;
474
- return !tn(r) && r.length !== void 0;
475
- }), n._zod.onattach.push((o) => {
476
- const r = o._zod.bag;
477
- r.minimum = t.length, r.maximum = t.length, r.length = t.length;
478
- }), n._zod.check = (o) => {
479
- const r = o.value, i = r.length;
480
- if (i === t.length)
481
- return;
482
- const s = on(r), c = i > t.length;
483
- o.issues.push({
484
- origin: s,
485
- ...c ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
486
- inclusive: !0,
487
- exact: !0,
488
- input: o.value,
489
- inst: n,
490
- continue: !t.abort
491
- });
492
- };
493
- }), H = /* @__PURE__ */ a("$ZodCheckStringFormat", (n, t) => {
494
- var e, o;
495
- $.init(n, t), n._zod.onattach.push((r) => {
496
- const i = r._zod.bag;
497
- i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern));
498
- }), t.pattern ? (e = n._zod).check ?? (e.check = (r) => {
499
- t.pattern.lastIndex = 0, !t.pattern.test(r.value) && r.issues.push({
500
- origin: "string",
501
- code: "invalid_format",
502
- format: t.format,
503
- input: r.value,
504
- ...t.pattern ? { pattern: t.pattern.toString() } : {},
505
- inst: n,
506
- continue: !t.abort
507
- });
508
- }) : (o = n._zod).check ?? (o.check = () => {
509
- });
510
- }), Yt = /* @__PURE__ */ a("$ZodCheckRegex", (n, t) => {
511
- H.init(n, t), n._zod.check = (e) => {
512
- t.pattern.lastIndex = 0, !t.pattern.test(e.value) && e.issues.push({
513
- origin: "string",
514
- code: "invalid_format",
515
- format: "regex",
516
- input: e.value,
517
- pattern: t.pattern.toString(),
518
- inst: n,
519
- continue: !t.abort
520
- });
521
- };
522
- }), Xt = /* @__PURE__ */ a("$ZodCheckLowerCase", (n, t) => {
523
- t.pattern ?? (t.pattern = Bt), H.init(n, t);
524
- }), Qt = /* @__PURE__ */ a("$ZodCheckUpperCase", (n, t) => {
525
- t.pattern ?? (t.pattern = Kt), H.init(n, t);
526
- }), ne = /* @__PURE__ */ a("$ZodCheckIncludes", (n, t) => {
527
- $.init(n, t);
528
- const e = B(t.includes), o = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${e}` : e);
529
- t.pattern = o, n._zod.onattach.push((r) => {
530
- const i = r._zod.bag;
531
- i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(o);
532
- }), n._zod.check = (r) => {
533
- r.value.includes(t.includes, t.position) || r.issues.push({
534
- origin: "string",
535
- code: "invalid_format",
536
- format: "includes",
537
- includes: t.includes,
538
- input: r.value,
539
- inst: n,
540
- continue: !t.abort
541
- });
542
- };
543
- }), te = /* @__PURE__ */ a("$ZodCheckStartsWith", (n, t) => {
544
- $.init(n, t);
545
- const e = new RegExp(`^${B(t.prefix)}.*`);
546
- t.pattern ?? (t.pattern = e), n._zod.onattach.push((o) => {
547
- const r = o._zod.bag;
548
- r.patterns ?? (r.patterns = /* @__PURE__ */ new Set()), r.patterns.add(e);
549
- }), n._zod.check = (o) => {
550
- o.value.startsWith(t.prefix) || o.issues.push({
551
- origin: "string",
552
- code: "invalid_format",
553
- format: "starts_with",
554
- prefix: t.prefix,
555
- input: o.value,
556
- inst: n,
557
- continue: !t.abort
558
- });
559
- };
560
- }), ee = /* @__PURE__ */ a("$ZodCheckEndsWith", (n, t) => {
561
- $.init(n, t);
562
- const e = new RegExp(`.*${B(t.suffix)}$`);
563
- t.pattern ?? (t.pattern = e), n._zod.onattach.push((o) => {
564
- const r = o._zod.bag;
565
- r.patterns ?? (r.patterns = /* @__PURE__ */ new Set()), r.patterns.add(e);
566
- }), n._zod.check = (o) => {
567
- o.value.endsWith(t.suffix) || o.issues.push({
568
- origin: "string",
569
- code: "invalid_format",
570
- format: "ends_with",
571
- suffix: t.suffix,
572
- input: o.value,
573
- inst: n,
574
- continue: !t.abort
575
- });
576
- };
577
- }), oe = /* @__PURE__ */ a("$ZodCheckOverwrite", (n, t) => {
578
- $.init(n, t), n._zod.check = (e) => {
579
- e.value = t.tx(e.value);
580
- };
581
- });
582
- class re {
583
- constructor(t = []) {
584
- this.content = [], this.indent = 0, this && (this.args = t);
585
- }
586
- indented(t) {
587
- this.indent += 1, t(this), this.indent -= 1;
588
- }
589
- write(t) {
590
- if (typeof t == "function") {
591
- t(this, { execution: "sync" }), t(this, { execution: "async" });
592
- return;
593
- }
594
- const e = t.split(`
595
- `).filter((i) => i), o = Math.min(...e.map((i) => i.length - i.trimStart().length)), r = e.map((i) => i.slice(o)).map((i) => " ".repeat(this.indent * 2) + i);
596
- for (const i of r)
597
- this.content.push(i);
598
- }
599
- compile() {
600
- const t = Function, e = this?.args, o = [...(this?.content ?? [""]).map((r) => ` ${r}`)];
601
- return new t(...e, o.join(`
602
- `));
603
- }
604
- }
605
- const ie = {
606
- major: 4,
607
- minor: 1,
608
- patch: 12
609
- }, _ = /* @__PURE__ */ a("$ZodType", (n, t) => {
610
- var e;
611
- n ?? (n = {}), n._zod.def = t, n._zod.bag = n._zod.bag || {}, n._zod.version = ie;
612
- const o = [...n._zod.def.checks ?? []];
613
- n._zod.traits.has("$ZodCheck") && o.unshift(n);
614
- for (const r of o)
615
- for (const i of r._zod.onattach)
616
- i(n);
617
- if (o.length === 0)
618
- (e = n._zod).deferred ?? (e.deferred = []), n._zod.deferred?.push(() => {
619
- n._zod.run = n._zod.parse;
620
- });
621
- else {
622
- const r = (s, c, u) => {
623
- let d = P(s), l;
624
- for (const p of c) {
625
- if (p._zod.def.when) {
626
- if (!p._zod.def.when(s))
627
- continue;
628
- } else if (d)
629
- continue;
630
- const m = s.issues.length, z = p._zod.check(s);
631
- if (z instanceof Promise && u?.async === !1)
632
- throw new I();
633
- if (l || z instanceof Promise)
634
- l = (l ?? Promise.resolve()).then(async () => {
635
- await z, s.issues.length !== m && (d || (d = P(s, m)));
636
- });
637
- else {
638
- if (s.issues.length === m)
639
- continue;
640
- d || (d = P(s, m));
641
- }
642
- }
643
- return l ? l.then(() => s) : s;
644
- }, i = (s, c, u) => {
645
- if (P(s))
646
- return s.aborted = !0, s;
647
- const d = r(c, o, u);
648
- if (d instanceof Promise) {
649
- if (u.async === !1)
650
- throw new I();
651
- return d.then((l) => n._zod.parse(l, u));
652
- }
653
- return n._zod.parse(d, u);
654
- };
655
- n._zod.run = (s, c) => {
656
- if (c.skipChecks)
657
- return n._zod.parse(s, c);
658
- if (c.direction === "backward") {
659
- const d = n._zod.parse({ value: s.value, issues: [] }, { ...c, skipChecks: !0 });
660
- return d instanceof Promise ? d.then((l) => i(l, s, c)) : i(d, s, c);
661
- }
662
- const u = n._zod.parse(s, c);
663
- if (u instanceof Promise) {
664
- if (c.async === !1)
665
- throw new I();
666
- return u.then((d) => r(d, o, c));
667
- }
668
- return r(u, o, c);
669
- };
670
- }
671
- n["~standard"] = {
672
- validate: (r) => {
673
- try {
674
- const i = ht(n, r);
675
- return i.success ? { value: i.data } : { issues: i.error?.issues };
676
- } catch {
677
- return mt(n, r).then((i) => i.success ? { value: i.data } : { issues: i.error?.issues });
678
- }
679
- },
680
- vendor: "zod",
681
- version: 1
682
- };
683
- }), an = /* @__PURE__ */ a("$ZodString", (n, t) => {
684
- _.init(n, t), n._zod.pattern = [...n?._zod.bag?.patterns ?? []].pop() ?? Mt(n._zod.bag), n._zod.parse = (e, o) => {
685
- if (t.coerce)
686
- try {
687
- e.value = String(e.value);
688
- } catch {
689
- }
690
- return typeof e.value == "string" || e.issues.push({
691
- expected: "string",
692
- code: "invalid_type",
693
- input: e.value,
694
- inst: n
695
- }), e;
696
- };
697
- }), v = /* @__PURE__ */ a("$ZodStringFormat", (n, t) => {
698
- H.init(n, t), an.init(n, t);
699
- }), se = /* @__PURE__ */ a("$ZodGUID", (n, t) => {
700
- t.pattern ?? (t.pattern = Pt), v.init(n, t);
701
- }), ae = /* @__PURE__ */ a("$ZodUUID", (n, t) => {
702
- if (t.version) {
703
- const e = {
704
- v1: 1,
705
- v2: 2,
706
- v3: 3,
707
- v4: 4,
708
- v5: 5,
709
- v6: 6,
710
- v7: 7,
711
- v8: 8
712
- }[t.version];
713
- if (e === void 0)
714
- throw new Error(`Invalid UUID version: "${t.version}"`);
715
- t.pattern ?? (t.pattern = fn(e));
716
- } else
717
- t.pattern ?? (t.pattern = fn());
718
- v.init(n, t);
719
- }), ce = /* @__PURE__ */ a("$ZodEmail", (n, t) => {
720
- t.pattern ?? (t.pattern = At), v.init(n, t);
721
- }), ue = /* @__PURE__ */ a("$ZodURL", (n, t) => {
722
- v.init(n, t), n._zod.check = (e) => {
723
- try {
724
- const o = e.value.trim(), r = new URL(o);
725
- t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(r.hostname) || e.issues.push({
726
- code: "invalid_format",
727
- format: "url",
728
- note: "Invalid hostname",
729
- pattern: Dt.source,
730
- input: e.value,
731
- inst: n,
732
- continue: !t.abort
733
- })), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(r.protocol.endsWith(":") ? r.protocol.slice(0, -1) : r.protocol) || e.issues.push({
734
- code: "invalid_format",
735
- format: "url",
736
- note: "Invalid protocol",
737
- pattern: t.protocol.source,
738
- input: e.value,
739
- inst: n,
740
- continue: !t.abort
741
- })), t.normalize ? e.value = r.href : e.value = o;
742
- return;
743
- } catch {
744
- e.issues.push({
745
- code: "invalid_format",
746
- format: "url",
747
- input: e.value,
748
- inst: n,
749
- continue: !t.abort
750
- });
751
- }
752
- };
753
- }), de = /* @__PURE__ */ a("$ZodEmoji", (n, t) => {
754
- t.pattern ?? (t.pattern = Tt()), v.init(n, t);
755
- }), fe = /* @__PURE__ */ a("$ZodNanoID", (n, t) => {
756
- t.pattern ?? (t.pattern = Et), v.init(n, t);
757
- }), le = /* @__PURE__ */ a("$ZodCUID", (n, t) => {
758
- t.pattern ?? (t.pattern = $t), v.init(n, t);
759
- }), pe = /* @__PURE__ */ a("$ZodCUID2", (n, t) => {
760
- t.pattern ?? (t.pattern = Zt), v.init(n, t);
761
- }), he = /* @__PURE__ */ a("$ZodULID", (n, t) => {
762
- t.pattern ?? (t.pattern = Ot), v.init(n, t);
763
- }), me = /* @__PURE__ */ a("$ZodXID", (n, t) => {
764
- t.pattern ?? (t.pattern = xt), v.init(n, t);
765
- }), ge = /* @__PURE__ */ a("$ZodKSUID", (n, t) => {
766
- t.pattern ?? (t.pattern = jt), v.init(n, t);
767
- }), ve = /* @__PURE__ */ a("$ZodISODateTime", (n, t) => {
768
- t.pattern ?? (t.pattern = Wt(t)), v.init(n, t);
769
- }), ye = /* @__PURE__ */ a("$ZodISODate", (n, t) => {
770
- t.pattern ?? (t.pattern = Vt), v.init(n, t);
771
- }), _e = /* @__PURE__ */ a("$ZodISOTime", (n, t) => {
772
- t.pattern ?? (t.pattern = Lt(t)), v.init(n, t);
773
- }), we = /* @__PURE__ */ a("$ZodISODuration", (n, t) => {
774
- t.pattern ?? (t.pattern = St), v.init(n, t);
775
- }), ze = /* @__PURE__ */ a("$ZodIPv4", (n, t) => {
776
- t.pattern ?? (t.pattern = Nt), v.init(n, t), n._zod.onattach.push((e) => {
777
- const o = e._zod.bag;
778
- o.format = "ipv4";
779
- });
780
- }), be = /* @__PURE__ */ a("$ZodIPv6", (n, t) => {
781
- t.pattern ?? (t.pattern = Ft), v.init(n, t), n._zod.onattach.push((e) => {
782
- const o = e._zod.bag;
783
- o.format = "ipv6";
784
- }), n._zod.check = (e) => {
785
- try {
786
- new URL(`http://[${e.value}]`);
787
- } catch {
788
- e.issues.push({
789
- code: "invalid_format",
790
- format: "ipv6",
791
- input: e.value,
792
- inst: n,
793
- continue: !t.abort
794
- });
795
- }
796
- };
797
- }), ke = /* @__PURE__ */ a("$ZodCIDRv4", (n, t) => {
798
- t.pattern ?? (t.pattern = Ct), v.init(n, t);
799
- }), $e = /* @__PURE__ */ a("$ZodCIDRv6", (n, t) => {
800
- t.pattern ?? (t.pattern = Jt), v.init(n, t), n._zod.check = (e) => {
801
- const o = e.value.split("/");
802
- try {
803
- if (o.length !== 2)
804
- throw new Error();
805
- const [r, i] = o;
806
- if (!i)
807
- throw new Error();
808
- const s = Number(i);
809
- if (`${s}` !== i)
810
- throw new Error();
811
- if (s < 0 || s > 128)
812
- throw new Error();
813
- new URL(`http://[${r}]`);
814
- } catch {
815
- e.issues.push({
816
- code: "invalid_format",
817
- format: "cidrv6",
818
- input: e.value,
819
- inst: n,
820
- continue: !t.abort
821
- });
822
- }
823
- };
824
- });
825
- function Cn(n) {
826
- if (n === "")
827
- return !0;
828
- if (n.length % 4 !== 0)
829
- return !1;
830
- try {
831
- return atob(n), !0;
832
- } catch {
833
- return !1;
834
- }
835
- }
836
- const Ze = /* @__PURE__ */ a("$ZodBase64", (n, t) => {
837
- t.pattern ?? (t.pattern = Rt), v.init(n, t), n._zod.onattach.push((e) => {
838
- e._zod.bag.contentEncoding = "base64";
839
- }), n._zod.check = (e) => {
840
- Cn(e.value) || e.issues.push({
841
- code: "invalid_format",
842
- format: "base64",
843
- input: e.value,
844
- inst: n,
845
- continue: !t.abort
846
- });
847
- };
848
- });
849
- function Oe(n) {
850
- if (!Tn.test(n))
851
- return !1;
852
- const t = n.replace(/[-_]/g, (o) => o === "-" ? "+" : "/"), e = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
853
- return Cn(e);
854
- }
855
- const xe = /* @__PURE__ */ a("$ZodBase64URL", (n, t) => {
856
- t.pattern ?? (t.pattern = Tn), v.init(n, t), n._zod.onattach.push((e) => {
857
- e._zod.bag.contentEncoding = "base64url";
858
- }), n._zod.check = (e) => {
859
- Oe(e.value) || e.issues.push({
860
- code: "invalid_format",
861
- format: "base64url",
862
- input: e.value,
863
- inst: n,
864
- continue: !t.abort
865
- });
866
- };
867
- }), je = /* @__PURE__ */ a("$ZodE164", (n, t) => {
868
- t.pattern ?? (t.pattern = Ut), v.init(n, t);
869
- });
870
- function Ee(n, t = null) {
871
- try {
872
- const e = n.split(".");
873
- if (e.length !== 3)
874
- return !1;
875
- const [o] = e;
876
- if (!o)
877
- return !1;
878
- const r = JSON.parse(atob(o));
879
- return !("typ" in r && r?.typ !== "JWT" || !r.alg || t && (!("alg" in r) || r.alg !== t));
880
- } catch {
881
- return !1;
882
- }
883
- }
884
- const Se = /* @__PURE__ */ a("$ZodJWT", (n, t) => {
885
- v.init(n, t), n._zod.check = (e) => {
886
- Ee(e.value, t.alg) || e.issues.push({
887
- code: "invalid_format",
888
- format: "jwt",
889
- input: e.value,
890
- inst: n,
891
- continue: !t.abort
892
- });
893
- };
894
- }), Pe = /* @__PURE__ */ a("$ZodUnknown", (n, t) => {
895
- _.init(n, t), n._zod.parse = (e) => e;
896
- }), Ae = /* @__PURE__ */ a("$ZodNever", (n, t) => {
897
- _.init(n, t), n._zod.parse = (e, o) => (e.issues.push({
898
- expected: "never",
899
- code: "invalid_type",
900
- input: e.value,
901
- inst: n
902
- }), e);
903
- });
904
- function ln(n, t, e) {
905
- n.issues.length && t.issues.push(...Sn(e, n.issues)), t.value[e] = n.value;
906
- }
907
- const Ie = /* @__PURE__ */ a("$ZodArray", (n, t) => {
908
- _.init(n, t), n._zod.parse = (e, o) => {
909
- const r = e.value;
910
- if (!Array.isArray(r))
911
- return e.issues.push({
912
- expected: "array",
913
- code: "invalid_type",
914
- input: r,
915
- inst: n
916
- }), e;
917
- e.value = Array(r.length);
918
- const i = [];
919
- for (let s = 0; s < r.length; s++) {
920
- const c = r[s], u = t.element._zod.run({
921
- value: c,
922
- issues: []
923
- }, o);
924
- u instanceof Promise ? i.push(u.then((d) => ln(d, e, s))) : ln(u, e, s);
925
- }
926
- return i.length ? Promise.all(i).then(() => e) : e;
927
- };
928
- });
929
- function W(n, t, e, o) {
930
- n.issues.length && t.issues.push(...Sn(e, n.issues)), n.value === void 0 ? e in o && (t.value[e] = void 0) : t.value[e] = n.value;
931
- }
932
- function Jn(n) {
933
- const t = Object.keys(n.shape);
934
- for (const o of t)
935
- if (!n.shape?.[o]?._zod?.traits?.has("$ZodType"))
936
- throw new Error(`Invalid element at key "${o}": expected a Zod schema`);
937
- const e = rt(n.shape);
938
- return {
939
- ...n,
940
- keys: t,
941
- keySet: new Set(t),
942
- numKeys: t.length,
943
- optionalKeys: new Set(e)
944
- };
945
- }
946
- function Rn(n, t, e, o, r, i) {
947
- const s = [], c = r.keySet, u = r.catchall._zod, d = u.def.type;
948
- for (const l of Object.keys(t)) {
949
- if (c.has(l))
950
- continue;
951
- if (d === "never") {
952
- s.push(l);
953
- continue;
954
- }
955
- const p = u.run({ value: t[l], issues: [] }, o);
956
- p instanceof Promise ? n.push(p.then((m) => W(m, e, l, t))) : W(p, e, l, t);
957
- }
958
- return s.length && e.issues.push({
959
- code: "unrecognized_keys",
960
- keys: s,
961
- input: t,
962
- inst: i
963
- }), n.length ? Promise.all(n).then(() => e) : e;
964
- }
965
- const Te = /* @__PURE__ */ a("$ZodObject", (n, t) => {
966
- if (_.init(n, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
967
- const s = t.shape;
968
- Object.defineProperty(t, "shape", {
969
- get: () => {
970
- const c = { ...s };
971
- return Object.defineProperty(t, "shape", {
972
- value: c
973
- }), c;
974
- }
975
- });
976
- }
977
- const e = nn(() => Jn(t));
978
- g(n._zod, "propValues", () => {
979
- const s = t.shape, c = {};
980
- for (const u in s) {
981
- const d = s[u]._zod;
982
- if (d.values) {
983
- c[u] ?? (c[u] = /* @__PURE__ */ new Set());
984
- for (const l of d.values)
985
- c[u].add(l);
986
- }
987
- }
988
- return c;
989
- });
990
- const o = L, r = t.catchall;
991
- let i;
992
- n._zod.parse = (s, c) => {
993
- i ?? (i = e.value);
994
- const u = s.value;
995
- if (!o(u))
996
- return s.issues.push({
997
- expected: "object",
998
- code: "invalid_type",
999
- input: u,
1000
- inst: n
1001
- }), s;
1002
- s.value = {};
1003
- const d = [], l = i.shape;
1004
- for (const p of i.keys) {
1005
- const m = l[p]._zod.run({ value: u[p], issues: [] }, c);
1006
- m instanceof Promise ? d.push(m.then((z) => W(z, s, p, u))) : W(m, s, p, u);
1007
- }
1008
- return r ? Rn(d, u, s, c, e.value, n) : d.length ? Promise.all(d).then(() => s) : s;
1009
- };
1010
- }), Ne = /* @__PURE__ */ a("$ZodObjectJIT", (n, t) => {
1011
- Te.init(n, t);
1012
- const e = n._zod.parse, o = nn(() => Jn(t)), r = (p) => {
1013
- const m = new re(["shape", "payload", "ctx"]), z = o.value, Kn = (Z) => {
1014
- const k = dn(Z);
1015
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1016
- };
1017
- m.write("const input = payload.value;");
1018
- const cn = /* @__PURE__ */ Object.create(null);
1019
- let Gn = 0;
1020
- for (const Z of z.keys)
1021
- cn[Z] = `key_${Gn++}`;
1022
- m.write("const newResult = {};");
1023
- for (const Z of z.keys) {
1024
- const k = cn[Z], T = dn(Z);
1025
- m.write(`const ${k} = ${Kn(Z)};`), m.write(`
1026
- if (${k}.issues.length) {
1027
- payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
1028
- ...iss,
1029
- path: iss.path ? [${T}, ...iss.path] : [${T}]
1030
- })));
1031
- }
1032
-
1033
-
1034
- if (${k}.value === undefined) {
1035
- if (${T} in input) {
1036
- newResult[${T}] = undefined;
1037
- }
1038
- } else {
1039
- newResult[${T}] = ${k}.value;
1040
- }
1041
-
1042
- `);
1043
- }
1044
- m.write("payload.value = newResult;"), m.write("return payload;");
1045
- const Hn = m.compile();
1046
- return (Z, k) => Hn(p, Z, k);
1047
- };
1048
- let i;
1049
- const s = L, c = !xn.jitless, u = c && et.value, d = t.catchall;
1050
- let l;
1051
- n._zod.parse = (p, m) => {
1052
- l ?? (l = o.value);
1053
- const z = p.value;
1054
- return s(z) ? c && u && m?.async === !1 && m.jitless !== !0 ? (i || (i = r(t.shape)), p = i(p, m), d ? Rn([], z, p, m, l, n) : p) : e(p, m) : (p.issues.push({
1055
- expected: "object",
1056
- code: "invalid_type",
1057
- input: z,
1058
- inst: n
1059
- }), p);
1060
- };
1061
- });
1062
- function pn(n, t, e, o) {
1063
- for (const i of n)
1064
- if (i.issues.length === 0)
1065
- return t.value = i.value, t;
1066
- const r = n.filter((i) => !P(i));
1067
- return r.length === 1 ? (t.value = r[0].value, r[0]) : (t.issues.push({
1068
- code: "invalid_union",
1069
- input: t.value,
1070
- inst: e,
1071
- errors: n.map((i) => i.issues.map((s) => j(s, o, x())))
1072
- }), t);
1073
- }
1074
- const Fe = /* @__PURE__ */ a("$ZodUnion", (n, t) => {
1075
- _.init(n, t), g(n._zod, "optin", () => t.options.some((r) => r._zod.optin === "optional") ? "optional" : void 0), g(n._zod, "optout", () => t.options.some((r) => r._zod.optout === "optional") ? "optional" : void 0), g(n._zod, "values", () => {
1076
- if (t.options.every((r) => r._zod.values))
1077
- return new Set(t.options.flatMap((r) => Array.from(r._zod.values)));
1078
- }), g(n._zod, "pattern", () => {
1079
- if (t.options.every((r) => r._zod.pattern)) {
1080
- const r = t.options.map((i) => i._zod.pattern);
1081
- return new RegExp(`^(${r.map((i) => en(i.source)).join("|")})$`);
1082
- }
1083
- });
1084
- const e = t.options.length === 1, o = t.options[0]._zod.run;
1085
- n._zod.parse = (r, i) => {
1086
- if (e)
1087
- return o(r, i);
1088
- let s = !1;
1089
- const c = [];
1090
- for (const u of t.options) {
1091
- const d = u._zod.run({
1092
- value: r.value,
1093
- issues: []
1094
- }, i);
1095
- if (d instanceof Promise)
1096
- c.push(d), s = !0;
1097
- else {
1098
- if (d.issues.length === 0)
1099
- return d;
1100
- c.push(d);
1101
- }
1102
- }
1103
- return s ? Promise.all(c).then((u) => pn(u, r, n, i)) : pn(c, r, n, i);
1104
- };
1105
- }), Ce = /* @__PURE__ */ a("$ZodIntersection", (n, t) => {
1106
- _.init(n, t), n._zod.parse = (e, o) => {
1107
- const r = e.value, i = t.left._zod.run({ value: r, issues: [] }, o), s = t.right._zod.run({ value: r, issues: [] }, o);
1108
- return i instanceof Promise || s instanceof Promise ? Promise.all([i, s]).then(([c, u]) => hn(e, c, u)) : hn(e, i, s);
1109
- };
1110
- });
1111
- function Y(n, t) {
1112
- if (n === t)
1113
- return { valid: !0, data: n };
1114
- if (n instanceof Date && t instanceof Date && +n == +t)
1115
- return { valid: !0, data: n };
1116
- if (F(n) && F(t)) {
1117
- const e = Object.keys(t), o = Object.keys(n).filter((i) => e.indexOf(i) !== -1), r = { ...n, ...t };
1118
- for (const i of o) {
1119
- const s = Y(n[i], t[i]);
1120
- if (!s.valid)
1121
- return {
1122
- valid: !1,
1123
- mergeErrorPath: [i, ...s.mergeErrorPath]
1124
- };
1125
- r[i] = s.data;
1126
- }
1127
- return { valid: !0, data: r };
1128
- }
1129
- if (Array.isArray(n) && Array.isArray(t)) {
1130
- if (n.length !== t.length)
1131
- return { valid: !1, mergeErrorPath: [] };
1132
- const e = [];
1133
- for (let o = 0; o < n.length; o++) {
1134
- const r = n[o], i = t[o], s = Y(r, i);
1135
- if (!s.valid)
1136
- return {
1137
- valid: !1,
1138
- mergeErrorPath: [o, ...s.mergeErrorPath]
1139
- };
1140
- e.push(s.data);
1141
- }
1142
- return { valid: !0, data: e };
1143
- }
1144
- return { valid: !1, mergeErrorPath: [] };
1145
- }
1146
- function hn(n, t, e) {
1147
- if (t.issues.length && n.issues.push(...t.issues), e.issues.length && n.issues.push(...e.issues), P(n))
1148
- return n;
1149
- const o = Y(t.value, e.value);
1150
- if (!o.valid)
1151
- throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);
1152
- return n.value = o.data, n;
1153
- }
1154
- const Je = /* @__PURE__ */ a("$ZodEnum", (n, t) => {
1155
- _.init(n, t);
1156
- const e = tt(t.entries), o = new Set(e);
1157
- n._zod.values = o, n._zod.pattern = new RegExp(`^(${e.filter((r) => ot.has(typeof r)).map((r) => typeof r == "string" ? B(r) : r.toString()).join("|")})$`), n._zod.parse = (r, i) => {
1158
- const s = r.value;
1159
- return o.has(s) || r.issues.push({
1160
- code: "invalid_value",
1161
- values: e,
1162
- input: s,
1163
- inst: n
1164
- }), r;
1165
- };
1166
- }), Re = /* @__PURE__ */ a("$ZodTransform", (n, t) => {
1167
- _.init(n, t), n._zod.parse = (e, o) => {
1168
- if (o.direction === "backward")
1169
- throw new On(n.constructor.name);
1170
- const r = t.transform(e.value, e);
1171
- if (o.async)
1172
- return (r instanceof Promise ? r : Promise.resolve(r)).then((i) => (e.value = i, e));
1173
- if (r instanceof Promise)
1174
- throw new I();
1175
- return e.value = r, e;
1176
- };
1177
- });
1178
- function mn(n, t) {
1179
- return n.issues.length && t === void 0 ? { issues: [], value: void 0 } : n;
1180
- }
1181
- const De = /* @__PURE__ */ a("$ZodOptional", (n, t) => {
1182
- _.init(n, t), n._zod.optin = "optional", n._zod.optout = "optional", g(n._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), g(n._zod, "pattern", () => {
1183
- const e = t.innerType._zod.pattern;
1184
- return e ? new RegExp(`^(${en(e.source)})?$`) : void 0;
1185
- }), n._zod.parse = (e, o) => {
1186
- if (t.innerType._zod.optin === "optional") {
1187
- const r = t.innerType._zod.run(e, o);
1188
- return r instanceof Promise ? r.then((i) => mn(i, e.value)) : mn(r, e.value);
1189
- }
1190
- return e.value === void 0 ? e : t.innerType._zod.run(e, o);
1191
- };
1192
- }), Ue = /* @__PURE__ */ a("$ZodNullable", (n, t) => {
1193
- _.init(n, t), g(n._zod, "optin", () => t.innerType._zod.optin), g(n._zod, "optout", () => t.innerType._zod.optout), g(n._zod, "pattern", () => {
1194
- const e = t.innerType._zod.pattern;
1195
- return e ? new RegExp(`^(${en(e.source)}|null)$`) : void 0;
1196
- }), g(n._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), n._zod.parse = (e, o) => e.value === null ? e : t.innerType._zod.run(e, o);
1197
- }), Ve = /* @__PURE__ */ a("$ZodDefault", (n, t) => {
1198
- _.init(n, t), n._zod.optin = "optional", g(n._zod, "values", () => t.innerType._zod.values), n._zod.parse = (e, o) => {
1199
- if (o.direction === "backward")
1200
- return t.innerType._zod.run(e, o);
1201
- if (e.value === void 0)
1202
- return e.value = t.defaultValue, e;
1203
- const r = t.innerType._zod.run(e, o);
1204
- return r instanceof Promise ? r.then((i) => gn(i, t)) : gn(r, t);
1205
- };
1206
- });
1207
- function gn(n, t) {
1208
- return n.value === void 0 && (n.value = t.defaultValue), n;
1209
- }
1210
- const Le = /* @__PURE__ */ a("$ZodPrefault", (n, t) => {
1211
- _.init(n, t), n._zod.optin = "optional", g(n._zod, "values", () => t.innerType._zod.values), n._zod.parse = (e, o) => (o.direction === "backward" || e.value === void 0 && (e.value = t.defaultValue), t.innerType._zod.run(e, o));
1212
- }), We = /* @__PURE__ */ a("$ZodNonOptional", (n, t) => {
1213
- _.init(n, t), g(n._zod, "values", () => {
1214
- const e = t.innerType._zod.values;
1215
- return e ? new Set([...e].filter((o) => o !== void 0)) : void 0;
1216
- }), n._zod.parse = (e, o) => {
1217
- const r = t.innerType._zod.run(e, o);
1218
- return r instanceof Promise ? r.then((i) => vn(i, n)) : vn(r, n);
1219
- };
1220
- });
1221
- function vn(n, t) {
1222
- return !n.issues.length && n.value === void 0 && n.issues.push({
1223
- code: "invalid_type",
1224
- expected: "nonoptional",
1225
- input: n.value,
1226
- inst: t
1227
- }), n;
1228
- }
1229
- const Me = /* @__PURE__ */ a("$ZodCatch", (n, t) => {
1230
- _.init(n, t), g(n._zod, "optin", () => t.innerType._zod.optin), g(n._zod, "optout", () => t.innerType._zod.optout), g(n._zod, "values", () => t.innerType._zod.values), n._zod.parse = (e, o) => {
1231
- if (o.direction === "backward")
1232
- return t.innerType._zod.run(e, o);
1233
- const r = t.innerType._zod.run(e, o);
1234
- return r instanceof Promise ? r.then((i) => (e.value = i.value, i.issues.length && (e.value = t.catchValue({
1235
- ...e,
1236
- error: {
1237
- issues: i.issues.map((s) => j(s, o, x()))
1238
- },
1239
- input: e.value
1240
- }), e.issues = []), e)) : (e.value = r.value, r.issues.length && (e.value = t.catchValue({
1241
- ...e,
1242
- error: {
1243
- issues: r.issues.map((i) => j(i, o, x()))
1244
- },
1245
- input: e.value
1246
- }), e.issues = []), e);
1247
- };
1248
- }), Be = /* @__PURE__ */ a("$ZodPipe", (n, t) => {
1249
- _.init(n, t), g(n._zod, "values", () => t.in._zod.values), g(n._zod, "optin", () => t.in._zod.optin), g(n._zod, "optout", () => t.out._zod.optout), g(n._zod, "propValues", () => t.in._zod.propValues), n._zod.parse = (e, o) => {
1250
- if (o.direction === "backward") {
1251
- const i = t.out._zod.run(e, o);
1252
- return i instanceof Promise ? i.then((s) => D(s, t.in, o)) : D(i, t.in, o);
1253
- }
1254
- const r = t.in._zod.run(e, o);
1255
- return r instanceof Promise ? r.then((i) => D(i, t.out, o)) : D(r, t.out, o);
1256
- };
1257
- });
1258
- function D(n, t, e) {
1259
- return n.issues.length ? (n.aborted = !0, n) : t._zod.run({ value: n.value, issues: n.issues }, e);
1260
- }
1261
- const Ke = /* @__PURE__ */ a("$ZodReadonly", (n, t) => {
1262
- _.init(n, t), g(n._zod, "propValues", () => t.innerType._zod.propValues), g(n._zod, "values", () => t.innerType._zod.values), g(n._zod, "optin", () => t.innerType._zod.optin), g(n._zod, "optout", () => t.innerType._zod.optout), n._zod.parse = (e, o) => {
1263
- if (o.direction === "backward")
1264
- return t.innerType._zod.run(e, o);
1265
- const r = t.innerType._zod.run(e, o);
1266
- return r instanceof Promise ? r.then(yn) : yn(r);
1267
- };
1268
- });
1269
- function yn(n) {
1270
- return n.value = Object.freeze(n.value), n;
1271
- }
1272
- const Ge = /* @__PURE__ */ a("$ZodCustom", (n, t) => {
1273
- $.init(n, t), _.init(n, t), n._zod.parse = (e, o) => e, n._zod.check = (e) => {
1274
- const o = e.value, r = t.fn(o);
1275
- if (r instanceof Promise)
1276
- return r.then((i) => _n(i, e, o, n));
1277
- _n(r, e, o, n);
1278
- };
1279
- });
1280
- function _n(n, t, e, o) {
1281
- if (!n) {
1282
- const r = {
1283
- code: "custom",
1284
- input: e,
1285
- inst: o,
1286
- // incorporates params.error into issue reporting
1287
- path: [...o._zod.def.path ?? []],
1288
- // incorporates params.error into issue reporting
1289
- continue: !o._zod.def.abort
1290
- // params: inst._zod.def.params,
1291
- };
1292
- o._zod.def.params && (r.params = o._zod.def.params), t.issues.push(C(r));
1293
- }
1294
- }
1295
- class He {
1296
- constructor() {
1297
- this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
1298
- }
1299
- add(t, ...e) {
1300
- const o = e[0];
1301
- if (this._map.set(t, o), o && typeof o == "object" && "id" in o) {
1302
- if (this._idmap.has(o.id))
1303
- throw new Error(`ID ${o.id} already exists in the registry`);
1304
- this._idmap.set(o.id, t);
1305
- }
1306
- return this;
1307
- }
1308
- clear() {
1309
- return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
1310
- }
1311
- remove(t) {
1312
- const e = this._map.get(t);
1313
- return e && typeof e == "object" && "id" in e && this._idmap.delete(e.id), this._map.delete(t), this;
1314
- }
1315
- get(t) {
1316
- const e = t._zod.parent;
1317
- if (e) {
1318
- const o = { ...this.get(e) ?? {} };
1319
- delete o.id;
1320
- const r = { ...o, ...this._map.get(t) };
1321
- return Object.keys(r).length ? r : void 0;
1322
- }
1323
- return this._map.get(t);
1324
- }
1325
- has(t) {
1326
- return this._map.has(t);
1327
- }
1328
- }
1329
- function qe() {
1330
- return new He();
1331
- }
1332
- const U = /* @__PURE__ */ qe();
1333
- function Ye(n, t) {
1334
- return new n({
1335
- type: "string",
1336
- ...f(t)
1337
- });
1338
- }
1339
- function Xe(n, t) {
1340
- return new n({
1341
- type: "string",
1342
- format: "email",
1343
- check: "string_format",
1344
- abort: !1,
1345
- ...f(t)
1346
- });
1347
- }
1348
- function wn(n, t) {
1349
- return new n({
1350
- type: "string",
1351
- format: "guid",
1352
- check: "string_format",
1353
- abort: !1,
1354
- ...f(t)
1355
- });
1356
- }
1357
- function Qe(n, t) {
1358
- return new n({
1359
- type: "string",
1360
- format: "uuid",
1361
- check: "string_format",
1362
- abort: !1,
1363
- ...f(t)
1364
- });
1365
- }
1366
- function no(n, t) {
1367
- return new n({
1368
- type: "string",
1369
- format: "uuid",
1370
- check: "string_format",
1371
- abort: !1,
1372
- version: "v4",
1373
- ...f(t)
1374
- });
1375
- }
1376
- function to(n, t) {
1377
- return new n({
1378
- type: "string",
1379
- format: "uuid",
1380
- check: "string_format",
1381
- abort: !1,
1382
- version: "v6",
1383
- ...f(t)
1384
- });
1385
- }
1386
- function eo(n, t) {
1387
- return new n({
1388
- type: "string",
1389
- format: "uuid",
1390
- check: "string_format",
1391
- abort: !1,
1392
- version: "v7",
1393
- ...f(t)
1394
- });
1395
- }
1396
- function oo(n, t) {
1397
- return new n({
1398
- type: "string",
1399
- format: "url",
1400
- check: "string_format",
1401
- abort: !1,
1402
- ...f(t)
1403
- });
1404
- }
1405
- function ro(n, t) {
1406
- return new n({
1407
- type: "string",
1408
- format: "emoji",
1409
- check: "string_format",
1410
- abort: !1,
1411
- ...f(t)
1412
- });
1413
- }
1414
- function io(n, t) {
1415
- return new n({
1416
- type: "string",
1417
- format: "nanoid",
1418
- check: "string_format",
1419
- abort: !1,
1420
- ...f(t)
1421
- });
1422
- }
1423
- function so(n, t) {
1424
- return new n({
1425
- type: "string",
1426
- format: "cuid",
1427
- check: "string_format",
1428
- abort: !1,
1429
- ...f(t)
1430
- });
1431
- }
1432
- function ao(n, t) {
1433
- return new n({
1434
- type: "string",
1435
- format: "cuid2",
1436
- check: "string_format",
1437
- abort: !1,
1438
- ...f(t)
1439
- });
1440
- }
1441
- function co(n, t) {
1442
- return new n({
1443
- type: "string",
1444
- format: "ulid",
1445
- check: "string_format",
1446
- abort: !1,
1447
- ...f(t)
1448
- });
1449
- }
1450
- function uo(n, t) {
1451
- return new n({
1452
- type: "string",
1453
- format: "xid",
1454
- check: "string_format",
1455
- abort: !1,
1456
- ...f(t)
1457
- });
1458
- }
1459
- function fo(n, t) {
1460
- return new n({
1461
- type: "string",
1462
- format: "ksuid",
1463
- check: "string_format",
1464
- abort: !1,
1465
- ...f(t)
1466
- });
1467
- }
1468
- function lo(n, t) {
1469
- return new n({
1470
- type: "string",
1471
- format: "ipv4",
1472
- check: "string_format",
1473
- abort: !1,
1474
- ...f(t)
1475
- });
1476
- }
1477
- function po(n, t) {
1478
- return new n({
1479
- type: "string",
1480
- format: "ipv6",
1481
- check: "string_format",
1482
- abort: !1,
1483
- ...f(t)
1484
- });
1485
- }
1486
- function ho(n, t) {
1487
- return new n({
1488
- type: "string",
1489
- format: "cidrv4",
1490
- check: "string_format",
1491
- abort: !1,
1492
- ...f(t)
1493
- });
1494
- }
1495
- function mo(n, t) {
1496
- return new n({
1497
- type: "string",
1498
- format: "cidrv6",
1499
- check: "string_format",
1500
- abort: !1,
1501
- ...f(t)
1502
- });
1503
- }
1504
- function go(n, t) {
1505
- return new n({
1506
- type: "string",
1507
- format: "base64",
1508
- check: "string_format",
1509
- abort: !1,
1510
- ...f(t)
1511
- });
1512
- }
1513
- function vo(n, t) {
1514
- return new n({
1515
- type: "string",
1516
- format: "base64url",
1517
- check: "string_format",
1518
- abort: !1,
1519
- ...f(t)
1520
- });
1521
- }
1522
- function yo(n, t) {
1523
- return new n({
1524
- type: "string",
1525
- format: "e164",
1526
- check: "string_format",
1527
- abort: !1,
1528
- ...f(t)
1529
- });
1530
- }
1531
- function _o(n, t) {
1532
- return new n({
1533
- type: "string",
1534
- format: "jwt",
1535
- check: "string_format",
1536
- abort: !1,
1537
- ...f(t)
1538
- });
1539
- }
1540
- function wo(n, t) {
1541
- return new n({
1542
- type: "string",
1543
- format: "datetime",
1544
- check: "string_format",
1545
- offset: !1,
1546
- local: !1,
1547
- precision: null,
1548
- ...f(t)
1549
- });
1550
- }
1551
- function zo(n, t) {
1552
- return new n({
1553
- type: "string",
1554
- format: "date",
1555
- check: "string_format",
1556
- ...f(t)
1557
- });
1558
- }
1559
- function bo(n, t) {
1560
- return new n({
1561
- type: "string",
1562
- format: "time",
1563
- check: "string_format",
1564
- precision: null,
1565
- ...f(t)
1566
- });
1567
- }
1568
- function ko(n, t) {
1569
- return new n({
1570
- type: "string",
1571
- format: "duration",
1572
- check: "string_format",
1573
- ...f(t)
1574
- });
1575
- }
1576
- function $o(n) {
1577
- return new n({
1578
- type: "unknown"
1579
- });
1580
- }
1581
- function Zo(n, t) {
1582
- return new n({
1583
- type: "never",
1584
- ...f(t)
1585
- });
1586
- }
1587
- function Dn(n, t) {
1588
- return new Gt({
1589
- check: "max_length",
1590
- ...f(t),
1591
- maximum: n
1592
- });
1593
- }
1594
- function M(n, t) {
1595
- return new Ht({
1596
- check: "min_length",
1597
- ...f(t),
1598
- minimum: n
1599
- });
1600
- }
1601
- function Un(n, t) {
1602
- return new qt({
1603
- check: "length_equals",
1604
- ...f(t),
1605
- length: n
1606
- });
1607
- }
1608
- function Oo(n, t) {
1609
- return new Yt({
1610
- check: "string_format",
1611
- format: "regex",
1612
- ...f(t),
1613
- pattern: n
1614
- });
1615
- }
1616
- function xo(n) {
1617
- return new Xt({
1618
- check: "string_format",
1619
- format: "lowercase",
1620
- ...f(n)
1621
- });
1622
- }
1623
- function jo(n) {
1624
- return new Qt({
1625
- check: "string_format",
1626
- format: "uppercase",
1627
- ...f(n)
1628
- });
1629
- }
1630
- function Eo(n, t) {
1631
- return new ne({
1632
- check: "string_format",
1633
- format: "includes",
1634
- ...f(t),
1635
- includes: n
1636
- });
1637
- }
1638
- function So(n, t) {
1639
- return new te({
1640
- check: "string_format",
1641
- format: "starts_with",
1642
- ...f(t),
1643
- prefix: n
1644
- });
1645
- }
1646
- function Po(n, t) {
1647
- return new ee({
1648
- check: "string_format",
1649
- format: "ends_with",
1650
- ...f(t),
1651
- suffix: n
1652
- });
1653
- }
1654
- function J(n) {
1655
- return new oe({
1656
- check: "overwrite",
1657
- tx: n
1658
- });
1659
- }
1660
- function Ao(n) {
1661
- return J((t) => t.normalize(n));
1662
- }
1663
- function Io() {
1664
- return J((n) => n.trim());
1665
- }
1666
- function To() {
1667
- return J((n) => n.toLowerCase());
1668
- }
1669
- function No() {
1670
- return J((n) => n.toUpperCase());
1671
- }
1672
- function Fo(n, t, e) {
1673
- return new n({
1674
- type: "array",
1675
- element: t,
1676
- // get element() {
1677
- // return element;
1678
- // },
1679
- ...f(e)
1680
- });
1681
- }
1682
- function Co(n, t, e) {
1683
- return new n({
1684
- type: "custom",
1685
- check: "custom",
1686
- fn: t,
1687
- ...f(e)
1688
- });
1689
- }
1690
- function Jo(n) {
1691
- const t = Ro((e) => (e.addIssue = (o) => {
1692
- if (typeof o == "string")
1693
- e.issues.push(C(o, e.value, t._zod.def));
1694
- else {
1695
- const r = o;
1696
- r.fatal && (r.continue = !1), r.code ?? (r.code = "custom"), r.input ?? (r.input = e.value), r.inst ?? (r.inst = t), r.continue ?? (r.continue = !t._zod.def.abort), e.issues.push(C(r));
1697
- }
1698
- }, n(e.value, e)));
1699
- return t;
1700
- }
1701
- function Ro(n, t) {
1702
- const e = new $({
1703
- check: "custom",
1704
- ...f(t)
1705
- });
1706
- return e._zod.check = n, e;
1707
- }
1708
- const Do = /* @__PURE__ */ a("ZodISODateTime", (n, t) => {
1709
- ve.init(n, t), y.init(n, t);
1710
- });
1711
- function Uo(n) {
1712
- return wo(Do, n);
1713
- }
1714
- const Vo = /* @__PURE__ */ a("ZodISODate", (n, t) => {
1715
- ye.init(n, t), y.init(n, t);
1716
- });
1717
- function Lo(n) {
1718
- return zo(Vo, n);
1719
- }
1720
- const Wo = /* @__PURE__ */ a("ZodISOTime", (n, t) => {
1721
- _e.init(n, t), y.init(n, t);
1722
- });
1723
- function Mo(n) {
1724
- return bo(Wo, n);
1725
- }
1726
- const Bo = /* @__PURE__ */ a("ZodISODuration", (n, t) => {
1727
- we.init(n, t), y.init(n, t);
1728
- });
1729
- function Ko(n) {
1730
- return ko(Bo, n);
1731
- }
1732
- const Go = (n, t) => {
1733
- An.init(n, t), n.name = "ZodError", Object.defineProperties(n, {
1734
- format: {
1735
- value: (e) => pt(n, e)
1736
- // enumerable: false,
1737
- },
1738
- flatten: {
1739
- value: (e) => lt(n, e)
1740
- // enumerable: false,
1741
- },
1742
- addIssue: {
1743
- value: (e) => {
1744
- n.issues.push(e), n.message = JSON.stringify(n.issues, q, 2);
1745
- }
1746
- // enumerable: false,
1747
- },
1748
- addIssues: {
1749
- value: (e) => {
1750
- n.issues.push(...e), n.message = JSON.stringify(n.issues, q, 2);
1751
- }
1752
- // enumerable: false,
1753
- },
1754
- isEmpty: {
1755
- get() {
1756
- return n.issues.length === 0;
1757
- }
1758
- // enumerable: false,
1759
- }
1760
- });
1761
- }, b = a("ZodError", Go, {
1762
- Parent: Error
1763
- }), Ho = /* @__PURE__ */ rn(b), qo = /* @__PURE__ */ sn(b), Yo = /* @__PURE__ */ K(b), Xo = /* @__PURE__ */ G(b), Qo = /* @__PURE__ */ gt(b), nr = /* @__PURE__ */ vt(b), tr = /* @__PURE__ */ yt(b), er = /* @__PURE__ */ _t(b), or = /* @__PURE__ */ wt(b), rr = /* @__PURE__ */ zt(b), ir = /* @__PURE__ */ bt(b), sr = /* @__PURE__ */ kt(b), w = /* @__PURE__ */ a("ZodType", (n, t) => (_.init(n, t), n.def = t, n.type = t.type, Object.defineProperty(n, "_def", { value: t }), n.check = (...e) => n.clone(S(t, {
1764
- checks: [
1765
- ...t.checks ?? [],
1766
- ...e.map((o) => typeof o == "function" ? { _zod: { check: o, def: { check: "custom" }, onattach: [] } } : o)
1767
- ]
1768
- })), n.clone = (e, o) => O(n, e, o), n.brand = () => n, n.register = (e, o) => (e.add(n, o), n), n.parse = (e, o) => Ho(n, e, o, { callee: n.parse }), n.safeParse = (e, o) => Yo(n, e, o), n.parseAsync = async (e, o) => qo(n, e, o, { callee: n.parseAsync }), n.safeParseAsync = async (e, o) => Xo(n, e, o), n.spa = n.safeParseAsync, n.encode = (e, o) => Qo(n, e, o), n.decode = (e, o) => nr(n, e, o), n.encodeAsync = async (e, o) => tr(n, e, o), n.decodeAsync = async (e, o) => er(n, e, o), n.safeEncode = (e, o) => or(n, e, o), n.safeDecode = (e, o) => rr(n, e, o), n.safeEncodeAsync = async (e, o) => ir(n, e, o), n.safeDecodeAsync = async (e, o) => sr(n, e, o), n.refine = (e, o) => n.check(Hr(e, o)), n.superRefine = (e) => n.check(qr(e)), n.overwrite = (e) => n.check(J(e)), n.optional = () => bn(n), n.nullable = () => kn(n), n.nullish = () => bn(kn(n)), n.nonoptional = (e) => Vr(n, e), n.array = () => Er(n), n.or = (e) => Ar([n, e]), n.and = (e) => Tr(n, e), n.transform = (e) => $n(n, Fr(e)), n.default = (e) => Rr(n, e), n.prefault = (e) => Ur(n, e), n.catch = (e) => Wr(n, e), n.pipe = (e) => $n(n, e), n.readonly = () => Kr(n), n.describe = (e) => {
1769
- const o = n.clone();
1770
- return U.add(o, { description: e }), o;
1771
- }, Object.defineProperty(n, "description", {
1772
- get() {
1773
- return U.get(n)?.description;
1774
- },
1775
- configurable: !0
1776
- }), n.meta = (...e) => {
1777
- if (e.length === 0)
1778
- return U.get(n);
1779
- const o = n.clone();
1780
- return U.add(o, e[0]), o;
1781
- }, n.isOptional = () => n.safeParse(void 0).success, n.isNullable = () => n.safeParse(null).success, n)), Vn = /* @__PURE__ */ a("_ZodString", (n, t) => {
1782
- an.init(n, t), w.init(n, t);
1783
- const e = n._zod.bag;
1784
- n.format = e.format ?? null, n.minLength = e.minimum ?? null, n.maxLength = e.maximum ?? null, n.regex = (...o) => n.check(Oo(...o)), n.includes = (...o) => n.check(Eo(...o)), n.startsWith = (...o) => n.check(So(...o)), n.endsWith = (...o) => n.check(Po(...o)), n.min = (...o) => n.check(M(...o)), n.max = (...o) => n.check(Dn(...o)), n.length = (...o) => n.check(Un(...o)), n.nonempty = (...o) => n.check(M(1, ...o)), n.lowercase = (o) => n.check(xo(o)), n.uppercase = (o) => n.check(jo(o)), n.trim = () => n.check(Io()), n.normalize = (...o) => n.check(Ao(...o)), n.toLowerCase = () => n.check(To()), n.toUpperCase = () => n.check(No());
1785
- }), ar = /* @__PURE__ */ a("ZodString", (n, t) => {
1786
- an.init(n, t), Vn.init(n, t), n.email = (e) => n.check(Xe(cr, e)), n.url = (e) => n.check(oo(ur, e)), n.jwt = (e) => n.check(_o($r, e)), n.emoji = (e) => n.check(ro(dr, e)), n.guid = (e) => n.check(wn(zn, e)), n.uuid = (e) => n.check(Qe(V, e)), n.uuidv4 = (e) => n.check(no(V, e)), n.uuidv6 = (e) => n.check(to(V, e)), n.uuidv7 = (e) => n.check(eo(V, e)), n.nanoid = (e) => n.check(io(fr, e)), n.guid = (e) => n.check(wn(zn, e)), n.cuid = (e) => n.check(so(lr, e)), n.cuid2 = (e) => n.check(ao(pr, e)), n.ulid = (e) => n.check(co(hr, e)), n.base64 = (e) => n.check(go(zr, e)), n.base64url = (e) => n.check(vo(br, e)), n.xid = (e) => n.check(uo(mr, e)), n.ksuid = (e) => n.check(fo(gr, e)), n.ipv4 = (e) => n.check(lo(vr, e)), n.ipv6 = (e) => n.check(po(yr, e)), n.cidrv4 = (e) => n.check(ho(_r, e)), n.cidrv6 = (e) => n.check(mo(wr, e)), n.e164 = (e) => n.check(yo(kr, e)), n.datetime = (e) => n.check(Uo(e)), n.date = (e) => n.check(Lo(e)), n.time = (e) => n.check(Mo(e)), n.duration = (e) => n.check(Ko(e));
1787
- });
1788
- function A(n) {
1789
- return Ye(ar, n);
1790
- }
1791
- const y = /* @__PURE__ */ a("ZodStringFormat", (n, t) => {
1792
- v.init(n, t), Vn.init(n, t);
1793
- }), cr = /* @__PURE__ */ a("ZodEmail", (n, t) => {
1794
- ce.init(n, t), y.init(n, t);
1795
- }), zn = /* @__PURE__ */ a("ZodGUID", (n, t) => {
1796
- se.init(n, t), y.init(n, t);
1797
- }), V = /* @__PURE__ */ a("ZodUUID", (n, t) => {
1798
- ae.init(n, t), y.init(n, t);
1799
- }), ur = /* @__PURE__ */ a("ZodURL", (n, t) => {
1800
- ue.init(n, t), y.init(n, t);
1801
- }), dr = /* @__PURE__ */ a("ZodEmoji", (n, t) => {
1802
- de.init(n, t), y.init(n, t);
1803
- }), fr = /* @__PURE__ */ a("ZodNanoID", (n, t) => {
1804
- fe.init(n, t), y.init(n, t);
1805
- }), lr = /* @__PURE__ */ a("ZodCUID", (n, t) => {
1806
- le.init(n, t), y.init(n, t);
1807
- }), pr = /* @__PURE__ */ a("ZodCUID2", (n, t) => {
1808
- pe.init(n, t), y.init(n, t);
1809
- }), hr = /* @__PURE__ */ a("ZodULID", (n, t) => {
1810
- he.init(n, t), y.init(n, t);
1811
- }), mr = /* @__PURE__ */ a("ZodXID", (n, t) => {
1812
- me.init(n, t), y.init(n, t);
1813
- }), gr = /* @__PURE__ */ a("ZodKSUID", (n, t) => {
1814
- ge.init(n, t), y.init(n, t);
1815
- }), vr = /* @__PURE__ */ a("ZodIPv4", (n, t) => {
1816
- ze.init(n, t), y.init(n, t);
1817
- }), yr = /* @__PURE__ */ a("ZodIPv6", (n, t) => {
1818
- be.init(n, t), y.init(n, t);
1819
- }), _r = /* @__PURE__ */ a("ZodCIDRv4", (n, t) => {
1820
- ke.init(n, t), y.init(n, t);
1821
- }), wr = /* @__PURE__ */ a("ZodCIDRv6", (n, t) => {
1822
- $e.init(n, t), y.init(n, t);
1823
- }), zr = /* @__PURE__ */ a("ZodBase64", (n, t) => {
1824
- Ze.init(n, t), y.init(n, t);
1825
- }), br = /* @__PURE__ */ a("ZodBase64URL", (n, t) => {
1826
- xe.init(n, t), y.init(n, t);
1827
- }), kr = /* @__PURE__ */ a("ZodE164", (n, t) => {
1828
- je.init(n, t), y.init(n, t);
1829
- }), $r = /* @__PURE__ */ a("ZodJWT", (n, t) => {
1830
- Se.init(n, t), y.init(n, t);
1831
- }), Zr = /* @__PURE__ */ a("ZodUnknown", (n, t) => {
1832
- Pe.init(n, t), w.init(n, t);
1833
- });
1834
- function X() {
1835
- return $o(Zr);
1836
- }
1837
- const Or = /* @__PURE__ */ a("ZodNever", (n, t) => {
1838
- Ae.init(n, t), w.init(n, t);
1839
- });
1840
- function xr(n) {
1841
- return Zo(Or, n);
1842
- }
1843
- const jr = /* @__PURE__ */ a("ZodArray", (n, t) => {
1844
- Ie.init(n, t), w.init(n, t), n.element = t.element, n.min = (e, o) => n.check(M(e, o)), n.nonempty = (e) => n.check(M(1, e)), n.max = (e, o) => n.check(Dn(e, o)), n.length = (e, o) => n.check(Un(e, o)), n.unwrap = () => n.element;
1845
- });
1846
- function Er(n, t) {
1847
- return Fo(jr, n, t);
1848
- }
1849
- const Sr = /* @__PURE__ */ a("ZodObject", (n, t) => {
1850
- Ne.init(n, t), w.init(n, t), g(n, "shape", () => t.shape), n.keyof = () => Wn(Object.keys(n._zod.def.shape)), n.catchall = (e) => n.clone({ ...n._zod.def, catchall: e }), n.passthrough = () => n.clone({ ...n._zod.def, catchall: X() }), n.loose = () => n.clone({ ...n._zod.def, catchall: X() }), n.strict = () => n.clone({ ...n._zod.def, catchall: xr() }), n.strip = () => n.clone({ ...n._zod.def, catchall: void 0 }), n.extend = (e) => at(n, e), n.safeExtend = (e) => ct(n, e), n.merge = (e) => ut(n, e), n.pick = (e) => it(n, e), n.omit = (e) => st(n, e), n.partial = (...e) => dt(Mn, n, e[0]), n.required = (...e) => ft(Bn, n, e[0]);
1851
- });
1852
- function Ln(n, t) {
1853
- const e = {
1854
- type: "object",
1855
- shape: n ?? {},
1856
- ...f(t)
1857
- };
1858
- return new Sr(e);
1859
- }
1860
- const Pr = /* @__PURE__ */ a("ZodUnion", (n, t) => {
1861
- Fe.init(n, t), w.init(n, t), n.options = t.options;
1862
- });
1863
- function Ar(n, t) {
1864
- return new Pr({
1865
- type: "union",
1866
- options: n,
1867
- ...f(t)
1868
- });
1869
- }
1870
- const Ir = /* @__PURE__ */ a("ZodIntersection", (n, t) => {
1871
- Ce.init(n, t), w.init(n, t);
1872
- });
1873
- function Tr(n, t) {
1874
- return new Ir({
1875
- type: "intersection",
1876
- left: n,
1877
- right: t
1878
- });
1879
- }
1880
- const Q = /* @__PURE__ */ a("ZodEnum", (n, t) => {
1881
- Je.init(n, t), w.init(n, t), n.enum = t.entries, n.options = Object.values(t.entries);
1882
- const e = new Set(Object.keys(t.entries));
1883
- n.extract = (o, r) => {
1884
- const i = {};
1885
- for (const s of o)
1886
- if (e.has(s))
1887
- i[s] = t.entries[s];
1888
- else
1889
- throw new Error(`Key ${s} not found in enum`);
1890
- return new Q({
1891
- ...t,
1892
- checks: [],
1893
- ...f(r),
1894
- entries: i
1895
- });
1896
- }, n.exclude = (o, r) => {
1897
- const i = { ...t.entries };
1898
- for (const s of o)
1899
- if (e.has(s))
1900
- delete i[s];
1901
- else
1902
- throw new Error(`Key ${s} not found in enum`);
1903
- return new Q({
1904
- ...t,
1905
- checks: [],
1906
- ...f(r),
1907
- entries: i
1908
- });
1909
- };
1910
- });
1911
- function Wn(n, t) {
1912
- const e = Array.isArray(n) ? Object.fromEntries(n.map((o) => [o, o])) : n;
1913
- return new Q({
1914
- type: "enum",
1915
- entries: e,
1916
- ...f(t)
1917
- });
1918
- }
1919
- const Nr = /* @__PURE__ */ a("ZodTransform", (n, t) => {
1920
- Re.init(n, t), w.init(n, t), n._zod.parse = (e, o) => {
1921
- if (o.direction === "backward")
1922
- throw new On(n.constructor.name);
1923
- e.addIssue = (i) => {
1924
- if (typeof i == "string")
1925
- e.issues.push(C(i, e.value, t));
1926
- else {
1927
- const s = i;
1928
- s.fatal && (s.continue = !1), s.code ?? (s.code = "custom"), s.input ?? (s.input = e.value), s.inst ?? (s.inst = n), e.issues.push(C(s));
1929
- }
1930
- };
1931
- const r = t.transform(e.value, e);
1932
- return r instanceof Promise ? r.then((i) => (e.value = i, e)) : (e.value = r, e);
1933
- };
1934
- });
1935
- function Fr(n) {
1936
- return new Nr({
1937
- type: "transform",
1938
- transform: n
1939
- });
1940
- }
1941
- const Mn = /* @__PURE__ */ a("ZodOptional", (n, t) => {
1942
- De.init(n, t), w.init(n, t), n.unwrap = () => n._zod.def.innerType;
1943
- });
1944
- function bn(n) {
1945
- return new Mn({
1946
- type: "optional",
1947
- innerType: n
1948
- });
1949
- }
1950
- const Cr = /* @__PURE__ */ a("ZodNullable", (n, t) => {
1951
- Ue.init(n, t), w.init(n, t), n.unwrap = () => n._zod.def.innerType;
1952
- });
1953
- function kn(n) {
1954
- return new Cr({
1955
- type: "nullable",
1956
- innerType: n
1957
- });
1958
- }
1959
- const Jr = /* @__PURE__ */ a("ZodDefault", (n, t) => {
1960
- Ve.init(n, t), w.init(n, t), n.unwrap = () => n._zod.def.innerType, n.removeDefault = n.unwrap;
1961
- });
1962
- function Rr(n, t) {
1963
- return new Jr({
1964
- type: "default",
1965
- innerType: n,
1966
- get defaultValue() {
1967
- return typeof t == "function" ? t() : En(t);
1968
- }
1969
- });
1970
- }
1971
- const Dr = /* @__PURE__ */ a("ZodPrefault", (n, t) => {
1972
- Le.init(n, t), w.init(n, t), n.unwrap = () => n._zod.def.innerType;
1973
- });
1974
- function Ur(n, t) {
1975
- return new Dr({
1976
- type: "prefault",
1977
- innerType: n,
1978
- get defaultValue() {
1979
- return typeof t == "function" ? t() : En(t);
1980
- }
1981
- });
1982
- }
1983
- const Bn = /* @__PURE__ */ a("ZodNonOptional", (n, t) => {
1984
- We.init(n, t), w.init(n, t), n.unwrap = () => n._zod.def.innerType;
1985
- });
1986
- function Vr(n, t) {
1987
- return new Bn({
1988
- type: "nonoptional",
1989
- innerType: n,
1990
- ...f(t)
1991
- });
1992
- }
1993
- const Lr = /* @__PURE__ */ a("ZodCatch", (n, t) => {
1994
- Me.init(n, t), w.init(n, t), n.unwrap = () => n._zod.def.innerType, n.removeCatch = n.unwrap;
1995
- });
1996
- function Wr(n, t) {
1997
- return new Lr({
1998
- type: "catch",
1999
- innerType: n,
2000
- catchValue: typeof t == "function" ? t : () => t
2001
- });
2002
- }
2003
- const Mr = /* @__PURE__ */ a("ZodPipe", (n, t) => {
2004
- Be.init(n, t), w.init(n, t), n.in = t.in, n.out = t.out;
2005
- });
2006
- function $n(n, t) {
2007
- return new Mr({
2008
- type: "pipe",
2009
- in: n,
2010
- out: t
2011
- // ...util.normalizeParams(params),
2012
- });
2013
- }
2014
- const Br = /* @__PURE__ */ a("ZodReadonly", (n, t) => {
2015
- Ke.init(n, t), w.init(n, t), n.unwrap = () => n._zod.def.innerType;
2016
- });
2017
- function Kr(n) {
2018
- return new Br({
2019
- type: "readonly",
2020
- innerType: n
2021
- });
2022
- }
2023
- const Gr = /* @__PURE__ */ a("ZodCustom", (n, t) => {
2024
- Ge.init(n, t), w.init(n, t);
2025
- });
2026
- function Hr(n, t = {}) {
2027
- return Co(Gr, n, t);
2028
- }
2029
- function qr(n) {
2030
- return Jo(n);
2031
- }
2032
- const Zn = Ln({
2033
- "en-au": A().optional(),
2034
- "en-gb": A().optional(),
2035
- "en-us": A().optional(),
2036
- "es-es": A().optional()
2037
- }), Yr = Ln({
2038
- id: A(),
2039
- label: Zn,
2040
- description: Zn,
2041
- statusId: X(),
2042
- typeId: Wn(["app", "engine", "connector", "context", "informer", "presenter"]),
2043
- version: A()
2044
- }), N = Xn(qn);
2045
- async function ei() {
1
+ import { exec as m } from "child_process";
2
+ import { promises as e } from "fs";
3
+ import { nanoid as w } from "nanoid";
4
+ import { promisify as y } from "util";
5
+ const h = ["createObject", "dropObject", "removeRecords", "upsertRecords"], v = ["findObject", "getRecord", "listNodes", "previewObject", "retrieveRecords"], g = y(m);
6
+ async function S() {
2046
7
  try {
2047
8
  console.info("🚀 Building configuration...");
2048
- const n = JSON.parse(await h.readFile("package.json", "utf8")), t = JSON.parse(await h.readFile("config.json", "utf8"));
2049
- Yr.parse(t), n.name && (t.id = n.name), n.version && (t.version = n.version), await h.writeFile("config.json", JSON.stringify(t, void 0, 4), "utf8"), console.info("✅ Configuration built.");
2050
- } catch (n) {
2051
- console.error("❌ Error building configuration.", n);
9
+ const o = JSON.parse(await e.readFile("package.json", "utf8")), n = JSON.parse(await e.readFile("config.json", "utf8"));
10
+ o.name && (n.id = o.name), o.version && (n.version = o.version), await e.writeFile("config.json", JSON.stringify(n, void 0, 4), "utf8"), console.info("✅ Configuration built.");
11
+ } catch (o) {
12
+ console.error("❌ Error building configuration.", o);
2052
13
  }
2053
14
  }
2054
- async function oi(n) {
15
+ async function J(o) {
2055
16
  try {
2056
- console.info(`🚀 Building public directory index for identifier '${n}'...`);
2057
- const t = {};
2058
- async function e(r, i) {
17
+ console.info(`🚀 Building public directory index for identifier '${o}'...`);
18
+ const n = {};
19
+ async function i(r, t) {
2059
20
  console.info(`⚙️ Processing directory '${r}'...`);
2060
- const s = [], c = r.substring(`public/${n}`.length);
2061
- t[c] = s;
2062
- for (const u of i) {
2063
- const d = `${r}/${u}`;
21
+ const f = [], a = r.substring(`public/${o}`.length);
22
+ n[a] = f;
23
+ for (const c of t) {
24
+ const l = `${r}/${c}`;
2064
25
  try {
2065
- const l = await h.stat(d);
2066
- if (l.isDirectory()) {
2067
- const p = await h.readdir(d), m = { childCount: p.length, name: `${u}`, typeId: "folder" };
2068
- s.push(m), await e(d, p);
26
+ const d = await e.stat(l);
27
+ if (d.isDirectory()) {
28
+ const p = await e.readdir(l), u = { childCount: p.length, name: `${c}`, typeId: "folder" };
29
+ f.push(u), await i(l, p);
2069
30
  } else {
2070
- const p = { id: Yn(), lastModifiedAt: l.mtimeMs, name: u, size: l.size, typeId: "object" };
2071
- s.push(p);
31
+ const p = { id: w(), lastModifiedAt: d.mtimeMs, name: c, size: d.size, typeId: "object" };
32
+ f.push(p);
2072
33
  }
2073
- } catch (l) {
2074
- throw new Error(`Unable to get information for '${u}' in 'buildPublicDirectoryIndex'. ${String(l)}`);
34
+ } catch (d) {
35
+ throw new Error(`Unable to get information for '${c}' in 'buildPublicDirectoryIndex'. ${String(d)}`);
2075
36
  }
2076
37
  }
2077
- s.sort((u, d) => {
2078
- const l = u.typeId.localeCompare(d.typeId);
2079
- return l !== 0 ? l : u.name.localeCompare(d.name);
38
+ f.sort((c, l) => {
39
+ const d = c.typeId.localeCompare(l.typeId);
40
+ return d !== 0 ? d : c.name.localeCompare(l.name);
2080
41
  });
2081
42
  }
2082
- const o = await h.readdir(`public/${n}`);
2083
- await e(`public/${n}`, o), await h.writeFile(`./public/${n}Index.json`, JSON.stringify(t), "utf8"), console.info("✅ Public directory index built.");
2084
- } catch (t) {
2085
- console.error("❌ Error building public directory index.", t);
43
+ const s = await e.readdir(`public/${o}`);
44
+ await i(`public/${o}`, s), await e.writeFile(`./public/${o}Index.json`, JSON.stringify(n), "utf8"), console.info("✅ Public directory index built.");
45
+ } catch (n) {
46
+ console.error("❌ Error building public directory index.", n);
2086
47
  }
2087
48
  }
2088
- async function ri() {
49
+ async function j() {
2089
50
  try {
2090
51
  console.info("🚀 Building connector configuration...");
2091
- const n = JSON.parse(await h.readFile("package.json", "utf8")), t = JSON.parse(await h.readFile("config.json", "utf8")), e = await h.readFile("src/index.ts", "utf8");
2092
- let o = !1, r = !1;
2093
- const i = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, s = [...e.matchAll(i)].filter((u) => !u[1] && u[2] !== "constructor").map((u) => {
2094
- const d = u[2];
2095
- return o = o || Qn.includes(d), r = r || nt.includes(d), d;
52
+ const o = JSON.parse(await e.readFile("package.json", "utf8")), n = JSON.parse(await e.readFile("config.json", "utf8")), i = await e.readFile("src/index.ts", "utf8");
53
+ let s = !1, r = !1;
54
+ const t = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, f = [...i.matchAll(t)].filter((c) => !c[1] && c[2] !== "constructor").map((c) => {
55
+ const l = c[2];
56
+ return s = s || h.includes(l), r = r || v.includes(l), l;
2096
57
  });
2097
- s.length > 0 ? console.info(`ℹ️ Implements ${s.length} operations.`) : console.warn("⚠️ Implements no operations.");
2098
- const c = r && o ? "bidirectional" : r ? "source" : o ? "destination" : null;
2099
- c ? console.info(`ℹ️ Supports ${c} usage.`) : console.warn("⚠️ No usage identified."), n.name && (t.id = n.name), t.operations = s, t.usageId = c, n.version && (t.version = n.version), await h.writeFile("config.json", JSON.stringify(t, void 0, 4), "utf8"), console.info("✅ Connector configuration built.");
2100
- } catch (n) {
2101
- console.error("❌ Error building connector configuration.", n);
58
+ f.length > 0 ? console.info(`ℹ️ Implements ${f.length} operations.`) : console.warn("⚠️ Implements no operations.");
59
+ const a = r && s ? "bidirectional" : r ? "source" : s ? "destination" : null;
60
+ a ? console.info(`ℹ️ Supports ${a} usage.`) : console.warn("⚠️ No usage identified."), o.name && (n.id = o.name), n.operations = f, n.usageId = a, o.version && (n.version = o.version), await e.writeFile("config.json", JSON.stringify(n, void 0, 4), "utf8"), console.info("✅ Connector configuration built.");
61
+ } catch (o) {
62
+ console.error("❌ Error building connector configuration.", o);
2102
63
  }
2103
64
  }
2104
- async function ii() {
65
+ async function x() {
2105
66
  try {
2106
67
  console.info("🚀 Building context configuration...");
2107
- const n = JSON.parse(await h.readFile("package.json", "utf8")), t = JSON.parse(await h.readFile("config.json", "utf8")), e = await h.readFile("src/index.ts", "utf8"), o = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, r = [...e.matchAll(o)].filter((i) => !i[1] && i[2] !== "constructor").map((i) => i[2]);
2108
- n.name && (t.id = n.name), t.operations = r, n.version && (t.version = n.version), await h.writeFile("config.json", JSON.stringify(t, void 0, 4), "utf8"), console.info("✅ Context configuration built.");
2109
- } catch (n) {
2110
- console.error("❌ Error building context configuration.", n);
68
+ const o = JSON.parse(await e.readFile("package.json", "utf8")), n = JSON.parse(await e.readFile("config.json", "utf8")), i = await e.readFile("src/index.ts", "utf8"), s = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, r = [...i.matchAll(s)].filter((t) => !t[1] && t[2] !== "constructor").map((t) => t[2]);
69
+ o.name && (n.id = o.name), n.operations = r, o.version && (n.version = o.version), await e.writeFile("config.json", JSON.stringify(n, void 0, 4), "utf8"), console.info("✅ Context configuration built.");
70
+ } catch (o) {
71
+ console.error("❌ Error building context configuration.", o);
2111
72
  }
2112
73
  }
2113
- async function si() {
74
+ async function F() {
2114
75
  try {
2115
76
  console.info("🚀 Building informer configuration...");
2116
- const n = JSON.parse(await h.readFile("package.json", "utf8")), t = JSON.parse(await h.readFile("config.json", "utf8")), e = await h.readFile("src/index.ts", "utf8"), o = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, r = [...e.matchAll(o)].filter((i) => !i[1] && i[2] !== "constructor").map((i) => i[2]);
2117
- n.name && (t.id = n.name), t.operations = r, n.version && (t.version = n.version), await h.writeFile("config.json", JSON.stringify(t, void 0, 4), "utf8"), console.info("✅ Informer configuration built.");
2118
- } catch (n) {
2119
- console.error("❌ Error building informer configuration.", n);
77
+ const o = JSON.parse(await e.readFile("package.json", "utf8")), n = JSON.parse(await e.readFile("config.json", "utf8")), i = await e.readFile("src/index.ts", "utf8"), s = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, r = [...i.matchAll(s)].filter((t) => !t[1] && t[2] !== "constructor").map((t) => t[2]);
78
+ o.name && (n.id = o.name), n.operations = r, o.version && (n.version = o.version), await e.writeFile("config.json", JSON.stringify(n, void 0, 4), "utf8"), console.info("✅ Informer configuration built.");
79
+ } catch (o) {
80
+ console.error("❌ Error building informer configuration.", o);
2120
81
  }
2121
82
  }
2122
- async function ai() {
83
+ async function C() {
2123
84
  try {
2124
85
  console.info("🚀 Building presenter configuration...");
2125
- const n = JSON.parse(await h.readFile("package.json", "utf8")), t = JSON.parse(await h.readFile("config.json", "utf8")), e = await h.readFile("src/index.ts", "utf8"), o = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, r = [...e.matchAll(o)].filter((i) => !i[1] && i[2] !== "constructor").map((i) => i[2]);
2126
- n.name && (t.id = n.name), t.operations = r, n.version && (t.version = n.version), await h.writeFile("config.json", JSON.stringify(t, void 0, 4), "utf8"), console.info("✅ Presenter configuration built.");
2127
- } catch (n) {
2128
- console.error("❌ Error building context configuration.", n);
86
+ const o = JSON.parse(await e.readFile("package.json", "utf8")), n = JSON.parse(await e.readFile("config.json", "utf8")), i = await e.readFile("src/index.ts", "utf8"), s = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, r = [...i.matchAll(s)].filter((t) => !t[1] && t[2] !== "constructor").map((t) => t[2]);
87
+ o.name && (n.id = o.name), n.operations = r, o.version && (n.version = o.version), await e.writeFile("config.json", JSON.stringify(n, void 0, 4), "utf8"), console.info("✅ Presenter configuration built.");
88
+ } catch (o) {
89
+ console.error("❌ Error building context configuration.", o);
2129
90
  }
2130
91
  }
2131
- async function ci() {
92
+ async function k() {
2132
93
  try {
2133
94
  console.info("🚀 Bumping version...");
2134
- const n = JSON.parse(await h.readFile("package.json", "utf8"));
2135
- if (n.version) {
2136
- const t = n.version, e = n.version.split(".");
2137
- n.version = `${e[0]}.${e[1]}.${Number(e[2]) + 1}`, await h.writeFile("package.json", JSON.stringify(n, void 0, 4), "utf8"), console.info(`✅ Version bumped from ${t} to ${n.version}.`);
95
+ const o = JSON.parse(await e.readFile("package.json", "utf8"));
96
+ if (o.version) {
97
+ const n = o.version, i = o.version.split(".");
98
+ o.version = `${i[0]}.${i[1]}.${Number(i[2]) + 1}`, await e.writeFile("package.json", JSON.stringify(o, void 0, 4), "utf8"), console.info(`✅ Version bumped from ${n} to ${o.version}.`);
2138
99
  } else
2139
- n.version = "0.0.001", await h.writeFile("package.json", JSON.stringify(n, void 0, 4), "utf8"), console.warn(`⚠️ Version initialised to ${n.version}.`);
2140
- } catch (n) {
2141
- console.error("❌ Error bumping package version.", n);
100
+ o.version = "0.0.001", await e.writeFile("package.json", JSON.stringify(o, void 0, 4), "utf8"), console.warn(`⚠️ Version initialised to ${o.version}.`);
101
+ } catch (o) {
102
+ console.error("❌ Error bumping package version.", o);
2142
103
  }
2143
104
  }
2144
- function ui(n) {
2145
- console.error(`❌ ${n} script not implemented.`);
105
+ function E(o) {
106
+ console.error(`❌ ${o} script not implemented.`);
2146
107
  }
2147
- async function di() {
108
+ async function I() {
2148
109
  try {
2149
110
  console.info("🚀 Sending deployment notice...");
2150
- const n = JSON.parse(await h.readFile("config.json", "utf8")), t = {
2151
- body: JSON.stringify(n),
111
+ const o = JSON.parse(await e.readFile("config.json", "utf8")), n = {
112
+ body: JSON.stringify(o),
2152
113
  headers: { "Content-Type": "application/json" },
2153
114
  method: "PUT"
2154
- }, e = await fetch(`https://api.datapos.app/states/${n.id}`, t);
2155
- if (!e.ok) throw new Error(await e.text());
115
+ }, i = await fetch(`https://api.datapos.app/states/${o.id}`, n);
116
+ if (!i.ok) throw new Error(await i.text());
2156
117
  console.info("✅ Deployment notice sent.");
2157
- } catch (n) {
2158
- console.error("❌ Error sending deployment notice.", n);
118
+ } catch (o) {
119
+ console.error("❌ Error sending deployment notice.", o);
2159
120
  }
2160
121
  }
2161
- async function fi() {
122
+ async function R() {
2162
123
  try {
2163
124
  console.info("🚀 Synchronising with GitHub....");
2164
- const n = JSON.parse(await h.readFile("package.json", "utf8"));
2165
- await N("git add ."), await N(`git commit -m "v${n.version}"`), await N("git push origin main:main"), console.info(`✅ Synchronised version ${n.version} with GitHub.`);
2166
- } catch (n) {
2167
- console.error("❌ Error synchronising with GitHub.", n);
125
+ const o = JSON.parse(await e.readFile("package.json", "utf8"));
126
+ await g("git add ."), await g(`git commit -m "v${o.version}"`), await g("git push origin main:main"), console.info(`✅ Synchronised version ${o.version} with GitHub.`);
127
+ } catch (o) {
128
+ console.error("❌ Error synchronising with GitHub.", o);
2168
129
  }
2169
130
  }
2170
- async function li(n, t) {
131
+ async function P(o, n) {
2171
132
  try {
2172
133
  console.info("🚀 Uploading directory to R2....");
2173
- async function e(r, i, s) {
2174
- for (const c of s) {
2175
- const u = `${r}/${c}`, d = `${i}/${c}`;
2176
- if ((await h.stat(u)).isDirectory()) {
2177
- const p = await h.readdir(u);
2178
- await e(u, d, p);
134
+ async function i(r, t, f) {
135
+ for (const a of f) {
136
+ const c = `${r}/${a}`, l = `${t}/${a}`;
137
+ if ((await e.stat(c)).isDirectory()) {
138
+ const p = await e.readdir(c);
139
+ await i(c, l, p);
2179
140
  } else {
2180
- console.info(`⚙️ Uploading '${r}/${c}'...`);
2181
- const p = `wrangler r2 object put "datapos-sample-data-eu/${i}/${c}" --file="${r}/${c}" --jurisdiction=eu --remote`, m = await N(p);
2182
- if (m.stderr) throw new Error(m.stderr);
141
+ console.info(`⚙️ Uploading '${r}/${a}'...`);
142
+ const p = `wrangler r2 object put "datapos-sample-data-eu/${t}/${a}" --file="${r}/${a}" --jurisdiction=eu --remote`, u = await g(p);
143
+ if (u.stderr) throw new Error(u.stderr);
2183
144
  }
2184
145
  }
2185
146
  }
2186
- const o = await h.readdir(`${n}/${t}/`);
2187
- await e(`${n}/${t}`, t, o), console.info("✅ Directory uploaded to R2.");
2188
- } catch (e) {
2189
- console.error("❌ Error uploading directory to R2.", e);
147
+ const s = await e.readdir(`${o}/${n}/`);
148
+ await i(`${o}/${n}`, n, s), console.info("✅ Directory uploaded to R2.");
149
+ } catch (i) {
150
+ console.error("❌ Error uploading directory to R2.", i);
2190
151
  }
2191
152
  }
2192
- async function pi() {
153
+ async function A() {
2193
154
  try {
2194
155
  console.info("🚀 Uploading module configuration....");
2195
- const n = JSON.parse(await h.readFile("config.json", "utf8")), t = n.id, e = {
2196
- body: JSON.stringify(n),
156
+ const o = JSON.parse(await e.readFile("config.json", "utf8")), n = o.id, i = {
157
+ body: JSON.stringify(o),
2197
158
  headers: { "Content-Type": "application/json" },
2198
159
  method: "PUT"
2199
- }, o = await fetch(`https://api.datapos.app/states/${t}`, e);
2200
- if (!o.ok) throw new Error(await o.text());
160
+ }, s = await fetch(`https://api.datapos.app/states/${n}`, i);
161
+ if (!s.ok) throw new Error(await s.text());
2201
162
  console.info("✅ Module configuration uploaded.");
2202
- } catch (n) {
2203
- console.error("❌ Error uploading module configuration.", n);
163
+ } catch (o) {
164
+ console.error("❌ Error uploading module configuration.", o);
2204
165
  }
2205
166
  }
2206
- async function hi(n) {
167
+ async function T(o) {
2207
168
  try {
2208
169
  console.info("🚀 Uploading module to R2...");
2209
- const e = `v${JSON.parse(await h.readFile("package.json", "utf8")).version}`;
2210
- async function o(r, i = "") {
2211
- const s = await h.readdir(r, { withFileTypes: !0 });
2212
- for (const c of s) {
2213
- const u = `${r}/${c.name}`, d = i ? `${i}/${c.name}` : c.name;
2214
- if (!c.isDirectory()) {
2215
- const l = `${n}/${e}/${d}`.replace(/\\/g, "/"), p = c.name.endsWith(".js") ? "application/javascript" : c.name.endsWith(".css") ? "text/css" : "application/octet-stream";
2216
- console.info(`⚙️ Uploading '${d}' → '${l}'...`);
2217
- const { stderr: m } = await N(`wrangler r2 object put "${l}" --file="${u}" --content-type ${p} --jurisdiction=eu --remote`);
2218
- if (m) throw new Error(m);
170
+ const i = `v${JSON.parse(await e.readFile("package.json", "utf8")).version}`;
171
+ async function s(r, t = "") {
172
+ const f = await e.readdir(r, { withFileTypes: !0 });
173
+ for (const a of f) {
174
+ const c = `${r}/${a.name}`, l = t ? `${t}/${a.name}` : a.name;
175
+ if (!a.isDirectory()) {
176
+ const d = `${o}/${i}/${l}`.replace(/\\/g, "/"), p = a.name.endsWith(".js") ? "application/javascript" : a.name.endsWith(".css") ? "text/css" : "application/octet-stream";
177
+ console.info(`⚙️ Uploading '${l}' → '${d}'...`);
178
+ const { stderr: u } = await g(`wrangler r2 object put "${d}" --file="${c}" --content-type ${p} --jurisdiction=eu --remote`);
179
+ if (u) throw new Error(u);
2219
180
  }
2220
181
  }
2221
182
  }
2222
- await o("dist"), console.info("✅ Module uploaded to R2.");
2223
- } catch (t) {
2224
- console.error("❌ Error uploading module to R2.", t);
183
+ await s("dist"), console.info("✅ Module uploaded to R2.");
184
+ } catch (n) {
185
+ console.error("❌ Error uploading module to R2.", n);
2225
186
  }
2226
187
  }
2227
188
  export {
2228
- ei as buildConfig,
2229
- ri as buildConnectorConfig,
2230
- ii as buildContextConfig,
2231
- si as buildInformerConfig,
2232
- ai as buildPresenterConfig,
2233
- oi as buildPublicDirectoryIndex,
2234
- ci as bumpVersion,
2235
- ui as echoScriptNotImplemented,
2236
- di as sendDeploymentNotice,
2237
- fi as syncWithGitHub,
2238
- li as uploadDirectoryToR2,
2239
- pi as uploadModuleConfigToDO,
2240
- hi as uploadModuleToR2
189
+ S as buildConfig,
190
+ j as buildConnectorConfig,
191
+ x as buildContextConfig,
192
+ F as buildInformerConfig,
193
+ C as buildPresenterConfig,
194
+ J as buildPublicDirectoryIndex,
195
+ k as bumpVersion,
196
+ E as echoScriptNotImplemented,
197
+ I as sendDeploymentNotice,
198
+ R as syncWithGitHub,
199
+ P as uploadDirectoryToR2,
200
+ A as uploadModuleConfigToDO,
201
+ T as uploadModuleToR2
2241
202
  };