@marlinjai/email-mcp 1.4.0 → 1.4.2
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/README.md +8 -6
- package/dist/index.js +600 -571
- package/dist/index.js.map +4 -4
- package/dist/setup/wizard.js +147 -125
- package/dist/setup/wizard.js.map +3 -3
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -3197,27 +3197,27 @@ var require_utils = __commonJS({
|
|
|
3197
3197
|
"use strict";
|
|
3198
3198
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
3199
3199
|
var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
3200
|
-
function stringArrayToHexStripped(
|
|
3200
|
+
function stringArrayToHexStripped(input2) {
|
|
3201
3201
|
let acc = "";
|
|
3202
3202
|
let code = 0;
|
|
3203
3203
|
let i = 0;
|
|
3204
|
-
for (i = 0; i <
|
|
3205
|
-
code =
|
|
3204
|
+
for (i = 0; i < input2.length; i++) {
|
|
3205
|
+
code = input2[i].charCodeAt(0);
|
|
3206
3206
|
if (code === 48) {
|
|
3207
3207
|
continue;
|
|
3208
3208
|
}
|
|
3209
3209
|
if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {
|
|
3210
3210
|
return "";
|
|
3211
3211
|
}
|
|
3212
|
-
acc +=
|
|
3212
|
+
acc += input2[i];
|
|
3213
3213
|
break;
|
|
3214
3214
|
}
|
|
3215
|
-
for (i += 1; i <
|
|
3216
|
-
code =
|
|
3215
|
+
for (i += 1; i < input2.length; i++) {
|
|
3216
|
+
code = input2[i].charCodeAt(0);
|
|
3217
3217
|
if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {
|
|
3218
3218
|
return "";
|
|
3219
3219
|
}
|
|
3220
|
-
acc +=
|
|
3220
|
+
acc += input2[i];
|
|
3221
3221
|
}
|
|
3222
3222
|
return acc;
|
|
3223
3223
|
}
|
|
@@ -3226,29 +3226,29 @@ var require_utils = __commonJS({
|
|
|
3226
3226
|
buffer.length = 0;
|
|
3227
3227
|
return true;
|
|
3228
3228
|
}
|
|
3229
|
-
function consumeHextets(buffer, address,
|
|
3229
|
+
function consumeHextets(buffer, address, output2) {
|
|
3230
3230
|
if (buffer.length) {
|
|
3231
3231
|
const hex3 = stringArrayToHexStripped(buffer);
|
|
3232
3232
|
if (hex3 !== "") {
|
|
3233
3233
|
address.push(hex3);
|
|
3234
3234
|
} else {
|
|
3235
|
-
|
|
3235
|
+
output2.error = true;
|
|
3236
3236
|
return false;
|
|
3237
3237
|
}
|
|
3238
3238
|
buffer.length = 0;
|
|
3239
3239
|
}
|
|
3240
3240
|
return true;
|
|
3241
3241
|
}
|
|
3242
|
-
function getIPV6(
|
|
3242
|
+
function getIPV6(input2) {
|
|
3243
3243
|
let tokenCount = 0;
|
|
3244
|
-
const
|
|
3244
|
+
const output2 = { error: false, address: "", zone: "" };
|
|
3245
3245
|
const address = [];
|
|
3246
3246
|
const buffer = [];
|
|
3247
3247
|
let endipv6Encountered = false;
|
|
3248
3248
|
let endIpv6 = false;
|
|
3249
3249
|
let consume = consumeHextets;
|
|
3250
|
-
for (let i = 0; i <
|
|
3251
|
-
const cursor =
|
|
3250
|
+
for (let i = 0; i < input2.length; i++) {
|
|
3251
|
+
const cursor = input2[i];
|
|
3252
3252
|
if (cursor === "[" || cursor === "]") {
|
|
3253
3253
|
continue;
|
|
3254
3254
|
}
|
|
@@ -3256,20 +3256,20 @@ var require_utils = __commonJS({
|
|
|
3256
3256
|
if (endipv6Encountered === true) {
|
|
3257
3257
|
endIpv6 = true;
|
|
3258
3258
|
}
|
|
3259
|
-
if (!consume(buffer, address,
|
|
3259
|
+
if (!consume(buffer, address, output2)) {
|
|
3260
3260
|
break;
|
|
3261
3261
|
}
|
|
3262
3262
|
if (++tokenCount > 7) {
|
|
3263
|
-
|
|
3263
|
+
output2.error = true;
|
|
3264
3264
|
break;
|
|
3265
3265
|
}
|
|
3266
|
-
if (i > 0 &&
|
|
3266
|
+
if (i > 0 && input2[i - 1] === ":") {
|
|
3267
3267
|
endipv6Encountered = true;
|
|
3268
3268
|
}
|
|
3269
3269
|
address.push(":");
|
|
3270
3270
|
continue;
|
|
3271
3271
|
} else if (cursor === "%") {
|
|
3272
|
-
if (!consume(buffer, address,
|
|
3272
|
+
if (!consume(buffer, address, output2)) {
|
|
3273
3273
|
break;
|
|
3274
3274
|
}
|
|
3275
3275
|
consume = consumeIsZone;
|
|
@@ -3280,15 +3280,15 @@ var require_utils = __commonJS({
|
|
|
3280
3280
|
}
|
|
3281
3281
|
if (buffer.length) {
|
|
3282
3282
|
if (consume === consumeIsZone) {
|
|
3283
|
-
|
|
3283
|
+
output2.zone = buffer.join("");
|
|
3284
3284
|
} else if (endIpv6) {
|
|
3285
3285
|
address.push(buffer.join(""));
|
|
3286
3286
|
} else {
|
|
3287
3287
|
address.push(stringArrayToHexStripped(buffer));
|
|
3288
3288
|
}
|
|
3289
3289
|
}
|
|
3290
|
-
|
|
3291
|
-
return
|
|
3290
|
+
output2.address = address.join("");
|
|
3291
|
+
return output2;
|
|
3292
3292
|
}
|
|
3293
3293
|
function normalizeIPv6(host) {
|
|
3294
3294
|
if (findToken(host, ":") < 2) {
|
|
@@ -3315,79 +3315,79 @@ var require_utils = __commonJS({
|
|
|
3315
3315
|
return ind;
|
|
3316
3316
|
}
|
|
3317
3317
|
function removeDotSegments(path3) {
|
|
3318
|
-
let
|
|
3319
|
-
const
|
|
3318
|
+
let input2 = path3;
|
|
3319
|
+
const output2 = [];
|
|
3320
3320
|
let nextSlash = -1;
|
|
3321
3321
|
let len = 0;
|
|
3322
|
-
while (len =
|
|
3322
|
+
while (len = input2.length) {
|
|
3323
3323
|
if (len === 1) {
|
|
3324
|
-
if (
|
|
3324
|
+
if (input2 === ".") {
|
|
3325
3325
|
break;
|
|
3326
|
-
} else if (
|
|
3327
|
-
|
|
3326
|
+
} else if (input2 === "/") {
|
|
3327
|
+
output2.push("/");
|
|
3328
3328
|
break;
|
|
3329
3329
|
} else {
|
|
3330
|
-
|
|
3330
|
+
output2.push(input2);
|
|
3331
3331
|
break;
|
|
3332
3332
|
}
|
|
3333
3333
|
} else if (len === 2) {
|
|
3334
|
-
if (
|
|
3335
|
-
if (
|
|
3334
|
+
if (input2[0] === ".") {
|
|
3335
|
+
if (input2[1] === ".") {
|
|
3336
3336
|
break;
|
|
3337
|
-
} else if (
|
|
3338
|
-
|
|
3337
|
+
} else if (input2[1] === "/") {
|
|
3338
|
+
input2 = input2.slice(2);
|
|
3339
3339
|
continue;
|
|
3340
3340
|
}
|
|
3341
|
-
} else if (
|
|
3342
|
-
if (
|
|
3343
|
-
|
|
3341
|
+
} else if (input2[0] === "/") {
|
|
3342
|
+
if (input2[1] === "." || input2[1] === "/") {
|
|
3343
|
+
output2.push("/");
|
|
3344
3344
|
break;
|
|
3345
3345
|
}
|
|
3346
3346
|
}
|
|
3347
3347
|
} else if (len === 3) {
|
|
3348
|
-
if (
|
|
3349
|
-
if (
|
|
3350
|
-
|
|
3348
|
+
if (input2 === "/..") {
|
|
3349
|
+
if (output2.length !== 0) {
|
|
3350
|
+
output2.pop();
|
|
3351
3351
|
}
|
|
3352
|
-
|
|
3352
|
+
output2.push("/");
|
|
3353
3353
|
break;
|
|
3354
3354
|
}
|
|
3355
3355
|
}
|
|
3356
|
-
if (
|
|
3357
|
-
if (
|
|
3358
|
-
if (
|
|
3359
|
-
|
|
3356
|
+
if (input2[0] === ".") {
|
|
3357
|
+
if (input2[1] === ".") {
|
|
3358
|
+
if (input2[2] === "/") {
|
|
3359
|
+
input2 = input2.slice(3);
|
|
3360
3360
|
continue;
|
|
3361
3361
|
}
|
|
3362
|
-
} else if (
|
|
3363
|
-
|
|
3362
|
+
} else if (input2[1] === "/") {
|
|
3363
|
+
input2 = input2.slice(2);
|
|
3364
3364
|
continue;
|
|
3365
3365
|
}
|
|
3366
|
-
} else if (
|
|
3367
|
-
if (
|
|
3368
|
-
if (
|
|
3369
|
-
|
|
3366
|
+
} else if (input2[0] === "/") {
|
|
3367
|
+
if (input2[1] === ".") {
|
|
3368
|
+
if (input2[2] === "/") {
|
|
3369
|
+
input2 = input2.slice(2);
|
|
3370
3370
|
continue;
|
|
3371
|
-
} else if (
|
|
3372
|
-
if (
|
|
3373
|
-
|
|
3374
|
-
if (
|
|
3375
|
-
|
|
3371
|
+
} else if (input2[2] === ".") {
|
|
3372
|
+
if (input2[3] === "/") {
|
|
3373
|
+
input2 = input2.slice(3);
|
|
3374
|
+
if (output2.length !== 0) {
|
|
3375
|
+
output2.pop();
|
|
3376
3376
|
}
|
|
3377
3377
|
continue;
|
|
3378
3378
|
}
|
|
3379
3379
|
}
|
|
3380
3380
|
}
|
|
3381
3381
|
}
|
|
3382
|
-
if ((nextSlash =
|
|
3383
|
-
|
|
3382
|
+
if ((nextSlash = input2.indexOf("/", 1)) === -1) {
|
|
3383
|
+
output2.push(input2);
|
|
3384
3384
|
break;
|
|
3385
3385
|
} else {
|
|
3386
|
-
|
|
3387
|
-
|
|
3386
|
+
output2.push(input2.slice(0, nextSlash));
|
|
3387
|
+
input2 = input2.slice(nextSlash);
|
|
3388
3388
|
}
|
|
3389
3389
|
}
|
|
3390
|
-
return
|
|
3390
|
+
return output2.join("");
|
|
3391
3391
|
}
|
|
3392
3392
|
function normalizeComponentEncoding(component, esc2) {
|
|
3393
3393
|
const func = esc2 !== true ? escape : unescape;
|
|
@@ -9291,6 +9291,113 @@ var init_account_manager = __esm({
|
|
|
9291
9291
|
}
|
|
9292
9292
|
});
|
|
9293
9293
|
|
|
9294
|
+
// src/setup/prompts.ts
|
|
9295
|
+
import readline from "node:readline/promises";
|
|
9296
|
+
import { stdin as input, stdout as output } from "node:process";
|
|
9297
|
+
function getInterface() {
|
|
9298
|
+
if (!sharedInterface) {
|
|
9299
|
+
sharedInterface = readline.createInterface({ input, output });
|
|
9300
|
+
}
|
|
9301
|
+
return sharedInterface;
|
|
9302
|
+
}
|
|
9303
|
+
function closePrompts() {
|
|
9304
|
+
sharedInterface?.close();
|
|
9305
|
+
sharedInterface = null;
|
|
9306
|
+
}
|
|
9307
|
+
async function askText(message, defaultValue) {
|
|
9308
|
+
const rl = getInterface();
|
|
9309
|
+
const suffix = defaultValue ? ` (${defaultValue})` : "";
|
|
9310
|
+
const answer = await rl.question(`${message}${suffix} `);
|
|
9311
|
+
const trimmed = answer.trim();
|
|
9312
|
+
return trimmed.length > 0 ? trimmed : defaultValue ?? "";
|
|
9313
|
+
}
|
|
9314
|
+
async function askValidated(message, defaultValue, validate) {
|
|
9315
|
+
for (; ; ) {
|
|
9316
|
+
const value = await askText(message, defaultValue);
|
|
9317
|
+
const result = validate(value);
|
|
9318
|
+
if (result === true) return value;
|
|
9319
|
+
console.log(` ${result}`);
|
|
9320
|
+
}
|
|
9321
|
+
}
|
|
9322
|
+
async function askConfirm(message, defaultValue = false) {
|
|
9323
|
+
const suffix = defaultValue ? "Y/n" : "y/N";
|
|
9324
|
+
const answer = await askText(`${message} (${suffix})`);
|
|
9325
|
+
if (!answer) return defaultValue;
|
|
9326
|
+
return /^y/i.test(answer);
|
|
9327
|
+
}
|
|
9328
|
+
async function askChoice(message, choices) {
|
|
9329
|
+
console.log(message);
|
|
9330
|
+
choices.forEach((c, i) => console.log(` ${i + 1}) ${c.name}`));
|
|
9331
|
+
for (; ; ) {
|
|
9332
|
+
const answer = await askText("Enter a number:");
|
|
9333
|
+
const idx = parseInt(answer, 10) - 1;
|
|
9334
|
+
if (idx >= 0 && idx < choices.length) return choices[idx].value;
|
|
9335
|
+
console.log(` Please enter a number between 1 and ${choices.length}.`);
|
|
9336
|
+
}
|
|
9337
|
+
}
|
|
9338
|
+
function askPassword(message) {
|
|
9339
|
+
return new Promise((resolve) => {
|
|
9340
|
+
output.write(`${message} `);
|
|
9341
|
+
closePrompts();
|
|
9342
|
+
let rawModeOk = true;
|
|
9343
|
+
try {
|
|
9344
|
+
input.setRawMode(true);
|
|
9345
|
+
} catch {
|
|
9346
|
+
rawModeOk = false;
|
|
9347
|
+
}
|
|
9348
|
+
if (!rawModeOk) {
|
|
9349
|
+
const rl = getInterface();
|
|
9350
|
+
rl.question("").then(resolve);
|
|
9351
|
+
return;
|
|
9352
|
+
}
|
|
9353
|
+
let value = "";
|
|
9354
|
+
input.resume();
|
|
9355
|
+
input.setEncoding("utf8");
|
|
9356
|
+
const cleanup = () => {
|
|
9357
|
+
input.setRawMode(false);
|
|
9358
|
+
input.pause();
|
|
9359
|
+
input.removeListener("data", onData);
|
|
9360
|
+
};
|
|
9361
|
+
const onData = (char) => {
|
|
9362
|
+
switch (char) {
|
|
9363
|
+
case "\n":
|
|
9364
|
+
case "\r":
|
|
9365
|
+
case CTRL_D:
|
|
9366
|
+
cleanup();
|
|
9367
|
+
output.write("\n");
|
|
9368
|
+
resolve(value);
|
|
9369
|
+
break;
|
|
9370
|
+
case CTRL_C:
|
|
9371
|
+
cleanup();
|
|
9372
|
+
output.write("\n");
|
|
9373
|
+
process.exit(130);
|
|
9374
|
+
break;
|
|
9375
|
+
case BACKSPACE:
|
|
9376
|
+
case "\b":
|
|
9377
|
+
if (value.length > 0) {
|
|
9378
|
+
value = value.slice(0, -1);
|
|
9379
|
+
output.write("\b \b");
|
|
9380
|
+
}
|
|
9381
|
+
break;
|
|
9382
|
+
default:
|
|
9383
|
+
value += char;
|
|
9384
|
+
output.write("*");
|
|
9385
|
+
}
|
|
9386
|
+
};
|
|
9387
|
+
input.on("data", onData);
|
|
9388
|
+
});
|
|
9389
|
+
}
|
|
9390
|
+
var CTRL_C, CTRL_D, BACKSPACE, sharedInterface;
|
|
9391
|
+
var init_prompts = __esm({
|
|
9392
|
+
"src/setup/prompts.ts"() {
|
|
9393
|
+
"use strict";
|
|
9394
|
+
CTRL_C = "";
|
|
9395
|
+
CTRL_D = "";
|
|
9396
|
+
BACKSPACE = "\x7F";
|
|
9397
|
+
sharedInterface = null;
|
|
9398
|
+
}
|
|
9399
|
+
});
|
|
9400
|
+
|
|
9294
9401
|
// src/auth/oauth-server.ts
|
|
9295
9402
|
import http from "node:http";
|
|
9296
9403
|
var SUCCESS_HTML, ERROR_HTML, OAuthCallbackServer;
|
|
@@ -9388,7 +9495,6 @@ var init_oauth_server = __esm({
|
|
|
9388
9495
|
var wizard_exports = {};
|
|
9389
9496
|
import crypto4 from "node:crypto";
|
|
9390
9497
|
import { exec } from "node:child_process";
|
|
9391
|
-
import inquirer from "inquirer";
|
|
9392
9498
|
function openBrowser(url2) {
|
|
9393
9499
|
const platform = process.platform;
|
|
9394
9500
|
let cmd;
|
|
@@ -9429,15 +9535,7 @@ async function testAndSave(creds) {
|
|
|
9429
9535
|
}
|
|
9430
9536
|
}
|
|
9431
9537
|
async function promptAccountName(defaultName) {
|
|
9432
|
-
|
|
9433
|
-
{
|
|
9434
|
-
type: "input",
|
|
9435
|
-
name: "name",
|
|
9436
|
-
message: "Account name:",
|
|
9437
|
-
default: defaultName
|
|
9438
|
-
}
|
|
9439
|
-
]);
|
|
9440
|
-
return name;
|
|
9538
|
+
return askText("Account name:", defaultName);
|
|
9441
9539
|
}
|
|
9442
9540
|
async function setupGmail() {
|
|
9443
9541
|
console.log("\n--- Gmail Setup ---");
|
|
@@ -9529,30 +9627,25 @@ async function setupICloud() {
|
|
|
9529
9627
|
console.log(
|
|
9530
9628
|
"You need an app-specific password for iCloud Mail.\nGenerate one at https://appleid.apple.com/account/manage\n(Sign In & Security > App-Specific Passwords)\n"
|
|
9531
9629
|
);
|
|
9532
|
-
const
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
message: "App-specific password:",
|
|
9543
|
-
mask: "*",
|
|
9544
|
-
validate: (v) => v.trim().length > 0 || "Password is required"
|
|
9545
|
-
}
|
|
9546
|
-
]);
|
|
9630
|
+
const email3 = await askValidated(
|
|
9631
|
+
"iCloud email address:",
|
|
9632
|
+
void 0,
|
|
9633
|
+
(v) => v.includes("@") || "Enter a valid email address"
|
|
9634
|
+
);
|
|
9635
|
+
let password = await askPassword("App-specific password:");
|
|
9636
|
+
while (password.trim().length === 0) {
|
|
9637
|
+
console.log(" Password is required");
|
|
9638
|
+
password = await askPassword("App-specific password:");
|
|
9639
|
+
}
|
|
9547
9640
|
const name = await promptAccountName("iCloud");
|
|
9548
9641
|
const id = crypto4.randomUUID();
|
|
9549
9642
|
const creds = {
|
|
9550
9643
|
id,
|
|
9551
9644
|
name,
|
|
9552
9645
|
provider: ProviderType.ICloud,
|
|
9553
|
-
email:
|
|
9646
|
+
email: email3.trim(),
|
|
9554
9647
|
password: {
|
|
9555
|
-
password
|
|
9648
|
+
password,
|
|
9556
9649
|
host: "imap.mail.me.com",
|
|
9557
9650
|
port: 993,
|
|
9558
9651
|
tls: true,
|
|
@@ -9564,72 +9657,26 @@ async function setupICloud() {
|
|
|
9564
9657
|
}
|
|
9565
9658
|
async function setupIMAP() {
|
|
9566
9659
|
console.log("\n--- Generic IMAP Setup ---\n");
|
|
9567
|
-
const
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
type: "input",
|
|
9582
|
-
name: "port",
|
|
9583
|
-
message: "IMAP port:",
|
|
9584
|
-
default: "993",
|
|
9585
|
-
validate: (v) => {
|
|
9586
|
-
const n = parseInt(v, 10);
|
|
9587
|
-
return n > 0 && n <= 65535 || "Enter a valid port number (1-65535)";
|
|
9588
|
-
}
|
|
9589
|
-
},
|
|
9590
|
-
{
|
|
9591
|
-
type: "confirm",
|
|
9592
|
-
name: "tls",
|
|
9593
|
-
message: "Use TLS?",
|
|
9594
|
-
default: true
|
|
9595
|
-
},
|
|
9596
|
-
{
|
|
9597
|
-
type: "password",
|
|
9598
|
-
name: "password",
|
|
9599
|
-
message: "Password:",
|
|
9600
|
-
mask: "*",
|
|
9601
|
-
validate: (v) => v.trim().length > 0 || "Password is required"
|
|
9602
|
-
},
|
|
9603
|
-
{
|
|
9604
|
-
type: "confirm",
|
|
9605
|
-
name: "configureSmtp",
|
|
9606
|
-
message: "Configure SMTP (for sending)?",
|
|
9607
|
-
default: false
|
|
9608
|
-
}
|
|
9609
|
-
]);
|
|
9660
|
+
const portValidator = (v) => {
|
|
9661
|
+
const n = parseInt(v, 10);
|
|
9662
|
+
return n > 0 && n <= 65535 || "Enter a valid port number (1-65535)";
|
|
9663
|
+
};
|
|
9664
|
+
const email3 = await askValidated("Email address:", void 0, (v) => v.includes("@") || "Enter a valid email address");
|
|
9665
|
+
const host = await askValidated("IMAP host:", void 0, (v) => v.trim().length > 0 || "Host is required");
|
|
9666
|
+
const portStr = await askValidated("IMAP port:", "993", portValidator);
|
|
9667
|
+
const tls = await askConfirm("Use TLS?", true);
|
|
9668
|
+
let password = await askPassword("Password:");
|
|
9669
|
+
while (password.trim().length === 0) {
|
|
9670
|
+
console.log(" Password is required");
|
|
9671
|
+
password = await askPassword("Password:");
|
|
9672
|
+
}
|
|
9673
|
+
const configureSmtp = await askConfirm("Configure SMTP (for sending)?", false);
|
|
9610
9674
|
let smtpHost;
|
|
9611
9675
|
let smtpPort;
|
|
9612
|
-
if (
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
name: "smtpHost",
|
|
9617
|
-
message: "SMTP host:",
|
|
9618
|
-
validate: (v) => v.trim().length > 0 || "SMTP host is required"
|
|
9619
|
-
},
|
|
9620
|
-
{
|
|
9621
|
-
type: "input",
|
|
9622
|
-
name: "smtpPort",
|
|
9623
|
-
message: "SMTP port:",
|
|
9624
|
-
default: "587",
|
|
9625
|
-
validate: (v) => {
|
|
9626
|
-
const n = parseInt(v, 10);
|
|
9627
|
-
return n > 0 && n <= 65535 || "Enter a valid port number (1-65535)";
|
|
9628
|
-
}
|
|
9629
|
-
}
|
|
9630
|
-
]);
|
|
9631
|
-
smtpHost = smtp.smtpHost.trim();
|
|
9632
|
-
smtpPort = parseInt(smtp.smtpPort, 10);
|
|
9676
|
+
if (configureSmtp) {
|
|
9677
|
+
smtpHost = await askValidated("SMTP host:", void 0, (v) => v.trim().length > 0 || "SMTP host is required");
|
|
9678
|
+
const smtpPortStr = await askValidated("SMTP port:", "587", portValidator);
|
|
9679
|
+
smtpPort = parseInt(smtpPortStr, 10);
|
|
9633
9680
|
}
|
|
9634
9681
|
const name = await promptAccountName("IMAP");
|
|
9635
9682
|
const id = crypto4.randomUUID();
|
|
@@ -9637,12 +9684,12 @@ async function setupIMAP() {
|
|
|
9637
9684
|
id,
|
|
9638
9685
|
name,
|
|
9639
9686
|
provider: ProviderType.IMAP,
|
|
9640
|
-
email:
|
|
9687
|
+
email: email3.trim(),
|
|
9641
9688
|
password: {
|
|
9642
|
-
password
|
|
9643
|
-
host:
|
|
9644
|
-
port: parseInt(
|
|
9645
|
-
tls
|
|
9689
|
+
password,
|
|
9690
|
+
host: host.trim(),
|
|
9691
|
+
port: parseInt(portStr, 10),
|
|
9692
|
+
tls,
|
|
9646
9693
|
smtpHost,
|
|
9647
9694
|
smtpPort
|
|
9648
9695
|
}
|
|
@@ -9672,14 +9719,7 @@ async function removeAccount(id) {
|
|
|
9672
9719
|
console.error(`Account not found: ${id}`);
|
|
9673
9720
|
process.exit(1);
|
|
9674
9721
|
}
|
|
9675
|
-
const
|
|
9676
|
-
{
|
|
9677
|
-
type: "confirm",
|
|
9678
|
-
name: "confirm",
|
|
9679
|
-
message: `Remove account "${acct.name}" (${acct.email})?`,
|
|
9680
|
-
default: false
|
|
9681
|
-
}
|
|
9682
|
-
]);
|
|
9722
|
+
const confirm = await askConfirm(`Remove account "${acct.name}" (${acct.email})?`, false);
|
|
9683
9723
|
if (confirm) {
|
|
9684
9724
|
await store.remove(id);
|
|
9685
9725
|
console.log(`Account "${acct.name}" removed.`);
|
|
@@ -9706,18 +9746,11 @@ async function main() {
|
|
|
9706
9746
|
console.log("@marlinjai/email-mcp Account Setup\n");
|
|
9707
9747
|
let addMore = true;
|
|
9708
9748
|
while (addMore) {
|
|
9709
|
-
const
|
|
9710
|
-
{
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
choices: [
|
|
9715
|
-
{ name: "Gmail", value: "gmail" },
|
|
9716
|
-
{ name: "Outlook", value: "outlook" },
|
|
9717
|
-
{ name: "iCloud", value: "icloud" },
|
|
9718
|
-
{ name: "Other IMAP", value: "imap" }
|
|
9719
|
-
]
|
|
9720
|
-
}
|
|
9749
|
+
const provider = await askChoice("Select provider:", [
|
|
9750
|
+
{ name: "Gmail", value: "gmail" },
|
|
9751
|
+
{ name: "Outlook", value: "outlook" },
|
|
9752
|
+
{ name: "iCloud", value: "icloud" },
|
|
9753
|
+
{ name: "Other IMAP", value: "imap" }
|
|
9721
9754
|
]);
|
|
9722
9755
|
switch (provider) {
|
|
9723
9756
|
case ProviderType.Gmail:
|
|
@@ -9736,15 +9769,7 @@ async function main() {
|
|
|
9736
9769
|
console.error(`Unknown provider: ${provider}`);
|
|
9737
9770
|
process.exit(1);
|
|
9738
9771
|
}
|
|
9739
|
-
|
|
9740
|
-
{
|
|
9741
|
-
type: "confirm",
|
|
9742
|
-
name: "another",
|
|
9743
|
-
message: "Would you like to add another email account?",
|
|
9744
|
-
default: false
|
|
9745
|
-
}
|
|
9746
|
-
]);
|
|
9747
|
-
addMore = another;
|
|
9772
|
+
addMore = await askConfirm("Would you like to add another email account?", false);
|
|
9748
9773
|
}
|
|
9749
9774
|
console.log("\nSetup complete! You can now use the email tools in Claude Code.");
|
|
9750
9775
|
}
|
|
@@ -9752,6 +9777,7 @@ var store, manager;
|
|
|
9752
9777
|
var init_wizard = __esm({
|
|
9753
9778
|
"src/setup/wizard.ts"() {
|
|
9754
9779
|
"use strict";
|
|
9780
|
+
init_prompts();
|
|
9755
9781
|
init_credential_store();
|
|
9756
9782
|
init_oauth_server();
|
|
9757
9783
|
init_auth();
|
|
@@ -9765,6 +9791,9 @@ var init_wizard = __esm({
|
|
|
9765
9791
|
console.error(`
|
|
9766
9792
|
Setup failed: ${err.message}`);
|
|
9767
9793
|
process.exit(1);
|
|
9794
|
+
}).finally(() => {
|
|
9795
|
+
closePrompts();
|
|
9796
|
+
process.exit(0);
|
|
9768
9797
|
});
|
|
9769
9798
|
}
|
|
9770
9799
|
});
|
|
@@ -10311,41 +10340,41 @@ var ZodType = class {
|
|
|
10311
10340
|
get description() {
|
|
10312
10341
|
return this._def.description;
|
|
10313
10342
|
}
|
|
10314
|
-
_getType(
|
|
10315
|
-
return getParsedType(
|
|
10343
|
+
_getType(input2) {
|
|
10344
|
+
return getParsedType(input2.data);
|
|
10316
10345
|
}
|
|
10317
|
-
_getOrReturnCtx(
|
|
10346
|
+
_getOrReturnCtx(input2, ctx) {
|
|
10318
10347
|
return ctx || {
|
|
10319
|
-
common:
|
|
10320
|
-
data:
|
|
10321
|
-
parsedType: getParsedType(
|
|
10348
|
+
common: input2.parent.common,
|
|
10349
|
+
data: input2.data,
|
|
10350
|
+
parsedType: getParsedType(input2.data),
|
|
10322
10351
|
schemaErrorMap: this._def.errorMap,
|
|
10323
|
-
path:
|
|
10324
|
-
parent:
|
|
10352
|
+
path: input2.path,
|
|
10353
|
+
parent: input2.parent
|
|
10325
10354
|
};
|
|
10326
10355
|
}
|
|
10327
|
-
_processInputParams(
|
|
10356
|
+
_processInputParams(input2) {
|
|
10328
10357
|
return {
|
|
10329
10358
|
status: new ParseStatus(),
|
|
10330
10359
|
ctx: {
|
|
10331
|
-
common:
|
|
10332
|
-
data:
|
|
10333
|
-
parsedType: getParsedType(
|
|
10360
|
+
common: input2.parent.common,
|
|
10361
|
+
data: input2.data,
|
|
10362
|
+
parsedType: getParsedType(input2.data),
|
|
10334
10363
|
schemaErrorMap: this._def.errorMap,
|
|
10335
|
-
path:
|
|
10336
|
-
parent:
|
|
10364
|
+
path: input2.path,
|
|
10365
|
+
parent: input2.parent
|
|
10337
10366
|
}
|
|
10338
10367
|
};
|
|
10339
10368
|
}
|
|
10340
|
-
_parseSync(
|
|
10341
|
-
const result = this._parse(
|
|
10369
|
+
_parseSync(input2) {
|
|
10370
|
+
const result = this._parse(input2);
|
|
10342
10371
|
if (isAsync(result)) {
|
|
10343
10372
|
throw new Error("Synchronous parse encountered promise.");
|
|
10344
10373
|
}
|
|
10345
10374
|
return result;
|
|
10346
10375
|
}
|
|
10347
|
-
_parseAsync(
|
|
10348
|
-
const result = this._parse(
|
|
10376
|
+
_parseAsync(input2) {
|
|
10377
|
+
const result = this._parse(input2);
|
|
10349
10378
|
return Promise.resolve(result);
|
|
10350
10379
|
}
|
|
10351
10380
|
parse(data, params) {
|
|
@@ -10671,13 +10700,13 @@ function isValidCidr(ip, version2) {
|
|
|
10671
10700
|
return false;
|
|
10672
10701
|
}
|
|
10673
10702
|
var ZodString = class _ZodString2 extends ZodType {
|
|
10674
|
-
_parse(
|
|
10703
|
+
_parse(input2) {
|
|
10675
10704
|
if (this._def.coerce) {
|
|
10676
|
-
|
|
10705
|
+
input2.data = String(input2.data);
|
|
10677
10706
|
}
|
|
10678
|
-
const parsedType2 = this._getType(
|
|
10707
|
+
const parsedType2 = this._getType(input2);
|
|
10679
10708
|
if (parsedType2 !== ZodParsedType.string) {
|
|
10680
|
-
const ctx2 = this._getOrReturnCtx(
|
|
10709
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
10681
10710
|
addIssueToContext(ctx2, {
|
|
10682
10711
|
code: ZodIssueCode.invalid_type,
|
|
10683
10712
|
expected: ZodParsedType.string,
|
|
@@ -10689,8 +10718,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10689
10718
|
let ctx = void 0;
|
|
10690
10719
|
for (const check2 of this._def.checks) {
|
|
10691
10720
|
if (check2.kind === "min") {
|
|
10692
|
-
if (
|
|
10693
|
-
ctx = this._getOrReturnCtx(
|
|
10721
|
+
if (input2.data.length < check2.value) {
|
|
10722
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10694
10723
|
addIssueToContext(ctx, {
|
|
10695
10724
|
code: ZodIssueCode.too_small,
|
|
10696
10725
|
minimum: check2.value,
|
|
@@ -10702,8 +10731,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10702
10731
|
status.dirty();
|
|
10703
10732
|
}
|
|
10704
10733
|
} else if (check2.kind === "max") {
|
|
10705
|
-
if (
|
|
10706
|
-
ctx = this._getOrReturnCtx(
|
|
10734
|
+
if (input2.data.length > check2.value) {
|
|
10735
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10707
10736
|
addIssueToContext(ctx, {
|
|
10708
10737
|
code: ZodIssueCode.too_big,
|
|
10709
10738
|
maximum: check2.value,
|
|
@@ -10715,10 +10744,10 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10715
10744
|
status.dirty();
|
|
10716
10745
|
}
|
|
10717
10746
|
} else if (check2.kind === "length") {
|
|
10718
|
-
const tooBig =
|
|
10719
|
-
const tooSmall =
|
|
10747
|
+
const tooBig = input2.data.length > check2.value;
|
|
10748
|
+
const tooSmall = input2.data.length < check2.value;
|
|
10720
10749
|
if (tooBig || tooSmall) {
|
|
10721
|
-
ctx = this._getOrReturnCtx(
|
|
10750
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10722
10751
|
if (tooBig) {
|
|
10723
10752
|
addIssueToContext(ctx, {
|
|
10724
10753
|
code: ZodIssueCode.too_big,
|
|
@@ -10741,8 +10770,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10741
10770
|
status.dirty();
|
|
10742
10771
|
}
|
|
10743
10772
|
} else if (check2.kind === "email") {
|
|
10744
|
-
if (!emailRegex.test(
|
|
10745
|
-
ctx = this._getOrReturnCtx(
|
|
10773
|
+
if (!emailRegex.test(input2.data)) {
|
|
10774
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10746
10775
|
addIssueToContext(ctx, {
|
|
10747
10776
|
validation: "email",
|
|
10748
10777
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10754,8 +10783,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10754
10783
|
if (!emojiRegex) {
|
|
10755
10784
|
emojiRegex = new RegExp(_emojiRegex, "u");
|
|
10756
10785
|
}
|
|
10757
|
-
if (!emojiRegex.test(
|
|
10758
|
-
ctx = this._getOrReturnCtx(
|
|
10786
|
+
if (!emojiRegex.test(input2.data)) {
|
|
10787
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10759
10788
|
addIssueToContext(ctx, {
|
|
10760
10789
|
validation: "emoji",
|
|
10761
10790
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10764,8 +10793,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10764
10793
|
status.dirty();
|
|
10765
10794
|
}
|
|
10766
10795
|
} else if (check2.kind === "uuid") {
|
|
10767
|
-
if (!uuidRegex.test(
|
|
10768
|
-
ctx = this._getOrReturnCtx(
|
|
10796
|
+
if (!uuidRegex.test(input2.data)) {
|
|
10797
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10769
10798
|
addIssueToContext(ctx, {
|
|
10770
10799
|
validation: "uuid",
|
|
10771
10800
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10774,8 +10803,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10774
10803
|
status.dirty();
|
|
10775
10804
|
}
|
|
10776
10805
|
} else if (check2.kind === "nanoid") {
|
|
10777
|
-
if (!nanoidRegex.test(
|
|
10778
|
-
ctx = this._getOrReturnCtx(
|
|
10806
|
+
if (!nanoidRegex.test(input2.data)) {
|
|
10807
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10779
10808
|
addIssueToContext(ctx, {
|
|
10780
10809
|
validation: "nanoid",
|
|
10781
10810
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10784,8 +10813,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10784
10813
|
status.dirty();
|
|
10785
10814
|
}
|
|
10786
10815
|
} else if (check2.kind === "cuid") {
|
|
10787
|
-
if (!cuidRegex.test(
|
|
10788
|
-
ctx = this._getOrReturnCtx(
|
|
10816
|
+
if (!cuidRegex.test(input2.data)) {
|
|
10817
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10789
10818
|
addIssueToContext(ctx, {
|
|
10790
10819
|
validation: "cuid",
|
|
10791
10820
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10794,8 +10823,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10794
10823
|
status.dirty();
|
|
10795
10824
|
}
|
|
10796
10825
|
} else if (check2.kind === "cuid2") {
|
|
10797
|
-
if (!cuid2Regex.test(
|
|
10798
|
-
ctx = this._getOrReturnCtx(
|
|
10826
|
+
if (!cuid2Regex.test(input2.data)) {
|
|
10827
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10799
10828
|
addIssueToContext(ctx, {
|
|
10800
10829
|
validation: "cuid2",
|
|
10801
10830
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10804,8 +10833,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10804
10833
|
status.dirty();
|
|
10805
10834
|
}
|
|
10806
10835
|
} else if (check2.kind === "ulid") {
|
|
10807
|
-
if (!ulidRegex.test(
|
|
10808
|
-
ctx = this._getOrReturnCtx(
|
|
10836
|
+
if (!ulidRegex.test(input2.data)) {
|
|
10837
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10809
10838
|
addIssueToContext(ctx, {
|
|
10810
10839
|
validation: "ulid",
|
|
10811
10840
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10815,9 +10844,9 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10815
10844
|
}
|
|
10816
10845
|
} else if (check2.kind === "url") {
|
|
10817
10846
|
try {
|
|
10818
|
-
new URL(
|
|
10847
|
+
new URL(input2.data);
|
|
10819
10848
|
} catch {
|
|
10820
|
-
ctx = this._getOrReturnCtx(
|
|
10849
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10821
10850
|
addIssueToContext(ctx, {
|
|
10822
10851
|
validation: "url",
|
|
10823
10852
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10827,9 +10856,9 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10827
10856
|
}
|
|
10828
10857
|
} else if (check2.kind === "regex") {
|
|
10829
10858
|
check2.regex.lastIndex = 0;
|
|
10830
|
-
const testResult = check2.regex.test(
|
|
10859
|
+
const testResult = check2.regex.test(input2.data);
|
|
10831
10860
|
if (!testResult) {
|
|
10832
|
-
ctx = this._getOrReturnCtx(
|
|
10861
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10833
10862
|
addIssueToContext(ctx, {
|
|
10834
10863
|
validation: "regex",
|
|
10835
10864
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10838,10 +10867,10 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10838
10867
|
status.dirty();
|
|
10839
10868
|
}
|
|
10840
10869
|
} else if (check2.kind === "trim") {
|
|
10841
|
-
|
|
10870
|
+
input2.data = input2.data.trim();
|
|
10842
10871
|
} else if (check2.kind === "includes") {
|
|
10843
|
-
if (!
|
|
10844
|
-
ctx = this._getOrReturnCtx(
|
|
10872
|
+
if (!input2.data.includes(check2.value, check2.position)) {
|
|
10873
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10845
10874
|
addIssueToContext(ctx, {
|
|
10846
10875
|
code: ZodIssueCode.invalid_string,
|
|
10847
10876
|
validation: { includes: check2.value, position: check2.position },
|
|
@@ -10850,12 +10879,12 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10850
10879
|
status.dirty();
|
|
10851
10880
|
}
|
|
10852
10881
|
} else if (check2.kind === "toLowerCase") {
|
|
10853
|
-
|
|
10882
|
+
input2.data = input2.data.toLowerCase();
|
|
10854
10883
|
} else if (check2.kind === "toUpperCase") {
|
|
10855
|
-
|
|
10884
|
+
input2.data = input2.data.toUpperCase();
|
|
10856
10885
|
} else if (check2.kind === "startsWith") {
|
|
10857
|
-
if (!
|
|
10858
|
-
ctx = this._getOrReturnCtx(
|
|
10886
|
+
if (!input2.data.startsWith(check2.value)) {
|
|
10887
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10859
10888
|
addIssueToContext(ctx, {
|
|
10860
10889
|
code: ZodIssueCode.invalid_string,
|
|
10861
10890
|
validation: { startsWith: check2.value },
|
|
@@ -10864,8 +10893,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10864
10893
|
status.dirty();
|
|
10865
10894
|
}
|
|
10866
10895
|
} else if (check2.kind === "endsWith") {
|
|
10867
|
-
if (!
|
|
10868
|
-
ctx = this._getOrReturnCtx(
|
|
10896
|
+
if (!input2.data.endsWith(check2.value)) {
|
|
10897
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10869
10898
|
addIssueToContext(ctx, {
|
|
10870
10899
|
code: ZodIssueCode.invalid_string,
|
|
10871
10900
|
validation: { endsWith: check2.value },
|
|
@@ -10875,8 +10904,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10875
10904
|
}
|
|
10876
10905
|
} else if (check2.kind === "datetime") {
|
|
10877
10906
|
const regex = datetimeRegex(check2);
|
|
10878
|
-
if (!regex.test(
|
|
10879
|
-
ctx = this._getOrReturnCtx(
|
|
10907
|
+
if (!regex.test(input2.data)) {
|
|
10908
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10880
10909
|
addIssueToContext(ctx, {
|
|
10881
10910
|
code: ZodIssueCode.invalid_string,
|
|
10882
10911
|
validation: "datetime",
|
|
@@ -10886,8 +10915,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10886
10915
|
}
|
|
10887
10916
|
} else if (check2.kind === "date") {
|
|
10888
10917
|
const regex = dateRegex;
|
|
10889
|
-
if (!regex.test(
|
|
10890
|
-
ctx = this._getOrReturnCtx(
|
|
10918
|
+
if (!regex.test(input2.data)) {
|
|
10919
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10891
10920
|
addIssueToContext(ctx, {
|
|
10892
10921
|
code: ZodIssueCode.invalid_string,
|
|
10893
10922
|
validation: "date",
|
|
@@ -10897,8 +10926,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10897
10926
|
}
|
|
10898
10927
|
} else if (check2.kind === "time") {
|
|
10899
10928
|
const regex = timeRegex(check2);
|
|
10900
|
-
if (!regex.test(
|
|
10901
|
-
ctx = this._getOrReturnCtx(
|
|
10929
|
+
if (!regex.test(input2.data)) {
|
|
10930
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10902
10931
|
addIssueToContext(ctx, {
|
|
10903
10932
|
code: ZodIssueCode.invalid_string,
|
|
10904
10933
|
validation: "time",
|
|
@@ -10907,8 +10936,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10907
10936
|
status.dirty();
|
|
10908
10937
|
}
|
|
10909
10938
|
} else if (check2.kind === "duration") {
|
|
10910
|
-
if (!durationRegex.test(
|
|
10911
|
-
ctx = this._getOrReturnCtx(
|
|
10939
|
+
if (!durationRegex.test(input2.data)) {
|
|
10940
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10912
10941
|
addIssueToContext(ctx, {
|
|
10913
10942
|
validation: "duration",
|
|
10914
10943
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10917,8 +10946,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10917
10946
|
status.dirty();
|
|
10918
10947
|
}
|
|
10919
10948
|
} else if (check2.kind === "ip") {
|
|
10920
|
-
if (!isValidIP(
|
|
10921
|
-
ctx = this._getOrReturnCtx(
|
|
10949
|
+
if (!isValidIP(input2.data, check2.version)) {
|
|
10950
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10922
10951
|
addIssueToContext(ctx, {
|
|
10923
10952
|
validation: "ip",
|
|
10924
10953
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10927,8 +10956,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10927
10956
|
status.dirty();
|
|
10928
10957
|
}
|
|
10929
10958
|
} else if (check2.kind === "jwt") {
|
|
10930
|
-
if (!isValidJWT(
|
|
10931
|
-
ctx = this._getOrReturnCtx(
|
|
10959
|
+
if (!isValidJWT(input2.data, check2.alg)) {
|
|
10960
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10932
10961
|
addIssueToContext(ctx, {
|
|
10933
10962
|
validation: "jwt",
|
|
10934
10963
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10937,8 +10966,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10937
10966
|
status.dirty();
|
|
10938
10967
|
}
|
|
10939
10968
|
} else if (check2.kind === "cidr") {
|
|
10940
|
-
if (!isValidCidr(
|
|
10941
|
-
ctx = this._getOrReturnCtx(
|
|
10969
|
+
if (!isValidCidr(input2.data, check2.version)) {
|
|
10970
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10942
10971
|
addIssueToContext(ctx, {
|
|
10943
10972
|
validation: "cidr",
|
|
10944
10973
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10947,8 +10976,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10947
10976
|
status.dirty();
|
|
10948
10977
|
}
|
|
10949
10978
|
} else if (check2.kind === "base64") {
|
|
10950
|
-
if (!base64Regex.test(
|
|
10951
|
-
ctx = this._getOrReturnCtx(
|
|
10979
|
+
if (!base64Regex.test(input2.data)) {
|
|
10980
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10952
10981
|
addIssueToContext(ctx, {
|
|
10953
10982
|
validation: "base64",
|
|
10954
10983
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10957,8 +10986,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10957
10986
|
status.dirty();
|
|
10958
10987
|
}
|
|
10959
10988
|
} else if (check2.kind === "base64url") {
|
|
10960
|
-
if (!base64urlRegex.test(
|
|
10961
|
-
ctx = this._getOrReturnCtx(
|
|
10989
|
+
if (!base64urlRegex.test(input2.data)) {
|
|
10990
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
10962
10991
|
addIssueToContext(ctx, {
|
|
10963
10992
|
validation: "base64url",
|
|
10964
10993
|
code: ZodIssueCode.invalid_string,
|
|
@@ -10970,7 +10999,7 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
10970
10999
|
util.assertNever(check2);
|
|
10971
11000
|
}
|
|
10972
11001
|
}
|
|
10973
|
-
return { status: status.value, value:
|
|
11002
|
+
return { status: status.value, value: input2.data };
|
|
10974
11003
|
}
|
|
10975
11004
|
_regex(regex, validation, message) {
|
|
10976
11005
|
return this.refinement((data) => regex.test(data), {
|
|
@@ -11231,13 +11260,13 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
11231
11260
|
this.max = this.lte;
|
|
11232
11261
|
this.step = this.multipleOf;
|
|
11233
11262
|
}
|
|
11234
|
-
_parse(
|
|
11263
|
+
_parse(input2) {
|
|
11235
11264
|
if (this._def.coerce) {
|
|
11236
|
-
|
|
11265
|
+
input2.data = Number(input2.data);
|
|
11237
11266
|
}
|
|
11238
|
-
const parsedType2 = this._getType(
|
|
11267
|
+
const parsedType2 = this._getType(input2);
|
|
11239
11268
|
if (parsedType2 !== ZodParsedType.number) {
|
|
11240
|
-
const ctx2 = this._getOrReturnCtx(
|
|
11269
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
11241
11270
|
addIssueToContext(ctx2, {
|
|
11242
11271
|
code: ZodIssueCode.invalid_type,
|
|
11243
11272
|
expected: ZodParsedType.number,
|
|
@@ -11249,8 +11278,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
11249
11278
|
const status = new ParseStatus();
|
|
11250
11279
|
for (const check2 of this._def.checks) {
|
|
11251
11280
|
if (check2.kind === "int") {
|
|
11252
|
-
if (!util.isInteger(
|
|
11253
|
-
ctx = this._getOrReturnCtx(
|
|
11281
|
+
if (!util.isInteger(input2.data)) {
|
|
11282
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
11254
11283
|
addIssueToContext(ctx, {
|
|
11255
11284
|
code: ZodIssueCode.invalid_type,
|
|
11256
11285
|
expected: "integer",
|
|
@@ -11260,9 +11289,9 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
11260
11289
|
status.dirty();
|
|
11261
11290
|
}
|
|
11262
11291
|
} else if (check2.kind === "min") {
|
|
11263
|
-
const tooSmall = check2.inclusive ?
|
|
11292
|
+
const tooSmall = check2.inclusive ? input2.data < check2.value : input2.data <= check2.value;
|
|
11264
11293
|
if (tooSmall) {
|
|
11265
|
-
ctx = this._getOrReturnCtx(
|
|
11294
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
11266
11295
|
addIssueToContext(ctx, {
|
|
11267
11296
|
code: ZodIssueCode.too_small,
|
|
11268
11297
|
minimum: check2.value,
|
|
@@ -11274,9 +11303,9 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
11274
11303
|
status.dirty();
|
|
11275
11304
|
}
|
|
11276
11305
|
} else if (check2.kind === "max") {
|
|
11277
|
-
const tooBig = check2.inclusive ?
|
|
11306
|
+
const tooBig = check2.inclusive ? input2.data > check2.value : input2.data >= check2.value;
|
|
11278
11307
|
if (tooBig) {
|
|
11279
|
-
ctx = this._getOrReturnCtx(
|
|
11308
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
11280
11309
|
addIssueToContext(ctx, {
|
|
11281
11310
|
code: ZodIssueCode.too_big,
|
|
11282
11311
|
maximum: check2.value,
|
|
@@ -11288,8 +11317,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
11288
11317
|
status.dirty();
|
|
11289
11318
|
}
|
|
11290
11319
|
} else if (check2.kind === "multipleOf") {
|
|
11291
|
-
if (floatSafeRemainder(
|
|
11292
|
-
ctx = this._getOrReturnCtx(
|
|
11320
|
+
if (floatSafeRemainder(input2.data, check2.value) !== 0) {
|
|
11321
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
11293
11322
|
addIssueToContext(ctx, {
|
|
11294
11323
|
code: ZodIssueCode.not_multiple_of,
|
|
11295
11324
|
multipleOf: check2.value,
|
|
@@ -11298,8 +11327,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
11298
11327
|
status.dirty();
|
|
11299
11328
|
}
|
|
11300
11329
|
} else if (check2.kind === "finite") {
|
|
11301
|
-
if (!Number.isFinite(
|
|
11302
|
-
ctx = this._getOrReturnCtx(
|
|
11330
|
+
if (!Number.isFinite(input2.data)) {
|
|
11331
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
11303
11332
|
addIssueToContext(ctx, {
|
|
11304
11333
|
code: ZodIssueCode.not_finite,
|
|
11305
11334
|
message: check2.message
|
|
@@ -11310,7 +11339,7 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
11310
11339
|
util.assertNever(check2);
|
|
11311
11340
|
}
|
|
11312
11341
|
}
|
|
11313
|
-
return { status: status.value, value:
|
|
11342
|
+
return { status: status.value, value: input2.data };
|
|
11314
11343
|
}
|
|
11315
11344
|
gte(value, message) {
|
|
11316
11345
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
@@ -11462,25 +11491,25 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
11462
11491
|
this.min = this.gte;
|
|
11463
11492
|
this.max = this.lte;
|
|
11464
11493
|
}
|
|
11465
|
-
_parse(
|
|
11494
|
+
_parse(input2) {
|
|
11466
11495
|
if (this._def.coerce) {
|
|
11467
11496
|
try {
|
|
11468
|
-
|
|
11497
|
+
input2.data = BigInt(input2.data);
|
|
11469
11498
|
} catch {
|
|
11470
|
-
return this._getInvalidInput(
|
|
11499
|
+
return this._getInvalidInput(input2);
|
|
11471
11500
|
}
|
|
11472
11501
|
}
|
|
11473
|
-
const parsedType2 = this._getType(
|
|
11502
|
+
const parsedType2 = this._getType(input2);
|
|
11474
11503
|
if (parsedType2 !== ZodParsedType.bigint) {
|
|
11475
|
-
return this._getInvalidInput(
|
|
11504
|
+
return this._getInvalidInput(input2);
|
|
11476
11505
|
}
|
|
11477
11506
|
let ctx = void 0;
|
|
11478
11507
|
const status = new ParseStatus();
|
|
11479
11508
|
for (const check2 of this._def.checks) {
|
|
11480
11509
|
if (check2.kind === "min") {
|
|
11481
|
-
const tooSmall = check2.inclusive ?
|
|
11510
|
+
const tooSmall = check2.inclusive ? input2.data < check2.value : input2.data <= check2.value;
|
|
11482
11511
|
if (tooSmall) {
|
|
11483
|
-
ctx = this._getOrReturnCtx(
|
|
11512
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
11484
11513
|
addIssueToContext(ctx, {
|
|
11485
11514
|
code: ZodIssueCode.too_small,
|
|
11486
11515
|
type: "bigint",
|
|
@@ -11491,9 +11520,9 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
11491
11520
|
status.dirty();
|
|
11492
11521
|
}
|
|
11493
11522
|
} else if (check2.kind === "max") {
|
|
11494
|
-
const tooBig = check2.inclusive ?
|
|
11523
|
+
const tooBig = check2.inclusive ? input2.data > check2.value : input2.data >= check2.value;
|
|
11495
11524
|
if (tooBig) {
|
|
11496
|
-
ctx = this._getOrReturnCtx(
|
|
11525
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
11497
11526
|
addIssueToContext(ctx, {
|
|
11498
11527
|
code: ZodIssueCode.too_big,
|
|
11499
11528
|
type: "bigint",
|
|
@@ -11504,8 +11533,8 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
11504
11533
|
status.dirty();
|
|
11505
11534
|
}
|
|
11506
11535
|
} else if (check2.kind === "multipleOf") {
|
|
11507
|
-
if (
|
|
11508
|
-
ctx = this._getOrReturnCtx(
|
|
11536
|
+
if (input2.data % check2.value !== BigInt(0)) {
|
|
11537
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
11509
11538
|
addIssueToContext(ctx, {
|
|
11510
11539
|
code: ZodIssueCode.not_multiple_of,
|
|
11511
11540
|
multipleOf: check2.value,
|
|
@@ -11517,10 +11546,10 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
11517
11546
|
util.assertNever(check2);
|
|
11518
11547
|
}
|
|
11519
11548
|
}
|
|
11520
|
-
return { status: status.value, value:
|
|
11549
|
+
return { status: status.value, value: input2.data };
|
|
11521
11550
|
}
|
|
11522
|
-
_getInvalidInput(
|
|
11523
|
-
const ctx = this._getOrReturnCtx(
|
|
11551
|
+
_getInvalidInput(input2) {
|
|
11552
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
11524
11553
|
addIssueToContext(ctx, {
|
|
11525
11554
|
code: ZodIssueCode.invalid_type,
|
|
11526
11555
|
expected: ZodParsedType.bigint,
|
|
@@ -11629,13 +11658,13 @@ ZodBigInt.create = (params) => {
|
|
|
11629
11658
|
});
|
|
11630
11659
|
};
|
|
11631
11660
|
var ZodBoolean = class extends ZodType {
|
|
11632
|
-
_parse(
|
|
11661
|
+
_parse(input2) {
|
|
11633
11662
|
if (this._def.coerce) {
|
|
11634
|
-
|
|
11663
|
+
input2.data = Boolean(input2.data);
|
|
11635
11664
|
}
|
|
11636
|
-
const parsedType2 = this._getType(
|
|
11665
|
+
const parsedType2 = this._getType(input2);
|
|
11637
11666
|
if (parsedType2 !== ZodParsedType.boolean) {
|
|
11638
|
-
const ctx = this._getOrReturnCtx(
|
|
11667
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
11639
11668
|
addIssueToContext(ctx, {
|
|
11640
11669
|
code: ZodIssueCode.invalid_type,
|
|
11641
11670
|
expected: ZodParsedType.boolean,
|
|
@@ -11643,7 +11672,7 @@ var ZodBoolean = class extends ZodType {
|
|
|
11643
11672
|
});
|
|
11644
11673
|
return INVALID;
|
|
11645
11674
|
}
|
|
11646
|
-
return OK(
|
|
11675
|
+
return OK(input2.data);
|
|
11647
11676
|
}
|
|
11648
11677
|
};
|
|
11649
11678
|
ZodBoolean.create = (params) => {
|
|
@@ -11654,13 +11683,13 @@ ZodBoolean.create = (params) => {
|
|
|
11654
11683
|
});
|
|
11655
11684
|
};
|
|
11656
11685
|
var ZodDate = class _ZodDate extends ZodType {
|
|
11657
|
-
_parse(
|
|
11686
|
+
_parse(input2) {
|
|
11658
11687
|
if (this._def.coerce) {
|
|
11659
|
-
|
|
11688
|
+
input2.data = new Date(input2.data);
|
|
11660
11689
|
}
|
|
11661
|
-
const parsedType2 = this._getType(
|
|
11690
|
+
const parsedType2 = this._getType(input2);
|
|
11662
11691
|
if (parsedType2 !== ZodParsedType.date) {
|
|
11663
|
-
const ctx2 = this._getOrReturnCtx(
|
|
11692
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
11664
11693
|
addIssueToContext(ctx2, {
|
|
11665
11694
|
code: ZodIssueCode.invalid_type,
|
|
11666
11695
|
expected: ZodParsedType.date,
|
|
@@ -11668,8 +11697,8 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
11668
11697
|
});
|
|
11669
11698
|
return INVALID;
|
|
11670
11699
|
}
|
|
11671
|
-
if (Number.isNaN(
|
|
11672
|
-
const ctx2 = this._getOrReturnCtx(
|
|
11700
|
+
if (Number.isNaN(input2.data.getTime())) {
|
|
11701
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
11673
11702
|
addIssueToContext(ctx2, {
|
|
11674
11703
|
code: ZodIssueCode.invalid_date
|
|
11675
11704
|
});
|
|
@@ -11679,8 +11708,8 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
11679
11708
|
let ctx = void 0;
|
|
11680
11709
|
for (const check2 of this._def.checks) {
|
|
11681
11710
|
if (check2.kind === "min") {
|
|
11682
|
-
if (
|
|
11683
|
-
ctx = this._getOrReturnCtx(
|
|
11711
|
+
if (input2.data.getTime() < check2.value) {
|
|
11712
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
11684
11713
|
addIssueToContext(ctx, {
|
|
11685
11714
|
code: ZodIssueCode.too_small,
|
|
11686
11715
|
message: check2.message,
|
|
@@ -11692,8 +11721,8 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
11692
11721
|
status.dirty();
|
|
11693
11722
|
}
|
|
11694
11723
|
} else if (check2.kind === "max") {
|
|
11695
|
-
if (
|
|
11696
|
-
ctx = this._getOrReturnCtx(
|
|
11724
|
+
if (input2.data.getTime() > check2.value) {
|
|
11725
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
11697
11726
|
addIssueToContext(ctx, {
|
|
11698
11727
|
code: ZodIssueCode.too_big,
|
|
11699
11728
|
message: check2.message,
|
|
@@ -11710,7 +11739,7 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
11710
11739
|
}
|
|
11711
11740
|
return {
|
|
11712
11741
|
status: status.value,
|
|
11713
|
-
value: new Date(
|
|
11742
|
+
value: new Date(input2.data.getTime())
|
|
11714
11743
|
};
|
|
11715
11744
|
}
|
|
11716
11745
|
_addCheck(check2) {
|
|
@@ -11763,10 +11792,10 @@ ZodDate.create = (params) => {
|
|
|
11763
11792
|
});
|
|
11764
11793
|
};
|
|
11765
11794
|
var ZodSymbol = class extends ZodType {
|
|
11766
|
-
_parse(
|
|
11767
|
-
const parsedType2 = this._getType(
|
|
11795
|
+
_parse(input2) {
|
|
11796
|
+
const parsedType2 = this._getType(input2);
|
|
11768
11797
|
if (parsedType2 !== ZodParsedType.symbol) {
|
|
11769
|
-
const ctx = this._getOrReturnCtx(
|
|
11798
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
11770
11799
|
addIssueToContext(ctx, {
|
|
11771
11800
|
code: ZodIssueCode.invalid_type,
|
|
11772
11801
|
expected: ZodParsedType.symbol,
|
|
@@ -11774,7 +11803,7 @@ var ZodSymbol = class extends ZodType {
|
|
|
11774
11803
|
});
|
|
11775
11804
|
return INVALID;
|
|
11776
11805
|
}
|
|
11777
|
-
return OK(
|
|
11806
|
+
return OK(input2.data);
|
|
11778
11807
|
}
|
|
11779
11808
|
};
|
|
11780
11809
|
ZodSymbol.create = (params) => {
|
|
@@ -11784,10 +11813,10 @@ ZodSymbol.create = (params) => {
|
|
|
11784
11813
|
});
|
|
11785
11814
|
};
|
|
11786
11815
|
var ZodUndefined = class extends ZodType {
|
|
11787
|
-
_parse(
|
|
11788
|
-
const parsedType2 = this._getType(
|
|
11816
|
+
_parse(input2) {
|
|
11817
|
+
const parsedType2 = this._getType(input2);
|
|
11789
11818
|
if (parsedType2 !== ZodParsedType.undefined) {
|
|
11790
|
-
const ctx = this._getOrReturnCtx(
|
|
11819
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
11791
11820
|
addIssueToContext(ctx, {
|
|
11792
11821
|
code: ZodIssueCode.invalid_type,
|
|
11793
11822
|
expected: ZodParsedType.undefined,
|
|
@@ -11795,7 +11824,7 @@ var ZodUndefined = class extends ZodType {
|
|
|
11795
11824
|
});
|
|
11796
11825
|
return INVALID;
|
|
11797
11826
|
}
|
|
11798
|
-
return OK(
|
|
11827
|
+
return OK(input2.data);
|
|
11799
11828
|
}
|
|
11800
11829
|
};
|
|
11801
11830
|
ZodUndefined.create = (params) => {
|
|
@@ -11805,10 +11834,10 @@ ZodUndefined.create = (params) => {
|
|
|
11805
11834
|
});
|
|
11806
11835
|
};
|
|
11807
11836
|
var ZodNull = class extends ZodType {
|
|
11808
|
-
_parse(
|
|
11809
|
-
const parsedType2 = this._getType(
|
|
11837
|
+
_parse(input2) {
|
|
11838
|
+
const parsedType2 = this._getType(input2);
|
|
11810
11839
|
if (parsedType2 !== ZodParsedType.null) {
|
|
11811
|
-
const ctx = this._getOrReturnCtx(
|
|
11840
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
11812
11841
|
addIssueToContext(ctx, {
|
|
11813
11842
|
code: ZodIssueCode.invalid_type,
|
|
11814
11843
|
expected: ZodParsedType.null,
|
|
@@ -11816,7 +11845,7 @@ var ZodNull = class extends ZodType {
|
|
|
11816
11845
|
});
|
|
11817
11846
|
return INVALID;
|
|
11818
11847
|
}
|
|
11819
|
-
return OK(
|
|
11848
|
+
return OK(input2.data);
|
|
11820
11849
|
}
|
|
11821
11850
|
};
|
|
11822
11851
|
ZodNull.create = (params) => {
|
|
@@ -11830,8 +11859,8 @@ var ZodAny = class extends ZodType {
|
|
|
11830
11859
|
super(...arguments);
|
|
11831
11860
|
this._any = true;
|
|
11832
11861
|
}
|
|
11833
|
-
_parse(
|
|
11834
|
-
return OK(
|
|
11862
|
+
_parse(input2) {
|
|
11863
|
+
return OK(input2.data);
|
|
11835
11864
|
}
|
|
11836
11865
|
};
|
|
11837
11866
|
ZodAny.create = (params) => {
|
|
@@ -11845,8 +11874,8 @@ var ZodUnknown = class extends ZodType {
|
|
|
11845
11874
|
super(...arguments);
|
|
11846
11875
|
this._unknown = true;
|
|
11847
11876
|
}
|
|
11848
|
-
_parse(
|
|
11849
|
-
return OK(
|
|
11877
|
+
_parse(input2) {
|
|
11878
|
+
return OK(input2.data);
|
|
11850
11879
|
}
|
|
11851
11880
|
};
|
|
11852
11881
|
ZodUnknown.create = (params) => {
|
|
@@ -11856,8 +11885,8 @@ ZodUnknown.create = (params) => {
|
|
|
11856
11885
|
});
|
|
11857
11886
|
};
|
|
11858
11887
|
var ZodNever = class extends ZodType {
|
|
11859
|
-
_parse(
|
|
11860
|
-
const ctx = this._getOrReturnCtx(
|
|
11888
|
+
_parse(input2) {
|
|
11889
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
11861
11890
|
addIssueToContext(ctx, {
|
|
11862
11891
|
code: ZodIssueCode.invalid_type,
|
|
11863
11892
|
expected: ZodParsedType.never,
|
|
@@ -11873,10 +11902,10 @@ ZodNever.create = (params) => {
|
|
|
11873
11902
|
});
|
|
11874
11903
|
};
|
|
11875
11904
|
var ZodVoid = class extends ZodType {
|
|
11876
|
-
_parse(
|
|
11877
|
-
const parsedType2 = this._getType(
|
|
11905
|
+
_parse(input2) {
|
|
11906
|
+
const parsedType2 = this._getType(input2);
|
|
11878
11907
|
if (parsedType2 !== ZodParsedType.undefined) {
|
|
11879
|
-
const ctx = this._getOrReturnCtx(
|
|
11908
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
11880
11909
|
addIssueToContext(ctx, {
|
|
11881
11910
|
code: ZodIssueCode.invalid_type,
|
|
11882
11911
|
expected: ZodParsedType.void,
|
|
@@ -11884,7 +11913,7 @@ var ZodVoid = class extends ZodType {
|
|
|
11884
11913
|
});
|
|
11885
11914
|
return INVALID;
|
|
11886
11915
|
}
|
|
11887
|
-
return OK(
|
|
11916
|
+
return OK(input2.data);
|
|
11888
11917
|
}
|
|
11889
11918
|
};
|
|
11890
11919
|
ZodVoid.create = (params) => {
|
|
@@ -11894,8 +11923,8 @@ ZodVoid.create = (params) => {
|
|
|
11894
11923
|
});
|
|
11895
11924
|
};
|
|
11896
11925
|
var ZodArray = class _ZodArray extends ZodType {
|
|
11897
|
-
_parse(
|
|
11898
|
-
const { ctx, status } = this._processInputParams(
|
|
11926
|
+
_parse(input2) {
|
|
11927
|
+
const { ctx, status } = this._processInputParams(input2);
|
|
11899
11928
|
const def = this._def;
|
|
11900
11929
|
if (ctx.parsedType !== ZodParsedType.array) {
|
|
11901
11930
|
addIssueToContext(ctx, {
|
|
@@ -12035,10 +12064,10 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
12035
12064
|
this._cached = { shape, keys };
|
|
12036
12065
|
return this._cached;
|
|
12037
12066
|
}
|
|
12038
|
-
_parse(
|
|
12039
|
-
const parsedType2 = this._getType(
|
|
12067
|
+
_parse(input2) {
|
|
12068
|
+
const parsedType2 = this._getType(input2);
|
|
12040
12069
|
if (parsedType2 !== ZodParsedType.object) {
|
|
12041
|
-
const ctx2 = this._getOrReturnCtx(
|
|
12070
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
12042
12071
|
addIssueToContext(ctx2, {
|
|
12043
12072
|
code: ZodIssueCode.invalid_type,
|
|
12044
12073
|
expected: ZodParsedType.object,
|
|
@@ -12046,7 +12075,7 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
12046
12075
|
});
|
|
12047
12076
|
return INVALID;
|
|
12048
12077
|
}
|
|
12049
|
-
const { status, ctx } = this._processInputParams(
|
|
12078
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
12050
12079
|
const { shape, keys: shapeKeys } = this._getCached();
|
|
12051
12080
|
const extraKeys = [];
|
|
12052
12081
|
if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
|
|
@@ -12359,8 +12388,8 @@ ZodObject.lazycreate = (shape, params) => {
|
|
|
12359
12388
|
});
|
|
12360
12389
|
};
|
|
12361
12390
|
var ZodUnion = class extends ZodType {
|
|
12362
|
-
_parse(
|
|
12363
|
-
const { ctx } = this._processInputParams(
|
|
12391
|
+
_parse(input2) {
|
|
12392
|
+
const { ctx } = this._processInputParams(input2);
|
|
12364
12393
|
const options = this._def.options;
|
|
12365
12394
|
function handleResults(results) {
|
|
12366
12395
|
for (const result of results) {
|
|
@@ -12481,8 +12510,8 @@ var getDiscriminator = (type) => {
|
|
|
12481
12510
|
}
|
|
12482
12511
|
};
|
|
12483
12512
|
var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
12484
|
-
_parse(
|
|
12485
|
-
const { ctx } = this._processInputParams(
|
|
12513
|
+
_parse(input2) {
|
|
12514
|
+
const { ctx } = this._processInputParams(input2);
|
|
12486
12515
|
if (ctx.parsedType !== ZodParsedType.object) {
|
|
12487
12516
|
addIssueToContext(ctx, {
|
|
12488
12517
|
code: ZodIssueCode.invalid_type,
|
|
@@ -12595,8 +12624,8 @@ function mergeValues(a, b) {
|
|
|
12595
12624
|
}
|
|
12596
12625
|
}
|
|
12597
12626
|
var ZodIntersection = class extends ZodType {
|
|
12598
|
-
_parse(
|
|
12599
|
-
const { status, ctx } = this._processInputParams(
|
|
12627
|
+
_parse(input2) {
|
|
12628
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
12600
12629
|
const handleParsed = (parsedLeft, parsedRight) => {
|
|
12601
12630
|
if (isAborted(parsedLeft) || isAborted(parsedRight)) {
|
|
12602
12631
|
return INVALID;
|
|
@@ -12648,8 +12677,8 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
12648
12677
|
});
|
|
12649
12678
|
};
|
|
12650
12679
|
var ZodTuple = class _ZodTuple extends ZodType {
|
|
12651
|
-
_parse(
|
|
12652
|
-
const { status, ctx } = this._processInputParams(
|
|
12680
|
+
_parse(input2) {
|
|
12681
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
12653
12682
|
if (ctx.parsedType !== ZodParsedType.array) {
|
|
12654
12683
|
addIssueToContext(ctx, {
|
|
12655
12684
|
code: ZodIssueCode.invalid_type,
|
|
@@ -12721,8 +12750,8 @@ var ZodRecord = class _ZodRecord extends ZodType {
|
|
|
12721
12750
|
get valueSchema() {
|
|
12722
12751
|
return this._def.valueType;
|
|
12723
12752
|
}
|
|
12724
|
-
_parse(
|
|
12725
|
-
const { status, ctx } = this._processInputParams(
|
|
12753
|
+
_parse(input2) {
|
|
12754
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
12726
12755
|
if (ctx.parsedType !== ZodParsedType.object) {
|
|
12727
12756
|
addIssueToContext(ctx, {
|
|
12728
12757
|
code: ZodIssueCode.invalid_type,
|
|
@@ -12774,8 +12803,8 @@ var ZodMap = class extends ZodType {
|
|
|
12774
12803
|
get valueSchema() {
|
|
12775
12804
|
return this._def.valueType;
|
|
12776
12805
|
}
|
|
12777
|
-
_parse(
|
|
12778
|
-
const { status, ctx } = this._processInputParams(
|
|
12806
|
+
_parse(input2) {
|
|
12807
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
12779
12808
|
if (ctx.parsedType !== ZodParsedType.map) {
|
|
12780
12809
|
addIssueToContext(ctx, {
|
|
12781
12810
|
code: ZodIssueCode.invalid_type,
|
|
@@ -12834,8 +12863,8 @@ ZodMap.create = (keyType, valueType, params) => {
|
|
|
12834
12863
|
});
|
|
12835
12864
|
};
|
|
12836
12865
|
var ZodSet = class _ZodSet extends ZodType {
|
|
12837
|
-
_parse(
|
|
12838
|
-
const { status, ctx } = this._processInputParams(
|
|
12866
|
+
_parse(input2) {
|
|
12867
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
12839
12868
|
if (ctx.parsedType !== ZodParsedType.set) {
|
|
12840
12869
|
addIssueToContext(ctx, {
|
|
12841
12870
|
code: ZodIssueCode.invalid_type,
|
|
@@ -12923,8 +12952,8 @@ var ZodFunction = class _ZodFunction extends ZodType {
|
|
|
12923
12952
|
super(...arguments);
|
|
12924
12953
|
this.validate = this.implement;
|
|
12925
12954
|
}
|
|
12926
|
-
_parse(
|
|
12927
|
-
const { ctx } = this._processInputParams(
|
|
12955
|
+
_parse(input2) {
|
|
12956
|
+
const { ctx } = this._processInputParams(input2);
|
|
12928
12957
|
if (ctx.parsedType !== ZodParsedType.function) {
|
|
12929
12958
|
addIssueToContext(ctx, {
|
|
12930
12959
|
code: ZodIssueCode.invalid_type,
|
|
@@ -13027,8 +13056,8 @@ var ZodLazy = class extends ZodType {
|
|
|
13027
13056
|
get schema() {
|
|
13028
13057
|
return this._def.getter();
|
|
13029
13058
|
}
|
|
13030
|
-
_parse(
|
|
13031
|
-
const { ctx } = this._processInputParams(
|
|
13059
|
+
_parse(input2) {
|
|
13060
|
+
const { ctx } = this._processInputParams(input2);
|
|
13032
13061
|
const lazySchema = this._def.getter();
|
|
13033
13062
|
return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
|
|
13034
13063
|
}
|
|
@@ -13041,9 +13070,9 @@ ZodLazy.create = (getter, params) => {
|
|
|
13041
13070
|
});
|
|
13042
13071
|
};
|
|
13043
13072
|
var ZodLiteral = class extends ZodType {
|
|
13044
|
-
_parse(
|
|
13045
|
-
if (
|
|
13046
|
-
const ctx = this._getOrReturnCtx(
|
|
13073
|
+
_parse(input2) {
|
|
13074
|
+
if (input2.data !== this._def.value) {
|
|
13075
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
13047
13076
|
addIssueToContext(ctx, {
|
|
13048
13077
|
received: ctx.data,
|
|
13049
13078
|
code: ZodIssueCode.invalid_literal,
|
|
@@ -13051,7 +13080,7 @@ var ZodLiteral = class extends ZodType {
|
|
|
13051
13080
|
});
|
|
13052
13081
|
return INVALID;
|
|
13053
13082
|
}
|
|
13054
|
-
return { status: "valid", value:
|
|
13083
|
+
return { status: "valid", value: input2.data };
|
|
13055
13084
|
}
|
|
13056
13085
|
get value() {
|
|
13057
13086
|
return this._def.value;
|
|
@@ -13072,9 +13101,9 @@ function createZodEnum(values, params) {
|
|
|
13072
13101
|
});
|
|
13073
13102
|
}
|
|
13074
13103
|
var ZodEnum = class _ZodEnum extends ZodType {
|
|
13075
|
-
_parse(
|
|
13076
|
-
if (typeof
|
|
13077
|
-
const ctx = this._getOrReturnCtx(
|
|
13104
|
+
_parse(input2) {
|
|
13105
|
+
if (typeof input2.data !== "string") {
|
|
13106
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
13078
13107
|
const expectedValues = this._def.values;
|
|
13079
13108
|
addIssueToContext(ctx, {
|
|
13080
13109
|
expected: util.joinValues(expectedValues),
|
|
@@ -13086,8 +13115,8 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
|
13086
13115
|
if (!this._cache) {
|
|
13087
13116
|
this._cache = new Set(this._def.values);
|
|
13088
13117
|
}
|
|
13089
|
-
if (!this._cache.has(
|
|
13090
|
-
const ctx = this._getOrReturnCtx(
|
|
13118
|
+
if (!this._cache.has(input2.data)) {
|
|
13119
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
13091
13120
|
const expectedValues = this._def.values;
|
|
13092
13121
|
addIssueToContext(ctx, {
|
|
13093
13122
|
received: ctx.data,
|
|
@@ -13096,7 +13125,7 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
|
13096
13125
|
});
|
|
13097
13126
|
return INVALID;
|
|
13098
13127
|
}
|
|
13099
|
-
return OK(
|
|
13128
|
+
return OK(input2.data);
|
|
13100
13129
|
}
|
|
13101
13130
|
get options() {
|
|
13102
13131
|
return this._def.values;
|
|
@@ -13137,9 +13166,9 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
|
13137
13166
|
};
|
|
13138
13167
|
ZodEnum.create = createZodEnum;
|
|
13139
13168
|
var ZodNativeEnum = class extends ZodType {
|
|
13140
|
-
_parse(
|
|
13169
|
+
_parse(input2) {
|
|
13141
13170
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
13142
|
-
const ctx = this._getOrReturnCtx(
|
|
13171
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
13143
13172
|
if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
|
|
13144
13173
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
13145
13174
|
addIssueToContext(ctx, {
|
|
@@ -13152,7 +13181,7 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
13152
13181
|
if (!this._cache) {
|
|
13153
13182
|
this._cache = new Set(util.getValidEnumValues(this._def.values));
|
|
13154
13183
|
}
|
|
13155
|
-
if (!this._cache.has(
|
|
13184
|
+
if (!this._cache.has(input2.data)) {
|
|
13156
13185
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
13157
13186
|
addIssueToContext(ctx, {
|
|
13158
13187
|
received: ctx.data,
|
|
@@ -13161,7 +13190,7 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
13161
13190
|
});
|
|
13162
13191
|
return INVALID;
|
|
13163
13192
|
}
|
|
13164
|
-
return OK(
|
|
13193
|
+
return OK(input2.data);
|
|
13165
13194
|
}
|
|
13166
13195
|
get enum() {
|
|
13167
13196
|
return this._def.values;
|
|
@@ -13178,8 +13207,8 @@ var ZodPromise = class extends ZodType {
|
|
|
13178
13207
|
unwrap() {
|
|
13179
13208
|
return this._def.type;
|
|
13180
13209
|
}
|
|
13181
|
-
_parse(
|
|
13182
|
-
const { ctx } = this._processInputParams(
|
|
13210
|
+
_parse(input2) {
|
|
13211
|
+
const { ctx } = this._processInputParams(input2);
|
|
13183
13212
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
13184
13213
|
addIssueToContext(ctx, {
|
|
13185
13214
|
code: ZodIssueCode.invalid_type,
|
|
@@ -13211,8 +13240,8 @@ var ZodEffects = class extends ZodType {
|
|
|
13211
13240
|
sourceType() {
|
|
13212
13241
|
return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
13213
13242
|
}
|
|
13214
|
-
_parse(
|
|
13215
|
-
const { status, ctx } = this._processInputParams(
|
|
13243
|
+
_parse(input2) {
|
|
13244
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
13216
13245
|
const effect = this._def.effect || null;
|
|
13217
13246
|
const checkCtx = {
|
|
13218
13247
|
addIssue: (arg) => {
|
|
@@ -13344,12 +13373,12 @@ ZodEffects.createWithPreprocess = (preprocess2, schema, params) => {
|
|
|
13344
13373
|
});
|
|
13345
13374
|
};
|
|
13346
13375
|
var ZodOptional = class extends ZodType {
|
|
13347
|
-
_parse(
|
|
13348
|
-
const parsedType2 = this._getType(
|
|
13376
|
+
_parse(input2) {
|
|
13377
|
+
const parsedType2 = this._getType(input2);
|
|
13349
13378
|
if (parsedType2 === ZodParsedType.undefined) {
|
|
13350
13379
|
return OK(void 0);
|
|
13351
13380
|
}
|
|
13352
|
-
return this._def.innerType._parse(
|
|
13381
|
+
return this._def.innerType._parse(input2);
|
|
13353
13382
|
}
|
|
13354
13383
|
unwrap() {
|
|
13355
13384
|
return this._def.innerType;
|
|
@@ -13363,12 +13392,12 @@ ZodOptional.create = (type, params) => {
|
|
|
13363
13392
|
});
|
|
13364
13393
|
};
|
|
13365
13394
|
var ZodNullable = class extends ZodType {
|
|
13366
|
-
_parse(
|
|
13367
|
-
const parsedType2 = this._getType(
|
|
13395
|
+
_parse(input2) {
|
|
13396
|
+
const parsedType2 = this._getType(input2);
|
|
13368
13397
|
if (parsedType2 === ZodParsedType.null) {
|
|
13369
13398
|
return OK(null);
|
|
13370
13399
|
}
|
|
13371
|
-
return this._def.innerType._parse(
|
|
13400
|
+
return this._def.innerType._parse(input2);
|
|
13372
13401
|
}
|
|
13373
13402
|
unwrap() {
|
|
13374
13403
|
return this._def.innerType;
|
|
@@ -13382,8 +13411,8 @@ ZodNullable.create = (type, params) => {
|
|
|
13382
13411
|
});
|
|
13383
13412
|
};
|
|
13384
13413
|
var ZodDefault = class extends ZodType {
|
|
13385
|
-
_parse(
|
|
13386
|
-
const { ctx } = this._processInputParams(
|
|
13414
|
+
_parse(input2) {
|
|
13415
|
+
const { ctx } = this._processInputParams(input2);
|
|
13387
13416
|
let data = ctx.data;
|
|
13388
13417
|
if (ctx.parsedType === ZodParsedType.undefined) {
|
|
13389
13418
|
data = this._def.defaultValue();
|
|
@@ -13407,8 +13436,8 @@ ZodDefault.create = (type, params) => {
|
|
|
13407
13436
|
});
|
|
13408
13437
|
};
|
|
13409
13438
|
var ZodCatch = class extends ZodType {
|
|
13410
|
-
_parse(
|
|
13411
|
-
const { ctx } = this._processInputParams(
|
|
13439
|
+
_parse(input2) {
|
|
13440
|
+
const { ctx } = this._processInputParams(input2);
|
|
13412
13441
|
const newCtx = {
|
|
13413
13442
|
...ctx,
|
|
13414
13443
|
common: {
|
|
@@ -13460,10 +13489,10 @@ ZodCatch.create = (type, params) => {
|
|
|
13460
13489
|
});
|
|
13461
13490
|
};
|
|
13462
13491
|
var ZodNaN = class extends ZodType {
|
|
13463
|
-
_parse(
|
|
13464
|
-
const parsedType2 = this._getType(
|
|
13492
|
+
_parse(input2) {
|
|
13493
|
+
const parsedType2 = this._getType(input2);
|
|
13465
13494
|
if (parsedType2 !== ZodParsedType.nan) {
|
|
13466
|
-
const ctx = this._getOrReturnCtx(
|
|
13495
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
13467
13496
|
addIssueToContext(ctx, {
|
|
13468
13497
|
code: ZodIssueCode.invalid_type,
|
|
13469
13498
|
expected: ZodParsedType.nan,
|
|
@@ -13471,7 +13500,7 @@ var ZodNaN = class extends ZodType {
|
|
|
13471
13500
|
});
|
|
13472
13501
|
return INVALID;
|
|
13473
13502
|
}
|
|
13474
|
-
return { status: "valid", value:
|
|
13503
|
+
return { status: "valid", value: input2.data };
|
|
13475
13504
|
}
|
|
13476
13505
|
};
|
|
13477
13506
|
ZodNaN.create = (params) => {
|
|
@@ -13481,8 +13510,8 @@ ZodNaN.create = (params) => {
|
|
|
13481
13510
|
});
|
|
13482
13511
|
};
|
|
13483
13512
|
var ZodBranded = class extends ZodType {
|
|
13484
|
-
_parse(
|
|
13485
|
-
const { ctx } = this._processInputParams(
|
|
13513
|
+
_parse(input2) {
|
|
13514
|
+
const { ctx } = this._processInputParams(input2);
|
|
13486
13515
|
const data = ctx.data;
|
|
13487
13516
|
return this._def.type._parse({
|
|
13488
13517
|
data,
|
|
@@ -13495,8 +13524,8 @@ var ZodBranded = class extends ZodType {
|
|
|
13495
13524
|
}
|
|
13496
13525
|
};
|
|
13497
13526
|
var ZodPipeline = class _ZodPipeline extends ZodType {
|
|
13498
|
-
_parse(
|
|
13499
|
-
const { status, ctx } = this._processInputParams(
|
|
13527
|
+
_parse(input2) {
|
|
13528
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
13500
13529
|
if (ctx.common.async) {
|
|
13501
13530
|
const handleAsync = async () => {
|
|
13502
13531
|
const inResult = await this._def.in._parseAsync({
|
|
@@ -13550,8 +13579,8 @@ var ZodPipeline = class _ZodPipeline extends ZodType {
|
|
|
13550
13579
|
}
|
|
13551
13580
|
};
|
|
13552
13581
|
var ZodReadonly = class extends ZodType {
|
|
13553
|
-
_parse(
|
|
13554
|
-
const result = this._def.innerType._parse(
|
|
13582
|
+
_parse(input2) {
|
|
13583
|
+
const result = this._def.innerType._parse(input2);
|
|
13555
13584
|
const freeze = (data) => {
|
|
13556
13585
|
if (isValid(data)) {
|
|
13557
13586
|
data.value = Object.freeze(data.value);
|
|
@@ -14106,8 +14135,8 @@ function cached(getter) {
|
|
|
14106
14135
|
}
|
|
14107
14136
|
};
|
|
14108
14137
|
}
|
|
14109
|
-
function nullish(
|
|
14110
|
-
return
|
|
14138
|
+
function nullish(input2) {
|
|
14139
|
+
return input2 === null || input2 === void 0;
|
|
14111
14140
|
}
|
|
14112
14141
|
function cleanRegex(source) {
|
|
14113
14142
|
const start = source.startsWith("^") ? 1 : 0;
|
|
@@ -14201,8 +14230,8 @@ function randomString(length = 10) {
|
|
|
14201
14230
|
function esc(str) {
|
|
14202
14231
|
return JSON.stringify(str);
|
|
14203
14232
|
}
|
|
14204
|
-
function slugify(
|
|
14205
|
-
return
|
|
14233
|
+
function slugify(input2) {
|
|
14234
|
+
return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
14206
14235
|
}
|
|
14207
14236
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
14208
14237
|
};
|
|
@@ -14584,19 +14613,19 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
14584
14613
|
}
|
|
14585
14614
|
return full;
|
|
14586
14615
|
}
|
|
14587
|
-
function getSizableOrigin(
|
|
14588
|
-
if (
|
|
14616
|
+
function getSizableOrigin(input2) {
|
|
14617
|
+
if (input2 instanceof Set)
|
|
14589
14618
|
return "set";
|
|
14590
|
-
if (
|
|
14619
|
+
if (input2 instanceof Map)
|
|
14591
14620
|
return "map";
|
|
14592
|
-
if (
|
|
14621
|
+
if (input2 instanceof File)
|
|
14593
14622
|
return "file";
|
|
14594
14623
|
return "unknown";
|
|
14595
14624
|
}
|
|
14596
|
-
function getLengthableOrigin(
|
|
14597
|
-
if (Array.isArray(
|
|
14625
|
+
function getLengthableOrigin(input2) {
|
|
14626
|
+
if (Array.isArray(input2))
|
|
14598
14627
|
return "array";
|
|
14599
|
-
if (typeof
|
|
14628
|
+
if (typeof input2 === "string")
|
|
14600
14629
|
return "string";
|
|
14601
14630
|
return "unknown";
|
|
14602
14631
|
}
|
|
@@ -14622,12 +14651,12 @@ function parsedType(data) {
|
|
|
14622
14651
|
return t;
|
|
14623
14652
|
}
|
|
14624
14653
|
function issue(...args) {
|
|
14625
|
-
const [iss,
|
|
14654
|
+
const [iss, input2, inst] = args;
|
|
14626
14655
|
if (typeof iss === "string") {
|
|
14627
14656
|
return {
|
|
14628
14657
|
message: iss,
|
|
14629
14658
|
code: "custom",
|
|
14630
|
-
input,
|
|
14659
|
+
input: input2,
|
|
14631
14660
|
inst
|
|
14632
14661
|
};
|
|
14633
14662
|
}
|
|
@@ -15166,23 +15195,23 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
15166
15195
|
bag.pattern = integer;
|
|
15167
15196
|
});
|
|
15168
15197
|
inst._zod.check = (payload) => {
|
|
15169
|
-
const
|
|
15198
|
+
const input2 = payload.value;
|
|
15170
15199
|
if (isInt) {
|
|
15171
|
-
if (!Number.isInteger(
|
|
15200
|
+
if (!Number.isInteger(input2)) {
|
|
15172
15201
|
payload.issues.push({
|
|
15173
15202
|
expected: origin,
|
|
15174
15203
|
format: def.format,
|
|
15175
15204
|
code: "invalid_type",
|
|
15176
15205
|
continue: false,
|
|
15177
|
-
input,
|
|
15206
|
+
input: input2,
|
|
15178
15207
|
inst
|
|
15179
15208
|
});
|
|
15180
15209
|
return;
|
|
15181
15210
|
}
|
|
15182
|
-
if (!Number.isSafeInteger(
|
|
15183
|
-
if (
|
|
15211
|
+
if (!Number.isSafeInteger(input2)) {
|
|
15212
|
+
if (input2 > 0) {
|
|
15184
15213
|
payload.issues.push({
|
|
15185
|
-
input,
|
|
15214
|
+
input: input2,
|
|
15186
15215
|
code: "too_big",
|
|
15187
15216
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
15188
15217
|
note: "Integers must be within the safe integer range.",
|
|
@@ -15193,7 +15222,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
15193
15222
|
});
|
|
15194
15223
|
} else {
|
|
15195
15224
|
payload.issues.push({
|
|
15196
|
-
input,
|
|
15225
|
+
input: input2,
|
|
15197
15226
|
code: "too_small",
|
|
15198
15227
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
15199
15228
|
note: "Integers must be within the safe integer range.",
|
|
@@ -15206,10 +15235,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
15206
15235
|
return;
|
|
15207
15236
|
}
|
|
15208
15237
|
}
|
|
15209
|
-
if (
|
|
15238
|
+
if (input2 < minimum) {
|
|
15210
15239
|
payload.issues.push({
|
|
15211
15240
|
origin: "number",
|
|
15212
|
-
input,
|
|
15241
|
+
input: input2,
|
|
15213
15242
|
code: "too_small",
|
|
15214
15243
|
minimum,
|
|
15215
15244
|
inclusive: true,
|
|
@@ -15217,10 +15246,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
15217
15246
|
continue: !def.abort
|
|
15218
15247
|
});
|
|
15219
15248
|
}
|
|
15220
|
-
if (
|
|
15249
|
+
if (input2 > maximum) {
|
|
15221
15250
|
payload.issues.push({
|
|
15222
15251
|
origin: "number",
|
|
15223
|
-
input,
|
|
15252
|
+
input: input2,
|
|
15224
15253
|
code: "too_big",
|
|
15225
15254
|
maximum,
|
|
15226
15255
|
inclusive: true,
|
|
@@ -15240,11 +15269,11 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
15240
15269
|
bag.maximum = maximum;
|
|
15241
15270
|
});
|
|
15242
15271
|
inst._zod.check = (payload) => {
|
|
15243
|
-
const
|
|
15244
|
-
if (
|
|
15272
|
+
const input2 = payload.value;
|
|
15273
|
+
if (input2 < minimum) {
|
|
15245
15274
|
payload.issues.push({
|
|
15246
15275
|
origin: "bigint",
|
|
15247
|
-
input,
|
|
15276
|
+
input: input2,
|
|
15248
15277
|
code: "too_small",
|
|
15249
15278
|
minimum,
|
|
15250
15279
|
inclusive: true,
|
|
@@ -15252,10 +15281,10 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
15252
15281
|
continue: !def.abort
|
|
15253
15282
|
});
|
|
15254
15283
|
}
|
|
15255
|
-
if (
|
|
15284
|
+
if (input2 > maximum) {
|
|
15256
15285
|
payload.issues.push({
|
|
15257
15286
|
origin: "bigint",
|
|
15258
|
-
input,
|
|
15287
|
+
input: input2,
|
|
15259
15288
|
code: "too_big",
|
|
15260
15289
|
maximum,
|
|
15261
15290
|
inclusive: true,
|
|
@@ -15278,16 +15307,16 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
|
|
|
15278
15307
|
inst2._zod.bag.maximum = def.maximum;
|
|
15279
15308
|
});
|
|
15280
15309
|
inst._zod.check = (payload) => {
|
|
15281
|
-
const
|
|
15282
|
-
const size =
|
|
15310
|
+
const input2 = payload.value;
|
|
15311
|
+
const size = input2.size;
|
|
15283
15312
|
if (size <= def.maximum)
|
|
15284
15313
|
return;
|
|
15285
15314
|
payload.issues.push({
|
|
15286
|
-
origin: getSizableOrigin(
|
|
15315
|
+
origin: getSizableOrigin(input2),
|
|
15287
15316
|
code: "too_big",
|
|
15288
15317
|
maximum: def.maximum,
|
|
15289
15318
|
inclusive: true,
|
|
15290
|
-
input,
|
|
15319
|
+
input: input2,
|
|
15291
15320
|
inst,
|
|
15292
15321
|
continue: !def.abort
|
|
15293
15322
|
});
|
|
@@ -15306,16 +15335,16 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
|
|
|
15306
15335
|
inst2._zod.bag.minimum = def.minimum;
|
|
15307
15336
|
});
|
|
15308
15337
|
inst._zod.check = (payload) => {
|
|
15309
|
-
const
|
|
15310
|
-
const size =
|
|
15338
|
+
const input2 = payload.value;
|
|
15339
|
+
const size = input2.size;
|
|
15311
15340
|
if (size >= def.minimum)
|
|
15312
15341
|
return;
|
|
15313
15342
|
payload.issues.push({
|
|
15314
|
-
origin: getSizableOrigin(
|
|
15343
|
+
origin: getSizableOrigin(input2),
|
|
15315
15344
|
code: "too_small",
|
|
15316
15345
|
minimum: def.minimum,
|
|
15317
15346
|
inclusive: true,
|
|
15318
|
-
input,
|
|
15347
|
+
input: input2,
|
|
15319
15348
|
inst,
|
|
15320
15349
|
continue: !def.abort
|
|
15321
15350
|
});
|
|
@@ -15335,13 +15364,13 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
|
|
|
15335
15364
|
bag.size = def.size;
|
|
15336
15365
|
});
|
|
15337
15366
|
inst._zod.check = (payload) => {
|
|
15338
|
-
const
|
|
15339
|
-
const size =
|
|
15367
|
+
const input2 = payload.value;
|
|
15368
|
+
const size = input2.size;
|
|
15340
15369
|
if (size === def.size)
|
|
15341
15370
|
return;
|
|
15342
15371
|
const tooBig = size > def.size;
|
|
15343
15372
|
payload.issues.push({
|
|
15344
|
-
origin: getSizableOrigin(
|
|
15373
|
+
origin: getSizableOrigin(input2),
|
|
15345
15374
|
...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
|
|
15346
15375
|
inclusive: true,
|
|
15347
15376
|
exact: true,
|
|
@@ -15364,17 +15393,17 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
15364
15393
|
inst2._zod.bag.maximum = def.maximum;
|
|
15365
15394
|
});
|
|
15366
15395
|
inst._zod.check = (payload) => {
|
|
15367
|
-
const
|
|
15368
|
-
const length =
|
|
15396
|
+
const input2 = payload.value;
|
|
15397
|
+
const length = input2.length;
|
|
15369
15398
|
if (length <= def.maximum)
|
|
15370
15399
|
return;
|
|
15371
|
-
const origin = getLengthableOrigin(
|
|
15400
|
+
const origin = getLengthableOrigin(input2);
|
|
15372
15401
|
payload.issues.push({
|
|
15373
15402
|
origin,
|
|
15374
15403
|
code: "too_big",
|
|
15375
15404
|
maximum: def.maximum,
|
|
15376
15405
|
inclusive: true,
|
|
15377
|
-
input,
|
|
15406
|
+
input: input2,
|
|
15378
15407
|
inst,
|
|
15379
15408
|
continue: !def.abort
|
|
15380
15409
|
});
|
|
@@ -15393,17 +15422,17 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
15393
15422
|
inst2._zod.bag.minimum = def.minimum;
|
|
15394
15423
|
});
|
|
15395
15424
|
inst._zod.check = (payload) => {
|
|
15396
|
-
const
|
|
15397
|
-
const length =
|
|
15425
|
+
const input2 = payload.value;
|
|
15426
|
+
const length = input2.length;
|
|
15398
15427
|
if (length >= def.minimum)
|
|
15399
15428
|
return;
|
|
15400
|
-
const origin = getLengthableOrigin(
|
|
15429
|
+
const origin = getLengthableOrigin(input2);
|
|
15401
15430
|
payload.issues.push({
|
|
15402
15431
|
origin,
|
|
15403
15432
|
code: "too_small",
|
|
15404
15433
|
minimum: def.minimum,
|
|
15405
15434
|
inclusive: true,
|
|
15406
|
-
input,
|
|
15435
|
+
input: input2,
|
|
15407
15436
|
inst,
|
|
15408
15437
|
continue: !def.abort
|
|
15409
15438
|
});
|
|
@@ -15423,11 +15452,11 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
15423
15452
|
bag.length = def.length;
|
|
15424
15453
|
});
|
|
15425
15454
|
inst._zod.check = (payload) => {
|
|
15426
|
-
const
|
|
15427
|
-
const length =
|
|
15455
|
+
const input2 = payload.value;
|
|
15456
|
+
const length = input2.length;
|
|
15428
15457
|
if (length === def.length)
|
|
15429
15458
|
return;
|
|
15430
|
-
const origin = getLengthableOrigin(
|
|
15459
|
+
const origin = getLengthableOrigin(input2);
|
|
15431
15460
|
const tooBig = length > def.length;
|
|
15432
15461
|
payload.issues.push({
|
|
15433
15462
|
origin,
|
|
@@ -16081,15 +16110,15 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
16081
16110
|
payload.value = Number(payload.value);
|
|
16082
16111
|
} catch (_) {
|
|
16083
16112
|
}
|
|
16084
|
-
const
|
|
16085
|
-
if (typeof
|
|
16113
|
+
const input2 = payload.value;
|
|
16114
|
+
if (typeof input2 === "number" && !Number.isNaN(input2) && Number.isFinite(input2)) {
|
|
16086
16115
|
return payload;
|
|
16087
16116
|
}
|
|
16088
|
-
const received = typeof
|
|
16117
|
+
const received = typeof input2 === "number" ? Number.isNaN(input2) ? "NaN" : !Number.isFinite(input2) ? "Infinity" : void 0 : void 0;
|
|
16089
16118
|
payload.issues.push({
|
|
16090
16119
|
expected: "number",
|
|
16091
16120
|
code: "invalid_type",
|
|
16092
|
-
input,
|
|
16121
|
+
input: input2,
|
|
16093
16122
|
inst,
|
|
16094
16123
|
...received ? { received } : {}
|
|
16095
16124
|
});
|
|
@@ -16109,13 +16138,13 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
|
16109
16138
|
payload.value = Boolean(payload.value);
|
|
16110
16139
|
} catch (_) {
|
|
16111
16140
|
}
|
|
16112
|
-
const
|
|
16113
|
-
if (typeof
|
|
16141
|
+
const input2 = payload.value;
|
|
16142
|
+
if (typeof input2 === "boolean")
|
|
16114
16143
|
return payload;
|
|
16115
16144
|
payload.issues.push({
|
|
16116
16145
|
expected: "boolean",
|
|
16117
16146
|
code: "invalid_type",
|
|
16118
|
-
input,
|
|
16147
|
+
input: input2,
|
|
16119
16148
|
inst
|
|
16120
16149
|
});
|
|
16121
16150
|
return payload;
|
|
@@ -16148,13 +16177,13 @@ var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, d
|
|
|
16148
16177
|
var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
|
|
16149
16178
|
$ZodType.init(inst, def);
|
|
16150
16179
|
inst._zod.parse = (payload, _ctx) => {
|
|
16151
|
-
const
|
|
16152
|
-
if (typeof
|
|
16180
|
+
const input2 = payload.value;
|
|
16181
|
+
if (typeof input2 === "symbol")
|
|
16153
16182
|
return payload;
|
|
16154
16183
|
payload.issues.push({
|
|
16155
16184
|
expected: "symbol",
|
|
16156
16185
|
code: "invalid_type",
|
|
16157
|
-
input,
|
|
16186
|
+
input: input2,
|
|
16158
16187
|
inst
|
|
16159
16188
|
});
|
|
16160
16189
|
return payload;
|
|
@@ -16167,13 +16196,13 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
|
|
|
16167
16196
|
inst._zod.optin = "optional";
|
|
16168
16197
|
inst._zod.optout = "optional";
|
|
16169
16198
|
inst._zod.parse = (payload, _ctx) => {
|
|
16170
|
-
const
|
|
16171
|
-
if (typeof
|
|
16199
|
+
const input2 = payload.value;
|
|
16200
|
+
if (typeof input2 === "undefined")
|
|
16172
16201
|
return payload;
|
|
16173
16202
|
payload.issues.push({
|
|
16174
16203
|
expected: "undefined",
|
|
16175
16204
|
code: "invalid_type",
|
|
16176
|
-
input,
|
|
16205
|
+
input: input2,
|
|
16177
16206
|
inst
|
|
16178
16207
|
});
|
|
16179
16208
|
return payload;
|
|
@@ -16184,13 +16213,13 @@ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
|
|
|
16184
16213
|
inst._zod.pattern = _null;
|
|
16185
16214
|
inst._zod.values = /* @__PURE__ */ new Set([null]);
|
|
16186
16215
|
inst._zod.parse = (payload, _ctx) => {
|
|
16187
|
-
const
|
|
16188
|
-
if (
|
|
16216
|
+
const input2 = payload.value;
|
|
16217
|
+
if (input2 === null)
|
|
16189
16218
|
return payload;
|
|
16190
16219
|
payload.issues.push({
|
|
16191
16220
|
expected: "null",
|
|
16192
16221
|
code: "invalid_type",
|
|
16193
|
-
input,
|
|
16222
|
+
input: input2,
|
|
16194
16223
|
inst
|
|
16195
16224
|
});
|
|
16196
16225
|
return payload;
|
|
@@ -16219,13 +16248,13 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
|
16219
16248
|
var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
|
|
16220
16249
|
$ZodType.init(inst, def);
|
|
16221
16250
|
inst._zod.parse = (payload, _ctx) => {
|
|
16222
|
-
const
|
|
16223
|
-
if (typeof
|
|
16251
|
+
const input2 = payload.value;
|
|
16252
|
+
if (typeof input2 === "undefined")
|
|
16224
16253
|
return payload;
|
|
16225
16254
|
payload.issues.push({
|
|
16226
16255
|
expected: "void",
|
|
16227
16256
|
code: "invalid_type",
|
|
16228
|
-
input,
|
|
16257
|
+
input: input2,
|
|
16229
16258
|
inst
|
|
16230
16259
|
});
|
|
16231
16260
|
return payload;
|
|
@@ -16240,15 +16269,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
16240
16269
|
} catch (_err) {
|
|
16241
16270
|
}
|
|
16242
16271
|
}
|
|
16243
|
-
const
|
|
16244
|
-
const isDate =
|
|
16245
|
-
const isValidDate = isDate && !Number.isNaN(
|
|
16272
|
+
const input2 = payload.value;
|
|
16273
|
+
const isDate = input2 instanceof Date;
|
|
16274
|
+
const isValidDate = isDate && !Number.isNaN(input2.getTime());
|
|
16246
16275
|
if (isValidDate)
|
|
16247
16276
|
return payload;
|
|
16248
16277
|
payload.issues.push({
|
|
16249
16278
|
expected: "date",
|
|
16250
16279
|
code: "invalid_type",
|
|
16251
|
-
input,
|
|
16280
|
+
input: input2,
|
|
16252
16281
|
...isDate ? { received: "Invalid Date" } : {},
|
|
16253
16282
|
inst
|
|
16254
16283
|
});
|
|
@@ -16264,20 +16293,20 @@ function handleArrayResult(result, final, index) {
|
|
|
16264
16293
|
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
16265
16294
|
$ZodType.init(inst, def);
|
|
16266
16295
|
inst._zod.parse = (payload, ctx) => {
|
|
16267
|
-
const
|
|
16268
|
-
if (!Array.isArray(
|
|
16296
|
+
const input2 = payload.value;
|
|
16297
|
+
if (!Array.isArray(input2)) {
|
|
16269
16298
|
payload.issues.push({
|
|
16270
16299
|
expected: "array",
|
|
16271
16300
|
code: "invalid_type",
|
|
16272
|
-
input,
|
|
16301
|
+
input: input2,
|
|
16273
16302
|
inst
|
|
16274
16303
|
});
|
|
16275
16304
|
return payload;
|
|
16276
16305
|
}
|
|
16277
|
-
payload.value = Array(
|
|
16306
|
+
payload.value = Array(input2.length);
|
|
16278
16307
|
const proms = [];
|
|
16279
|
-
for (let i = 0; i <
|
|
16280
|
-
const item =
|
|
16308
|
+
for (let i = 0; i < input2.length; i++) {
|
|
16309
|
+
const item = input2[i];
|
|
16281
16310
|
const result = def.element._zod.run({
|
|
16282
16311
|
value: item,
|
|
16283
16312
|
issues: []
|
|
@@ -16294,15 +16323,15 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
16294
16323
|
return payload;
|
|
16295
16324
|
};
|
|
16296
16325
|
});
|
|
16297
|
-
function handlePropertyResult(result, final, key,
|
|
16326
|
+
function handlePropertyResult(result, final, key, input2, isOptionalOut) {
|
|
16298
16327
|
if (result.issues.length) {
|
|
16299
|
-
if (isOptionalOut && !(key in
|
|
16328
|
+
if (isOptionalOut && !(key in input2)) {
|
|
16300
16329
|
return;
|
|
16301
16330
|
}
|
|
16302
16331
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
16303
16332
|
}
|
|
16304
16333
|
if (result.value === void 0) {
|
|
16305
|
-
if (key in
|
|
16334
|
+
if (key in input2) {
|
|
16306
16335
|
final.value[key] = void 0;
|
|
16307
16336
|
}
|
|
16308
16337
|
} else {
|
|
@@ -16325,31 +16354,31 @@ function normalizeDef(def) {
|
|
|
16325
16354
|
optionalKeys: new Set(okeys)
|
|
16326
16355
|
};
|
|
16327
16356
|
}
|
|
16328
|
-
function handleCatchall(proms,
|
|
16357
|
+
function handleCatchall(proms, input2, payload, ctx, def, inst) {
|
|
16329
16358
|
const unrecognized = [];
|
|
16330
16359
|
const keySet = def.keySet;
|
|
16331
16360
|
const _catchall = def.catchall._zod;
|
|
16332
16361
|
const t = _catchall.def.type;
|
|
16333
16362
|
const isOptionalOut = _catchall.optout === "optional";
|
|
16334
|
-
for (const key in
|
|
16363
|
+
for (const key in input2) {
|
|
16335
16364
|
if (keySet.has(key))
|
|
16336
16365
|
continue;
|
|
16337
16366
|
if (t === "never") {
|
|
16338
16367
|
unrecognized.push(key);
|
|
16339
16368
|
continue;
|
|
16340
16369
|
}
|
|
16341
|
-
const r = _catchall.run({ value:
|
|
16370
|
+
const r = _catchall.run({ value: input2[key], issues: [] }, ctx);
|
|
16342
16371
|
if (r instanceof Promise) {
|
|
16343
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
16372
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalOut)));
|
|
16344
16373
|
} else {
|
|
16345
|
-
handlePropertyResult(r, payload, key,
|
|
16374
|
+
handlePropertyResult(r, payload, key, input2, isOptionalOut);
|
|
16346
16375
|
}
|
|
16347
16376
|
}
|
|
16348
16377
|
if (unrecognized.length) {
|
|
16349
16378
|
payload.issues.push({
|
|
16350
16379
|
code: "unrecognized_keys",
|
|
16351
16380
|
keys: unrecognized,
|
|
16352
|
-
input,
|
|
16381
|
+
input: input2,
|
|
16353
16382
|
inst
|
|
16354
16383
|
});
|
|
16355
16384
|
}
|
|
@@ -16393,12 +16422,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
16393
16422
|
let value;
|
|
16394
16423
|
inst._zod.parse = (payload, ctx) => {
|
|
16395
16424
|
value ?? (value = _normalized.value);
|
|
16396
|
-
const
|
|
16397
|
-
if (!isObject2(
|
|
16425
|
+
const input2 = payload.value;
|
|
16426
|
+
if (!isObject2(input2)) {
|
|
16398
16427
|
payload.issues.push({
|
|
16399
16428
|
expected: "object",
|
|
16400
16429
|
code: "invalid_type",
|
|
16401
|
-
input,
|
|
16430
|
+
input: input2,
|
|
16402
16431
|
inst
|
|
16403
16432
|
});
|
|
16404
16433
|
return payload;
|
|
@@ -16409,17 +16438,17 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
16409
16438
|
for (const key of value.keys) {
|
|
16410
16439
|
const el = shape[key];
|
|
16411
16440
|
const isOptionalOut = el._zod.optout === "optional";
|
|
16412
|
-
const r = el._zod.run({ value:
|
|
16441
|
+
const r = el._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
16413
16442
|
if (r instanceof Promise) {
|
|
16414
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
16443
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalOut)));
|
|
16415
16444
|
} else {
|
|
16416
|
-
handlePropertyResult(r, payload, key,
|
|
16445
|
+
handlePropertyResult(r, payload, key, input2, isOptionalOut);
|
|
16417
16446
|
}
|
|
16418
16447
|
}
|
|
16419
16448
|
if (!catchall) {
|
|
16420
16449
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
16421
16450
|
}
|
|
16422
|
-
return handleCatchall(proms,
|
|
16451
|
+
return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst);
|
|
16423
16452
|
};
|
|
16424
16453
|
});
|
|
16425
16454
|
var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -16500,12 +16529,12 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
16500
16529
|
let value;
|
|
16501
16530
|
inst._zod.parse = (payload, ctx) => {
|
|
16502
16531
|
value ?? (value = _normalized.value);
|
|
16503
|
-
const
|
|
16504
|
-
if (!isObject2(
|
|
16532
|
+
const input2 = payload.value;
|
|
16533
|
+
if (!isObject2(input2)) {
|
|
16505
16534
|
payload.issues.push({
|
|
16506
16535
|
expected: "object",
|
|
16507
16536
|
code: "invalid_type",
|
|
16508
|
-
input,
|
|
16537
|
+
input: input2,
|
|
16509
16538
|
inst
|
|
16510
16539
|
});
|
|
16511
16540
|
return payload;
|
|
@@ -16516,7 +16545,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
16516
16545
|
payload = fastpass(payload, ctx);
|
|
16517
16546
|
if (!catchall)
|
|
16518
16547
|
return payload;
|
|
16519
|
-
return handleCatchall([],
|
|
16548
|
+
return handleCatchall([], input2, payload, ctx, value, inst);
|
|
16520
16549
|
}
|
|
16521
16550
|
return superParse(payload, ctx);
|
|
16522
16551
|
};
|
|
@@ -16678,17 +16707,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
16678
16707
|
return map2;
|
|
16679
16708
|
});
|
|
16680
16709
|
inst._zod.parse = (payload, ctx) => {
|
|
16681
|
-
const
|
|
16682
|
-
if (!isObject(
|
|
16710
|
+
const input2 = payload.value;
|
|
16711
|
+
if (!isObject(input2)) {
|
|
16683
16712
|
payload.issues.push({
|
|
16684
16713
|
code: "invalid_type",
|
|
16685
16714
|
expected: "object",
|
|
16686
|
-
input,
|
|
16715
|
+
input: input2,
|
|
16687
16716
|
inst
|
|
16688
16717
|
});
|
|
16689
16718
|
return payload;
|
|
16690
16719
|
}
|
|
16691
|
-
const opt = disc.value.get(
|
|
16720
|
+
const opt = disc.value.get(input2?.[def.discriminator]);
|
|
16692
16721
|
if (opt) {
|
|
16693
16722
|
return opt._zod.run(payload, ctx);
|
|
16694
16723
|
}
|
|
@@ -16700,7 +16729,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
16700
16729
|
errors: [],
|
|
16701
16730
|
note: "No matching discriminator",
|
|
16702
16731
|
discriminator: def.discriminator,
|
|
16703
|
-
input,
|
|
16732
|
+
input: input2,
|
|
16704
16733
|
path: [def.discriminator],
|
|
16705
16734
|
inst
|
|
16706
16735
|
});
|
|
@@ -16710,9 +16739,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
16710
16739
|
var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
16711
16740
|
$ZodType.init(inst, def);
|
|
16712
16741
|
inst._zod.parse = (payload, ctx) => {
|
|
16713
|
-
const
|
|
16714
|
-
const left = def.left._zod.run({ value:
|
|
16715
|
-
const right = def.right._zod.run({ value:
|
|
16742
|
+
const input2 = payload.value;
|
|
16743
|
+
const left = def.left._zod.run({ value: input2, issues: [] }, ctx);
|
|
16744
|
+
const right = def.right._zod.run({ value: input2, issues: [] }, ctx);
|
|
16716
16745
|
const async = left instanceof Promise || right instanceof Promise;
|
|
16717
16746
|
if (async) {
|
|
16718
16747
|
return Promise.all([left, right]).then(([left2, right2]) => {
|
|
@@ -16809,10 +16838,10 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
16809
16838
|
$ZodType.init(inst, def);
|
|
16810
16839
|
const items = def.items;
|
|
16811
16840
|
inst._zod.parse = (payload, ctx) => {
|
|
16812
|
-
const
|
|
16813
|
-
if (!Array.isArray(
|
|
16841
|
+
const input2 = payload.value;
|
|
16842
|
+
if (!Array.isArray(input2)) {
|
|
16814
16843
|
payload.issues.push({
|
|
16815
|
-
input,
|
|
16844
|
+
input: input2,
|
|
16816
16845
|
inst,
|
|
16817
16846
|
expected: "tuple",
|
|
16818
16847
|
code: "invalid_type"
|
|
@@ -16824,12 +16853,12 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
16824
16853
|
const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
|
|
16825
16854
|
const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
|
|
16826
16855
|
if (!def.rest) {
|
|
16827
|
-
const tooBig =
|
|
16828
|
-
const tooSmall =
|
|
16856
|
+
const tooBig = input2.length > items.length;
|
|
16857
|
+
const tooSmall = input2.length < optStart - 1;
|
|
16829
16858
|
if (tooBig || tooSmall) {
|
|
16830
16859
|
payload.issues.push({
|
|
16831
16860
|
...tooBig ? { code: "too_big", maximum: items.length, inclusive: true } : { code: "too_small", minimum: items.length },
|
|
16832
|
-
input,
|
|
16861
|
+
input: input2,
|
|
16833
16862
|
inst,
|
|
16834
16863
|
origin: "array"
|
|
16835
16864
|
});
|
|
@@ -16839,12 +16868,12 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
16839
16868
|
let i = -1;
|
|
16840
16869
|
for (const item of items) {
|
|
16841
16870
|
i++;
|
|
16842
|
-
if (i >=
|
|
16871
|
+
if (i >= input2.length) {
|
|
16843
16872
|
if (i >= optStart)
|
|
16844
16873
|
continue;
|
|
16845
16874
|
}
|
|
16846
16875
|
const result = item._zod.run({
|
|
16847
|
-
value:
|
|
16876
|
+
value: input2[i],
|
|
16848
16877
|
issues: []
|
|
16849
16878
|
}, ctx);
|
|
16850
16879
|
if (result instanceof Promise) {
|
|
@@ -16854,7 +16883,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
16854
16883
|
}
|
|
16855
16884
|
}
|
|
16856
16885
|
if (def.rest) {
|
|
16857
|
-
const rest =
|
|
16886
|
+
const rest = input2.slice(items.length);
|
|
16858
16887
|
for (const el of rest) {
|
|
16859
16888
|
i++;
|
|
16860
16889
|
const result = def.rest._zod.run({
|
|
@@ -16882,12 +16911,12 @@ function handleTupleResult(result, final, index) {
|
|
|
16882
16911
|
var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
16883
16912
|
$ZodType.init(inst, def);
|
|
16884
16913
|
inst._zod.parse = (payload, ctx) => {
|
|
16885
|
-
const
|
|
16886
|
-
if (!isPlainObject(
|
|
16914
|
+
const input2 = payload.value;
|
|
16915
|
+
if (!isPlainObject(input2)) {
|
|
16887
16916
|
payload.issues.push({
|
|
16888
16917
|
expected: "record",
|
|
16889
16918
|
code: "invalid_type",
|
|
16890
|
-
input,
|
|
16919
|
+
input: input2,
|
|
16891
16920
|
inst
|
|
16892
16921
|
});
|
|
16893
16922
|
return payload;
|
|
@@ -16900,7 +16929,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
16900
16929
|
for (const key of values) {
|
|
16901
16930
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
16902
16931
|
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
16903
|
-
const result = def.valueType._zod.run({ value:
|
|
16932
|
+
const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
16904
16933
|
if (result instanceof Promise) {
|
|
16905
16934
|
proms.push(result.then((result2) => {
|
|
16906
16935
|
if (result2.issues.length) {
|
|
@@ -16917,7 +16946,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
16917
16946
|
}
|
|
16918
16947
|
}
|
|
16919
16948
|
let unrecognized;
|
|
16920
|
-
for (const key in
|
|
16949
|
+
for (const key in input2) {
|
|
16921
16950
|
if (!recordKeys.has(key)) {
|
|
16922
16951
|
unrecognized = unrecognized ?? [];
|
|
16923
16952
|
unrecognized.push(key);
|
|
@@ -16926,14 +16955,14 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
16926
16955
|
if (unrecognized && unrecognized.length > 0) {
|
|
16927
16956
|
payload.issues.push({
|
|
16928
16957
|
code: "unrecognized_keys",
|
|
16929
|
-
input,
|
|
16958
|
+
input: input2,
|
|
16930
16959
|
inst,
|
|
16931
16960
|
keys: unrecognized
|
|
16932
16961
|
});
|
|
16933
16962
|
}
|
|
16934
16963
|
} else {
|
|
16935
16964
|
payload.value = {};
|
|
16936
|
-
for (const key of Reflect.ownKeys(
|
|
16965
|
+
for (const key of Reflect.ownKeys(input2)) {
|
|
16937
16966
|
if (key === "__proto__")
|
|
16938
16967
|
continue;
|
|
16939
16968
|
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
@@ -16952,7 +16981,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
16952
16981
|
}
|
|
16953
16982
|
if (keyResult.issues.length) {
|
|
16954
16983
|
if (def.mode === "loose") {
|
|
16955
|
-
payload.value[key] =
|
|
16984
|
+
payload.value[key] = input2[key];
|
|
16956
16985
|
} else {
|
|
16957
16986
|
payload.issues.push({
|
|
16958
16987
|
code: "invalid_key",
|
|
@@ -16965,7 +16994,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
16965
16994
|
}
|
|
16966
16995
|
continue;
|
|
16967
16996
|
}
|
|
16968
|
-
const result = def.valueType._zod.run({ value:
|
|
16997
|
+
const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
16969
16998
|
if (result instanceof Promise) {
|
|
16970
16999
|
proms.push(result.then((result2) => {
|
|
16971
17000
|
if (result2.issues.length) {
|
|
@@ -16990,27 +17019,27 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
16990
17019
|
var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
16991
17020
|
$ZodType.init(inst, def);
|
|
16992
17021
|
inst._zod.parse = (payload, ctx) => {
|
|
16993
|
-
const
|
|
16994
|
-
if (!(
|
|
17022
|
+
const input2 = payload.value;
|
|
17023
|
+
if (!(input2 instanceof Map)) {
|
|
16995
17024
|
payload.issues.push({
|
|
16996
17025
|
expected: "map",
|
|
16997
17026
|
code: "invalid_type",
|
|
16998
|
-
input,
|
|
17027
|
+
input: input2,
|
|
16999
17028
|
inst
|
|
17000
17029
|
});
|
|
17001
17030
|
return payload;
|
|
17002
17031
|
}
|
|
17003
17032
|
const proms = [];
|
|
17004
17033
|
payload.value = /* @__PURE__ */ new Map();
|
|
17005
|
-
for (const [key, value] of
|
|
17034
|
+
for (const [key, value] of input2) {
|
|
17006
17035
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
17007
17036
|
const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
|
|
17008
17037
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
17009
17038
|
proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
|
|
17010
|
-
handleMapResult(keyResult2, valueResult2, payload, key,
|
|
17039
|
+
handleMapResult(keyResult2, valueResult2, payload, key, input2, inst, ctx);
|
|
17011
17040
|
}));
|
|
17012
17041
|
} else {
|
|
17013
|
-
handleMapResult(keyResult, valueResult, payload, key,
|
|
17042
|
+
handleMapResult(keyResult, valueResult, payload, key, input2, inst, ctx);
|
|
17014
17043
|
}
|
|
17015
17044
|
}
|
|
17016
17045
|
if (proms.length)
|
|
@@ -17018,7 +17047,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
17018
17047
|
return payload;
|
|
17019
17048
|
};
|
|
17020
17049
|
});
|
|
17021
|
-
function handleMapResult(keyResult, valueResult, final, key,
|
|
17050
|
+
function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
|
|
17022
17051
|
if (keyResult.issues.length) {
|
|
17023
17052
|
if (propertyKeyTypes.has(typeof key)) {
|
|
17024
17053
|
final.issues.push(...prefixIssues(key, keyResult.issues));
|
|
@@ -17026,7 +17055,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
17026
17055
|
final.issues.push({
|
|
17027
17056
|
code: "invalid_key",
|
|
17028
17057
|
origin: "map",
|
|
17029
|
-
input,
|
|
17058
|
+
input: input2,
|
|
17030
17059
|
inst,
|
|
17031
17060
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
17032
17061
|
});
|
|
@@ -17039,7 +17068,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
17039
17068
|
final.issues.push({
|
|
17040
17069
|
origin: "map",
|
|
17041
17070
|
code: "invalid_element",
|
|
17042
|
-
input,
|
|
17071
|
+
input: input2,
|
|
17043
17072
|
inst,
|
|
17044
17073
|
key,
|
|
17045
17074
|
issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
@@ -17051,10 +17080,10 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
17051
17080
|
var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
17052
17081
|
$ZodType.init(inst, def);
|
|
17053
17082
|
inst._zod.parse = (payload, ctx) => {
|
|
17054
|
-
const
|
|
17055
|
-
if (!(
|
|
17083
|
+
const input2 = payload.value;
|
|
17084
|
+
if (!(input2 instanceof Set)) {
|
|
17056
17085
|
payload.issues.push({
|
|
17057
|
-
input,
|
|
17086
|
+
input: input2,
|
|
17058
17087
|
inst,
|
|
17059
17088
|
expected: "set",
|
|
17060
17089
|
code: "invalid_type"
|
|
@@ -17063,7 +17092,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
|
17063
17092
|
}
|
|
17064
17093
|
const proms = [];
|
|
17065
17094
|
payload.value = /* @__PURE__ */ new Set();
|
|
17066
|
-
for (const item of
|
|
17095
|
+
for (const item of input2) {
|
|
17067
17096
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
17068
17097
|
if (result instanceof Promise) {
|
|
17069
17098
|
proms.push(result.then((result2) => handleSetResult(result2, payload)));
|
|
@@ -17088,14 +17117,14 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
17088
17117
|
inst._zod.values = valuesSet;
|
|
17089
17118
|
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
17090
17119
|
inst._zod.parse = (payload, _ctx) => {
|
|
17091
|
-
const
|
|
17092
|
-
if (valuesSet.has(
|
|
17120
|
+
const input2 = payload.value;
|
|
17121
|
+
if (valuesSet.has(input2)) {
|
|
17093
17122
|
return payload;
|
|
17094
17123
|
}
|
|
17095
17124
|
payload.issues.push({
|
|
17096
17125
|
code: "invalid_value",
|
|
17097
17126
|
values,
|
|
17098
|
-
input,
|
|
17127
|
+
input: input2,
|
|
17099
17128
|
inst
|
|
17100
17129
|
});
|
|
17101
17130
|
return payload;
|
|
@@ -17110,14 +17139,14 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
17110
17139
|
inst._zod.values = values;
|
|
17111
17140
|
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
17112
17141
|
inst._zod.parse = (payload, _ctx) => {
|
|
17113
|
-
const
|
|
17114
|
-
if (values.has(
|
|
17142
|
+
const input2 = payload.value;
|
|
17143
|
+
if (values.has(input2)) {
|
|
17115
17144
|
return payload;
|
|
17116
17145
|
}
|
|
17117
17146
|
payload.issues.push({
|
|
17118
17147
|
code: "invalid_value",
|
|
17119
17148
|
values: def.values,
|
|
17120
|
-
input,
|
|
17149
|
+
input: input2,
|
|
17121
17150
|
inst
|
|
17122
17151
|
});
|
|
17123
17152
|
return payload;
|
|
@@ -17126,13 +17155,13 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
17126
17155
|
var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
|
|
17127
17156
|
$ZodType.init(inst, def);
|
|
17128
17157
|
inst._zod.parse = (payload, _ctx) => {
|
|
17129
|
-
const
|
|
17130
|
-
if (
|
|
17158
|
+
const input2 = payload.value;
|
|
17159
|
+
if (input2 instanceof File)
|
|
17131
17160
|
return payload;
|
|
17132
17161
|
payload.issues.push({
|
|
17133
17162
|
expected: "file",
|
|
17134
17163
|
code: "invalid_type",
|
|
17135
|
-
input,
|
|
17164
|
+
input: input2,
|
|
17136
17165
|
inst
|
|
17137
17166
|
});
|
|
17138
17167
|
return payload;
|
|
@@ -17146,9 +17175,9 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
17146
17175
|
}
|
|
17147
17176
|
const _out = def.transform(payload.value, payload);
|
|
17148
17177
|
if (ctx.async) {
|
|
17149
|
-
const
|
|
17150
|
-
return
|
|
17151
|
-
payload.value =
|
|
17178
|
+
const output2 = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
17179
|
+
return output2.then((output3) => {
|
|
17180
|
+
payload.value = output3;
|
|
17152
17181
|
return payload;
|
|
17153
17182
|
});
|
|
17154
17183
|
}
|
|
@@ -17159,8 +17188,8 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
17159
17188
|
return payload;
|
|
17160
17189
|
};
|
|
17161
17190
|
});
|
|
17162
|
-
function handleOptionalResult(result,
|
|
17163
|
-
if (result.issues.length &&
|
|
17191
|
+
function handleOptionalResult(result, input2) {
|
|
17192
|
+
if (result.issues.length && input2 === void 0) {
|
|
17164
17193
|
return { issues: [], value: void 0 };
|
|
17165
17194
|
}
|
|
17166
17195
|
return result;
|
|
@@ -17561,12 +17590,12 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
|
17561
17590
|
output: inst._def.output
|
|
17562
17591
|
});
|
|
17563
17592
|
};
|
|
17564
|
-
inst.output = (
|
|
17593
|
+
inst.output = (output2) => {
|
|
17565
17594
|
const F = inst.constructor;
|
|
17566
17595
|
return new F({
|
|
17567
17596
|
type: "function",
|
|
17568
17597
|
input: inst._def.input,
|
|
17569
|
-
output
|
|
17598
|
+
output: output2
|
|
17570
17599
|
});
|
|
17571
17600
|
};
|
|
17572
17601
|
return inst;
|
|
@@ -17596,20 +17625,20 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
|
17596
17625
|
return payload;
|
|
17597
17626
|
};
|
|
17598
17627
|
inst._zod.check = (payload) => {
|
|
17599
|
-
const
|
|
17600
|
-
const r = def.fn(
|
|
17628
|
+
const input2 = payload.value;
|
|
17629
|
+
const r = def.fn(input2);
|
|
17601
17630
|
if (r instanceof Promise) {
|
|
17602
|
-
return r.then((r2) => handleRefineResult(r2, payload,
|
|
17631
|
+
return r.then((r2) => handleRefineResult(r2, payload, input2, inst));
|
|
17603
17632
|
}
|
|
17604
|
-
handleRefineResult(r, payload,
|
|
17633
|
+
handleRefineResult(r, payload, input2, inst);
|
|
17605
17634
|
return;
|
|
17606
17635
|
};
|
|
17607
17636
|
});
|
|
17608
|
-
function handleRefineResult(result, payload,
|
|
17637
|
+
function handleRefineResult(result, payload, input2, inst) {
|
|
17609
17638
|
if (!result) {
|
|
17610
17639
|
const _iss = {
|
|
17611
17640
|
code: "custom",
|
|
17612
|
-
input,
|
|
17641
|
+
input: input2,
|
|
17613
17642
|
inst,
|
|
17614
17643
|
// incorporates params.error into issue reporting
|
|
17615
17644
|
path: [...inst._zod.def.path ?? []],
|
|
@@ -23919,23 +23948,23 @@ function _overwrite(tx) {
|
|
|
23919
23948
|
}
|
|
23920
23949
|
// @__NO_SIDE_EFFECTS__
|
|
23921
23950
|
function _normalize(form) {
|
|
23922
|
-
return /* @__PURE__ */ _overwrite((
|
|
23951
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.normalize(form));
|
|
23923
23952
|
}
|
|
23924
23953
|
// @__NO_SIDE_EFFECTS__
|
|
23925
23954
|
function _trim() {
|
|
23926
|
-
return /* @__PURE__ */ _overwrite((
|
|
23955
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.trim());
|
|
23927
23956
|
}
|
|
23928
23957
|
// @__NO_SIDE_EFFECTS__
|
|
23929
23958
|
function _toLowerCase() {
|
|
23930
|
-
return /* @__PURE__ */ _overwrite((
|
|
23959
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.toLowerCase());
|
|
23931
23960
|
}
|
|
23932
23961
|
// @__NO_SIDE_EFFECTS__
|
|
23933
23962
|
function _toUpperCase() {
|
|
23934
|
-
return /* @__PURE__ */ _overwrite((
|
|
23963
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.toUpperCase());
|
|
23935
23964
|
}
|
|
23936
23965
|
// @__NO_SIDE_EFFECTS__
|
|
23937
23966
|
function _slugify() {
|
|
23938
|
-
return /* @__PURE__ */ _overwrite((
|
|
23967
|
+
return /* @__PURE__ */ _overwrite((input2) => slugify(input2));
|
|
23939
23968
|
}
|
|
23940
23969
|
// @__NO_SIDE_EFFECTS__
|
|
23941
23970
|
function _array(Class2, element, params) {
|
|
@@ -24240,8 +24269,8 @@ function _stringbool(Classes, _params) {
|
|
|
24240
24269
|
type: "pipe",
|
|
24241
24270
|
in: stringSchema,
|
|
24242
24271
|
out: booleanSchema,
|
|
24243
|
-
transform: ((
|
|
24244
|
-
let data =
|
|
24272
|
+
transform: ((input2, payload) => {
|
|
24273
|
+
let data = input2;
|
|
24245
24274
|
if (params.case !== "sensitive")
|
|
24246
24275
|
data = data.toLowerCase();
|
|
24247
24276
|
if (truthySet.has(data)) {
|
|
@@ -24260,8 +24289,8 @@ function _stringbool(Classes, _params) {
|
|
|
24260
24289
|
return {};
|
|
24261
24290
|
}
|
|
24262
24291
|
}),
|
|
24263
|
-
reverseTransform: ((
|
|
24264
|
-
if (
|
|
24292
|
+
reverseTransform: ((input2, _payload) => {
|
|
24293
|
+
if (input2 === true) {
|
|
24265
24294
|
return truthyArray[0] || "true";
|
|
24266
24295
|
} else {
|
|
24267
24296
|
return falsyArray[0] || "false";
|
|
@@ -25157,9 +25186,9 @@ var allProcessors = {
|
|
|
25157
25186
|
optional: optionalProcessor,
|
|
25158
25187
|
lazy: lazyProcessor
|
|
25159
25188
|
};
|
|
25160
|
-
function toJSONSchema(
|
|
25161
|
-
if ("_idmap" in
|
|
25162
|
-
const registry2 =
|
|
25189
|
+
function toJSONSchema(input2, params) {
|
|
25190
|
+
if ("_idmap" in input2) {
|
|
25191
|
+
const registry2 = input2;
|
|
25163
25192
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
25164
25193
|
const defs = {};
|
|
25165
25194
|
for (const entry of registry2._idmap.entries()) {
|
|
@@ -25187,9 +25216,9 @@ function toJSONSchema(input, params) {
|
|
|
25187
25216
|
return { schemas };
|
|
25188
25217
|
}
|
|
25189
25218
|
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
25190
|
-
process2(
|
|
25191
|
-
extractDefs(ctx,
|
|
25192
|
-
return finalize(ctx,
|
|
25219
|
+
process2(input2, ctx);
|
|
25220
|
+
extractDefs(ctx, input2);
|
|
25221
|
+
return finalize(ctx, input2);
|
|
25193
25222
|
}
|
|
25194
25223
|
|
|
25195
25224
|
// node_modules/zod/v4/core/json-schema-generator.js
|
|
@@ -26793,14 +26822,14 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
|
26793
26822
|
payload.issues.push(util_exports.issue(_issue));
|
|
26794
26823
|
}
|
|
26795
26824
|
};
|
|
26796
|
-
const
|
|
26797
|
-
if (
|
|
26798
|
-
return
|
|
26799
|
-
payload.value =
|
|
26825
|
+
const output2 = def.transform(payload.value, payload);
|
|
26826
|
+
if (output2 instanceof Promise) {
|
|
26827
|
+
return output2.then((output3) => {
|
|
26828
|
+
payload.value = output3;
|
|
26800
26829
|
return payload;
|
|
26801
26830
|
});
|
|
26802
26831
|
}
|
|
26803
|
-
payload.value =
|
|
26832
|
+
payload.value = output2;
|
|
26804
26833
|
return payload;
|
|
26805
26834
|
};
|
|
26806
26835
|
});
|
|
@@ -31450,12 +31479,12 @@ var AjvJsonSchemaValidator = class {
|
|
|
31450
31479
|
*/
|
|
31451
31480
|
getValidator(schema) {
|
|
31452
31481
|
const ajvValidator = "$id" in schema && typeof schema.$id === "string" ? this._ajv.getSchema(schema.$id) ?? this._ajv.compile(schema) : this._ajv.compile(schema);
|
|
31453
|
-
return (
|
|
31454
|
-
const valid = ajvValidator(
|
|
31482
|
+
return (input2) => {
|
|
31483
|
+
const valid = ajvValidator(input2);
|
|
31455
31484
|
if (valid) {
|
|
31456
31485
|
return {
|
|
31457
31486
|
valid: true,
|
|
31458
|
-
data:
|
|
31487
|
+
data: input2,
|
|
31459
31488
|
errorMessage: void 0
|
|
31460
31489
|
};
|
|
31461
31490
|
} else {
|