@betternotify/discord 1.0.0-beta.3 → 1.0.0-beta.4
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.d.ts +12 -13
- package/dist/index.js +376 -165
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as _betternotify_core0 from "@betternotify/core";
|
|
2
1
|
import { LoggerLike, Transport as Transport$1 } from "@betternotify/core";
|
|
3
2
|
import { HttpClientBehaviorOptions, MockTransport } from "@betternotify/core/transports";
|
|
4
3
|
|
|
@@ -58,47 +57,47 @@ type EmbedsResolver<TInput> = DiscordEmbed[] | ((args: {
|
|
|
58
57
|
input: TInput;
|
|
59
58
|
ctx: unknown;
|
|
60
59
|
}) => DiscordEmbed[]);
|
|
61
|
-
declare const discordChannel: () =>
|
|
60
|
+
declare const discordChannel: () => import("@betternotify/core").Channel<"discord", import("@betternotify/core").ChannelBuilder<unknown, {
|
|
62
61
|
body: string;
|
|
63
62
|
embeds: DiscordEmbed[];
|
|
64
63
|
username: string;
|
|
65
64
|
avatarUrl: string;
|
|
66
65
|
attachments: DiscordAttachment[];
|
|
67
66
|
}, {
|
|
68
|
-
body:
|
|
67
|
+
body: import("@betternotify/core").SlotConfig<"resolver"> & {
|
|
69
68
|
required: true;
|
|
70
69
|
__value?: string | undefined;
|
|
71
|
-
optional: () =>
|
|
70
|
+
optional: () => import("@betternotify/core").SlotConfig<"resolver"> & {
|
|
72
71
|
required: false;
|
|
73
72
|
__value?: string | undefined;
|
|
74
73
|
optional: /*elided*/any;
|
|
75
74
|
};
|
|
76
75
|
};
|
|
77
|
-
embeds:
|
|
76
|
+
embeds: import("@betternotify/core").SlotConfig<"resolver"> & {
|
|
78
77
|
required: false;
|
|
79
78
|
__value?: DiscordEmbed[] | undefined;
|
|
80
|
-
optional: () =>
|
|
79
|
+
optional: () => import("@betternotify/core").SlotConfig<"resolver"> & /*elided*/any;
|
|
81
80
|
};
|
|
82
|
-
username:
|
|
81
|
+
username: import("@betternotify/core").SlotConfig<"resolver"> & {
|
|
83
82
|
required: false;
|
|
84
83
|
__value?: string | undefined;
|
|
85
|
-
optional: () =>
|
|
84
|
+
optional: () => import("@betternotify/core").SlotConfig<"resolver"> & /*elided*/any;
|
|
86
85
|
};
|
|
87
|
-
avatarUrl:
|
|
86
|
+
avatarUrl: import("@betternotify/core").SlotConfig<"resolver"> & {
|
|
88
87
|
required: false;
|
|
89
88
|
__value?: string | undefined;
|
|
90
|
-
optional: () =>
|
|
89
|
+
optional: () => import("@betternotify/core").SlotConfig<"resolver"> & /*elided*/any;
|
|
91
90
|
};
|
|
92
|
-
attachments:
|
|
91
|
+
attachments: import("@betternotify/core").SlotConfig<"resolver"> & {
|
|
93
92
|
required: false;
|
|
94
93
|
__value?: DiscordAttachment[] | undefined;
|
|
95
|
-
optional: () =>
|
|
94
|
+
optional: () => import("@betternotify/core").SlotConfig<"resolver"> & /*elided*/any;
|
|
96
95
|
};
|
|
97
96
|
}, Omit<{
|
|
98
97
|
input: unknown;
|
|
99
98
|
}, "input">, RenderedDiscord, "discord">, {
|
|
100
99
|
input: unknown;
|
|
101
|
-
}, RenderedDiscord,
|
|
100
|
+
}, RenderedDiscord, import("@betternotify/core").Transport<RenderedDiscord, unknown>>;
|
|
102
101
|
//#endregion
|
|
103
102
|
//#region src/transports/types.d.ts
|
|
104
103
|
type DiscordTransportData = {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NotifyRpcProviderError, consoleLogger, defineChannel, slot } from "@betternotify/core";
|
|
2
2
|
import { createHttpClient, createMockTransport, createTransport, mapHttpStatus } from "@betternotify/core/transports";
|
|
3
|
-
|
|
3
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
4
|
+
var _a$1;
|
|
4
5
|
function $constructor(name, initializer, params) {
|
|
5
6
|
function init(inst, def) {
|
|
6
7
|
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
@@ -51,13 +52,14 @@ var $ZodEncodeError = class extends Error {
|
|
|
51
52
|
this.name = "ZodEncodeError";
|
|
52
53
|
}
|
|
53
54
|
};
|
|
54
|
-
|
|
55
|
+
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
56
|
+
const globalConfig = globalThis.__zod_globalConfig;
|
|
55
57
|
function config(newConfig) {
|
|
56
58
|
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
57
59
|
return globalConfig;
|
|
58
60
|
}
|
|
59
61
|
//#endregion
|
|
60
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
62
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
|
|
61
63
|
function getEnumValues(entries) {
|
|
62
64
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
63
65
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -84,7 +86,7 @@ function cleanRegex(source) {
|
|
|
84
86
|
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
85
87
|
return source.slice(start, end);
|
|
86
88
|
}
|
|
87
|
-
const EVALUATING = Symbol("evaluating");
|
|
89
|
+
const EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
88
90
|
function defineLazy(object, key, getter) {
|
|
89
91
|
let value = void 0;
|
|
90
92
|
Object.defineProperty(object, key, {
|
|
@@ -122,7 +124,8 @@ const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace
|
|
|
122
124
|
function isObject(data) {
|
|
123
125
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
124
126
|
}
|
|
125
|
-
const allowsEval = cached(() => {
|
|
127
|
+
const allowsEval = /* @__PURE__ */ cached(() => {
|
|
128
|
+
if (globalConfig.jitless) return false;
|
|
126
129
|
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
|
|
127
130
|
try {
|
|
128
131
|
new Function("");
|
|
@@ -144,9 +147,11 @@ function isPlainObject(o) {
|
|
|
144
147
|
function shallowClone(o) {
|
|
145
148
|
if (isPlainObject(o)) return { ...o };
|
|
146
149
|
if (Array.isArray(o)) return [...o];
|
|
150
|
+
if (o instanceof Map) return new Map(o);
|
|
151
|
+
if (o instanceof Set) return new Set(o);
|
|
147
152
|
return o;
|
|
148
153
|
}
|
|
149
|
-
const propertyKeyTypes = new Set([
|
|
154
|
+
const propertyKeyTypes = /* @__PURE__ */ new Set([
|
|
150
155
|
"string",
|
|
151
156
|
"number",
|
|
152
157
|
"symbol"
|
|
@@ -244,6 +249,7 @@ function safeExtend(schema, shape) {
|
|
|
244
249
|
} }));
|
|
245
250
|
}
|
|
246
251
|
function merge(a, b) {
|
|
252
|
+
if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
247
253
|
return clone(a, mergeDefs(a._zod.def, {
|
|
248
254
|
get shape() {
|
|
249
255
|
const _shape = {
|
|
@@ -256,7 +262,7 @@ function merge(a, b) {
|
|
|
256
262
|
get catchall() {
|
|
257
263
|
return b._zod.def.catchall;
|
|
258
264
|
},
|
|
259
|
-
checks: []
|
|
265
|
+
checks: b._zod.def.checks ?? []
|
|
260
266
|
}));
|
|
261
267
|
}
|
|
262
268
|
function partial(Class, schema, mask) {
|
|
@@ -309,6 +315,11 @@ function aborted(x, startIndex = 0) {
|
|
|
309
315
|
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
|
|
310
316
|
return false;
|
|
311
317
|
}
|
|
318
|
+
function explicitlyAborted(x, startIndex = 0) {
|
|
319
|
+
if (x.aborted === true) return true;
|
|
320
|
+
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue === false) return true;
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
312
323
|
function prefixIssues(path, issues) {
|
|
313
324
|
return issues.map((iss) => {
|
|
314
325
|
var _a;
|
|
@@ -321,15 +332,12 @@ function unwrapMessage(message) {
|
|
|
321
332
|
return typeof message === "string" ? message : message?.message;
|
|
322
333
|
}
|
|
323
334
|
function finalizeIssue(iss, ctx, config) {
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
if (
|
|
329
|
-
|
|
330
|
-
delete full.continue;
|
|
331
|
-
if (!ctx?.reportInput) delete full.input;
|
|
332
|
-
return full;
|
|
335
|
+
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
336
|
+
const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
|
|
337
|
+
rest.path ?? (rest.path = []);
|
|
338
|
+
rest.message = message;
|
|
339
|
+
if (ctx?.reportInput) rest.input = _input;
|
|
340
|
+
return rest;
|
|
333
341
|
}
|
|
334
342
|
function getLengthableOrigin(input) {
|
|
335
343
|
if (Array.isArray(input)) return "array";
|
|
@@ -347,7 +355,7 @@ function issue(...args) {
|
|
|
347
355
|
return { ...iss };
|
|
348
356
|
}
|
|
349
357
|
//#endregion
|
|
350
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
358
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
|
|
351
359
|
const initializer$1 = (inst, def) => {
|
|
352
360
|
inst.name = "$ZodError";
|
|
353
361
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -380,23 +388,26 @@ function flattenError(error, mapper = (issue) => issue.message) {
|
|
|
380
388
|
}
|
|
381
389
|
function formatError(error, mapper = (issue) => issue.message) {
|
|
382
390
|
const fieldErrors = { _errors: [] };
|
|
383
|
-
const processError = (error) => {
|
|
384
|
-
for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }));
|
|
385
|
-
else if (issue.code === "invalid_key") processError({ issues: issue.issues });
|
|
386
|
-
else if (issue.code === "invalid_element") processError({ issues: issue.issues });
|
|
387
|
-
else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue));
|
|
391
|
+
const processError = (error, path = []) => {
|
|
392
|
+
for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
|
|
393
|
+
else if (issue.code === "invalid_key") processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
394
|
+
else if (issue.code === "invalid_element") processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
388
395
|
else {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
curr[el]
|
|
396
|
+
const fullpath = [...path, ...issue.path];
|
|
397
|
+
if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue));
|
|
398
|
+
else {
|
|
399
|
+
let curr = fieldErrors;
|
|
400
|
+
let i = 0;
|
|
401
|
+
while (i < fullpath.length) {
|
|
402
|
+
const el = fullpath[i];
|
|
403
|
+
if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] };
|
|
404
|
+
else {
|
|
405
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
406
|
+
curr[el]._errors.push(mapper(issue));
|
|
407
|
+
}
|
|
408
|
+
curr = curr[el];
|
|
409
|
+
i++;
|
|
397
410
|
}
|
|
398
|
-
curr = curr[el];
|
|
399
|
-
i++;
|
|
400
411
|
}
|
|
401
412
|
}
|
|
402
413
|
};
|
|
@@ -404,9 +415,12 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
404
415
|
return fieldErrors;
|
|
405
416
|
}
|
|
406
417
|
//#endregion
|
|
407
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
418
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
|
|
408
419
|
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
409
|
-
const ctx = _ctx ?
|
|
420
|
+
const ctx = _ctx ? {
|
|
421
|
+
..._ctx,
|
|
422
|
+
async: false
|
|
423
|
+
} : { async: false };
|
|
410
424
|
const result = schema._zod.run({
|
|
411
425
|
value,
|
|
412
426
|
issues: []
|
|
@@ -420,7 +434,10 @@ const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
420
434
|
return result.value;
|
|
421
435
|
};
|
|
422
436
|
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
423
|
-
const ctx = _ctx ?
|
|
437
|
+
const ctx = _ctx ? {
|
|
438
|
+
..._ctx,
|
|
439
|
+
async: true
|
|
440
|
+
} : { async: true };
|
|
424
441
|
let result = schema._zod.run({
|
|
425
442
|
value,
|
|
426
443
|
issues: []
|
|
@@ -453,7 +470,10 @@ const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
453
470
|
};
|
|
454
471
|
const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
455
472
|
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
456
|
-
const ctx = _ctx ?
|
|
473
|
+
const ctx = _ctx ? {
|
|
474
|
+
..._ctx,
|
|
475
|
+
async: true
|
|
476
|
+
} : { async: true };
|
|
457
477
|
let result = schema._zod.run({
|
|
458
478
|
value,
|
|
459
479
|
issues: []
|
|
@@ -469,35 +489,47 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
469
489
|
};
|
|
470
490
|
const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
471
491
|
const _encode = (_Err) => (schema, value, _ctx) => {
|
|
472
|
-
const ctx = _ctx ?
|
|
492
|
+
const ctx = _ctx ? {
|
|
493
|
+
..._ctx,
|
|
494
|
+
direction: "backward"
|
|
495
|
+
} : { direction: "backward" };
|
|
473
496
|
return _parse(_Err)(schema, value, ctx);
|
|
474
497
|
};
|
|
475
498
|
const _decode = (_Err) => (schema, value, _ctx) => {
|
|
476
499
|
return _parse(_Err)(schema, value, _ctx);
|
|
477
500
|
};
|
|
478
501
|
const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
479
|
-
const ctx = _ctx ?
|
|
502
|
+
const ctx = _ctx ? {
|
|
503
|
+
..._ctx,
|
|
504
|
+
direction: "backward"
|
|
505
|
+
} : { direction: "backward" };
|
|
480
506
|
return _parseAsync(_Err)(schema, value, ctx);
|
|
481
507
|
};
|
|
482
508
|
const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
483
509
|
return _parseAsync(_Err)(schema, value, _ctx);
|
|
484
510
|
};
|
|
485
511
|
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
486
|
-
const ctx = _ctx ?
|
|
512
|
+
const ctx = _ctx ? {
|
|
513
|
+
..._ctx,
|
|
514
|
+
direction: "backward"
|
|
515
|
+
} : { direction: "backward" };
|
|
487
516
|
return _safeParse(_Err)(schema, value, ctx);
|
|
488
517
|
};
|
|
489
518
|
const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
490
519
|
return _safeParse(_Err)(schema, value, _ctx);
|
|
491
520
|
};
|
|
492
521
|
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
493
|
-
const ctx = _ctx ?
|
|
522
|
+
const ctx = _ctx ? {
|
|
523
|
+
..._ctx,
|
|
524
|
+
direction: "backward"
|
|
525
|
+
} : { direction: "backward" };
|
|
494
526
|
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
495
527
|
};
|
|
496
528
|
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
497
529
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
498
530
|
};
|
|
499
531
|
//#endregion
|
|
500
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
532
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
|
|
501
533
|
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
502
534
|
var _a;
|
|
503
535
|
inst._zod ?? (inst._zod = {});
|
|
@@ -599,7 +631,7 @@ const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (i
|
|
|
599
631
|
};
|
|
600
632
|
});
|
|
601
633
|
//#endregion
|
|
602
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
634
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js
|
|
603
635
|
var Doc = class {
|
|
604
636
|
constructor(args = []) {
|
|
605
637
|
this.content = [];
|
|
@@ -630,14 +662,14 @@ var Doc = class {
|
|
|
630
662
|
}
|
|
631
663
|
};
|
|
632
664
|
//#endregion
|
|
633
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
665
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
|
|
634
666
|
const version = {
|
|
635
667
|
major: 4,
|
|
636
|
-
minor:
|
|
637
|
-
patch:
|
|
668
|
+
minor: 4,
|
|
669
|
+
patch: 3
|
|
638
670
|
};
|
|
639
671
|
//#endregion
|
|
640
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
672
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
|
|
641
673
|
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
642
674
|
var _a;
|
|
643
675
|
inst ?? (inst = {});
|
|
@@ -658,6 +690,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
658
690
|
let asyncResult;
|
|
659
691
|
for (const ch of checks) {
|
|
660
692
|
if (ch._zod.def.when) {
|
|
693
|
+
if (explicitlyAborted(payload)) continue;
|
|
661
694
|
if (!ch._zod.def.when(payload)) continue;
|
|
662
695
|
} else if (isAborted) continue;
|
|
663
696
|
const currLen = payload.issues.length;
|
|
@@ -774,13 +807,23 @@ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
774
807
|
return payload;
|
|
775
808
|
};
|
|
776
809
|
});
|
|
777
|
-
function handlePropertyResult(result, final, key, input, isOptionalOut) {
|
|
810
|
+
function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
|
|
811
|
+
const isPresent = key in input;
|
|
778
812
|
if (result.issues.length) {
|
|
779
|
-
if (isOptionalOut && !
|
|
813
|
+
if (isOptionalIn && isOptionalOut && !isPresent) return;
|
|
780
814
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
781
815
|
}
|
|
816
|
+
if (!isPresent && !isOptionalIn) {
|
|
817
|
+
if (!result.issues.length) final.issues.push({
|
|
818
|
+
code: "invalid_type",
|
|
819
|
+
expected: "nonoptional",
|
|
820
|
+
input: void 0,
|
|
821
|
+
path: [key]
|
|
822
|
+
});
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
782
825
|
if (result.value === void 0) {
|
|
783
|
-
if (
|
|
826
|
+
if (isPresent) final.value[key] = void 0;
|
|
784
827
|
} else final.value[key] = result.value;
|
|
785
828
|
}
|
|
786
829
|
function normalizeDef(def) {
|
|
@@ -800,8 +843,10 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
800
843
|
const keySet = def.keySet;
|
|
801
844
|
const _catchall = def.catchall._zod;
|
|
802
845
|
const t = _catchall.def.type;
|
|
846
|
+
const isOptionalIn = _catchall.optin === "optional";
|
|
803
847
|
const isOptionalOut = _catchall.optout === "optional";
|
|
804
848
|
for (const key in input) {
|
|
849
|
+
if (key === "__proto__") continue;
|
|
805
850
|
if (keySet.has(key)) continue;
|
|
806
851
|
if (t === "never") {
|
|
807
852
|
unrecognized.push(key);
|
|
@@ -811,8 +856,8 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
811
856
|
value: input[key],
|
|
812
857
|
issues: []
|
|
813
858
|
}, ctx);
|
|
814
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
|
|
815
|
-
else handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
859
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
860
|
+
else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
816
861
|
}
|
|
817
862
|
if (unrecognized.length) payload.issues.push({
|
|
818
863
|
code: "unrecognized_keys",
|
|
@@ -848,13 +893,13 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
848
893
|
}
|
|
849
894
|
return propValues;
|
|
850
895
|
});
|
|
851
|
-
const isObject$
|
|
896
|
+
const isObject$1 = isObject;
|
|
852
897
|
const catchall = def.catchall;
|
|
853
898
|
let value;
|
|
854
899
|
inst._zod.parse = (payload, ctx) => {
|
|
855
900
|
value ?? (value = _normalized.value);
|
|
856
901
|
const input = payload.value;
|
|
857
|
-
if (!isObject$
|
|
902
|
+
if (!isObject$1(input)) {
|
|
858
903
|
payload.issues.push({
|
|
859
904
|
expected: "object",
|
|
860
905
|
code: "invalid_type",
|
|
@@ -868,13 +913,14 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
868
913
|
const shape = value.shape;
|
|
869
914
|
for (const key of value.keys) {
|
|
870
915
|
const el = shape[key];
|
|
916
|
+
const isOptionalIn = el._zod.optin === "optional";
|
|
871
917
|
const isOptionalOut = el._zod.optout === "optional";
|
|
872
918
|
const r = el._zod.run({
|
|
873
919
|
value: input[key],
|
|
874
920
|
issues: []
|
|
875
921
|
}, ctx);
|
|
876
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
|
|
877
|
-
else handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
922
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
923
|
+
else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
878
924
|
}
|
|
879
925
|
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
880
926
|
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
@@ -903,9 +949,11 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
|
|
|
903
949
|
for (const key of normalized.keys) {
|
|
904
950
|
const id = ids[key];
|
|
905
951
|
const k = esc(key);
|
|
906
|
-
const
|
|
952
|
+
const schema = shape[key];
|
|
953
|
+
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
954
|
+
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
907
955
|
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
908
|
-
if (isOptionalOut) doc.write(`
|
|
956
|
+
if (isOptionalIn && isOptionalOut) doc.write(`
|
|
909
957
|
if (${id}.issues.length) {
|
|
910
958
|
if (${k} in input) {
|
|
911
959
|
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
@@ -923,6 +971,32 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
|
|
|
923
971
|
newResult[${k}] = ${id}.value;
|
|
924
972
|
}
|
|
925
973
|
|
|
974
|
+
`);
|
|
975
|
+
else if (!isOptionalIn) doc.write(`
|
|
976
|
+
const ${id}_present = ${k} in input;
|
|
977
|
+
if (${id}.issues.length) {
|
|
978
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
979
|
+
...iss,
|
|
980
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
981
|
+
})));
|
|
982
|
+
}
|
|
983
|
+
if (!${id}_present && !${id}.issues.length) {
|
|
984
|
+
payload.issues.push({
|
|
985
|
+
code: "invalid_type",
|
|
986
|
+
expected: "nonoptional",
|
|
987
|
+
input: undefined,
|
|
988
|
+
path: [${k}]
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
if (${id}_present) {
|
|
993
|
+
if (${id}.value === undefined) {
|
|
994
|
+
newResult[${k}] = undefined;
|
|
995
|
+
} else {
|
|
996
|
+
newResult[${k}] = ${id}.value;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
|
|
926
1000
|
`);
|
|
927
1001
|
else doc.write(`
|
|
928
1002
|
if (${id}.issues.length) {
|
|
@@ -948,7 +1022,7 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
|
|
|
948
1022
|
return (payload, ctx) => fn(shape, payload, ctx);
|
|
949
1023
|
};
|
|
950
1024
|
let fastpass;
|
|
951
|
-
const isObject$
|
|
1025
|
+
const isObject$2 = isObject;
|
|
952
1026
|
const jit = !globalConfig.jitless;
|
|
953
1027
|
const fastEnabled = jit && allowsEval.value;
|
|
954
1028
|
const catchall = def.catchall;
|
|
@@ -956,7 +1030,7 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
|
|
|
956
1030
|
inst._zod.parse = (payload, ctx) => {
|
|
957
1031
|
value ?? (value = _normalized.value);
|
|
958
1032
|
const input = payload.value;
|
|
959
|
-
if (!isObject$
|
|
1033
|
+
if (!isObject$2(input)) {
|
|
960
1034
|
payload.issues.push({
|
|
961
1035
|
expected: "object",
|
|
962
1036
|
code: "invalid_type",
|
|
@@ -1005,10 +1079,9 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
1005
1079
|
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
1006
1080
|
}
|
|
1007
1081
|
});
|
|
1008
|
-
const
|
|
1009
|
-
const first = def.options[0]._zod.run;
|
|
1082
|
+
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
|
|
1010
1083
|
inst._zod.parse = (payload, ctx) => {
|
|
1011
|
-
if (
|
|
1084
|
+
if (first) return first(payload, ctx);
|
|
1012
1085
|
let async = false;
|
|
1013
1086
|
const results = [];
|
|
1014
1087
|
for (const option of def.options) {
|
|
@@ -1149,20 +1222,23 @@ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
1149
1222
|
});
|
|
1150
1223
|
const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
1151
1224
|
$ZodType.init(inst, def);
|
|
1225
|
+
inst._zod.optin = "optional";
|
|
1152
1226
|
inst._zod.parse = (payload, ctx) => {
|
|
1153
1227
|
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
1154
1228
|
const _out = def.transform(payload.value, payload);
|
|
1155
1229
|
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
1156
1230
|
payload.value = output;
|
|
1231
|
+
payload.fallback = true;
|
|
1157
1232
|
return payload;
|
|
1158
1233
|
});
|
|
1159
1234
|
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
1160
1235
|
payload.value = _out;
|
|
1236
|
+
payload.fallback = true;
|
|
1161
1237
|
return payload;
|
|
1162
1238
|
};
|
|
1163
1239
|
});
|
|
1164
1240
|
function handleOptionalResult(result, input) {
|
|
1165
|
-
if (result.issues.length
|
|
1241
|
+
if (input === void 0 && (result.issues.length || result.fallback)) return {
|
|
1166
1242
|
issues: [],
|
|
1167
1243
|
value: void 0
|
|
1168
1244
|
};
|
|
@@ -1181,9 +1257,10 @@ const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) =>
|
|
|
1181
1257
|
});
|
|
1182
1258
|
inst._zod.parse = (payload, ctx) => {
|
|
1183
1259
|
if (def.innerType._zod.optin === "optional") {
|
|
1260
|
+
const input = payload.value;
|
|
1184
1261
|
const result = def.innerType._zod.run(payload, ctx);
|
|
1185
|
-
if (result instanceof Promise) return result.then((r) => handleOptionalResult(r,
|
|
1186
|
-
return handleOptionalResult(result,
|
|
1262
|
+
if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
|
|
1263
|
+
return handleOptionalResult(result, input);
|
|
1187
1264
|
}
|
|
1188
1265
|
if (payload.value === void 0) return payload;
|
|
1189
1266
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1268,7 +1345,7 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
1268
1345
|
}
|
|
1269
1346
|
const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
1270
1347
|
$ZodType.init(inst, def);
|
|
1271
|
-
|
|
1348
|
+
inst._zod.optin = "optional";
|
|
1272
1349
|
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1273
1350
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1274
1351
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -1283,6 +1360,7 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
1283
1360
|
input: payload.value
|
|
1284
1361
|
});
|
|
1285
1362
|
payload.issues = [];
|
|
1363
|
+
payload.fallback = true;
|
|
1286
1364
|
}
|
|
1287
1365
|
return payload;
|
|
1288
1366
|
});
|
|
@@ -1294,6 +1372,7 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
1294
1372
|
input: payload.value
|
|
1295
1373
|
});
|
|
1296
1374
|
payload.issues = [];
|
|
1375
|
+
payload.fallback = true;
|
|
1297
1376
|
}
|
|
1298
1377
|
return payload;
|
|
1299
1378
|
};
|
|
@@ -1322,7 +1401,8 @@ function handlePipeResult(left, next, ctx) {
|
|
|
1322
1401
|
}
|
|
1323
1402
|
return next._zod.run({
|
|
1324
1403
|
value: left.value,
|
|
1325
|
-
issues: left.issues
|
|
1404
|
+
issues: left.issues,
|
|
1405
|
+
fallback: left.fallback
|
|
1326
1406
|
}, ctx);
|
|
1327
1407
|
}
|
|
1328
1408
|
const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
@@ -1369,7 +1449,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
1369
1449
|
}
|
|
1370
1450
|
}
|
|
1371
1451
|
//#endregion
|
|
1372
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1452
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
|
|
1373
1453
|
var _a;
|
|
1374
1454
|
var $ZodRegistry = class {
|
|
1375
1455
|
constructor() {
|
|
@@ -1416,7 +1496,7 @@ function registry() {
|
|
|
1416
1496
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
1417
1497
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
1418
1498
|
//#endregion
|
|
1419
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1499
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
|
|
1420
1500
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1421
1501
|
function _unknown(Class) {
|
|
1422
1502
|
return new Class({ type: "unknown" });
|
|
@@ -1477,7 +1557,7 @@ function _refine(Class, fn, _params) {
|
|
|
1477
1557
|
});
|
|
1478
1558
|
}
|
|
1479
1559
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1480
|
-
function _superRefine(fn) {
|
|
1560
|
+
function _superRefine(fn, params) {
|
|
1481
1561
|
const ch = /* @__PURE__ */ _check((payload) => {
|
|
1482
1562
|
payload.addIssue = (issue$2) => {
|
|
1483
1563
|
if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def));
|
|
@@ -1492,7 +1572,7 @@ function _superRefine(fn) {
|
|
|
1492
1572
|
}
|
|
1493
1573
|
};
|
|
1494
1574
|
return fn(payload.value, payload);
|
|
1495
|
-
});
|
|
1575
|
+
}, params);
|
|
1496
1576
|
return ch;
|
|
1497
1577
|
}
|
|
1498
1578
|
/* @__NO_SIDE_EFFECTS__ */
|
|
@@ -1505,7 +1585,7 @@ function _check(fn, params) {
|
|
|
1505
1585
|
return ch;
|
|
1506
1586
|
}
|
|
1507
1587
|
//#endregion
|
|
1508
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1588
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
|
|
1509
1589
|
function initializeContext(params) {
|
|
1510
1590
|
let target = params?.target ?? "draft-2020-12";
|
|
1511
1591
|
if (target === "draft-4") target = "draft-04";
|
|
@@ -1571,7 +1651,7 @@ function process(schema, ctx, _params = {
|
|
|
1571
1651
|
delete result.schema.examples;
|
|
1572
1652
|
delete result.schema.default;
|
|
1573
1653
|
}
|
|
1574
|
-
if (ctx.io === "input" && result.schema
|
|
1654
|
+
if (ctx.io === "input" && "_prefault" in result.schema) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
1575
1655
|
delete result.schema._prefault;
|
|
1576
1656
|
return ctx.seen.get(schema).schema;
|
|
1577
1657
|
}
|
|
@@ -1711,10 +1791,15 @@ function finalize(ctx, schema) {
|
|
|
1711
1791
|
result.$id = ctx.external.uri(id);
|
|
1712
1792
|
}
|
|
1713
1793
|
Object.assign(result, root.def ?? root.schema);
|
|
1794
|
+
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
1795
|
+
if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
|
|
1714
1796
|
const defs = ctx.external?.defs ?? {};
|
|
1715
1797
|
for (const entry of ctx.seen.entries()) {
|
|
1716
1798
|
const seen = entry[1];
|
|
1717
|
-
if (seen.def && seen.defId)
|
|
1799
|
+
if (seen.def && seen.defId) {
|
|
1800
|
+
if (seen.def.id === seen.defId) delete seen.def.id;
|
|
1801
|
+
defs[seen.defId] = seen.def;
|
|
1802
|
+
}
|
|
1718
1803
|
}
|
|
1719
1804
|
if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
1720
1805
|
else result.definitions = defs;
|
|
@@ -1748,7 +1833,10 @@ function isTransforming(_schema, _ctx) {
|
|
|
1748
1833
|
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") return isTransforming(def.innerType, ctx);
|
|
1749
1834
|
if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
1750
1835
|
if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
1751
|
-
if (def.type === "pipe")
|
|
1836
|
+
if (def.type === "pipe") {
|
|
1837
|
+
if (_schema._zod.traits.has("$ZodCodec")) return true;
|
|
1838
|
+
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
1839
|
+
}
|
|
1752
1840
|
if (def.type === "object") {
|
|
1753
1841
|
for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true;
|
|
1754
1842
|
return false;
|
|
@@ -1790,7 +1878,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
1790
1878
|
return finalize(ctx, schema);
|
|
1791
1879
|
};
|
|
1792
1880
|
//#endregion
|
|
1793
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1881
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
|
|
1794
1882
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
1795
1883
|
json.not = {};
|
|
1796
1884
|
};
|
|
@@ -1927,7 +2015,8 @@ const catchProcessor = (schema, ctx, json, params) => {
|
|
|
1927
2015
|
};
|
|
1928
2016
|
const pipeProcessor = (schema, ctx, _json, params) => {
|
|
1929
2017
|
const def = schema._zod.def;
|
|
1930
|
-
const
|
|
2018
|
+
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
2019
|
+
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
1931
2020
|
process(innerType, ctx, params);
|
|
1932
2021
|
const seen = ctx.seen.get(schema);
|
|
1933
2022
|
seen.ref = innerType;
|
|
@@ -1946,7 +2035,7 @@ const optionalProcessor = (schema, ctx, _json, params) => {
|
|
|
1946
2035
|
seen.ref = def.innerType;
|
|
1947
2036
|
};
|
|
1948
2037
|
//#endregion
|
|
1949
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
2038
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
|
|
1950
2039
|
const initializer = (inst, issues) => {
|
|
1951
2040
|
$ZodError.init(inst, issues);
|
|
1952
2041
|
inst.name = "ZodError";
|
|
@@ -1966,10 +2055,9 @@ const initializer = (inst, issues) => {
|
|
|
1966
2055
|
} }
|
|
1967
2056
|
});
|
|
1968
2057
|
};
|
|
1969
|
-
$constructor("ZodError", initializer);
|
|
1970
|
-
const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
|
|
2058
|
+
const ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer, { Parent: Error });
|
|
1971
2059
|
//#endregion
|
|
1972
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
2060
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
|
|
1973
2061
|
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
1974
2062
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
1975
2063
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -1983,7 +2071,43 @@ const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
|
1983
2071
|
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
1984
2072
|
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
1985
2073
|
//#endregion
|
|
1986
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
2074
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
|
|
2075
|
+
const _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
2076
|
+
function _installLazyMethods(inst, group, methods) {
|
|
2077
|
+
const proto = Object.getPrototypeOf(inst);
|
|
2078
|
+
let installed = _installedGroups.get(proto);
|
|
2079
|
+
if (!installed) {
|
|
2080
|
+
installed = /* @__PURE__ */ new Set();
|
|
2081
|
+
_installedGroups.set(proto, installed);
|
|
2082
|
+
}
|
|
2083
|
+
if (installed.has(group)) return;
|
|
2084
|
+
installed.add(group);
|
|
2085
|
+
for (const key in methods) {
|
|
2086
|
+
const fn = methods[key];
|
|
2087
|
+
Object.defineProperty(proto, key, {
|
|
2088
|
+
configurable: true,
|
|
2089
|
+
enumerable: false,
|
|
2090
|
+
get() {
|
|
2091
|
+
const bound = fn.bind(this);
|
|
2092
|
+
Object.defineProperty(this, key, {
|
|
2093
|
+
configurable: true,
|
|
2094
|
+
writable: true,
|
|
2095
|
+
enumerable: true,
|
|
2096
|
+
value: bound
|
|
2097
|
+
});
|
|
2098
|
+
return bound;
|
|
2099
|
+
},
|
|
2100
|
+
set(v) {
|
|
2101
|
+
Object.defineProperty(this, key, {
|
|
2102
|
+
configurable: true,
|
|
2103
|
+
writable: true,
|
|
2104
|
+
enumerable: true,
|
|
2105
|
+
value: v
|
|
2106
|
+
});
|
|
2107
|
+
}
|
|
2108
|
+
});
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
1987
2111
|
const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
1988
2112
|
$ZodType.init(inst, def);
|
|
1989
2113
|
Object.assign(inst["~standard"], { jsonSchema: {
|
|
@@ -1994,20 +2118,6 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
1994
2118
|
inst.def = def;
|
|
1995
2119
|
inst.type = def.type;
|
|
1996
2120
|
Object.defineProperty(inst, "_def", { value: def });
|
|
1997
|
-
inst.check = (...checks) => {
|
|
1998
|
-
return inst.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...checks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
1999
|
-
check: ch,
|
|
2000
|
-
def: { check: "custom" },
|
|
2001
|
-
onattach: []
|
|
2002
|
-
} } : ch)] }), { parent: true });
|
|
2003
|
-
};
|
|
2004
|
-
inst.with = inst.check;
|
|
2005
|
-
inst.clone = (def, params) => clone(inst, def, params);
|
|
2006
|
-
inst.brand = () => inst;
|
|
2007
|
-
inst.register = ((reg, meta) => {
|
|
2008
|
-
reg.add(inst, meta);
|
|
2009
|
-
return inst;
|
|
2010
|
-
});
|
|
2011
2121
|
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
2012
2122
|
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
2013
2123
|
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
@@ -2021,43 +2131,106 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
2021
2131
|
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
2022
2132
|
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
2023
2133
|
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
2024
|
-
inst
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2134
|
+
_installLazyMethods(inst, "ZodType", {
|
|
2135
|
+
check(...chks) {
|
|
2136
|
+
const def = this.def;
|
|
2137
|
+
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
2138
|
+
check: ch,
|
|
2139
|
+
def: { check: "custom" },
|
|
2140
|
+
onattach: []
|
|
2141
|
+
} } : ch)] }), { parent: true });
|
|
2142
|
+
},
|
|
2143
|
+
with(...chks) {
|
|
2144
|
+
return this.check(...chks);
|
|
2145
|
+
},
|
|
2146
|
+
clone(def, params) {
|
|
2147
|
+
return clone(this, def, params);
|
|
2148
|
+
},
|
|
2149
|
+
brand() {
|
|
2150
|
+
return this;
|
|
2151
|
+
},
|
|
2152
|
+
register(reg, meta) {
|
|
2153
|
+
reg.add(this, meta);
|
|
2154
|
+
return this;
|
|
2155
|
+
},
|
|
2156
|
+
refine(check, params) {
|
|
2157
|
+
return this.check(refine(check, params));
|
|
2158
|
+
},
|
|
2159
|
+
superRefine(refinement, params) {
|
|
2160
|
+
return this.check(superRefine(refinement, params));
|
|
2161
|
+
},
|
|
2162
|
+
overwrite(fn) {
|
|
2163
|
+
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
2164
|
+
},
|
|
2165
|
+
optional() {
|
|
2166
|
+
return optional(this);
|
|
2167
|
+
},
|
|
2168
|
+
exactOptional() {
|
|
2169
|
+
return exactOptional(this);
|
|
2170
|
+
},
|
|
2171
|
+
nullable() {
|
|
2172
|
+
return nullable(this);
|
|
2173
|
+
},
|
|
2174
|
+
nullish() {
|
|
2175
|
+
return optional(nullable(this));
|
|
2176
|
+
},
|
|
2177
|
+
nonoptional(params) {
|
|
2178
|
+
return nonoptional(this, params);
|
|
2179
|
+
},
|
|
2180
|
+
array() {
|
|
2181
|
+
return array(this);
|
|
2182
|
+
},
|
|
2183
|
+
or(arg) {
|
|
2184
|
+
return union([this, arg]);
|
|
2185
|
+
},
|
|
2186
|
+
and(arg) {
|
|
2187
|
+
return intersection(this, arg);
|
|
2188
|
+
},
|
|
2189
|
+
transform(tx) {
|
|
2190
|
+
return pipe(this, transform(tx));
|
|
2191
|
+
},
|
|
2192
|
+
default(d) {
|
|
2193
|
+
return _default(this, d);
|
|
2194
|
+
},
|
|
2195
|
+
prefault(d) {
|
|
2196
|
+
return prefault(this, d);
|
|
2197
|
+
},
|
|
2198
|
+
catch(params) {
|
|
2199
|
+
return _catch(this, params);
|
|
2200
|
+
},
|
|
2201
|
+
pipe(target) {
|
|
2202
|
+
return pipe(this, target);
|
|
2203
|
+
},
|
|
2204
|
+
readonly() {
|
|
2205
|
+
return readonly(this);
|
|
2206
|
+
},
|
|
2207
|
+
describe(description) {
|
|
2208
|
+
const cl = this.clone();
|
|
2209
|
+
globalRegistry.add(cl, { description });
|
|
2210
|
+
return cl;
|
|
2211
|
+
},
|
|
2212
|
+
meta(...args) {
|
|
2213
|
+
if (args.length === 0) return globalRegistry.get(this);
|
|
2214
|
+
const cl = this.clone();
|
|
2215
|
+
globalRegistry.add(cl, args[0]);
|
|
2216
|
+
return cl;
|
|
2217
|
+
},
|
|
2218
|
+
isOptional() {
|
|
2219
|
+
return this.safeParse(void 0).success;
|
|
2220
|
+
},
|
|
2221
|
+
isNullable() {
|
|
2222
|
+
return this.safeParse(null).success;
|
|
2223
|
+
},
|
|
2224
|
+
apply(fn) {
|
|
2225
|
+
return fn(this);
|
|
2226
|
+
}
|
|
2227
|
+
});
|
|
2046
2228
|
Object.defineProperty(inst, "description", {
|
|
2047
2229
|
get() {
|
|
2048
2230
|
return globalRegistry.get(inst)?.description;
|
|
2049
2231
|
},
|
|
2050
2232
|
configurable: true
|
|
2051
2233
|
});
|
|
2052
|
-
inst.meta = (...args) => {
|
|
2053
|
-
if (args.length === 0) return globalRegistry.get(inst);
|
|
2054
|
-
const cl = inst.clone();
|
|
2055
|
-
globalRegistry.add(cl, args[0]);
|
|
2056
|
-
return cl;
|
|
2057
|
-
};
|
|
2058
|
-
inst.isOptional = () => inst.safeParse(void 0).success;
|
|
2059
|
-
inst.isNullable = () => inst.safeParse(null).success;
|
|
2060
|
-
inst.apply = (fn) => fn(inst);
|
|
2061
2234
|
return inst;
|
|
2062
2235
|
});
|
|
2063
2236
|
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
@@ -2081,11 +2254,23 @@ const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
|
2081
2254
|
ZodType.init(inst, def);
|
|
2082
2255
|
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
2083
2256
|
inst.element = def.element;
|
|
2084
|
-
inst
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2257
|
+
_installLazyMethods(inst, "ZodArray", {
|
|
2258
|
+
min(n, params) {
|
|
2259
|
+
return this.check(/* @__PURE__ */ _minLength(n, params));
|
|
2260
|
+
},
|
|
2261
|
+
nonempty(params) {
|
|
2262
|
+
return this.check(/* @__PURE__ */ _minLength(1, params));
|
|
2263
|
+
},
|
|
2264
|
+
max(n, params) {
|
|
2265
|
+
return this.check(/* @__PURE__ */ _maxLength(n, params));
|
|
2266
|
+
},
|
|
2267
|
+
length(n, params) {
|
|
2268
|
+
return this.check(/* @__PURE__ */ _length(n, params));
|
|
2269
|
+
},
|
|
2270
|
+
unwrap() {
|
|
2271
|
+
return this.element;
|
|
2272
|
+
}
|
|
2273
|
+
});
|
|
2089
2274
|
});
|
|
2090
2275
|
function array(element, params) {
|
|
2091
2276
|
return /* @__PURE__ */ _array(ZodArray, element, params);
|
|
@@ -2097,38 +2282,62 @@ const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
2097
2282
|
defineLazy(inst, "shape", () => {
|
|
2098
2283
|
return def.shape;
|
|
2099
2284
|
});
|
|
2100
|
-
inst
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2285
|
+
_installLazyMethods(inst, "ZodObject", {
|
|
2286
|
+
keyof() {
|
|
2287
|
+
return _enum(Object.keys(this._zod.def.shape));
|
|
2288
|
+
},
|
|
2289
|
+
catchall(catchall) {
|
|
2290
|
+
return this.clone({
|
|
2291
|
+
...this._zod.def,
|
|
2292
|
+
catchall
|
|
2293
|
+
});
|
|
2294
|
+
},
|
|
2295
|
+
passthrough() {
|
|
2296
|
+
return this.clone({
|
|
2297
|
+
...this._zod.def,
|
|
2298
|
+
catchall: unknown()
|
|
2299
|
+
});
|
|
2300
|
+
},
|
|
2301
|
+
loose() {
|
|
2302
|
+
return this.clone({
|
|
2303
|
+
...this._zod.def,
|
|
2304
|
+
catchall: unknown()
|
|
2305
|
+
});
|
|
2306
|
+
},
|
|
2307
|
+
strict() {
|
|
2308
|
+
return this.clone({
|
|
2309
|
+
...this._zod.def,
|
|
2310
|
+
catchall: never()
|
|
2311
|
+
});
|
|
2312
|
+
},
|
|
2313
|
+
strip() {
|
|
2314
|
+
return this.clone({
|
|
2315
|
+
...this._zod.def,
|
|
2316
|
+
catchall: void 0
|
|
2317
|
+
});
|
|
2318
|
+
},
|
|
2319
|
+
extend(incoming) {
|
|
2320
|
+
return extend(this, incoming);
|
|
2321
|
+
},
|
|
2322
|
+
safeExtend(incoming) {
|
|
2323
|
+
return safeExtend(this, incoming);
|
|
2324
|
+
},
|
|
2325
|
+
merge(other) {
|
|
2326
|
+
return merge(this, other);
|
|
2327
|
+
},
|
|
2328
|
+
pick(mask) {
|
|
2329
|
+
return pick(this, mask);
|
|
2330
|
+
},
|
|
2331
|
+
omit(mask) {
|
|
2332
|
+
return omit(this, mask);
|
|
2333
|
+
},
|
|
2334
|
+
partial(...args) {
|
|
2335
|
+
return partial(ZodOptional, this, args[0]);
|
|
2336
|
+
},
|
|
2337
|
+
required(...args) {
|
|
2338
|
+
return required(ZodNonOptional, this, args[0]);
|
|
2339
|
+
}
|
|
2120
2340
|
});
|
|
2121
|
-
inst.extend = (incoming) => {
|
|
2122
|
-
return extend(inst, incoming);
|
|
2123
|
-
};
|
|
2124
|
-
inst.safeExtend = (incoming) => {
|
|
2125
|
-
return safeExtend(inst, incoming);
|
|
2126
|
-
};
|
|
2127
|
-
inst.merge = (other) => merge(inst, other);
|
|
2128
|
-
inst.pick = (mask) => pick(inst, mask);
|
|
2129
|
-
inst.omit = (mask) => omit(inst, mask);
|
|
2130
|
-
inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
|
|
2131
|
-
inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
|
|
2132
2341
|
});
|
|
2133
2342
|
function object(shape, params) {
|
|
2134
2343
|
return new ZodObject({
|
|
@@ -2219,9 +2428,11 @@ const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) =>
|
|
|
2219
2428
|
const output = def.transform(payload.value, payload);
|
|
2220
2429
|
if (output instanceof Promise) return output.then((output) => {
|
|
2221
2430
|
payload.value = output;
|
|
2431
|
+
payload.fallback = true;
|
|
2222
2432
|
return payload;
|
|
2223
2433
|
});
|
|
2224
2434
|
payload.value = output;
|
|
2435
|
+
payload.fallback = true;
|
|
2225
2436
|
return payload;
|
|
2226
2437
|
};
|
|
2227
2438
|
});
|
|
@@ -2359,8 +2570,8 @@ const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
|
2359
2570
|
function refine(fn, _params = {}) {
|
|
2360
2571
|
return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
|
|
2361
2572
|
}
|
|
2362
|
-
function superRefine(fn) {
|
|
2363
|
-
return /* @__PURE__ */ _superRefine(fn);
|
|
2573
|
+
function superRefine(fn, params) {
|
|
2574
|
+
return /* @__PURE__ */ _superRefine(fn, params);
|
|
2364
2575
|
}
|
|
2365
2576
|
//#endregion
|
|
2366
2577
|
//#region src/channel.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@betternotify/discord",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "Discord channel plugin for betternotify.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@standard-schema/spec": "1.1.0",
|
|
26
|
-
"zod": "4.3
|
|
27
|
-
"@betternotify/core": "^1.0.0-beta.
|
|
26
|
+
"zod": "4.4.3",
|
|
27
|
+
"@betternotify/core": "^1.0.0-beta.8"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"rolldown": "1.0.1",
|