@chrischall/gemini-mcp 1.5.1 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +28 -54
- package/dist/blob-store.js +176 -0
- package/dist/bundle.js +1177 -491
- package/dist/client.js +74 -2
- package/dist/index.js +20 -4
- package/dist/jobs.js +1 -1
- package/dist/media-name.js +20 -0
- package/dist/tools/files.js +1 -1
- package/dist/tools/shared.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -15
- package/server.json +2 -2
- package/skills/gemini-mcp/SKILL.md +4 -4
- package/dist/connector-origin.js +0 -34
- package/dist/media-cleanup.js +0 -78
- package/dist/media-endpoint.js +0 -166
- package/dist/put-endpoint.js +0 -122
- package/dist/upload-endpoint.js +0 -79
package/dist/bundle.js
CHANGED
|
@@ -4651,8 +4651,8 @@ function uint8ArrayToBase64(bytes) {
|
|
|
4651
4651
|
}
|
|
4652
4652
|
return btoa(binaryString);
|
|
4653
4653
|
}
|
|
4654
|
-
function base64urlToUint8Array(
|
|
4655
|
-
const base643 =
|
|
4654
|
+
function base64urlToUint8Array(base64url4) {
|
|
4655
|
+
const base643 = base64url4.replace(/-/g, "+").replace(/_/g, "/");
|
|
4656
4656
|
const padding = "=".repeat((4 - base643.length % 4) % 4);
|
|
4657
4657
|
return base64ToUint8Array(base643 + padding);
|
|
4658
4658
|
}
|
|
@@ -5174,9 +5174,9 @@ var init_regexes = __esm({
|
|
|
5174
5174
|
});
|
|
5175
5175
|
|
|
5176
5176
|
// node_modules/zod/v4/core/checks.js
|
|
5177
|
-
function handleCheckPropertyResult(result,
|
|
5177
|
+
function handleCheckPropertyResult(result, payload2, property) {
|
|
5178
5178
|
if (result.issues.length) {
|
|
5179
|
-
|
|
5179
|
+
payload2.issues.push(...prefixIssues(property, result.issues));
|
|
5180
5180
|
}
|
|
5181
5181
|
}
|
|
5182
5182
|
var $ZodCheck, numericOriginMap, $ZodCheckLessThan, $ZodCheckGreaterThan, $ZodCheckMultipleOf, $ZodCheckNumberFormat, $ZodCheckBigIntFormat, $ZodCheckMaxSize, $ZodCheckMinSize, $ZodCheckSizeEquals, $ZodCheckMaxLength, $ZodCheckMinLength, $ZodCheckLengthEquals, $ZodCheckStringFormat, $ZodCheckRegex, $ZodCheckLowerCase, $ZodCheckUpperCase, $ZodCheckIncludes, $ZodCheckStartsWith, $ZodCheckEndsWith, $ZodCheckProperty, $ZodCheckMimeType, $ZodCheckOverwrite;
|
|
@@ -5209,15 +5209,15 @@ var init_checks = __esm({
|
|
|
5209
5209
|
bag.exclusiveMaximum = def.value;
|
|
5210
5210
|
}
|
|
5211
5211
|
});
|
|
5212
|
-
inst._zod.check = (
|
|
5213
|
-
if (def.inclusive ?
|
|
5212
|
+
inst._zod.check = (payload2) => {
|
|
5213
|
+
if (def.inclusive ? payload2.value <= def.value : payload2.value < def.value) {
|
|
5214
5214
|
return;
|
|
5215
5215
|
}
|
|
5216
|
-
|
|
5216
|
+
payload2.issues.push({
|
|
5217
5217
|
origin,
|
|
5218
5218
|
code: "too_big",
|
|
5219
5219
|
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
5220
|
-
input:
|
|
5220
|
+
input: payload2.value,
|
|
5221
5221
|
inclusive: def.inclusive,
|
|
5222
5222
|
inst,
|
|
5223
5223
|
continue: !def.abort
|
|
@@ -5237,15 +5237,15 @@ var init_checks = __esm({
|
|
|
5237
5237
|
bag.exclusiveMinimum = def.value;
|
|
5238
5238
|
}
|
|
5239
5239
|
});
|
|
5240
|
-
inst._zod.check = (
|
|
5241
|
-
if (def.inclusive ?
|
|
5240
|
+
inst._zod.check = (payload2) => {
|
|
5241
|
+
if (def.inclusive ? payload2.value >= def.value : payload2.value > def.value) {
|
|
5242
5242
|
return;
|
|
5243
5243
|
}
|
|
5244
|
-
|
|
5244
|
+
payload2.issues.push({
|
|
5245
5245
|
origin,
|
|
5246
5246
|
code: "too_small",
|
|
5247
5247
|
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
5248
|
-
input:
|
|
5248
|
+
input: payload2.value,
|
|
5249
5249
|
inclusive: def.inclusive,
|
|
5250
5250
|
inst,
|
|
5251
5251
|
continue: !def.abort
|
|
@@ -5258,17 +5258,17 @@ var init_checks = __esm({
|
|
|
5258
5258
|
var _a3;
|
|
5259
5259
|
(_a3 = inst2._zod.bag).multipleOf ?? (_a3.multipleOf = def.value);
|
|
5260
5260
|
});
|
|
5261
|
-
inst._zod.check = (
|
|
5262
|
-
if (typeof
|
|
5261
|
+
inst._zod.check = (payload2) => {
|
|
5262
|
+
if (typeof payload2.value !== typeof def.value)
|
|
5263
5263
|
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
5264
|
-
const isMultiple = typeof
|
|
5264
|
+
const isMultiple = typeof payload2.value === "bigint" ? payload2.value % def.value === BigInt(0) : floatSafeRemainder2(payload2.value, def.value) === 0;
|
|
5265
5265
|
if (isMultiple)
|
|
5266
5266
|
return;
|
|
5267
|
-
|
|
5268
|
-
origin: typeof
|
|
5267
|
+
payload2.issues.push({
|
|
5268
|
+
origin: typeof payload2.value,
|
|
5269
5269
|
code: "not_multiple_of",
|
|
5270
5270
|
divisor: def.value,
|
|
5271
|
-
input:
|
|
5271
|
+
input: payload2.value,
|
|
5272
5272
|
inst,
|
|
5273
5273
|
continue: !def.abort
|
|
5274
5274
|
});
|
|
@@ -5288,11 +5288,11 @@ var init_checks = __esm({
|
|
|
5288
5288
|
if (isInt)
|
|
5289
5289
|
bag.pattern = integer;
|
|
5290
5290
|
});
|
|
5291
|
-
inst._zod.check = (
|
|
5292
|
-
const input =
|
|
5291
|
+
inst._zod.check = (payload2) => {
|
|
5292
|
+
const input = payload2.value;
|
|
5293
5293
|
if (isInt) {
|
|
5294
5294
|
if (!Number.isInteger(input)) {
|
|
5295
|
-
|
|
5295
|
+
payload2.issues.push({
|
|
5296
5296
|
expected: origin,
|
|
5297
5297
|
format: def.format,
|
|
5298
5298
|
code: "invalid_type",
|
|
@@ -5304,7 +5304,7 @@ var init_checks = __esm({
|
|
|
5304
5304
|
}
|
|
5305
5305
|
if (!Number.isSafeInteger(input)) {
|
|
5306
5306
|
if (input > 0) {
|
|
5307
|
-
|
|
5307
|
+
payload2.issues.push({
|
|
5308
5308
|
input,
|
|
5309
5309
|
code: "too_big",
|
|
5310
5310
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
@@ -5315,7 +5315,7 @@ var init_checks = __esm({
|
|
|
5315
5315
|
continue: !def.abort
|
|
5316
5316
|
});
|
|
5317
5317
|
} else {
|
|
5318
|
-
|
|
5318
|
+
payload2.issues.push({
|
|
5319
5319
|
input,
|
|
5320
5320
|
code: "too_small",
|
|
5321
5321
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
@@ -5330,7 +5330,7 @@ var init_checks = __esm({
|
|
|
5330
5330
|
}
|
|
5331
5331
|
}
|
|
5332
5332
|
if (input < minimum) {
|
|
5333
|
-
|
|
5333
|
+
payload2.issues.push({
|
|
5334
5334
|
origin: "number",
|
|
5335
5335
|
input,
|
|
5336
5336
|
code: "too_small",
|
|
@@ -5341,7 +5341,7 @@ var init_checks = __esm({
|
|
|
5341
5341
|
});
|
|
5342
5342
|
}
|
|
5343
5343
|
if (input > maximum) {
|
|
5344
|
-
|
|
5344
|
+
payload2.issues.push({
|
|
5345
5345
|
origin: "number",
|
|
5346
5346
|
input,
|
|
5347
5347
|
code: "too_big",
|
|
@@ -5362,10 +5362,10 @@ var init_checks = __esm({
|
|
|
5362
5362
|
bag.minimum = minimum;
|
|
5363
5363
|
bag.maximum = maximum;
|
|
5364
5364
|
});
|
|
5365
|
-
inst._zod.check = (
|
|
5366
|
-
const input =
|
|
5365
|
+
inst._zod.check = (payload2) => {
|
|
5366
|
+
const input = payload2.value;
|
|
5367
5367
|
if (input < minimum) {
|
|
5368
|
-
|
|
5368
|
+
payload2.issues.push({
|
|
5369
5369
|
origin: "bigint",
|
|
5370
5370
|
input,
|
|
5371
5371
|
code: "too_small",
|
|
@@ -5376,7 +5376,7 @@ var init_checks = __esm({
|
|
|
5376
5376
|
});
|
|
5377
5377
|
}
|
|
5378
5378
|
if (input > maximum) {
|
|
5379
|
-
|
|
5379
|
+
payload2.issues.push({
|
|
5380
5380
|
origin: "bigint",
|
|
5381
5381
|
input,
|
|
5382
5382
|
code: "too_big",
|
|
@@ -5391,8 +5391,8 @@ var init_checks = __esm({
|
|
|
5391
5391
|
$ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, def) => {
|
|
5392
5392
|
var _a3;
|
|
5393
5393
|
$ZodCheck.init(inst, def);
|
|
5394
|
-
(_a3 = inst._zod.def).when ?? (_a3.when = (
|
|
5395
|
-
const val =
|
|
5394
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload2) => {
|
|
5395
|
+
const val = payload2.value;
|
|
5396
5396
|
return !nullish(val) && val.size !== void 0;
|
|
5397
5397
|
});
|
|
5398
5398
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -5400,12 +5400,12 @@ var init_checks = __esm({
|
|
|
5400
5400
|
if (def.maximum < curr)
|
|
5401
5401
|
inst2._zod.bag.maximum = def.maximum;
|
|
5402
5402
|
});
|
|
5403
|
-
inst._zod.check = (
|
|
5404
|
-
const input =
|
|
5403
|
+
inst._zod.check = (payload2) => {
|
|
5404
|
+
const input = payload2.value;
|
|
5405
5405
|
const size = input.size;
|
|
5406
5406
|
if (size <= def.maximum)
|
|
5407
5407
|
return;
|
|
5408
|
-
|
|
5408
|
+
payload2.issues.push({
|
|
5409
5409
|
origin: getSizableOrigin(input),
|
|
5410
5410
|
code: "too_big",
|
|
5411
5411
|
maximum: def.maximum,
|
|
@@ -5419,8 +5419,8 @@ var init_checks = __esm({
|
|
|
5419
5419
|
$ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => {
|
|
5420
5420
|
var _a3;
|
|
5421
5421
|
$ZodCheck.init(inst, def);
|
|
5422
|
-
(_a3 = inst._zod.def).when ?? (_a3.when = (
|
|
5423
|
-
const val =
|
|
5422
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload2) => {
|
|
5423
|
+
const val = payload2.value;
|
|
5424
5424
|
return !nullish(val) && val.size !== void 0;
|
|
5425
5425
|
});
|
|
5426
5426
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -5428,12 +5428,12 @@ var init_checks = __esm({
|
|
|
5428
5428
|
if (def.minimum > curr)
|
|
5429
5429
|
inst2._zod.bag.minimum = def.minimum;
|
|
5430
5430
|
});
|
|
5431
|
-
inst._zod.check = (
|
|
5432
|
-
const input =
|
|
5431
|
+
inst._zod.check = (payload2) => {
|
|
5432
|
+
const input = payload2.value;
|
|
5433
5433
|
const size = input.size;
|
|
5434
5434
|
if (size >= def.minimum)
|
|
5435
5435
|
return;
|
|
5436
|
-
|
|
5436
|
+
payload2.issues.push({
|
|
5437
5437
|
origin: getSizableOrigin(input),
|
|
5438
5438
|
code: "too_small",
|
|
5439
5439
|
minimum: def.minimum,
|
|
@@ -5447,8 +5447,8 @@ var init_checks = __esm({
|
|
|
5447
5447
|
$ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (inst, def) => {
|
|
5448
5448
|
var _a3;
|
|
5449
5449
|
$ZodCheck.init(inst, def);
|
|
5450
|
-
(_a3 = inst._zod.def).when ?? (_a3.when = (
|
|
5451
|
-
const val =
|
|
5450
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload2) => {
|
|
5451
|
+
const val = payload2.value;
|
|
5452
5452
|
return !nullish(val) && val.size !== void 0;
|
|
5453
5453
|
});
|
|
5454
5454
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -5457,18 +5457,18 @@ var init_checks = __esm({
|
|
|
5457
5457
|
bag.maximum = def.size;
|
|
5458
5458
|
bag.size = def.size;
|
|
5459
5459
|
});
|
|
5460
|
-
inst._zod.check = (
|
|
5461
|
-
const input =
|
|
5460
|
+
inst._zod.check = (payload2) => {
|
|
5461
|
+
const input = payload2.value;
|
|
5462
5462
|
const size = input.size;
|
|
5463
5463
|
if (size === def.size)
|
|
5464
5464
|
return;
|
|
5465
5465
|
const tooBig2 = size > def.size;
|
|
5466
|
-
|
|
5466
|
+
payload2.issues.push({
|
|
5467
5467
|
origin: getSizableOrigin(input),
|
|
5468
5468
|
...tooBig2 ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
|
|
5469
5469
|
inclusive: true,
|
|
5470
5470
|
exact: true,
|
|
5471
|
-
input:
|
|
5471
|
+
input: payload2.value,
|
|
5472
5472
|
inst,
|
|
5473
5473
|
continue: !def.abort
|
|
5474
5474
|
});
|
|
@@ -5477,8 +5477,8 @@ var init_checks = __esm({
|
|
|
5477
5477
|
$ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
5478
5478
|
var _a3;
|
|
5479
5479
|
$ZodCheck.init(inst, def);
|
|
5480
|
-
(_a3 = inst._zod.def).when ?? (_a3.when = (
|
|
5481
|
-
const val =
|
|
5480
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload2) => {
|
|
5481
|
+
const val = payload2.value;
|
|
5482
5482
|
return !nullish(val) && val.length !== void 0;
|
|
5483
5483
|
});
|
|
5484
5484
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -5486,13 +5486,13 @@ var init_checks = __esm({
|
|
|
5486
5486
|
if (def.maximum < curr)
|
|
5487
5487
|
inst2._zod.bag.maximum = def.maximum;
|
|
5488
5488
|
});
|
|
5489
|
-
inst._zod.check = (
|
|
5490
|
-
const input =
|
|
5489
|
+
inst._zod.check = (payload2) => {
|
|
5490
|
+
const input = payload2.value;
|
|
5491
5491
|
const length = input.length;
|
|
5492
5492
|
if (length <= def.maximum)
|
|
5493
5493
|
return;
|
|
5494
5494
|
const origin = getLengthableOrigin(input);
|
|
5495
|
-
|
|
5495
|
+
payload2.issues.push({
|
|
5496
5496
|
origin,
|
|
5497
5497
|
code: "too_big",
|
|
5498
5498
|
maximum: def.maximum,
|
|
@@ -5506,8 +5506,8 @@ var init_checks = __esm({
|
|
|
5506
5506
|
$ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
5507
5507
|
var _a3;
|
|
5508
5508
|
$ZodCheck.init(inst, def);
|
|
5509
|
-
(_a3 = inst._zod.def).when ?? (_a3.when = (
|
|
5510
|
-
const val =
|
|
5509
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload2) => {
|
|
5510
|
+
const val = payload2.value;
|
|
5511
5511
|
return !nullish(val) && val.length !== void 0;
|
|
5512
5512
|
});
|
|
5513
5513
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -5515,13 +5515,13 @@ var init_checks = __esm({
|
|
|
5515
5515
|
if (def.minimum > curr)
|
|
5516
5516
|
inst2._zod.bag.minimum = def.minimum;
|
|
5517
5517
|
});
|
|
5518
|
-
inst._zod.check = (
|
|
5519
|
-
const input =
|
|
5518
|
+
inst._zod.check = (payload2) => {
|
|
5519
|
+
const input = payload2.value;
|
|
5520
5520
|
const length = input.length;
|
|
5521
5521
|
if (length >= def.minimum)
|
|
5522
5522
|
return;
|
|
5523
5523
|
const origin = getLengthableOrigin(input);
|
|
5524
|
-
|
|
5524
|
+
payload2.issues.push({
|
|
5525
5525
|
origin,
|
|
5526
5526
|
code: "too_small",
|
|
5527
5527
|
minimum: def.minimum,
|
|
@@ -5535,8 +5535,8 @@ var init_checks = __esm({
|
|
|
5535
5535
|
$ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
5536
5536
|
var _a3;
|
|
5537
5537
|
$ZodCheck.init(inst, def);
|
|
5538
|
-
(_a3 = inst._zod.def).when ?? (_a3.when = (
|
|
5539
|
-
const val =
|
|
5538
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload2) => {
|
|
5539
|
+
const val = payload2.value;
|
|
5540
5540
|
return !nullish(val) && val.length !== void 0;
|
|
5541
5541
|
});
|
|
5542
5542
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -5545,19 +5545,19 @@ var init_checks = __esm({
|
|
|
5545
5545
|
bag.maximum = def.length;
|
|
5546
5546
|
bag.length = def.length;
|
|
5547
5547
|
});
|
|
5548
|
-
inst._zod.check = (
|
|
5549
|
-
const input =
|
|
5548
|
+
inst._zod.check = (payload2) => {
|
|
5549
|
+
const input = payload2.value;
|
|
5550
5550
|
const length = input.length;
|
|
5551
5551
|
if (length === def.length)
|
|
5552
5552
|
return;
|
|
5553
5553
|
const origin = getLengthableOrigin(input);
|
|
5554
5554
|
const tooBig2 = length > def.length;
|
|
5555
|
-
|
|
5555
|
+
payload2.issues.push({
|
|
5556
5556
|
origin,
|
|
5557
5557
|
...tooBig2 ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length },
|
|
5558
5558
|
inclusive: true,
|
|
5559
5559
|
exact: true,
|
|
5560
|
-
input:
|
|
5560
|
+
input: payload2.value,
|
|
5561
5561
|
inst,
|
|
5562
5562
|
continue: !def.abort
|
|
5563
5563
|
});
|
|
@@ -5575,15 +5575,15 @@ var init_checks = __esm({
|
|
|
5575
5575
|
}
|
|
5576
5576
|
});
|
|
5577
5577
|
if (def.pattern)
|
|
5578
|
-
(_a3 = inst._zod).check ?? (_a3.check = (
|
|
5578
|
+
(_a3 = inst._zod).check ?? (_a3.check = (payload2) => {
|
|
5579
5579
|
def.pattern.lastIndex = 0;
|
|
5580
|
-
if (def.pattern.test(
|
|
5580
|
+
if (def.pattern.test(payload2.value))
|
|
5581
5581
|
return;
|
|
5582
|
-
|
|
5582
|
+
payload2.issues.push({
|
|
5583
5583
|
origin: "string",
|
|
5584
5584
|
code: "invalid_format",
|
|
5585
5585
|
format: def.format,
|
|
5586
|
-
input:
|
|
5586
|
+
input: payload2.value,
|
|
5587
5587
|
...def.pattern ? { pattern: def.pattern.toString() } : {},
|
|
5588
5588
|
inst,
|
|
5589
5589
|
continue: !def.abort
|
|
@@ -5595,15 +5595,15 @@ var init_checks = __esm({
|
|
|
5595
5595
|
});
|
|
5596
5596
|
$ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
5597
5597
|
$ZodCheckStringFormat.init(inst, def);
|
|
5598
|
-
inst._zod.check = (
|
|
5598
|
+
inst._zod.check = (payload2) => {
|
|
5599
5599
|
def.pattern.lastIndex = 0;
|
|
5600
|
-
if (def.pattern.test(
|
|
5600
|
+
if (def.pattern.test(payload2.value))
|
|
5601
5601
|
return;
|
|
5602
|
-
|
|
5602
|
+
payload2.issues.push({
|
|
5603
5603
|
origin: "string",
|
|
5604
5604
|
code: "invalid_format",
|
|
5605
5605
|
format: "regex",
|
|
5606
|
-
input:
|
|
5606
|
+
input: payload2.value,
|
|
5607
5607
|
pattern: def.pattern.toString(),
|
|
5608
5608
|
inst,
|
|
5609
5609
|
continue: !def.abort
|
|
@@ -5628,15 +5628,15 @@ var init_checks = __esm({
|
|
|
5628
5628
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
5629
5629
|
bag.patterns.add(pattern);
|
|
5630
5630
|
});
|
|
5631
|
-
inst._zod.check = (
|
|
5632
|
-
if (
|
|
5631
|
+
inst._zod.check = (payload2) => {
|
|
5632
|
+
if (payload2.value.includes(def.includes, def.position))
|
|
5633
5633
|
return;
|
|
5634
|
-
|
|
5634
|
+
payload2.issues.push({
|
|
5635
5635
|
origin: "string",
|
|
5636
5636
|
code: "invalid_format",
|
|
5637
5637
|
format: "includes",
|
|
5638
5638
|
includes: def.includes,
|
|
5639
|
-
input:
|
|
5639
|
+
input: payload2.value,
|
|
5640
5640
|
inst,
|
|
5641
5641
|
continue: !def.abort
|
|
5642
5642
|
});
|
|
@@ -5651,15 +5651,15 @@ var init_checks = __esm({
|
|
|
5651
5651
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
5652
5652
|
bag.patterns.add(pattern);
|
|
5653
5653
|
});
|
|
5654
|
-
inst._zod.check = (
|
|
5655
|
-
if (
|
|
5654
|
+
inst._zod.check = (payload2) => {
|
|
5655
|
+
if (payload2.value.startsWith(def.prefix))
|
|
5656
5656
|
return;
|
|
5657
|
-
|
|
5657
|
+
payload2.issues.push({
|
|
5658
5658
|
origin: "string",
|
|
5659
5659
|
code: "invalid_format",
|
|
5660
5660
|
format: "starts_with",
|
|
5661
5661
|
prefix: def.prefix,
|
|
5662
|
-
input:
|
|
5662
|
+
input: payload2.value,
|
|
5663
5663
|
inst,
|
|
5664
5664
|
continue: !def.abort
|
|
5665
5665
|
});
|
|
@@ -5674,15 +5674,15 @@ var init_checks = __esm({
|
|
|
5674
5674
|
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
5675
5675
|
bag.patterns.add(pattern);
|
|
5676
5676
|
});
|
|
5677
|
-
inst._zod.check = (
|
|
5678
|
-
if (
|
|
5677
|
+
inst._zod.check = (payload2) => {
|
|
5678
|
+
if (payload2.value.endsWith(def.suffix))
|
|
5679
5679
|
return;
|
|
5680
|
-
|
|
5680
|
+
payload2.issues.push({
|
|
5681
5681
|
origin: "string",
|
|
5682
5682
|
code: "invalid_format",
|
|
5683
5683
|
format: "ends_with",
|
|
5684
5684
|
suffix: def.suffix,
|
|
5685
|
-
input:
|
|
5685
|
+
input: payload2.value,
|
|
5686
5686
|
inst,
|
|
5687
5687
|
continue: !def.abort
|
|
5688
5688
|
});
|
|
@@ -5690,15 +5690,15 @@ var init_checks = __esm({
|
|
|
5690
5690
|
});
|
|
5691
5691
|
$ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst, def) => {
|
|
5692
5692
|
$ZodCheck.init(inst, def);
|
|
5693
|
-
inst._zod.check = (
|
|
5693
|
+
inst._zod.check = (payload2) => {
|
|
5694
5694
|
const result = def.schema._zod.run({
|
|
5695
|
-
value:
|
|
5695
|
+
value: payload2.value[def.property],
|
|
5696
5696
|
issues: []
|
|
5697
5697
|
}, {});
|
|
5698
5698
|
if (result instanceof Promise) {
|
|
5699
|
-
return result.then((result2) => handleCheckPropertyResult(result2,
|
|
5699
|
+
return result.then((result2) => handleCheckPropertyResult(result2, payload2, def.property));
|
|
5700
5700
|
}
|
|
5701
|
-
handleCheckPropertyResult(result,
|
|
5701
|
+
handleCheckPropertyResult(result, payload2, def.property);
|
|
5702
5702
|
return;
|
|
5703
5703
|
};
|
|
5704
5704
|
});
|
|
@@ -5708,13 +5708,13 @@ var init_checks = __esm({
|
|
|
5708
5708
|
inst._zod.onattach.push((inst2) => {
|
|
5709
5709
|
inst2._zod.bag.mime = def.mime;
|
|
5710
5710
|
});
|
|
5711
|
-
inst._zod.check = (
|
|
5712
|
-
if (mimeSet.has(
|
|
5711
|
+
inst._zod.check = (payload2) => {
|
|
5712
|
+
if (mimeSet.has(payload2.value.type))
|
|
5713
5713
|
return;
|
|
5714
|
-
|
|
5714
|
+
payload2.issues.push({
|
|
5715
5715
|
code: "invalid_value",
|
|
5716
5716
|
values: def.mime,
|
|
5717
|
-
input:
|
|
5717
|
+
input: payload2.value.type,
|
|
5718
5718
|
inst,
|
|
5719
5719
|
continue: !def.abort
|
|
5720
5720
|
});
|
|
@@ -5722,8 +5722,8 @@ var init_checks = __esm({
|
|
|
5722
5722
|
});
|
|
5723
5723
|
$ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
5724
5724
|
$ZodCheck.init(inst, def);
|
|
5725
|
-
inst._zod.check = (
|
|
5726
|
-
|
|
5725
|
+
inst._zod.check = (payload2) => {
|
|
5726
|
+
payload2.value = def.tx(payload2.value);
|
|
5727
5727
|
};
|
|
5728
5728
|
});
|
|
5729
5729
|
}
|
|
@@ -5873,7 +5873,7 @@ function normalizeDef(def) {
|
|
|
5873
5873
|
optionalKeys: new Set(okeys)
|
|
5874
5874
|
};
|
|
5875
5875
|
}
|
|
5876
|
-
function handleCatchall(proms, input,
|
|
5876
|
+
function handleCatchall(proms, input, payload2, ctx, def, inst) {
|
|
5877
5877
|
const unrecognized = [];
|
|
5878
5878
|
const keySet = def.keySet;
|
|
5879
5879
|
const _catchall = def.catchall._zod;
|
|
@@ -5891,13 +5891,13 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
5891
5891
|
}
|
|
5892
5892
|
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
5893
5893
|
if (r instanceof Promise) {
|
|
5894
|
-
proms.push(r.then((r2) => handlePropertyResult(r2,
|
|
5894
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload2, key, input, isOptionalIn, isOptionalOut)));
|
|
5895
5895
|
} else {
|
|
5896
|
-
handlePropertyResult(r,
|
|
5896
|
+
handlePropertyResult(r, payload2, key, input, isOptionalIn, isOptionalOut);
|
|
5897
5897
|
}
|
|
5898
5898
|
}
|
|
5899
5899
|
if (unrecognized.length) {
|
|
5900
|
-
|
|
5900
|
+
payload2.issues.push({
|
|
5901
5901
|
code: "unrecognized_keys",
|
|
5902
5902
|
keys: unrecognized,
|
|
5903
5903
|
input,
|
|
@@ -5905,9 +5905,9 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
5905
5905
|
});
|
|
5906
5906
|
}
|
|
5907
5907
|
if (!proms.length)
|
|
5908
|
-
return
|
|
5908
|
+
return payload2;
|
|
5909
5909
|
return Promise.all(proms).then(() => {
|
|
5910
|
-
return
|
|
5910
|
+
return payload2;
|
|
5911
5911
|
});
|
|
5912
5912
|
}
|
|
5913
5913
|
function handleUnionResults(results, final, inst, ctx) {
|
|
@@ -6114,22 +6114,22 @@ function handleOptionalResult(result, input) {
|
|
|
6114
6114
|
}
|
|
6115
6115
|
return result;
|
|
6116
6116
|
}
|
|
6117
|
-
function handleDefaultResult(
|
|
6118
|
-
if (
|
|
6119
|
-
|
|
6117
|
+
function handleDefaultResult(payload2, def) {
|
|
6118
|
+
if (payload2.value === void 0) {
|
|
6119
|
+
payload2.value = def.defaultValue;
|
|
6120
6120
|
}
|
|
6121
|
-
return
|
|
6121
|
+
return payload2;
|
|
6122
6122
|
}
|
|
6123
|
-
function handleNonOptionalResult(
|
|
6124
|
-
if (!
|
|
6125
|
-
|
|
6123
|
+
function handleNonOptionalResult(payload2, inst) {
|
|
6124
|
+
if (!payload2.issues.length && payload2.value === void 0) {
|
|
6125
|
+
payload2.issues.push({
|
|
6126
6126
|
code: "invalid_type",
|
|
6127
6127
|
expected: "nonoptional",
|
|
6128
|
-
input:
|
|
6128
|
+
input: payload2.value,
|
|
6129
6129
|
inst
|
|
6130
6130
|
});
|
|
6131
6131
|
}
|
|
6132
|
-
return
|
|
6132
|
+
return payload2;
|
|
6133
6133
|
}
|
|
6134
6134
|
function handlePipeResult(left, next, ctx) {
|
|
6135
6135
|
if (left.issues.length) {
|
|
@@ -6165,11 +6165,11 @@ function handleCodecTxResult(left, value, nextSchema, ctx) {
|
|
|
6165
6165
|
}
|
|
6166
6166
|
return nextSchema._zod.run({ value, issues: left.issues }, ctx);
|
|
6167
6167
|
}
|
|
6168
|
-
function handleReadonlyResult(
|
|
6169
|
-
|
|
6170
|
-
return
|
|
6168
|
+
function handleReadonlyResult(payload2) {
|
|
6169
|
+
payload2.value = Object.freeze(payload2.value);
|
|
6170
|
+
return payload2;
|
|
6171
6171
|
}
|
|
6172
|
-
function handleRefineResult(result,
|
|
6172
|
+
function handleRefineResult(result, payload2, input, inst) {
|
|
6173
6173
|
if (!result) {
|
|
6174
6174
|
const _iss = {
|
|
6175
6175
|
code: "custom",
|
|
@@ -6183,7 +6183,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
6183
6183
|
};
|
|
6184
6184
|
if (inst._zod.def.params)
|
|
6185
6185
|
_iss.params = inst._zod.def.params;
|
|
6186
|
-
|
|
6186
|
+
payload2.issues.push(issue(_iss));
|
|
6187
6187
|
}
|
|
6188
6188
|
}
|
|
6189
6189
|
var $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodMAC, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodCustomStringFormat, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodBigInt, $ZodBigIntFormat, $ZodSymbol, $ZodUndefined, $ZodNull, $ZodAny, $ZodUnknown, $ZodNever, $ZodVoid, $ZodDate, $ZodArray, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodXor, $ZodDiscriminatedUnion, $ZodIntersection, $ZodTuple, $ZodRecord, $ZodMap, $ZodSet, $ZodEnum, $ZodLiteral, $ZodFile, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodSuccess, $ZodCatch, $ZodNaN, $ZodPipe, $ZodCodec, $ZodPreprocess, $ZodReadonly, $ZodTemplateLiteral, $ZodFunction, $ZodPromise, $ZodLazy, $ZodCustom;
|
|
@@ -6218,54 +6218,54 @@ var init_schemas = __esm({
|
|
|
6218
6218
|
inst._zod.run = inst._zod.parse;
|
|
6219
6219
|
});
|
|
6220
6220
|
} else {
|
|
6221
|
-
const runChecks = (
|
|
6222
|
-
let isAborted2 = aborted(
|
|
6221
|
+
const runChecks = (payload2, checks2, ctx) => {
|
|
6222
|
+
let isAborted2 = aborted(payload2);
|
|
6223
6223
|
let asyncResult;
|
|
6224
6224
|
for (const ch of checks2) {
|
|
6225
6225
|
if (ch._zod.def.when) {
|
|
6226
|
-
if (explicitlyAborted(
|
|
6226
|
+
if (explicitlyAborted(payload2))
|
|
6227
6227
|
continue;
|
|
6228
|
-
const shouldRun = ch._zod.def.when(
|
|
6228
|
+
const shouldRun = ch._zod.def.when(payload2);
|
|
6229
6229
|
if (!shouldRun)
|
|
6230
6230
|
continue;
|
|
6231
6231
|
} else if (isAborted2) {
|
|
6232
6232
|
continue;
|
|
6233
6233
|
}
|
|
6234
|
-
const currLen =
|
|
6235
|
-
const _ = ch._zod.check(
|
|
6234
|
+
const currLen = payload2.issues.length;
|
|
6235
|
+
const _ = ch._zod.check(payload2);
|
|
6236
6236
|
if (_ instanceof Promise && ctx?.async === false) {
|
|
6237
6237
|
throw new $ZodAsyncError();
|
|
6238
6238
|
}
|
|
6239
6239
|
if (asyncResult || _ instanceof Promise) {
|
|
6240
6240
|
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
6241
6241
|
await _;
|
|
6242
|
-
const nextLen =
|
|
6242
|
+
const nextLen = payload2.issues.length;
|
|
6243
6243
|
if (nextLen === currLen)
|
|
6244
6244
|
return;
|
|
6245
6245
|
if (!isAborted2)
|
|
6246
|
-
isAborted2 = aborted(
|
|
6246
|
+
isAborted2 = aborted(payload2, currLen);
|
|
6247
6247
|
});
|
|
6248
6248
|
} else {
|
|
6249
|
-
const nextLen =
|
|
6249
|
+
const nextLen = payload2.issues.length;
|
|
6250
6250
|
if (nextLen === currLen)
|
|
6251
6251
|
continue;
|
|
6252
6252
|
if (!isAborted2)
|
|
6253
|
-
isAborted2 = aborted(
|
|
6253
|
+
isAborted2 = aborted(payload2, currLen);
|
|
6254
6254
|
}
|
|
6255
6255
|
}
|
|
6256
6256
|
if (asyncResult) {
|
|
6257
6257
|
return asyncResult.then(() => {
|
|
6258
|
-
return
|
|
6258
|
+
return payload2;
|
|
6259
6259
|
});
|
|
6260
6260
|
}
|
|
6261
|
-
return
|
|
6261
|
+
return payload2;
|
|
6262
6262
|
};
|
|
6263
|
-
const handleCanaryResult = (canary,
|
|
6263
|
+
const handleCanaryResult = (canary, payload2, ctx) => {
|
|
6264
6264
|
if (aborted(canary)) {
|
|
6265
6265
|
canary.aborted = true;
|
|
6266
6266
|
return canary;
|
|
6267
6267
|
}
|
|
6268
|
-
const checkResult = runChecks(
|
|
6268
|
+
const checkResult = runChecks(payload2, checks, ctx);
|
|
6269
6269
|
if (checkResult instanceof Promise) {
|
|
6270
6270
|
if (ctx.async === false)
|
|
6271
6271
|
throw new $ZodAsyncError();
|
|
@@ -6273,20 +6273,20 @@ var init_schemas = __esm({
|
|
|
6273
6273
|
}
|
|
6274
6274
|
return inst._zod.parse(checkResult, ctx);
|
|
6275
6275
|
};
|
|
6276
|
-
inst._zod.run = (
|
|
6276
|
+
inst._zod.run = (payload2, ctx) => {
|
|
6277
6277
|
if (ctx.skipChecks) {
|
|
6278
|
-
return inst._zod.parse(
|
|
6278
|
+
return inst._zod.parse(payload2, ctx);
|
|
6279
6279
|
}
|
|
6280
6280
|
if (ctx.direction === "backward") {
|
|
6281
|
-
const canary = inst._zod.parse({ value:
|
|
6281
|
+
const canary = inst._zod.parse({ value: payload2.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
6282
6282
|
if (canary instanceof Promise) {
|
|
6283
6283
|
return canary.then((canary2) => {
|
|
6284
|
-
return handleCanaryResult(canary2,
|
|
6284
|
+
return handleCanaryResult(canary2, payload2, ctx);
|
|
6285
6285
|
});
|
|
6286
6286
|
}
|
|
6287
|
-
return handleCanaryResult(canary,
|
|
6287
|
+
return handleCanaryResult(canary, payload2, ctx);
|
|
6288
6288
|
}
|
|
6289
|
-
const result = inst._zod.parse(
|
|
6289
|
+
const result = inst._zod.parse(payload2, ctx);
|
|
6290
6290
|
if (result instanceof Promise) {
|
|
6291
6291
|
if (ctx.async === false)
|
|
6292
6292
|
throw new $ZodAsyncError();
|
|
@@ -6311,21 +6311,21 @@ var init_schemas = __esm({
|
|
|
6311
6311
|
$ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
6312
6312
|
$ZodType.init(inst, def);
|
|
6313
6313
|
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
|
|
6314
|
-
inst._zod.parse = (
|
|
6314
|
+
inst._zod.parse = (payload2, _) => {
|
|
6315
6315
|
if (def.coerce)
|
|
6316
6316
|
try {
|
|
6317
|
-
|
|
6317
|
+
payload2.value = String(payload2.value);
|
|
6318
6318
|
} catch (_2) {
|
|
6319
6319
|
}
|
|
6320
|
-
if (typeof
|
|
6321
|
-
return
|
|
6322
|
-
|
|
6320
|
+
if (typeof payload2.value === "string")
|
|
6321
|
+
return payload2;
|
|
6322
|
+
payload2.issues.push({
|
|
6323
6323
|
expected: "string",
|
|
6324
6324
|
code: "invalid_type",
|
|
6325
|
-
input:
|
|
6325
|
+
input: payload2.value,
|
|
6326
6326
|
inst
|
|
6327
6327
|
});
|
|
6328
|
-
return
|
|
6328
|
+
return payload2;
|
|
6329
6329
|
};
|
|
6330
6330
|
});
|
|
6331
6331
|
$ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
|
|
@@ -6362,16 +6362,16 @@ var init_schemas = __esm({
|
|
|
6362
6362
|
});
|
|
6363
6363
|
$ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
6364
6364
|
$ZodStringFormat.init(inst, def);
|
|
6365
|
-
inst._zod.check = (
|
|
6365
|
+
inst._zod.check = (payload2) => {
|
|
6366
6366
|
try {
|
|
6367
|
-
const trimmed =
|
|
6367
|
+
const trimmed = payload2.value.trim();
|
|
6368
6368
|
if (!def.normalize && def.protocol?.source === httpProtocol.source) {
|
|
6369
6369
|
if (!/^https?:\/\//i.test(trimmed)) {
|
|
6370
|
-
|
|
6370
|
+
payload2.issues.push({
|
|
6371
6371
|
code: "invalid_format",
|
|
6372
6372
|
format: "url",
|
|
6373
6373
|
note: "Invalid URL format",
|
|
6374
|
-
input:
|
|
6374
|
+
input: payload2.value,
|
|
6375
6375
|
inst,
|
|
6376
6376
|
continue: !def.abort
|
|
6377
6377
|
});
|
|
@@ -6382,12 +6382,12 @@ var init_schemas = __esm({
|
|
|
6382
6382
|
if (def.hostname) {
|
|
6383
6383
|
def.hostname.lastIndex = 0;
|
|
6384
6384
|
if (!def.hostname.test(url2.hostname)) {
|
|
6385
|
-
|
|
6385
|
+
payload2.issues.push({
|
|
6386
6386
|
code: "invalid_format",
|
|
6387
6387
|
format: "url",
|
|
6388
6388
|
note: "Invalid hostname",
|
|
6389
6389
|
pattern: def.hostname.source,
|
|
6390
|
-
input:
|
|
6390
|
+
input: payload2.value,
|
|
6391
6391
|
inst,
|
|
6392
6392
|
continue: !def.abort
|
|
6393
6393
|
});
|
|
@@ -6396,28 +6396,28 @@ var init_schemas = __esm({
|
|
|
6396
6396
|
if (def.protocol) {
|
|
6397
6397
|
def.protocol.lastIndex = 0;
|
|
6398
6398
|
if (!def.protocol.test(url2.protocol.endsWith(":") ? url2.protocol.slice(0, -1) : url2.protocol)) {
|
|
6399
|
-
|
|
6399
|
+
payload2.issues.push({
|
|
6400
6400
|
code: "invalid_format",
|
|
6401
6401
|
format: "url",
|
|
6402
6402
|
note: "Invalid protocol",
|
|
6403
6403
|
pattern: def.protocol.source,
|
|
6404
|
-
input:
|
|
6404
|
+
input: payload2.value,
|
|
6405
6405
|
inst,
|
|
6406
6406
|
continue: !def.abort
|
|
6407
6407
|
});
|
|
6408
6408
|
}
|
|
6409
6409
|
}
|
|
6410
6410
|
if (def.normalize) {
|
|
6411
|
-
|
|
6411
|
+
payload2.value = url2.href;
|
|
6412
6412
|
} else {
|
|
6413
|
-
|
|
6413
|
+
payload2.value = trimmed;
|
|
6414
6414
|
}
|
|
6415
6415
|
return;
|
|
6416
6416
|
} catch (_) {
|
|
6417
|
-
|
|
6417
|
+
payload2.issues.push({
|
|
6418
6418
|
code: "invalid_format",
|
|
6419
6419
|
format: "url",
|
|
6420
|
-
input:
|
|
6420
|
+
input: payload2.value,
|
|
6421
6421
|
inst,
|
|
6422
6422
|
continue: !def.abort
|
|
6423
6423
|
});
|
|
@@ -6477,14 +6477,14 @@ var init_schemas = __esm({
|
|
|
6477
6477
|
def.pattern ?? (def.pattern = ipv6);
|
|
6478
6478
|
$ZodStringFormat.init(inst, def);
|
|
6479
6479
|
inst._zod.bag.format = `ipv6`;
|
|
6480
|
-
inst._zod.check = (
|
|
6480
|
+
inst._zod.check = (payload2) => {
|
|
6481
6481
|
try {
|
|
6482
|
-
new URL(`http://[${
|
|
6482
|
+
new URL(`http://[${payload2.value}]`);
|
|
6483
6483
|
} catch {
|
|
6484
|
-
|
|
6484
|
+
payload2.issues.push({
|
|
6485
6485
|
code: "invalid_format",
|
|
6486
6486
|
format: "ipv6",
|
|
6487
|
-
input:
|
|
6487
|
+
input: payload2.value,
|
|
6488
6488
|
inst,
|
|
6489
6489
|
continue: !def.abort
|
|
6490
6490
|
});
|
|
@@ -6503,8 +6503,8 @@ var init_schemas = __esm({
|
|
|
6503
6503
|
$ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
6504
6504
|
def.pattern ?? (def.pattern = cidrv6);
|
|
6505
6505
|
$ZodStringFormat.init(inst, def);
|
|
6506
|
-
inst._zod.check = (
|
|
6507
|
-
const parts =
|
|
6506
|
+
inst._zod.check = (payload2) => {
|
|
6507
|
+
const parts = payload2.value.split("/");
|
|
6508
6508
|
try {
|
|
6509
6509
|
if (parts.length !== 2)
|
|
6510
6510
|
throw new Error();
|
|
@@ -6518,10 +6518,10 @@ var init_schemas = __esm({
|
|
|
6518
6518
|
throw new Error();
|
|
6519
6519
|
new URL(`http://[${address}]`);
|
|
6520
6520
|
} catch {
|
|
6521
|
-
|
|
6521
|
+
payload2.issues.push({
|
|
6522
6522
|
code: "invalid_format",
|
|
6523
6523
|
format: "cidrv6",
|
|
6524
|
-
input:
|
|
6524
|
+
input: payload2.value,
|
|
6525
6525
|
inst,
|
|
6526
6526
|
continue: !def.abort
|
|
6527
6527
|
});
|
|
@@ -6532,13 +6532,13 @@ var init_schemas = __esm({
|
|
|
6532
6532
|
def.pattern ?? (def.pattern = base64);
|
|
6533
6533
|
$ZodStringFormat.init(inst, def);
|
|
6534
6534
|
inst._zod.bag.contentEncoding = "base64";
|
|
6535
|
-
inst._zod.check = (
|
|
6536
|
-
if (isValidBase64(
|
|
6535
|
+
inst._zod.check = (payload2) => {
|
|
6536
|
+
if (isValidBase64(payload2.value))
|
|
6537
6537
|
return;
|
|
6538
|
-
|
|
6538
|
+
payload2.issues.push({
|
|
6539
6539
|
code: "invalid_format",
|
|
6540
6540
|
format: "base64",
|
|
6541
|
-
input:
|
|
6541
|
+
input: payload2.value,
|
|
6542
6542
|
inst,
|
|
6543
6543
|
continue: !def.abort
|
|
6544
6544
|
});
|
|
@@ -6548,13 +6548,13 @@ var init_schemas = __esm({
|
|
|
6548
6548
|
def.pattern ?? (def.pattern = base64url);
|
|
6549
6549
|
$ZodStringFormat.init(inst, def);
|
|
6550
6550
|
inst._zod.bag.contentEncoding = "base64url";
|
|
6551
|
-
inst._zod.check = (
|
|
6552
|
-
if (isValidBase64URL(
|
|
6551
|
+
inst._zod.check = (payload2) => {
|
|
6552
|
+
if (isValidBase64URL(payload2.value))
|
|
6553
6553
|
return;
|
|
6554
|
-
|
|
6554
|
+
payload2.issues.push({
|
|
6555
6555
|
code: "invalid_format",
|
|
6556
6556
|
format: "base64url",
|
|
6557
|
-
input:
|
|
6557
|
+
input: payload2.value,
|
|
6558
6558
|
inst,
|
|
6559
6559
|
continue: !def.abort
|
|
6560
6560
|
});
|
|
@@ -6566,13 +6566,13 @@ var init_schemas = __esm({
|
|
|
6566
6566
|
});
|
|
6567
6567
|
$ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
6568
6568
|
$ZodStringFormat.init(inst, def);
|
|
6569
|
-
inst._zod.check = (
|
|
6570
|
-
if (isValidJWT2(
|
|
6569
|
+
inst._zod.check = (payload2) => {
|
|
6570
|
+
if (isValidJWT2(payload2.value, def.alg))
|
|
6571
6571
|
return;
|
|
6572
|
-
|
|
6572
|
+
payload2.issues.push({
|
|
6573
6573
|
code: "invalid_format",
|
|
6574
6574
|
format: "jwt",
|
|
6575
|
-
input:
|
|
6575
|
+
input: payload2.value,
|
|
6576
6576
|
inst,
|
|
6577
6577
|
continue: !def.abort
|
|
6578
6578
|
});
|
|
@@ -6580,13 +6580,13 @@ var init_schemas = __esm({
|
|
|
6580
6580
|
});
|
|
6581
6581
|
$ZodCustomStringFormat = /* @__PURE__ */ $constructor("$ZodCustomStringFormat", (inst, def) => {
|
|
6582
6582
|
$ZodStringFormat.init(inst, def);
|
|
6583
|
-
inst._zod.check = (
|
|
6584
|
-
if (def.fn(
|
|
6583
|
+
inst._zod.check = (payload2) => {
|
|
6584
|
+
if (def.fn(payload2.value))
|
|
6585
6585
|
return;
|
|
6586
|
-
|
|
6586
|
+
payload2.issues.push({
|
|
6587
6587
|
code: "invalid_format",
|
|
6588
6588
|
format: def.format,
|
|
6589
|
-
input:
|
|
6589
|
+
input: payload2.value,
|
|
6590
6590
|
inst,
|
|
6591
6591
|
continue: !def.abort
|
|
6592
6592
|
});
|
|
@@ -6595,25 +6595,25 @@ var init_schemas = __esm({
|
|
|
6595
6595
|
$ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
6596
6596
|
$ZodType.init(inst, def);
|
|
6597
6597
|
inst._zod.pattern = inst._zod.bag.pattern ?? number;
|
|
6598
|
-
inst._zod.parse = (
|
|
6598
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
6599
6599
|
if (def.coerce)
|
|
6600
6600
|
try {
|
|
6601
|
-
|
|
6601
|
+
payload2.value = Number(payload2.value);
|
|
6602
6602
|
} catch (_) {
|
|
6603
6603
|
}
|
|
6604
|
-
const input =
|
|
6604
|
+
const input = payload2.value;
|
|
6605
6605
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
|
|
6606
|
-
return
|
|
6606
|
+
return payload2;
|
|
6607
6607
|
}
|
|
6608
6608
|
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
|
|
6609
|
-
|
|
6609
|
+
payload2.issues.push({
|
|
6610
6610
|
expected: "number",
|
|
6611
6611
|
code: "invalid_type",
|
|
6612
6612
|
input,
|
|
6613
6613
|
inst,
|
|
6614
6614
|
...received ? { received } : {}
|
|
6615
6615
|
});
|
|
6616
|
-
return
|
|
6616
|
+
return payload2;
|
|
6617
6617
|
};
|
|
6618
6618
|
});
|
|
6619
6619
|
$ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
@@ -6623,42 +6623,42 @@ var init_schemas = __esm({
|
|
|
6623
6623
|
$ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
6624
6624
|
$ZodType.init(inst, def);
|
|
6625
6625
|
inst._zod.pattern = boolean;
|
|
6626
|
-
inst._zod.parse = (
|
|
6626
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
6627
6627
|
if (def.coerce)
|
|
6628
6628
|
try {
|
|
6629
|
-
|
|
6629
|
+
payload2.value = Boolean(payload2.value);
|
|
6630
6630
|
} catch (_) {
|
|
6631
6631
|
}
|
|
6632
|
-
const input =
|
|
6632
|
+
const input = payload2.value;
|
|
6633
6633
|
if (typeof input === "boolean")
|
|
6634
|
-
return
|
|
6635
|
-
|
|
6634
|
+
return payload2;
|
|
6635
|
+
payload2.issues.push({
|
|
6636
6636
|
expected: "boolean",
|
|
6637
6637
|
code: "invalid_type",
|
|
6638
6638
|
input,
|
|
6639
6639
|
inst
|
|
6640
6640
|
});
|
|
6641
|
-
return
|
|
6641
|
+
return payload2;
|
|
6642
6642
|
};
|
|
6643
6643
|
});
|
|
6644
6644
|
$ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
|
|
6645
6645
|
$ZodType.init(inst, def);
|
|
6646
6646
|
inst._zod.pattern = bigint;
|
|
6647
|
-
inst._zod.parse = (
|
|
6647
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
6648
6648
|
if (def.coerce)
|
|
6649
6649
|
try {
|
|
6650
|
-
|
|
6650
|
+
payload2.value = BigInt(payload2.value);
|
|
6651
6651
|
} catch (_) {
|
|
6652
6652
|
}
|
|
6653
|
-
if (typeof
|
|
6654
|
-
return
|
|
6655
|
-
|
|
6653
|
+
if (typeof payload2.value === "bigint")
|
|
6654
|
+
return payload2;
|
|
6655
|
+
payload2.issues.push({
|
|
6656
6656
|
expected: "bigint",
|
|
6657
6657
|
code: "invalid_type",
|
|
6658
|
-
input:
|
|
6658
|
+
input: payload2.value,
|
|
6659
6659
|
inst
|
|
6660
6660
|
});
|
|
6661
|
-
return
|
|
6661
|
+
return payload2;
|
|
6662
6662
|
};
|
|
6663
6663
|
});
|
|
6664
6664
|
$ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, def) => {
|
|
@@ -6667,126 +6667,126 @@ var init_schemas = __esm({
|
|
|
6667
6667
|
});
|
|
6668
6668
|
$ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
|
|
6669
6669
|
$ZodType.init(inst, def);
|
|
6670
|
-
inst._zod.parse = (
|
|
6671
|
-
const input =
|
|
6670
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
6671
|
+
const input = payload2.value;
|
|
6672
6672
|
if (typeof input === "symbol")
|
|
6673
|
-
return
|
|
6674
|
-
|
|
6673
|
+
return payload2;
|
|
6674
|
+
payload2.issues.push({
|
|
6675
6675
|
expected: "symbol",
|
|
6676
6676
|
code: "invalid_type",
|
|
6677
6677
|
input,
|
|
6678
6678
|
inst
|
|
6679
6679
|
});
|
|
6680
|
-
return
|
|
6680
|
+
return payload2;
|
|
6681
6681
|
};
|
|
6682
6682
|
});
|
|
6683
6683
|
$ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) => {
|
|
6684
6684
|
$ZodType.init(inst, def);
|
|
6685
6685
|
inst._zod.pattern = _undefined;
|
|
6686
6686
|
inst._zod.values = /* @__PURE__ */ new Set([void 0]);
|
|
6687
|
-
inst._zod.parse = (
|
|
6688
|
-
const input =
|
|
6687
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
6688
|
+
const input = payload2.value;
|
|
6689
6689
|
if (typeof input === "undefined")
|
|
6690
|
-
return
|
|
6691
|
-
|
|
6690
|
+
return payload2;
|
|
6691
|
+
payload2.issues.push({
|
|
6692
6692
|
expected: "undefined",
|
|
6693
6693
|
code: "invalid_type",
|
|
6694
6694
|
input,
|
|
6695
6695
|
inst
|
|
6696
6696
|
});
|
|
6697
|
-
return
|
|
6697
|
+
return payload2;
|
|
6698
6698
|
};
|
|
6699
6699
|
});
|
|
6700
6700
|
$ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
|
|
6701
6701
|
$ZodType.init(inst, def);
|
|
6702
6702
|
inst._zod.pattern = _null;
|
|
6703
6703
|
inst._zod.values = /* @__PURE__ */ new Set([null]);
|
|
6704
|
-
inst._zod.parse = (
|
|
6705
|
-
const input =
|
|
6704
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
6705
|
+
const input = payload2.value;
|
|
6706
6706
|
if (input === null)
|
|
6707
|
-
return
|
|
6708
|
-
|
|
6707
|
+
return payload2;
|
|
6708
|
+
payload2.issues.push({
|
|
6709
6709
|
expected: "null",
|
|
6710
6710
|
code: "invalid_type",
|
|
6711
6711
|
input,
|
|
6712
6712
|
inst
|
|
6713
6713
|
});
|
|
6714
|
-
return
|
|
6714
|
+
return payload2;
|
|
6715
6715
|
};
|
|
6716
6716
|
});
|
|
6717
6717
|
$ZodAny = /* @__PURE__ */ $constructor("$ZodAny", (inst, def) => {
|
|
6718
6718
|
$ZodType.init(inst, def);
|
|
6719
|
-
inst._zod.parse = (
|
|
6719
|
+
inst._zod.parse = (payload2) => payload2;
|
|
6720
6720
|
});
|
|
6721
6721
|
$ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
6722
6722
|
$ZodType.init(inst, def);
|
|
6723
|
-
inst._zod.parse = (
|
|
6723
|
+
inst._zod.parse = (payload2) => payload2;
|
|
6724
6724
|
});
|
|
6725
6725
|
$ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
6726
6726
|
$ZodType.init(inst, def);
|
|
6727
|
-
inst._zod.parse = (
|
|
6728
|
-
|
|
6727
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
6728
|
+
payload2.issues.push({
|
|
6729
6729
|
expected: "never",
|
|
6730
6730
|
code: "invalid_type",
|
|
6731
|
-
input:
|
|
6731
|
+
input: payload2.value,
|
|
6732
6732
|
inst
|
|
6733
6733
|
});
|
|
6734
|
-
return
|
|
6734
|
+
return payload2;
|
|
6735
6735
|
};
|
|
6736
6736
|
});
|
|
6737
6737
|
$ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
|
|
6738
6738
|
$ZodType.init(inst, def);
|
|
6739
|
-
inst._zod.parse = (
|
|
6740
|
-
const input =
|
|
6739
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
6740
|
+
const input = payload2.value;
|
|
6741
6741
|
if (typeof input === "undefined")
|
|
6742
|
-
return
|
|
6743
|
-
|
|
6742
|
+
return payload2;
|
|
6743
|
+
payload2.issues.push({
|
|
6744
6744
|
expected: "void",
|
|
6745
6745
|
code: "invalid_type",
|
|
6746
6746
|
input,
|
|
6747
6747
|
inst
|
|
6748
6748
|
});
|
|
6749
|
-
return
|
|
6749
|
+
return payload2;
|
|
6750
6750
|
};
|
|
6751
6751
|
});
|
|
6752
6752
|
$ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
6753
6753
|
$ZodType.init(inst, def);
|
|
6754
|
-
inst._zod.parse = (
|
|
6754
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
6755
6755
|
if (def.coerce) {
|
|
6756
6756
|
try {
|
|
6757
|
-
|
|
6757
|
+
payload2.value = new Date(payload2.value);
|
|
6758
6758
|
} catch (_err) {
|
|
6759
6759
|
}
|
|
6760
6760
|
}
|
|
6761
|
-
const input =
|
|
6761
|
+
const input = payload2.value;
|
|
6762
6762
|
const isDate = input instanceof Date;
|
|
6763
6763
|
const isValidDate = isDate && !Number.isNaN(input.getTime());
|
|
6764
6764
|
if (isValidDate)
|
|
6765
|
-
return
|
|
6766
|
-
|
|
6765
|
+
return payload2;
|
|
6766
|
+
payload2.issues.push({
|
|
6767
6767
|
expected: "date",
|
|
6768
6768
|
code: "invalid_type",
|
|
6769
6769
|
input,
|
|
6770
6770
|
...isDate ? { received: "Invalid Date" } : {},
|
|
6771
6771
|
inst
|
|
6772
6772
|
});
|
|
6773
|
-
return
|
|
6773
|
+
return payload2;
|
|
6774
6774
|
};
|
|
6775
6775
|
});
|
|
6776
6776
|
$ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
6777
6777
|
$ZodType.init(inst, def);
|
|
6778
|
-
inst._zod.parse = (
|
|
6779
|
-
const input =
|
|
6778
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
6779
|
+
const input = payload2.value;
|
|
6780
6780
|
if (!Array.isArray(input)) {
|
|
6781
|
-
|
|
6781
|
+
payload2.issues.push({
|
|
6782
6782
|
expected: "array",
|
|
6783
6783
|
code: "invalid_type",
|
|
6784
6784
|
input,
|
|
6785
6785
|
inst
|
|
6786
6786
|
});
|
|
6787
|
-
return
|
|
6787
|
+
return payload2;
|
|
6788
6788
|
}
|
|
6789
|
-
|
|
6789
|
+
payload2.value = Array(input.length);
|
|
6790
6790
|
const proms = [];
|
|
6791
6791
|
for (let i = 0; i < input.length; i++) {
|
|
6792
6792
|
const item = input[i];
|
|
@@ -6795,15 +6795,15 @@ var init_schemas = __esm({
|
|
|
6795
6795
|
issues: []
|
|
6796
6796
|
}, ctx);
|
|
6797
6797
|
if (result instanceof Promise) {
|
|
6798
|
-
proms.push(result.then((result2) => handleArrayResult(result2,
|
|
6798
|
+
proms.push(result.then((result2) => handleArrayResult(result2, payload2, i)));
|
|
6799
6799
|
} else {
|
|
6800
|
-
handleArrayResult(result,
|
|
6800
|
+
handleArrayResult(result, payload2, i);
|
|
6801
6801
|
}
|
|
6802
6802
|
}
|
|
6803
6803
|
if (proms.length) {
|
|
6804
|
-
return Promise.all(proms).then(() =>
|
|
6804
|
+
return Promise.all(proms).then(() => payload2);
|
|
6805
6805
|
}
|
|
6806
|
-
return
|
|
6806
|
+
return payload2;
|
|
6807
6807
|
};
|
|
6808
6808
|
});
|
|
6809
6809
|
$ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
@@ -6838,19 +6838,19 @@ var init_schemas = __esm({
|
|
|
6838
6838
|
const isObject2 = isObject;
|
|
6839
6839
|
const catchall = def.catchall;
|
|
6840
6840
|
let value;
|
|
6841
|
-
inst._zod.parse = (
|
|
6841
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
6842
6842
|
value ?? (value = _normalized.value);
|
|
6843
|
-
const input =
|
|
6843
|
+
const input = payload2.value;
|
|
6844
6844
|
if (!isObject2(input)) {
|
|
6845
|
-
|
|
6845
|
+
payload2.issues.push({
|
|
6846
6846
|
expected: "object",
|
|
6847
6847
|
code: "invalid_type",
|
|
6848
6848
|
input,
|
|
6849
6849
|
inst
|
|
6850
6850
|
});
|
|
6851
|
-
return
|
|
6851
|
+
return payload2;
|
|
6852
6852
|
}
|
|
6853
|
-
|
|
6853
|
+
payload2.value = {};
|
|
6854
6854
|
const proms = [];
|
|
6855
6855
|
const shape = value.shape;
|
|
6856
6856
|
for (const key of value.keys) {
|
|
@@ -6859,15 +6859,15 @@ var init_schemas = __esm({
|
|
|
6859
6859
|
const isOptionalOut = el._zod.optout === "optional";
|
|
6860
6860
|
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
6861
6861
|
if (r instanceof Promise) {
|
|
6862
|
-
proms.push(r.then((r2) => handlePropertyResult(r2,
|
|
6862
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload2, key, input, isOptionalIn, isOptionalOut)));
|
|
6863
6863
|
} else {
|
|
6864
|
-
handlePropertyResult(r,
|
|
6864
|
+
handlePropertyResult(r, payload2, key, input, isOptionalIn, isOptionalOut);
|
|
6865
6865
|
}
|
|
6866
6866
|
}
|
|
6867
6867
|
if (!catchall) {
|
|
6868
|
-
return proms.length ? Promise.all(proms).then(() =>
|
|
6868
|
+
return proms.length ? Promise.all(proms).then(() => payload2) : payload2;
|
|
6869
6869
|
}
|
|
6870
|
-
return handleCatchall(proms, input,
|
|
6870
|
+
return handleCatchall(proms, input, payload2, ctx, _normalized.value, inst);
|
|
6871
6871
|
};
|
|
6872
6872
|
});
|
|
6873
6873
|
$ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -6965,7 +6965,7 @@ var init_schemas = __esm({
|
|
|
6965
6965
|
doc.write(`payload.value = newResult;`);
|
|
6966
6966
|
doc.write(`return payload;`);
|
|
6967
6967
|
const fn = doc.compile();
|
|
6968
|
-
return (
|
|
6968
|
+
return (payload2, ctx) => fn(shape, payload2, ctx);
|
|
6969
6969
|
};
|
|
6970
6970
|
let fastpass;
|
|
6971
6971
|
const isObject2 = isObject;
|
|
@@ -6974,27 +6974,27 @@ var init_schemas = __esm({
|
|
|
6974
6974
|
const fastEnabled = jit && allowsEval2.value;
|
|
6975
6975
|
const catchall = def.catchall;
|
|
6976
6976
|
let value;
|
|
6977
|
-
inst._zod.parse = (
|
|
6977
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
6978
6978
|
value ?? (value = _normalized.value);
|
|
6979
|
-
const input =
|
|
6979
|
+
const input = payload2.value;
|
|
6980
6980
|
if (!isObject2(input)) {
|
|
6981
|
-
|
|
6981
|
+
payload2.issues.push({
|
|
6982
6982
|
expected: "object",
|
|
6983
6983
|
code: "invalid_type",
|
|
6984
6984
|
input,
|
|
6985
6985
|
inst
|
|
6986
6986
|
});
|
|
6987
|
-
return
|
|
6987
|
+
return payload2;
|
|
6988
6988
|
}
|
|
6989
6989
|
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
6990
6990
|
if (!fastpass)
|
|
6991
6991
|
fastpass = generateFastpass(def.shape);
|
|
6992
|
-
|
|
6992
|
+
payload2 = fastpass(payload2, ctx);
|
|
6993
6993
|
if (!catchall)
|
|
6994
|
-
return
|
|
6995
|
-
return handleCatchall([], input,
|
|
6994
|
+
return payload2;
|
|
6995
|
+
return handleCatchall([], input, payload2, ctx, value, inst);
|
|
6996
6996
|
}
|
|
6997
|
-
return superParse(
|
|
6997
|
+
return superParse(payload2, ctx);
|
|
6998
6998
|
};
|
|
6999
6999
|
});
|
|
7000
7000
|
$ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
@@ -7015,15 +7015,15 @@ var init_schemas = __esm({
|
|
|
7015
7015
|
return void 0;
|
|
7016
7016
|
});
|
|
7017
7017
|
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
|
|
7018
|
-
inst._zod.parse = (
|
|
7018
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7019
7019
|
if (first) {
|
|
7020
|
-
return first(
|
|
7020
|
+
return first(payload2, ctx);
|
|
7021
7021
|
}
|
|
7022
7022
|
let async = false;
|
|
7023
7023
|
const results = [];
|
|
7024
7024
|
for (const option of def.options) {
|
|
7025
7025
|
const result = option._zod.run({
|
|
7026
|
-
value:
|
|
7026
|
+
value: payload2.value,
|
|
7027
7027
|
issues: []
|
|
7028
7028
|
}, ctx);
|
|
7029
7029
|
if (result instanceof Promise) {
|
|
@@ -7036,9 +7036,9 @@ var init_schemas = __esm({
|
|
|
7036
7036
|
}
|
|
7037
7037
|
}
|
|
7038
7038
|
if (!async)
|
|
7039
|
-
return handleUnionResults(results,
|
|
7039
|
+
return handleUnionResults(results, payload2, inst, ctx);
|
|
7040
7040
|
return Promise.all(results).then((results2) => {
|
|
7041
|
-
return handleUnionResults(results2,
|
|
7041
|
+
return handleUnionResults(results2, payload2, inst, ctx);
|
|
7042
7042
|
});
|
|
7043
7043
|
};
|
|
7044
7044
|
});
|
|
@@ -7046,15 +7046,15 @@ var init_schemas = __esm({
|
|
|
7046
7046
|
$ZodUnion.init(inst, def);
|
|
7047
7047
|
def.inclusive = false;
|
|
7048
7048
|
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
|
|
7049
|
-
inst._zod.parse = (
|
|
7049
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7050
7050
|
if (first) {
|
|
7051
|
-
return first(
|
|
7051
|
+
return first(payload2, ctx);
|
|
7052
7052
|
}
|
|
7053
7053
|
let async = false;
|
|
7054
7054
|
const results = [];
|
|
7055
7055
|
for (const option of def.options) {
|
|
7056
7056
|
const result = option._zod.run({
|
|
7057
|
-
value:
|
|
7057
|
+
value: payload2.value,
|
|
7058
7058
|
issues: []
|
|
7059
7059
|
}, ctx);
|
|
7060
7060
|
if (result instanceof Promise) {
|
|
@@ -7065,9 +7065,9 @@ var init_schemas = __esm({
|
|
|
7065
7065
|
}
|
|
7066
7066
|
}
|
|
7067
7067
|
if (!async)
|
|
7068
|
-
return handleExclusiveUnionResults(results,
|
|
7068
|
+
return handleExclusiveUnionResults(results, payload2, inst, ctx);
|
|
7069
7069
|
return Promise.all(results).then((results2) => {
|
|
7070
|
-
return handleExclusiveUnionResults(results2,
|
|
7070
|
+
return handleExclusiveUnionResults(results2, payload2, inst, ctx);
|
|
7071
7071
|
});
|
|
7072
7072
|
};
|
|
7073
7073
|
});
|
|
@@ -7107,25 +7107,25 @@ var init_schemas = __esm({
|
|
|
7107
7107
|
}
|
|
7108
7108
|
return map2;
|
|
7109
7109
|
});
|
|
7110
|
-
inst._zod.parse = (
|
|
7111
|
-
const input =
|
|
7110
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7111
|
+
const input = payload2.value;
|
|
7112
7112
|
if (!isObject(input)) {
|
|
7113
|
-
|
|
7113
|
+
payload2.issues.push({
|
|
7114
7114
|
code: "invalid_type",
|
|
7115
7115
|
expected: "object",
|
|
7116
7116
|
input,
|
|
7117
7117
|
inst
|
|
7118
7118
|
});
|
|
7119
|
-
return
|
|
7119
|
+
return payload2;
|
|
7120
7120
|
}
|
|
7121
7121
|
const opt = disc.value.get(input?.[def.discriminator]);
|
|
7122
7122
|
if (opt) {
|
|
7123
|
-
return opt._zod.run(
|
|
7123
|
+
return opt._zod.run(payload2, ctx);
|
|
7124
7124
|
}
|
|
7125
7125
|
if (def.unionFallback || ctx.direction === "backward") {
|
|
7126
|
-
return _super(
|
|
7126
|
+
return _super(payload2, ctx);
|
|
7127
7127
|
}
|
|
7128
|
-
|
|
7128
|
+
payload2.issues.push({
|
|
7129
7129
|
code: "invalid_union",
|
|
7130
7130
|
errors: [],
|
|
7131
7131
|
note: "No matching discriminator",
|
|
@@ -7135,45 +7135,45 @@ var init_schemas = __esm({
|
|
|
7135
7135
|
path: [def.discriminator],
|
|
7136
7136
|
inst
|
|
7137
7137
|
});
|
|
7138
|
-
return
|
|
7138
|
+
return payload2;
|
|
7139
7139
|
};
|
|
7140
7140
|
});
|
|
7141
7141
|
$ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
7142
7142
|
$ZodType.init(inst, def);
|
|
7143
|
-
inst._zod.parse = (
|
|
7144
|
-
const input =
|
|
7143
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7144
|
+
const input = payload2.value;
|
|
7145
7145
|
const left = def.left._zod.run({ value: input, issues: [] }, ctx);
|
|
7146
7146
|
const right = def.right._zod.run({ value: input, issues: [] }, ctx);
|
|
7147
7147
|
const async = left instanceof Promise || right instanceof Promise;
|
|
7148
7148
|
if (async) {
|
|
7149
7149
|
return Promise.all([left, right]).then(([left2, right2]) => {
|
|
7150
|
-
return handleIntersectionResults(
|
|
7150
|
+
return handleIntersectionResults(payload2, left2, right2);
|
|
7151
7151
|
});
|
|
7152
7152
|
}
|
|
7153
|
-
return handleIntersectionResults(
|
|
7153
|
+
return handleIntersectionResults(payload2, left, right);
|
|
7154
7154
|
};
|
|
7155
7155
|
});
|
|
7156
7156
|
$ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
7157
7157
|
$ZodType.init(inst, def);
|
|
7158
7158
|
const items = def.items;
|
|
7159
|
-
inst._zod.parse = (
|
|
7160
|
-
const input =
|
|
7159
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7160
|
+
const input = payload2.value;
|
|
7161
7161
|
if (!Array.isArray(input)) {
|
|
7162
|
-
|
|
7162
|
+
payload2.issues.push({
|
|
7163
7163
|
input,
|
|
7164
7164
|
inst,
|
|
7165
7165
|
expected: "tuple",
|
|
7166
7166
|
code: "invalid_type"
|
|
7167
7167
|
});
|
|
7168
|
-
return
|
|
7168
|
+
return payload2;
|
|
7169
7169
|
}
|
|
7170
|
-
|
|
7170
|
+
payload2.value = [];
|
|
7171
7171
|
const proms = [];
|
|
7172
7172
|
const optinStart = getTupleOptStart(items, "optin");
|
|
7173
7173
|
const optoutStart = getTupleOptStart(items, "optout");
|
|
7174
7174
|
if (!def.rest) {
|
|
7175
7175
|
if (input.length < optinStart) {
|
|
7176
|
-
|
|
7176
|
+
payload2.issues.push({
|
|
7177
7177
|
code: "too_small",
|
|
7178
7178
|
minimum: optinStart,
|
|
7179
7179
|
inclusive: true,
|
|
@@ -7181,10 +7181,10 @@ var init_schemas = __esm({
|
|
|
7181
7181
|
inst,
|
|
7182
7182
|
origin: "array"
|
|
7183
7183
|
});
|
|
7184
|
-
return
|
|
7184
|
+
return payload2;
|
|
7185
7185
|
}
|
|
7186
7186
|
if (input.length > items.length) {
|
|
7187
|
-
|
|
7187
|
+
payload2.issues.push({
|
|
7188
7188
|
code: "too_big",
|
|
7189
7189
|
maximum: items.length,
|
|
7190
7190
|
inclusive: true,
|
|
@@ -7212,35 +7212,35 @@ var init_schemas = __esm({
|
|
|
7212
7212
|
i++;
|
|
7213
7213
|
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
7214
7214
|
if (result instanceof Promise) {
|
|
7215
|
-
proms.push(result.then((r) => handleTupleResult(r,
|
|
7215
|
+
proms.push(result.then((r) => handleTupleResult(r, payload2, i)));
|
|
7216
7216
|
} else {
|
|
7217
|
-
handleTupleResult(result,
|
|
7217
|
+
handleTupleResult(result, payload2, i);
|
|
7218
7218
|
}
|
|
7219
7219
|
}
|
|
7220
7220
|
}
|
|
7221
7221
|
if (proms.length) {
|
|
7222
|
-
return Promise.all(proms).then(() => handleTupleResults(itemResults,
|
|
7222
|
+
return Promise.all(proms).then(() => handleTupleResults(itemResults, payload2, items, input, optoutStart));
|
|
7223
7223
|
}
|
|
7224
|
-
return handleTupleResults(itemResults,
|
|
7224
|
+
return handleTupleResults(itemResults, payload2, items, input, optoutStart);
|
|
7225
7225
|
};
|
|
7226
7226
|
});
|
|
7227
7227
|
$ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
7228
7228
|
$ZodType.init(inst, def);
|
|
7229
|
-
inst._zod.parse = (
|
|
7230
|
-
const input =
|
|
7229
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7230
|
+
const input = payload2.value;
|
|
7231
7231
|
if (!isPlainObject(input)) {
|
|
7232
|
-
|
|
7232
|
+
payload2.issues.push({
|
|
7233
7233
|
expected: "record",
|
|
7234
7234
|
code: "invalid_type",
|
|
7235
7235
|
input,
|
|
7236
7236
|
inst
|
|
7237
7237
|
});
|
|
7238
|
-
return
|
|
7238
|
+
return payload2;
|
|
7239
7239
|
}
|
|
7240
7240
|
const proms = [];
|
|
7241
7241
|
const values = def.keyType._zod.values;
|
|
7242
7242
|
if (values) {
|
|
7243
|
-
|
|
7243
|
+
payload2.value = {};
|
|
7244
7244
|
const recordKeys = /* @__PURE__ */ new Set();
|
|
7245
7245
|
for (const key of values) {
|
|
7246
7246
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
@@ -7250,7 +7250,7 @@ var init_schemas = __esm({
|
|
|
7250
7250
|
throw new Error("Async schemas not supported in object keys currently");
|
|
7251
7251
|
}
|
|
7252
7252
|
if (keyResult.issues.length) {
|
|
7253
|
-
|
|
7253
|
+
payload2.issues.push({
|
|
7254
7254
|
code: "invalid_key",
|
|
7255
7255
|
origin: "record",
|
|
7256
7256
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
@@ -7265,15 +7265,15 @@ var init_schemas = __esm({
|
|
|
7265
7265
|
if (result instanceof Promise) {
|
|
7266
7266
|
proms.push(result.then((result2) => {
|
|
7267
7267
|
if (result2.issues.length) {
|
|
7268
|
-
|
|
7268
|
+
payload2.issues.push(...prefixIssues(key, result2.issues));
|
|
7269
7269
|
}
|
|
7270
|
-
|
|
7270
|
+
payload2.value[outKey] = result2.value;
|
|
7271
7271
|
}));
|
|
7272
7272
|
} else {
|
|
7273
7273
|
if (result.issues.length) {
|
|
7274
|
-
|
|
7274
|
+
payload2.issues.push(...prefixIssues(key, result.issues));
|
|
7275
7275
|
}
|
|
7276
|
-
|
|
7276
|
+
payload2.value[outKey] = result.value;
|
|
7277
7277
|
}
|
|
7278
7278
|
}
|
|
7279
7279
|
}
|
|
@@ -7285,7 +7285,7 @@ var init_schemas = __esm({
|
|
|
7285
7285
|
}
|
|
7286
7286
|
}
|
|
7287
7287
|
if (unrecognized && unrecognized.length > 0) {
|
|
7288
|
-
|
|
7288
|
+
payload2.issues.push({
|
|
7289
7289
|
code: "unrecognized_keys",
|
|
7290
7290
|
input,
|
|
7291
7291
|
inst,
|
|
@@ -7293,7 +7293,7 @@ var init_schemas = __esm({
|
|
|
7293
7293
|
});
|
|
7294
7294
|
}
|
|
7295
7295
|
} else {
|
|
7296
|
-
|
|
7296
|
+
payload2.value = {};
|
|
7297
7297
|
for (const key of Reflect.ownKeys(input)) {
|
|
7298
7298
|
if (key === "__proto__")
|
|
7299
7299
|
continue;
|
|
@@ -7315,9 +7315,9 @@ var init_schemas = __esm({
|
|
|
7315
7315
|
}
|
|
7316
7316
|
if (keyResult.issues.length) {
|
|
7317
7317
|
if (def.mode === "loose") {
|
|
7318
|
-
|
|
7318
|
+
payload2.value[key] = input[key];
|
|
7319
7319
|
} else {
|
|
7320
|
-
|
|
7320
|
+
payload2.issues.push({
|
|
7321
7321
|
code: "invalid_key",
|
|
7322
7322
|
origin: "record",
|
|
7323
7323
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
@@ -7332,80 +7332,80 @@ var init_schemas = __esm({
|
|
|
7332
7332
|
if (result instanceof Promise) {
|
|
7333
7333
|
proms.push(result.then((result2) => {
|
|
7334
7334
|
if (result2.issues.length) {
|
|
7335
|
-
|
|
7335
|
+
payload2.issues.push(...prefixIssues(key, result2.issues));
|
|
7336
7336
|
}
|
|
7337
|
-
|
|
7337
|
+
payload2.value[keyResult.value] = result2.value;
|
|
7338
7338
|
}));
|
|
7339
7339
|
} else {
|
|
7340
7340
|
if (result.issues.length) {
|
|
7341
|
-
|
|
7341
|
+
payload2.issues.push(...prefixIssues(key, result.issues));
|
|
7342
7342
|
}
|
|
7343
|
-
|
|
7343
|
+
payload2.value[keyResult.value] = result.value;
|
|
7344
7344
|
}
|
|
7345
7345
|
}
|
|
7346
7346
|
}
|
|
7347
7347
|
if (proms.length) {
|
|
7348
|
-
return Promise.all(proms).then(() =>
|
|
7348
|
+
return Promise.all(proms).then(() => payload2);
|
|
7349
7349
|
}
|
|
7350
|
-
return
|
|
7350
|
+
return payload2;
|
|
7351
7351
|
};
|
|
7352
7352
|
});
|
|
7353
7353
|
$ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
7354
7354
|
$ZodType.init(inst, def);
|
|
7355
|
-
inst._zod.parse = (
|
|
7356
|
-
const input =
|
|
7355
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7356
|
+
const input = payload2.value;
|
|
7357
7357
|
if (!(input instanceof Map)) {
|
|
7358
|
-
|
|
7358
|
+
payload2.issues.push({
|
|
7359
7359
|
expected: "map",
|
|
7360
7360
|
code: "invalid_type",
|
|
7361
7361
|
input,
|
|
7362
7362
|
inst
|
|
7363
7363
|
});
|
|
7364
|
-
return
|
|
7364
|
+
return payload2;
|
|
7365
7365
|
}
|
|
7366
7366
|
const proms = [];
|
|
7367
|
-
|
|
7367
|
+
payload2.value = /* @__PURE__ */ new Map();
|
|
7368
7368
|
for (const [key, value] of input) {
|
|
7369
7369
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
7370
7370
|
const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
|
|
7371
7371
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
7372
7372
|
proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
|
|
7373
|
-
handleMapResult(keyResult2, valueResult2,
|
|
7373
|
+
handleMapResult(keyResult2, valueResult2, payload2, key, input, inst, ctx);
|
|
7374
7374
|
}));
|
|
7375
7375
|
} else {
|
|
7376
|
-
handleMapResult(keyResult, valueResult,
|
|
7376
|
+
handleMapResult(keyResult, valueResult, payload2, key, input, inst, ctx);
|
|
7377
7377
|
}
|
|
7378
7378
|
}
|
|
7379
7379
|
if (proms.length)
|
|
7380
|
-
return Promise.all(proms).then(() =>
|
|
7381
|
-
return
|
|
7380
|
+
return Promise.all(proms).then(() => payload2);
|
|
7381
|
+
return payload2;
|
|
7382
7382
|
};
|
|
7383
7383
|
});
|
|
7384
7384
|
$ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
7385
7385
|
$ZodType.init(inst, def);
|
|
7386
|
-
inst._zod.parse = (
|
|
7387
|
-
const input =
|
|
7386
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7387
|
+
const input = payload2.value;
|
|
7388
7388
|
if (!(input instanceof Set)) {
|
|
7389
|
-
|
|
7389
|
+
payload2.issues.push({
|
|
7390
7390
|
input,
|
|
7391
7391
|
inst,
|
|
7392
7392
|
expected: "set",
|
|
7393
7393
|
code: "invalid_type"
|
|
7394
7394
|
});
|
|
7395
|
-
return
|
|
7395
|
+
return payload2;
|
|
7396
7396
|
}
|
|
7397
7397
|
const proms = [];
|
|
7398
|
-
|
|
7398
|
+
payload2.value = /* @__PURE__ */ new Set();
|
|
7399
7399
|
for (const item of input) {
|
|
7400
7400
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
7401
7401
|
if (result instanceof Promise) {
|
|
7402
|
-
proms.push(result.then((result2) => handleSetResult(result2,
|
|
7402
|
+
proms.push(result.then((result2) => handleSetResult(result2, payload2)));
|
|
7403
7403
|
} else
|
|
7404
|
-
handleSetResult(result,
|
|
7404
|
+
handleSetResult(result, payload2);
|
|
7405
7405
|
}
|
|
7406
7406
|
if (proms.length)
|
|
7407
|
-
return Promise.all(proms).then(() =>
|
|
7408
|
-
return
|
|
7407
|
+
return Promise.all(proms).then(() => payload2);
|
|
7408
|
+
return payload2;
|
|
7409
7409
|
};
|
|
7410
7410
|
});
|
|
7411
7411
|
$ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
@@ -7414,18 +7414,18 @@ var init_schemas = __esm({
|
|
|
7414
7414
|
const valuesSet = new Set(values);
|
|
7415
7415
|
inst._zod.values = valuesSet;
|
|
7416
7416
|
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
7417
|
-
inst._zod.parse = (
|
|
7418
|
-
const input =
|
|
7417
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
7418
|
+
const input = payload2.value;
|
|
7419
7419
|
if (valuesSet.has(input)) {
|
|
7420
|
-
return
|
|
7420
|
+
return payload2;
|
|
7421
7421
|
}
|
|
7422
|
-
|
|
7422
|
+
payload2.issues.push({
|
|
7423
7423
|
code: "invalid_value",
|
|
7424
7424
|
values,
|
|
7425
7425
|
input,
|
|
7426
7426
|
inst
|
|
7427
7427
|
});
|
|
7428
|
-
return
|
|
7428
|
+
return payload2;
|
|
7429
7429
|
};
|
|
7430
7430
|
});
|
|
7431
7431
|
$ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
@@ -7436,57 +7436,57 @@ var init_schemas = __esm({
|
|
|
7436
7436
|
const values = new Set(def.values);
|
|
7437
7437
|
inst._zod.values = values;
|
|
7438
7438
|
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
7439
|
-
inst._zod.parse = (
|
|
7440
|
-
const input =
|
|
7439
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
7440
|
+
const input = payload2.value;
|
|
7441
7441
|
if (values.has(input)) {
|
|
7442
|
-
return
|
|
7442
|
+
return payload2;
|
|
7443
7443
|
}
|
|
7444
|
-
|
|
7444
|
+
payload2.issues.push({
|
|
7445
7445
|
code: "invalid_value",
|
|
7446
7446
|
values: def.values,
|
|
7447
7447
|
input,
|
|
7448
7448
|
inst
|
|
7449
7449
|
});
|
|
7450
|
-
return
|
|
7450
|
+
return payload2;
|
|
7451
7451
|
};
|
|
7452
7452
|
});
|
|
7453
7453
|
$ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
|
|
7454
7454
|
$ZodType.init(inst, def);
|
|
7455
|
-
inst._zod.parse = (
|
|
7456
|
-
const input =
|
|
7455
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
7456
|
+
const input = payload2.value;
|
|
7457
7457
|
if (input instanceof File)
|
|
7458
|
-
return
|
|
7459
|
-
|
|
7458
|
+
return payload2;
|
|
7459
|
+
payload2.issues.push({
|
|
7460
7460
|
expected: "file",
|
|
7461
7461
|
code: "invalid_type",
|
|
7462
7462
|
input,
|
|
7463
7463
|
inst
|
|
7464
7464
|
});
|
|
7465
|
-
return
|
|
7465
|
+
return payload2;
|
|
7466
7466
|
};
|
|
7467
7467
|
});
|
|
7468
7468
|
$ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
7469
7469
|
$ZodType.init(inst, def);
|
|
7470
7470
|
inst._zod.optin = "optional";
|
|
7471
|
-
inst._zod.parse = (
|
|
7471
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7472
7472
|
if (ctx.direction === "backward") {
|
|
7473
7473
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
7474
7474
|
}
|
|
7475
|
-
const _out = def.transform(
|
|
7475
|
+
const _out = def.transform(payload2.value, payload2);
|
|
7476
7476
|
if (ctx.async) {
|
|
7477
7477
|
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
7478
7478
|
return output.then((output2) => {
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
return
|
|
7479
|
+
payload2.value = output2;
|
|
7480
|
+
payload2.fallback = true;
|
|
7481
|
+
return payload2;
|
|
7482
7482
|
});
|
|
7483
7483
|
}
|
|
7484
7484
|
if (_out instanceof Promise) {
|
|
7485
7485
|
throw new $ZodAsyncError();
|
|
7486
7486
|
}
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
return
|
|
7487
|
+
payload2.value = _out;
|
|
7488
|
+
payload2.fallback = true;
|
|
7489
|
+
return payload2;
|
|
7490
7490
|
};
|
|
7491
7491
|
});
|
|
7492
7492
|
$ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
@@ -7500,26 +7500,26 @@ var init_schemas = __esm({
|
|
|
7500
7500
|
const pattern = def.innerType._zod.pattern;
|
|
7501
7501
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
7502
7502
|
});
|
|
7503
|
-
inst._zod.parse = (
|
|
7503
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7504
7504
|
if (def.innerType._zod.optin === "optional") {
|
|
7505
|
-
const input =
|
|
7506
|
-
const result = def.innerType._zod.run(
|
|
7505
|
+
const input = payload2.value;
|
|
7506
|
+
const result = def.innerType._zod.run(payload2, ctx);
|
|
7507
7507
|
if (result instanceof Promise)
|
|
7508
7508
|
return result.then((r) => handleOptionalResult(r, input));
|
|
7509
7509
|
return handleOptionalResult(result, input);
|
|
7510
7510
|
}
|
|
7511
|
-
if (
|
|
7512
|
-
return
|
|
7511
|
+
if (payload2.value === void 0) {
|
|
7512
|
+
return payload2;
|
|
7513
7513
|
}
|
|
7514
|
-
return def.innerType._zod.run(
|
|
7514
|
+
return def.innerType._zod.run(payload2, ctx);
|
|
7515
7515
|
};
|
|
7516
7516
|
});
|
|
7517
7517
|
$ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
|
|
7518
7518
|
$ZodOptional.init(inst, def);
|
|
7519
7519
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
7520
7520
|
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
7521
|
-
inst._zod.parse = (
|
|
7522
|
-
return def.innerType._zod.run(
|
|
7521
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7522
|
+
return def.innerType._zod.run(payload2, ctx);
|
|
7523
7523
|
};
|
|
7524
7524
|
});
|
|
7525
7525
|
$ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
@@ -7533,25 +7533,25 @@ var init_schemas = __esm({
|
|
|
7533
7533
|
defineLazy(inst._zod, "values", () => {
|
|
7534
7534
|
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
7535
7535
|
});
|
|
7536
|
-
inst._zod.parse = (
|
|
7537
|
-
if (
|
|
7538
|
-
return
|
|
7539
|
-
return def.innerType._zod.run(
|
|
7536
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7537
|
+
if (payload2.value === null)
|
|
7538
|
+
return payload2;
|
|
7539
|
+
return def.innerType._zod.run(payload2, ctx);
|
|
7540
7540
|
};
|
|
7541
7541
|
});
|
|
7542
7542
|
$ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
7543
7543
|
$ZodType.init(inst, def);
|
|
7544
7544
|
inst._zod.optin = "optional";
|
|
7545
7545
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
7546
|
-
inst._zod.parse = (
|
|
7546
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7547
7547
|
if (ctx.direction === "backward") {
|
|
7548
|
-
return def.innerType._zod.run(
|
|
7548
|
+
return def.innerType._zod.run(payload2, ctx);
|
|
7549
7549
|
}
|
|
7550
|
-
if (
|
|
7551
|
-
|
|
7552
|
-
return
|
|
7550
|
+
if (payload2.value === void 0) {
|
|
7551
|
+
payload2.value = def.defaultValue;
|
|
7552
|
+
return payload2;
|
|
7553
7553
|
}
|
|
7554
|
-
const result = def.innerType._zod.run(
|
|
7554
|
+
const result = def.innerType._zod.run(payload2, ctx);
|
|
7555
7555
|
if (result instanceof Promise) {
|
|
7556
7556
|
return result.then((result2) => handleDefaultResult(result2, def));
|
|
7557
7557
|
}
|
|
@@ -7562,14 +7562,14 @@ var init_schemas = __esm({
|
|
|
7562
7562
|
$ZodType.init(inst, def);
|
|
7563
7563
|
inst._zod.optin = "optional";
|
|
7564
7564
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
7565
|
-
inst._zod.parse = (
|
|
7565
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7566
7566
|
if (ctx.direction === "backward") {
|
|
7567
|
-
return def.innerType._zod.run(
|
|
7567
|
+
return def.innerType._zod.run(payload2, ctx);
|
|
7568
7568
|
}
|
|
7569
|
-
if (
|
|
7570
|
-
|
|
7569
|
+
if (payload2.value === void 0) {
|
|
7570
|
+
payload2.value = def.defaultValue;
|
|
7571
7571
|
}
|
|
7572
|
-
return def.innerType._zod.run(
|
|
7572
|
+
return def.innerType._zod.run(payload2, ctx);
|
|
7573
7573
|
};
|
|
7574
7574
|
});
|
|
7575
7575
|
$ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
@@ -7578,8 +7578,8 @@ var init_schemas = __esm({
|
|
|
7578
7578
|
const v = def.innerType._zod.values;
|
|
7579
7579
|
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
7580
7580
|
});
|
|
7581
|
-
inst._zod.parse = (
|
|
7582
|
-
const result = def.innerType._zod.run(
|
|
7581
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7582
|
+
const result = def.innerType._zod.run(payload2, ctx);
|
|
7583
7583
|
if (result instanceof Promise) {
|
|
7584
7584
|
return result.then((result2) => handleNonOptionalResult(result2, inst));
|
|
7585
7585
|
}
|
|
@@ -7588,19 +7588,19 @@ var init_schemas = __esm({
|
|
|
7588
7588
|
});
|
|
7589
7589
|
$ZodSuccess = /* @__PURE__ */ $constructor("$ZodSuccess", (inst, def) => {
|
|
7590
7590
|
$ZodType.init(inst, def);
|
|
7591
|
-
inst._zod.parse = (
|
|
7591
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7592
7592
|
if (ctx.direction === "backward") {
|
|
7593
7593
|
throw new $ZodEncodeError("ZodSuccess");
|
|
7594
7594
|
}
|
|
7595
|
-
const result = def.innerType._zod.run(
|
|
7595
|
+
const result = def.innerType._zod.run(payload2, ctx);
|
|
7596
7596
|
if (result instanceof Promise) {
|
|
7597
7597
|
return result.then((result2) => {
|
|
7598
|
-
|
|
7599
|
-
return
|
|
7598
|
+
payload2.value = result2.issues.length === 0;
|
|
7599
|
+
return payload2;
|
|
7600
7600
|
});
|
|
7601
7601
|
}
|
|
7602
|
-
|
|
7603
|
-
return
|
|
7602
|
+
payload2.value = result.issues.length === 0;
|
|
7603
|
+
return payload2;
|
|
7604
7604
|
};
|
|
7605
7605
|
});
|
|
7606
7606
|
$ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
@@ -7608,56 +7608,56 @@ var init_schemas = __esm({
|
|
|
7608
7608
|
inst._zod.optin = "optional";
|
|
7609
7609
|
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
7610
7610
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
7611
|
-
inst._zod.parse = (
|
|
7611
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7612
7612
|
if (ctx.direction === "backward") {
|
|
7613
|
-
return def.innerType._zod.run(
|
|
7613
|
+
return def.innerType._zod.run(payload2, ctx);
|
|
7614
7614
|
}
|
|
7615
|
-
const result = def.innerType._zod.run(
|
|
7615
|
+
const result = def.innerType._zod.run(payload2, ctx);
|
|
7616
7616
|
if (result instanceof Promise) {
|
|
7617
7617
|
return result.then((result2) => {
|
|
7618
|
-
|
|
7618
|
+
payload2.value = result2.value;
|
|
7619
7619
|
if (result2.issues.length) {
|
|
7620
|
-
|
|
7621
|
-
...
|
|
7620
|
+
payload2.value = def.catchValue({
|
|
7621
|
+
...payload2,
|
|
7622
7622
|
error: {
|
|
7623
7623
|
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
7624
7624
|
},
|
|
7625
|
-
input:
|
|
7625
|
+
input: payload2.value
|
|
7626
7626
|
});
|
|
7627
|
-
|
|
7628
|
-
|
|
7627
|
+
payload2.issues = [];
|
|
7628
|
+
payload2.fallback = true;
|
|
7629
7629
|
}
|
|
7630
|
-
return
|
|
7630
|
+
return payload2;
|
|
7631
7631
|
});
|
|
7632
7632
|
}
|
|
7633
|
-
|
|
7633
|
+
payload2.value = result.value;
|
|
7634
7634
|
if (result.issues.length) {
|
|
7635
|
-
|
|
7636
|
-
...
|
|
7635
|
+
payload2.value = def.catchValue({
|
|
7636
|
+
...payload2,
|
|
7637
7637
|
error: {
|
|
7638
7638
|
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
7639
7639
|
},
|
|
7640
|
-
input:
|
|
7640
|
+
input: payload2.value
|
|
7641
7641
|
});
|
|
7642
|
-
|
|
7643
|
-
|
|
7642
|
+
payload2.issues = [];
|
|
7643
|
+
payload2.fallback = true;
|
|
7644
7644
|
}
|
|
7645
|
-
return
|
|
7645
|
+
return payload2;
|
|
7646
7646
|
};
|
|
7647
7647
|
});
|
|
7648
7648
|
$ZodNaN = /* @__PURE__ */ $constructor("$ZodNaN", (inst, def) => {
|
|
7649
7649
|
$ZodType.init(inst, def);
|
|
7650
|
-
inst._zod.parse = (
|
|
7651
|
-
if (typeof
|
|
7652
|
-
|
|
7653
|
-
input:
|
|
7650
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
7651
|
+
if (typeof payload2.value !== "number" || !Number.isNaN(payload2.value)) {
|
|
7652
|
+
payload2.issues.push({
|
|
7653
|
+
input: payload2.value,
|
|
7654
7654
|
inst,
|
|
7655
7655
|
expected: "nan",
|
|
7656
7656
|
code: "invalid_type"
|
|
7657
7657
|
});
|
|
7658
|
-
return
|
|
7658
|
+
return payload2;
|
|
7659
7659
|
}
|
|
7660
|
-
return
|
|
7660
|
+
return payload2;
|
|
7661
7661
|
};
|
|
7662
7662
|
});
|
|
7663
7663
|
$ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
@@ -7666,15 +7666,15 @@ var init_schemas = __esm({
|
|
|
7666
7666
|
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
7667
7667
|
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
7668
7668
|
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
7669
|
-
inst._zod.parse = (
|
|
7669
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7670
7670
|
if (ctx.direction === "backward") {
|
|
7671
|
-
const right = def.out._zod.run(
|
|
7671
|
+
const right = def.out._zod.run(payload2, ctx);
|
|
7672
7672
|
if (right instanceof Promise) {
|
|
7673
7673
|
return right.then((right2) => handlePipeResult(right2, def.in, ctx));
|
|
7674
7674
|
}
|
|
7675
7675
|
return handlePipeResult(right, def.in, ctx);
|
|
7676
7676
|
}
|
|
7677
|
-
const left = def.in._zod.run(
|
|
7677
|
+
const left = def.in._zod.run(payload2, ctx);
|
|
7678
7678
|
if (left instanceof Promise) {
|
|
7679
7679
|
return left.then((left2) => handlePipeResult(left2, def.out, ctx));
|
|
7680
7680
|
}
|
|
@@ -7687,16 +7687,16 @@ var init_schemas = __esm({
|
|
|
7687
7687
|
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
7688
7688
|
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
7689
7689
|
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
7690
|
-
inst._zod.parse = (
|
|
7690
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7691
7691
|
const direction = ctx.direction || "forward";
|
|
7692
7692
|
if (direction === "forward") {
|
|
7693
|
-
const left = def.in._zod.run(
|
|
7693
|
+
const left = def.in._zod.run(payload2, ctx);
|
|
7694
7694
|
if (left instanceof Promise) {
|
|
7695
7695
|
return left.then((left2) => handleCodecAResult(left2, def, ctx));
|
|
7696
7696
|
}
|
|
7697
7697
|
return handleCodecAResult(left, def, ctx);
|
|
7698
7698
|
} else {
|
|
7699
|
-
const right = def.out._zod.run(
|
|
7699
|
+
const right = def.out._zod.run(payload2, ctx);
|
|
7700
7700
|
if (right instanceof Promise) {
|
|
7701
7701
|
return right.then((right2) => handleCodecAResult(right2, def, ctx));
|
|
7702
7702
|
}
|
|
@@ -7713,11 +7713,11 @@ var init_schemas = __esm({
|
|
|
7713
7713
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
7714
7714
|
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
7715
7715
|
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
7716
|
-
inst._zod.parse = (
|
|
7716
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7717
7717
|
if (ctx.direction === "backward") {
|
|
7718
|
-
return def.innerType._zod.run(
|
|
7718
|
+
return def.innerType._zod.run(payload2, ctx);
|
|
7719
7719
|
}
|
|
7720
|
-
const result = def.innerType._zod.run(
|
|
7720
|
+
const result = def.innerType._zod.run(payload2, ctx);
|
|
7721
7721
|
if (result instanceof Promise) {
|
|
7722
7722
|
return result.then(handleReadonlyResult);
|
|
7723
7723
|
}
|
|
@@ -7745,28 +7745,28 @@ var init_schemas = __esm({
|
|
|
7745
7745
|
}
|
|
7746
7746
|
}
|
|
7747
7747
|
inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);
|
|
7748
|
-
inst._zod.parse = (
|
|
7749
|
-
if (typeof
|
|
7750
|
-
|
|
7751
|
-
input:
|
|
7748
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
7749
|
+
if (typeof payload2.value !== "string") {
|
|
7750
|
+
payload2.issues.push({
|
|
7751
|
+
input: payload2.value,
|
|
7752
7752
|
inst,
|
|
7753
7753
|
expected: "string",
|
|
7754
7754
|
code: "invalid_type"
|
|
7755
7755
|
});
|
|
7756
|
-
return
|
|
7756
|
+
return payload2;
|
|
7757
7757
|
}
|
|
7758
7758
|
inst._zod.pattern.lastIndex = 0;
|
|
7759
|
-
if (!inst._zod.pattern.test(
|
|
7760
|
-
|
|
7761
|
-
input:
|
|
7759
|
+
if (!inst._zod.pattern.test(payload2.value)) {
|
|
7760
|
+
payload2.issues.push({
|
|
7761
|
+
input: payload2.value,
|
|
7762
7762
|
inst,
|
|
7763
7763
|
code: "invalid_format",
|
|
7764
7764
|
format: def.format ?? "template_literal",
|
|
7765
7765
|
pattern: inst._zod.pattern.source
|
|
7766
7766
|
});
|
|
7767
|
-
return
|
|
7767
|
+
return payload2;
|
|
7768
7768
|
}
|
|
7769
|
-
return
|
|
7769
|
+
return payload2;
|
|
7770
7770
|
};
|
|
7771
7771
|
});
|
|
7772
7772
|
$ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
@@ -7799,23 +7799,23 @@ var init_schemas = __esm({
|
|
|
7799
7799
|
return result;
|
|
7800
7800
|
};
|
|
7801
7801
|
};
|
|
7802
|
-
inst._zod.parse = (
|
|
7803
|
-
if (typeof
|
|
7804
|
-
|
|
7802
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
7803
|
+
if (typeof payload2.value !== "function") {
|
|
7804
|
+
payload2.issues.push({
|
|
7805
7805
|
code: "invalid_type",
|
|
7806
7806
|
expected: "function",
|
|
7807
|
-
input:
|
|
7807
|
+
input: payload2.value,
|
|
7808
7808
|
inst
|
|
7809
7809
|
});
|
|
7810
|
-
return
|
|
7810
|
+
return payload2;
|
|
7811
7811
|
}
|
|
7812
7812
|
const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === "promise";
|
|
7813
7813
|
if (hasPromiseOutput) {
|
|
7814
|
-
|
|
7814
|
+
payload2.value = inst.implementAsync(payload2.value);
|
|
7815
7815
|
} else {
|
|
7816
|
-
|
|
7816
|
+
payload2.value = inst.implement(payload2.value);
|
|
7817
7817
|
}
|
|
7818
|
-
return
|
|
7818
|
+
return payload2;
|
|
7819
7819
|
};
|
|
7820
7820
|
inst.input = (...args) => {
|
|
7821
7821
|
const F = inst.constructor;
|
|
@@ -7848,8 +7848,8 @@ var init_schemas = __esm({
|
|
|
7848
7848
|
});
|
|
7849
7849
|
$ZodPromise = /* @__PURE__ */ $constructor("$ZodPromise", (inst, def) => {
|
|
7850
7850
|
$ZodType.init(inst, def);
|
|
7851
|
-
inst._zod.parse = (
|
|
7852
|
-
return Promise.resolve(
|
|
7851
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7852
|
+
return Promise.resolve(payload2.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));
|
|
7853
7853
|
};
|
|
7854
7854
|
});
|
|
7855
7855
|
$ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
|
|
@@ -7864,24 +7864,24 @@ var init_schemas = __esm({
|
|
|
7864
7864
|
defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
|
|
7865
7865
|
defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? void 0);
|
|
7866
7866
|
defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? void 0);
|
|
7867
|
-
inst._zod.parse = (
|
|
7867
|
+
inst._zod.parse = (payload2, ctx) => {
|
|
7868
7868
|
const inner = inst._zod.innerType;
|
|
7869
|
-
return inner._zod.run(
|
|
7869
|
+
return inner._zod.run(payload2, ctx);
|
|
7870
7870
|
};
|
|
7871
7871
|
});
|
|
7872
7872
|
$ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
7873
7873
|
$ZodCheck.init(inst, def);
|
|
7874
7874
|
$ZodType.init(inst, def);
|
|
7875
|
-
inst._zod.parse = (
|
|
7876
|
-
return
|
|
7875
|
+
inst._zod.parse = (payload2, _) => {
|
|
7876
|
+
return payload2;
|
|
7877
7877
|
};
|
|
7878
|
-
inst._zod.check = (
|
|
7879
|
-
const input =
|
|
7878
|
+
inst._zod.check = (payload2) => {
|
|
7879
|
+
const input = payload2.value;
|
|
7880
7880
|
const r = def.fn(input);
|
|
7881
7881
|
if (r instanceof Promise) {
|
|
7882
|
-
return r.then((r2) => handleRefineResult(r2,
|
|
7882
|
+
return r.then((r2) => handleRefineResult(r2, payload2, input, inst));
|
|
7883
7883
|
}
|
|
7884
|
-
handleRefineResult(r,
|
|
7884
|
+
handleRefineResult(r, payload2, input, inst);
|
|
7885
7885
|
return;
|
|
7886
7886
|
};
|
|
7887
7887
|
});
|
|
@@ -15172,22 +15172,22 @@ function _refine(Class2, fn, _params) {
|
|
|
15172
15172
|
}
|
|
15173
15173
|
// @__NO_SIDE_EFFECTS__
|
|
15174
15174
|
function _superRefine(fn, params) {
|
|
15175
|
-
const ch = /* @__PURE__ */ _check((
|
|
15176
|
-
|
|
15175
|
+
const ch = /* @__PURE__ */ _check((payload2) => {
|
|
15176
|
+
payload2.addIssue = (issue2) => {
|
|
15177
15177
|
if (typeof issue2 === "string") {
|
|
15178
|
-
|
|
15178
|
+
payload2.issues.push(issue(issue2, payload2.value, ch._zod.def));
|
|
15179
15179
|
} else {
|
|
15180
15180
|
const _issue = issue2;
|
|
15181
15181
|
if (_issue.fatal)
|
|
15182
15182
|
_issue.continue = false;
|
|
15183
15183
|
_issue.code ?? (_issue.code = "custom");
|
|
15184
|
-
_issue.input ?? (_issue.input =
|
|
15184
|
+
_issue.input ?? (_issue.input = payload2.value);
|
|
15185
15185
|
_issue.inst ?? (_issue.inst = ch);
|
|
15186
15186
|
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
15187
|
-
|
|
15187
|
+
payload2.issues.push(issue(_issue));
|
|
15188
15188
|
}
|
|
15189
15189
|
};
|
|
15190
|
-
return fn(
|
|
15190
|
+
return fn(payload2.value, payload2);
|
|
15191
15191
|
}, params);
|
|
15192
15192
|
return ch;
|
|
15193
15193
|
}
|
|
@@ -15246,7 +15246,7 @@ function _stringbool(Classes, _params) {
|
|
|
15246
15246
|
type: "pipe",
|
|
15247
15247
|
in: stringSchema,
|
|
15248
15248
|
out: booleanSchema,
|
|
15249
|
-
transform: ((input,
|
|
15249
|
+
transform: ((input, payload2) => {
|
|
15250
15250
|
let data = input;
|
|
15251
15251
|
if (params.case !== "sensitive")
|
|
15252
15252
|
data = data.toLowerCase();
|
|
@@ -15255,11 +15255,11 @@ function _stringbool(Classes, _params) {
|
|
|
15255
15255
|
} else if (falsySet.has(data)) {
|
|
15256
15256
|
return false;
|
|
15257
15257
|
} else {
|
|
15258
|
-
|
|
15258
|
+
payload2.issues.push({
|
|
15259
15259
|
code: "invalid_value",
|
|
15260
15260
|
expected: "stringbool",
|
|
15261
15261
|
values: [...truthySet, ...falsySet],
|
|
15262
|
-
input:
|
|
15262
|
+
input: payload2.value,
|
|
15263
15263
|
inst: codec2,
|
|
15264
15264
|
continue: false
|
|
15265
15265
|
});
|
|
@@ -16799,17 +16799,33 @@ function normalizeObjectSchema(schema) {
|
|
|
16799
16799
|
}
|
|
16800
16800
|
return void 0;
|
|
16801
16801
|
}
|
|
16802
|
+
function getDotPath(path) {
|
|
16803
|
+
if (path.length === 0) {
|
|
16804
|
+
return "object root";
|
|
16805
|
+
}
|
|
16806
|
+
return path.reduce((acc, seg, index) => {
|
|
16807
|
+
if (index === 0) {
|
|
16808
|
+
return String(seg);
|
|
16809
|
+
}
|
|
16810
|
+
if (typeof seg === "number") {
|
|
16811
|
+
return `${acc}[${seg}]`;
|
|
16812
|
+
}
|
|
16813
|
+
return `${acc}.${seg}`;
|
|
16814
|
+
}, "");
|
|
16815
|
+
}
|
|
16802
16816
|
function getParseErrorMessage(error51) {
|
|
16803
16817
|
if (error51 && typeof error51 === "object") {
|
|
16818
|
+
if ("issues" in error51 && Array.isArray(error51.issues) && error51.issues.length > 0) {
|
|
16819
|
+
return error51.issues.map((i) => {
|
|
16820
|
+
if (!i.path?.length) {
|
|
16821
|
+
return i.message;
|
|
16822
|
+
}
|
|
16823
|
+
return `${i.message} at ${getDotPath(i.path)}`;
|
|
16824
|
+
}).join("\n");
|
|
16825
|
+
}
|
|
16804
16826
|
if ("message" in error51 && typeof error51.message === "string") {
|
|
16805
16827
|
return error51.message;
|
|
16806
16828
|
}
|
|
16807
|
-
if ("issues" in error51 && Array.isArray(error51.issues) && error51.issues.length > 0) {
|
|
16808
|
-
const firstIssue = error51.issues[0];
|
|
16809
|
-
if (firstIssue && typeof firstIssue === "object" && "message" in firstIssue) {
|
|
16810
|
-
return String(firstIssue.message);
|
|
16811
|
-
}
|
|
16812
|
-
}
|
|
16813
16829
|
try {
|
|
16814
16830
|
return JSON.stringify(error51);
|
|
16815
16831
|
} catch {
|
|
@@ -17677,12 +17693,12 @@ function _instanceof(cls, params = {}) {
|
|
|
17677
17693
|
...util_exports.normalizeParams(params)
|
|
17678
17694
|
});
|
|
17679
17695
|
inst._zod.bag.Class = cls;
|
|
17680
|
-
inst._zod.check = (
|
|
17681
|
-
if (!(
|
|
17682
|
-
|
|
17696
|
+
inst._zod.check = (payload2) => {
|
|
17697
|
+
if (!(payload2.value instanceof cls)) {
|
|
17698
|
+
payload2.issues.push({
|
|
17683
17699
|
code: "invalid_type",
|
|
17684
17700
|
expected: cls.name,
|
|
17685
|
-
input:
|
|
17701
|
+
input: payload2.value,
|
|
17686
17702
|
inst,
|
|
17687
17703
|
path: [...inst._zod.def.path ?? []]
|
|
17688
17704
|
});
|
|
@@ -18349,34 +18365,34 @@ var init_schemas3 = __esm({
|
|
|
18349
18365
|
$ZodTransform.init(inst, def);
|
|
18350
18366
|
ZodType2.init(inst, def);
|
|
18351
18367
|
inst._zod.processJSONSchema = (ctx, json2, params) => transformProcessor(inst, ctx, json2, params);
|
|
18352
|
-
inst._zod.parse = (
|
|
18368
|
+
inst._zod.parse = (payload2, _ctx) => {
|
|
18353
18369
|
if (_ctx.direction === "backward") {
|
|
18354
18370
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
18355
18371
|
}
|
|
18356
|
-
|
|
18372
|
+
payload2.addIssue = (issue2) => {
|
|
18357
18373
|
if (typeof issue2 === "string") {
|
|
18358
|
-
|
|
18374
|
+
payload2.issues.push(util_exports.issue(issue2, payload2.value, def));
|
|
18359
18375
|
} else {
|
|
18360
18376
|
const _issue = issue2;
|
|
18361
18377
|
if (_issue.fatal)
|
|
18362
18378
|
_issue.continue = false;
|
|
18363
18379
|
_issue.code ?? (_issue.code = "custom");
|
|
18364
|
-
_issue.input ?? (_issue.input =
|
|
18380
|
+
_issue.input ?? (_issue.input = payload2.value);
|
|
18365
18381
|
_issue.inst ?? (_issue.inst = inst);
|
|
18366
|
-
|
|
18382
|
+
payload2.issues.push(util_exports.issue(_issue));
|
|
18367
18383
|
}
|
|
18368
18384
|
};
|
|
18369
|
-
const output = def.transform(
|
|
18385
|
+
const output = def.transform(payload2.value, payload2);
|
|
18370
18386
|
if (output instanceof Promise) {
|
|
18371
18387
|
return output.then((output2) => {
|
|
18372
|
-
|
|
18373
|
-
|
|
18374
|
-
return
|
|
18388
|
+
payload2.value = output2;
|
|
18389
|
+
payload2.fallback = true;
|
|
18390
|
+
return payload2;
|
|
18375
18391
|
});
|
|
18376
18392
|
}
|
|
18377
|
-
|
|
18378
|
-
|
|
18379
|
-
return
|
|
18393
|
+
payload2.value = output;
|
|
18394
|
+
payload2.fallback = true;
|
|
18395
|
+
return payload2;
|
|
18380
18396
|
};
|
|
18381
18397
|
});
|
|
18382
18398
|
ZodOptional2 = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
@@ -27061,7 +27077,12 @@ var require_fast_uri = __commonJS({
|
|
|
27061
27077
|
}
|
|
27062
27078
|
function resolve2(baseURI, relativeURI, options) {
|
|
27063
27079
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
27064
|
-
const
|
|
27080
|
+
const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
|
|
27081
|
+
const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
|
|
27082
|
+
if (baseMalformed || relativeMalformed) {
|
|
27083
|
+
throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
27084
|
+
}
|
|
27085
|
+
const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
|
|
27065
27086
|
schemelessOptions.skipEscape = true;
|
|
27066
27087
|
return serialize(resolved, schemelessOptions);
|
|
27067
27088
|
}
|
|
@@ -27187,6 +27208,7 @@ var require_fast_uri = __commonJS({
|
|
|
27187
27208
|
}
|
|
27188
27209
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
27189
27210
|
var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
|
|
27211
|
+
var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
|
|
27190
27212
|
function getParseError(parsed, matches) {
|
|
27191
27213
|
if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
|
|
27192
27214
|
return 'URI path must start with "/" when authority is present.';
|
|
@@ -27221,6 +27243,20 @@ var require_fast_uri = __commonJS({
|
|
|
27221
27243
|
parsed.error = "URI authority must not contain a literal backslash.";
|
|
27222
27244
|
malformedAuthorityOrPort = true;
|
|
27223
27245
|
}
|
|
27246
|
+
const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
|
|
27247
|
+
if (introducerMatch !== null) {
|
|
27248
|
+
const region = introducerMatch[1];
|
|
27249
|
+
const normalizedRegion = region.replace(/[\t\n\r]/g, "");
|
|
27250
|
+
if (normalizedRegion.length >= 2) {
|
|
27251
|
+
if (normalizedRegion.slice(0, 2) !== "//") {
|
|
27252
|
+
parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
|
|
27253
|
+
malformedAuthorityOrPort = true;
|
|
27254
|
+
} else if (region.length !== normalizedRegion.length) {
|
|
27255
|
+
parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
|
|
27256
|
+
malformedAuthorityOrPort = true;
|
|
27257
|
+
}
|
|
27258
|
+
}
|
|
27259
|
+
}
|
|
27224
27260
|
const matches = uri.match(URI_PARSE);
|
|
27225
27261
|
if (matches) {
|
|
27226
27262
|
parsed.scheme = matches[1];
|
|
@@ -30718,16 +30754,7 @@ var init_server2 = __esm({
|
|
|
30718
30754
|
if (!methodSchema) {
|
|
30719
30755
|
throw new Error("Schema is missing a method literal");
|
|
30720
30756
|
}
|
|
30721
|
-
|
|
30722
|
-
if (isZ4Schema(methodSchema)) {
|
|
30723
|
-
const v4Schema = methodSchema;
|
|
30724
|
-
const v4Def = v4Schema._zod?.def;
|
|
30725
|
-
methodValue = v4Def?.value ?? v4Schema.value;
|
|
30726
|
-
} else {
|
|
30727
|
-
const v3Schema = methodSchema;
|
|
30728
|
-
const legacyDef = v3Schema._def;
|
|
30729
|
-
methodValue = legacyDef?.value ?? v3Schema.value;
|
|
30730
|
-
}
|
|
30757
|
+
const methodValue = getLiteralValue(methodSchema);
|
|
30731
30758
|
if (typeof methodValue !== "string") {
|
|
30732
30759
|
throw new Error("Schema method literal must be a string");
|
|
30733
30760
|
}
|
|
@@ -31962,12 +31989,21 @@ function deserializeMessage(line) {
|
|
|
31962
31989
|
function serializeMessage(message) {
|
|
31963
31990
|
return JSON.stringify(message) + "\n";
|
|
31964
31991
|
}
|
|
31965
|
-
var ReadBuffer;
|
|
31992
|
+
var STDIO_DEFAULT_MAX_BUFFER_SIZE, ReadBuffer;
|
|
31966
31993
|
var init_stdio = __esm({
|
|
31967
31994
|
"node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js"() {
|
|
31968
31995
|
init_types2();
|
|
31996
|
+
STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
|
|
31969
31997
|
ReadBuffer = class {
|
|
31998
|
+
constructor(options) {
|
|
31999
|
+
this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
32000
|
+
}
|
|
31970
32001
|
append(chunk) {
|
|
32002
|
+
const newSize = (this._buffer?.length ?? 0) + chunk.length;
|
|
32003
|
+
if (newSize > this._maxBufferSize) {
|
|
32004
|
+
this.clear();
|
|
32005
|
+
throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
|
|
32006
|
+
}
|
|
31971
32007
|
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
|
|
31972
32008
|
}
|
|
31973
32009
|
readMessage() {
|
|
@@ -31996,18 +32032,24 @@ var init_stdio2 = __esm({
|
|
|
31996
32032
|
"node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js"() {
|
|
31997
32033
|
init_stdio();
|
|
31998
32034
|
StdioServerTransport = class {
|
|
31999
|
-
constructor(_stdin = process3.stdin, _stdout = process3.stdout) {
|
|
32035
|
+
constructor(_stdin = process3.stdin, _stdout = process3.stdout, options) {
|
|
32000
32036
|
this._stdin = _stdin;
|
|
32001
32037
|
this._stdout = _stdout;
|
|
32002
|
-
this._readBuffer = new ReadBuffer();
|
|
32003
32038
|
this._started = false;
|
|
32004
32039
|
this._ondata = (chunk) => {
|
|
32005
|
-
|
|
32006
|
-
|
|
32040
|
+
try {
|
|
32041
|
+
this._readBuffer.append(chunk);
|
|
32042
|
+
this.processReadBuffer();
|
|
32043
|
+
} catch (error51) {
|
|
32044
|
+
this.onerror?.(error51);
|
|
32045
|
+
this.close().catch(() => {
|
|
32046
|
+
});
|
|
32047
|
+
}
|
|
32007
32048
|
};
|
|
32008
32049
|
this._onerror = (error51) => {
|
|
32009
32050
|
this.onerror?.(error51);
|
|
32010
32051
|
};
|
|
32052
|
+
this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
|
|
32011
32053
|
}
|
|
32012
32054
|
/**
|
|
32013
32055
|
* Starts listening for messages on stdin.
|
|
@@ -32784,11 +32826,84 @@ var init_clipboard = __esm({
|
|
|
32784
32826
|
});
|
|
32785
32827
|
|
|
32786
32828
|
// src/media-url.ts
|
|
32787
|
-
var
|
|
32829
|
+
var media_url_exports = {};
|
|
32830
|
+
__export(media_url_exports, {
|
|
32831
|
+
MEDIA_URL_TTL_MS: () => MEDIA_URL_TTL_MS,
|
|
32832
|
+
SIGNING_SECRET_KV_KEY: () => SIGNING_SECRET_KV_KEY,
|
|
32833
|
+
base64UrlDecode: () => base64UrlDecode,
|
|
32834
|
+
base64UrlEncode: () => base64UrlEncode,
|
|
32835
|
+
buildMediaUrl: () => buildMediaUrl,
|
|
32836
|
+
loadSigningKey: () => loadSigningKey,
|
|
32837
|
+
resolveSigningKey: () => resolveSigningKey,
|
|
32838
|
+
signMediaKey: () => signMediaKey,
|
|
32839
|
+
verifyMediaSignature: () => verifyMediaSignature
|
|
32840
|
+
});
|
|
32841
|
+
function base64UrlEncode(bytes) {
|
|
32842
|
+
const view = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
|
|
32843
|
+
let binary = "";
|
|
32844
|
+
for (let i = 0; i < view.length; i++) binary += String.fromCharCode(view[i]);
|
|
32845
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
32846
|
+
}
|
|
32847
|
+
function base64UrlDecode(text) {
|
|
32848
|
+
const padded = text.replace(/-/g, "+").replace(/_/g, "/").padEnd(Math.ceil(text.length / 4) * 4, "=");
|
|
32849
|
+
const binary = atob(padded);
|
|
32850
|
+
const out = new Uint8Array(binary.length);
|
|
32851
|
+
for (let i = 0; i < binary.length; i++) out[i] = binary.charCodeAt(i);
|
|
32852
|
+
return out;
|
|
32853
|
+
}
|
|
32854
|
+
async function importKey(material) {
|
|
32855
|
+
return crypto.subtle.importKey("raw", new TextEncoder().encode(material), { name: "HMAC", hash: "SHA-256" }, false, [
|
|
32856
|
+
"sign",
|
|
32857
|
+
"verify"
|
|
32858
|
+
]);
|
|
32859
|
+
}
|
|
32860
|
+
async function resolveSigningKey(secret, store) {
|
|
32861
|
+
let material = secret?.trim();
|
|
32862
|
+
if (!material) {
|
|
32863
|
+
material = await store.get(SIGNING_SECRET_KV_KEY) ?? void 0;
|
|
32864
|
+
if (!material) {
|
|
32865
|
+
const generated = base64UrlEncode(crypto.getRandomValues(new Uint8Array(32)));
|
|
32866
|
+
await store.put(SIGNING_SECRET_KV_KEY, generated);
|
|
32867
|
+
material = await store.get(SIGNING_SECRET_KV_KEY) ?? generated;
|
|
32868
|
+
}
|
|
32869
|
+
}
|
|
32870
|
+
return importKey(material);
|
|
32871
|
+
}
|
|
32872
|
+
async function loadSigningKey(secret, store) {
|
|
32873
|
+
const material = secret?.trim() || await store.get(SIGNING_SECRET_KV_KEY);
|
|
32874
|
+
return material ? importKey(material) : void 0;
|
|
32875
|
+
}
|
|
32876
|
+
function payload(key, expiresAtMs2) {
|
|
32877
|
+
return new TextEncoder().encode(`${key}
|
|
32878
|
+
${expiresAtMs2}`);
|
|
32879
|
+
}
|
|
32880
|
+
async function signMediaKey(signingKey, key, expiresAtMs2) {
|
|
32881
|
+
return base64UrlEncode(await crypto.subtle.sign("HMAC", signingKey, payload(key, expiresAtMs2)));
|
|
32882
|
+
}
|
|
32883
|
+
async function verifyMediaSignature(signingKey, key, exp, sig, nowMs) {
|
|
32884
|
+
if (!exp || !sig) return { ok: false, reason: "missing" };
|
|
32885
|
+
const expiresAtMs2 = Number(exp);
|
|
32886
|
+
if (!Number.isFinite(expiresAtMs2)) return { ok: false, reason: "invalid" };
|
|
32887
|
+
let valid;
|
|
32888
|
+
try {
|
|
32889
|
+
valid = await crypto.subtle.verify("HMAC", signingKey, base64UrlDecode(sig), payload(key, expiresAtMs2));
|
|
32890
|
+
} catch {
|
|
32891
|
+
return { ok: false, reason: "invalid" };
|
|
32892
|
+
}
|
|
32893
|
+
if (!valid) return { ok: false, reason: "invalid" };
|
|
32894
|
+
if (nowMs > expiresAtMs2) return { ok: false, reason: "expired" };
|
|
32895
|
+
return { ok: true };
|
|
32896
|
+
}
|
|
32897
|
+
function buildMediaUrl(baseUrl, key, expiresAtMs2, signature) {
|
|
32898
|
+
const path = key.split("/").map(encodeURIComponent).join("/");
|
|
32899
|
+
return `${baseUrl.replace(/\/+$/, "")}/${path}?exp=${expiresAtMs2}&sig=${signature}`;
|
|
32900
|
+
}
|
|
32901
|
+
var MEDIA_URL_TTL_MS, SIGNING_SECRET_KV_KEY;
|
|
32788
32902
|
var init_media_url = __esm({
|
|
32789
32903
|
"src/media-url.ts"() {
|
|
32790
32904
|
"use strict";
|
|
32791
32905
|
MEDIA_URL_TTL_MS = 48 * 60 * 60 * 1e3;
|
|
32906
|
+
SIGNING_SECRET_KV_KEY = "media:url-signing-secret";
|
|
32792
32907
|
}
|
|
32793
32908
|
});
|
|
32794
32909
|
|
|
@@ -32805,7 +32920,7 @@ async function loadStdioDotenv() {
|
|
|
32805
32920
|
}
|
|
32806
32921
|
|
|
32807
32922
|
// src/version.ts
|
|
32808
|
-
var VERSION = "1.
|
|
32923
|
+
var VERSION = "1.6.1";
|
|
32809
32924
|
|
|
32810
32925
|
// src/tools/models.ts
|
|
32811
32926
|
init_dist();
|
|
@@ -33255,9 +33370,79 @@ function createDiskSink() {
|
|
|
33255
33370
|
note: () => void 0
|
|
33256
33371
|
};
|
|
33257
33372
|
}
|
|
33373
|
+
async function tenantIdFor(secret) {
|
|
33374
|
+
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(secret));
|
|
33375
|
+
return [...new Uint8Array(digest).slice(0, 6)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
33376
|
+
}
|
|
33377
|
+
var KEY_PREFIX_DEFAULT = "gen";
|
|
33378
|
+
function safeKeySegment(base) {
|
|
33379
|
+
const cleaned = base.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/\.{2,}/g, "-").replace(/-+/g, "-").replace(/^[-.]+|[-.]+$/g, "");
|
|
33380
|
+
return cleaned || "media";
|
|
33381
|
+
}
|
|
33382
|
+
function createR2Sink(bucket, opts) {
|
|
33383
|
+
const prefix = opts.prefix ?? KEY_PREFIX_DEFAULT;
|
|
33384
|
+
const now = opts.now ?? (() => /* @__PURE__ */ new Date());
|
|
33385
|
+
const randomId = opts.randomId ?? (() => crypto.randomUUID().slice(0, 8));
|
|
33386
|
+
const publicBase = opts.publicBaseUrl?.replace(/\/+$/, "");
|
|
33387
|
+
const signedBase = opts.signedBaseUrl?.replace(/\/+$/, "");
|
|
33388
|
+
const ttlMs = opts.urlTtlMs ?? 0;
|
|
33389
|
+
const readPrefixes = [prefix, ...opts.readPrefixes ?? []];
|
|
33390
|
+
let tenantCache;
|
|
33391
|
+
const tenantId = () => tenantCache ??= Promise.resolve(typeof opts.tenant === "function" ? opts.tenant() : opts.tenant);
|
|
33392
|
+
const ownPrefix = async () => {
|
|
33393
|
+
const tenant = await tenantId();
|
|
33394
|
+
return tenant ? `${prefix}/${tenant}/` : `${prefix}/`;
|
|
33395
|
+
};
|
|
33396
|
+
const owned = async (key) => {
|
|
33397
|
+
if (!opts.tenant) return true;
|
|
33398
|
+
const tenant = await tenantId();
|
|
33399
|
+
return readPrefixes.some((p) => key.startsWith(`${p}/${tenant}/`));
|
|
33400
|
+
};
|
|
33401
|
+
return {
|
|
33402
|
+
kind: "r2",
|
|
33403
|
+
persistsFiles: false,
|
|
33404
|
+
async read(key) {
|
|
33405
|
+
if (!bucket.get || !await owned(key)) return void 0;
|
|
33406
|
+
const object3 = await bucket.get(key);
|
|
33407
|
+
if (!object3) return void 0;
|
|
33408
|
+
return {
|
|
33409
|
+
bytes: new Uint8Array(await object3.arrayBuffer()),
|
|
33410
|
+
mimeType: object3.httpMetadata?.contentType ?? "application/octet-stream"
|
|
33411
|
+
};
|
|
33412
|
+
},
|
|
33413
|
+
async resign(key) {
|
|
33414
|
+
if (!await owned(key)) return void 0;
|
|
33415
|
+
if (bucket.get && !await bucket.get(key)) return void 0;
|
|
33416
|
+
return describe3(key, now().getTime() + ttlMs);
|
|
33417
|
+
},
|
|
33418
|
+
async persist(items, persistOpts) {
|
|
33419
|
+
const { mediaExt: mediaExt2 } = await Promise.resolve().then(() => (init_images(), images_exports));
|
|
33420
|
+
const keyBase = await ownPrefix();
|
|
33421
|
+
const day = now().toISOString().slice(0, 10);
|
|
33422
|
+
const effectiveTtlMs = Math.min(persistOpts.urlTtlMs ?? ttlMs, opts.maxUrlTtlMs ?? Infinity);
|
|
33423
|
+
const expiresAtMs2 = now().getTime() + effectiveTtlMs;
|
|
33424
|
+
const refs = [];
|
|
33425
|
+
for (const it of items) {
|
|
33426
|
+
const key = `${keyBase}${day}/${randomId()}-${safeKeySegment(it.base)}.${mediaExt2(it.mimeType)}`;
|
|
33427
|
+
await bucket.put(key, base64ToBytes(it.base64), { httpMetadata: { contentType: it.mimeType } });
|
|
33428
|
+
refs.push(await describe3(key, expiresAtMs2));
|
|
33429
|
+
}
|
|
33430
|
+
return refs;
|
|
33431
|
+
},
|
|
33432
|
+
note: () => publicBase ? "Generated media was uploaded to R2 and the values above are public URLs (not local file paths) \u2014 open or download them directly. This hosted connector has no filesystem, so `output_dir` is ignored and no <image>.json sidecar is written \u2014 capture interaction_id from this result to chain further turns." : signedBase ? "Generated media is served by this connector at the signed URLs above \u2014 open them in a browser or fetch them with curl; no auth header is needed, the signature is in the link. They expire (see media[].expires_at), and the objects behind them are cleaned up on a retention schedule. This hosted connector has no filesystem, so `output_dir` is ignored and no <image>.json sidecar is written \u2014 capture interaction_id from this result to chain further turns." : "Generated media was stored, but this connector has no public media URL configured and no signing route available, so the values above are bare object keys rather than fetchable links. Set MEDIA_PUBLIC_BASE_URL on the Worker, or pass inline: true to receive the bytes directly."
|
|
33433
|
+
};
|
|
33434
|
+
async function describe3(key, expiresAtMs2) {
|
|
33435
|
+
if (publicBase) return { ref: `${publicBase}/${key}`, key };
|
|
33436
|
+
if (signedBase && opts.sign) {
|
|
33437
|
+
const { buildMediaUrl: buildMediaUrl2 } = await Promise.resolve().then(() => (init_media_url(), media_url_exports));
|
|
33438
|
+
const signature = await opts.sign(key, expiresAtMs2);
|
|
33439
|
+
return { ref: buildMediaUrl2(signedBase, key, expiresAtMs2, signature), key, expiresAt: new Date(expiresAtMs2).toISOString() };
|
|
33440
|
+
}
|
|
33441
|
+
return { ref: key, key, unavailable: true };
|
|
33442
|
+
}
|
|
33443
|
+
}
|
|
33258
33444
|
|
|
33259
|
-
// src/media-
|
|
33260
|
-
init_media_url();
|
|
33445
|
+
// src/media-name.ts
|
|
33261
33446
|
function downloadFilename(key) {
|
|
33262
33447
|
const last = key.split("/").pop() || "media";
|
|
33263
33448
|
const stripped = last.replace(/^[0-9a-f]{6,12}-/i, "");
|
|
@@ -34213,6 +34398,254 @@ init_dist();
|
|
|
34213
34398
|
init_dist();
|
|
34214
34399
|
import { basename } from "node:path";
|
|
34215
34400
|
|
|
34401
|
+
// src/library.ts
|
|
34402
|
+
var LIBRARY_KEY_PREFIX = "lib";
|
|
34403
|
+
var LIBRARY_NAME_PATTERN = /^[a-z0-9][a-z0-9_-]{0,39}$/;
|
|
34404
|
+
function isValidLibraryName(name) {
|
|
34405
|
+
return LIBRARY_NAME_PATTERN.test(name);
|
|
34406
|
+
}
|
|
34407
|
+
function createR2Library(bucket, opts) {
|
|
34408
|
+
const now = opts.now ?? (() => /* @__PURE__ */ new Date());
|
|
34409
|
+
let tenantCache;
|
|
34410
|
+
const tenantId = () => tenantCache ??= Promise.resolve(typeof opts.tenant === "function" ? opts.tenant() : opts.tenant);
|
|
34411
|
+
const assertName = (name) => {
|
|
34412
|
+
if (!isValidLibraryName(name)) {
|
|
34413
|
+
throw new Error(`Invalid library name "${name}" \u2014 use 1-40 lowercase letters, digits, "-" or "_" (e.g. "finn", "bold-cartoon-sports").`);
|
|
34414
|
+
}
|
|
34415
|
+
return name;
|
|
34416
|
+
};
|
|
34417
|
+
const keyFor = async (kind, name, ext) => `${LIBRARY_KEY_PREFIX}/${await tenantId()}/${kind}/${assertName(name)}.${ext}`;
|
|
34418
|
+
async function readJson(key) {
|
|
34419
|
+
const object3 = await bucket.get(key);
|
|
34420
|
+
if (!object3) return void 0;
|
|
34421
|
+
try {
|
|
34422
|
+
return JSON.parse(new TextDecoder().decode(await object3.arrayBuffer()));
|
|
34423
|
+
} catch {
|
|
34424
|
+
return void 0;
|
|
34425
|
+
}
|
|
34426
|
+
}
|
|
34427
|
+
async function readImage(kind, name) {
|
|
34428
|
+
const object3 = await bucket.get(await keyFor(kind, name, "img"));
|
|
34429
|
+
if (!object3) return void 0;
|
|
34430
|
+
return {
|
|
34431
|
+
bytes: new Uint8Array(await object3.arrayBuffer()),
|
|
34432
|
+
mimeType: object3.httpMetadata?.contentType ?? "application/octet-stream"
|
|
34433
|
+
};
|
|
34434
|
+
}
|
|
34435
|
+
async function listRecords(kind) {
|
|
34436
|
+
const prefix = `${LIBRARY_KEY_PREFIX}/${await tenantId()}/${kind}/`;
|
|
34437
|
+
const keys = [];
|
|
34438
|
+
let cursor;
|
|
34439
|
+
for (; ; ) {
|
|
34440
|
+
const page = await bucket.list({ prefix, cursor, limit: 1e3 });
|
|
34441
|
+
keys.push(...page.objects.map((o) => o.key).filter((k) => k.endsWith(".json")));
|
|
34442
|
+
if (!page.truncated) break;
|
|
34443
|
+
cursor = page.cursor;
|
|
34444
|
+
}
|
|
34445
|
+
const records = await Promise.all(keys.map((k) => readJson(k)));
|
|
34446
|
+
return records.filter((r) => r !== void 0).sort((a, b) => a.name.localeCompare(b.name));
|
|
34447
|
+
}
|
|
34448
|
+
async function deleteEntry(kind, name) {
|
|
34449
|
+
const jsonKey = await keyFor(kind, name, "json");
|
|
34450
|
+
const existed = await bucket.get(jsonKey) !== null;
|
|
34451
|
+
await bucket.delete([jsonKey, await keyFor(kind, name, "img")]);
|
|
34452
|
+
return existed;
|
|
34453
|
+
}
|
|
34454
|
+
return {
|
|
34455
|
+
async saveCharacter({ name, description, image }) {
|
|
34456
|
+
const jsonKey = await keyFor("characters", name, "json");
|
|
34457
|
+
const imageKey = await keyFor("characters", name, "img");
|
|
34458
|
+
const at = now().toISOString();
|
|
34459
|
+
const existing = await readJson(jsonKey);
|
|
34460
|
+
const record2 = {
|
|
34461
|
+
name,
|
|
34462
|
+
description,
|
|
34463
|
+
image_key: imageKey,
|
|
34464
|
+
mime_type: image.mimeType,
|
|
34465
|
+
created_at: existing?.created_at ?? at,
|
|
34466
|
+
updated_at: at
|
|
34467
|
+
};
|
|
34468
|
+
await bucket.put(imageKey, image.bytes, { httpMetadata: { contentType: image.mimeType } });
|
|
34469
|
+
await bucket.put(jsonKey, JSON.stringify(record2, null, 2), { httpMetadata: { contentType: "application/json" } });
|
|
34470
|
+
return record2;
|
|
34471
|
+
},
|
|
34472
|
+
async getCharacter(name) {
|
|
34473
|
+
return readJson(await keyFor("characters", name, "json"));
|
|
34474
|
+
},
|
|
34475
|
+
readCharacterImage: (name) => readImage("characters", name),
|
|
34476
|
+
listCharacters: () => listRecords("characters"),
|
|
34477
|
+
deleteCharacter: (name) => deleteEntry("characters", name),
|
|
34478
|
+
async saveStyle({ name, promptFragment, image }) {
|
|
34479
|
+
const jsonKey = await keyFor("styles", name, "json");
|
|
34480
|
+
const imageKey = await keyFor("styles", name, "img");
|
|
34481
|
+
const at = now().toISOString();
|
|
34482
|
+
const existing = await readJson(jsonKey);
|
|
34483
|
+
const record2 = {
|
|
34484
|
+
name,
|
|
34485
|
+
prompt_fragment: promptFragment,
|
|
34486
|
+
...image ? { image_key: imageKey, mime_type: image.mimeType } : {},
|
|
34487
|
+
created_at: existing?.created_at ?? at,
|
|
34488
|
+
updated_at: at
|
|
34489
|
+
};
|
|
34490
|
+
if (image) {
|
|
34491
|
+
await bucket.put(imageKey, image.bytes, { httpMetadata: { contentType: image.mimeType } });
|
|
34492
|
+
} else if (existing?.image_key) {
|
|
34493
|
+
await bucket.delete(imageKey);
|
|
34494
|
+
}
|
|
34495
|
+
await bucket.put(jsonKey, JSON.stringify(record2, null, 2), { httpMetadata: { contentType: "application/json" } });
|
|
34496
|
+
return record2;
|
|
34497
|
+
},
|
|
34498
|
+
async getStyle(name) {
|
|
34499
|
+
return readJson(await keyFor("styles", name, "json"));
|
|
34500
|
+
},
|
|
34501
|
+
readStyleImage: (name) => readImage("styles", name),
|
|
34502
|
+
listStyles: () => listRecords("styles"),
|
|
34503
|
+
deleteStyle: (name) => deleteEntry("styles", name)
|
|
34504
|
+
};
|
|
34505
|
+
}
|
|
34506
|
+
|
|
34507
|
+
// src/upload-url.ts
|
|
34508
|
+
init_media_url();
|
|
34509
|
+
var UPLOAD_URL_TTL_MS = 10 * 60 * 1e3;
|
|
34510
|
+
var UPLOAD_MAX_BYTES = 15 * 1024 * 1024;
|
|
34511
|
+
var UPLOAD_KEY_PREFIX = "up";
|
|
34512
|
+
function buildUploadUrl(baseUrl, key, contentType, expiresAtMs2, signature) {
|
|
34513
|
+
const path = key.split("/").map(encodeURIComponent).join("/");
|
|
34514
|
+
return `${baseUrl.replace(/\/+$/, "")}/${path}?ct=${encodeURIComponent(contentType.toLowerCase())}&exp=${expiresAtMs2}&sig=${signature}`;
|
|
34515
|
+
}
|
|
34516
|
+
var RASTER_IMAGE_TYPE_PATTERN = /^image\/(jpeg|png|webp|gif|avif|heic|heif|bmp|tiff)$/i;
|
|
34517
|
+
function acceptableUploadType(contentType) {
|
|
34518
|
+
return RASTER_IMAGE_TYPE_PATTERN.test(contentType);
|
|
34519
|
+
}
|
|
34520
|
+
function createUploadUrlMinter(opts) {
|
|
34521
|
+
const now = opts.now ?? (() => /* @__PURE__ */ new Date());
|
|
34522
|
+
const randomId = opts.randomId ?? (() => crypto.randomUUID().slice(0, 8));
|
|
34523
|
+
const ttlMs = opts.ttlMs ?? UPLOAD_URL_TTL_MS;
|
|
34524
|
+
return {
|
|
34525
|
+
async mint(filename, contentType) {
|
|
34526
|
+
const ct = contentType.trim().toLowerCase();
|
|
34527
|
+
if (!acceptableUploadType(ct)) {
|
|
34528
|
+
throw new Error(
|
|
34529
|
+
`content_type must be a raster image type (image/jpeg, image/png, image/webp, image/gif, image/avif, image/heic, image/heif, image/bmp, image/tiff), got "${contentType}". SVG is deliberately not accepted: it can carry scripts, and /media serves from the connector origin.`
|
|
34530
|
+
);
|
|
34531
|
+
}
|
|
34532
|
+
const tenant = typeof opts.tenant === "function" ? await opts.tenant() : opts.tenant;
|
|
34533
|
+
const day = now().toISOString().slice(0, 10);
|
|
34534
|
+
const key = `${UPLOAD_KEY_PREFIX}/${tenant}/${day}/${randomId()}-${safeKeySegment(filename)}`;
|
|
34535
|
+
const expiresAtMs2 = now().getTime() + ttlMs;
|
|
34536
|
+
const signature = await opts.sign(key, ct, expiresAtMs2);
|
|
34537
|
+
return { url: buildUploadUrl(opts.baseUrl, key, ct, expiresAtMs2, signature), key, contentType: ct, expiresAtMs: expiresAtMs2 };
|
|
34538
|
+
}
|
|
34539
|
+
};
|
|
34540
|
+
}
|
|
34541
|
+
|
|
34542
|
+
// src/blob-store.ts
|
|
34543
|
+
var READ = (key, exp) => `${key}
|
|
34544
|
+
${exp}`;
|
|
34545
|
+
var WRITE = (key, ct, exp) => `put\0${key}\0${ct}\0${exp}`;
|
|
34546
|
+
var WRITE_PERMANENT = (key, ct, exp) => `putp\0${key}\0${ct}\0${exp}`;
|
|
34547
|
+
var DELETE = (key, exp) => `del\0${key}\0${exp}`;
|
|
34548
|
+
var LIST = (prefix, exp) => `list\0${prefix}\0${exp}`;
|
|
34549
|
+
var PERMANENT_PREFIX = "lib";
|
|
34550
|
+
var DEFAULT_TTL_MS = 60 * 60 * 1e3;
|
|
34551
|
+
function base64url3(bytes) {
|
|
34552
|
+
return Buffer.from(bytes).toString("base64url");
|
|
34553
|
+
}
|
|
34554
|
+
async function hmac(secret, payload2) {
|
|
34555
|
+
const key = await crypto.subtle.importKey(
|
|
34556
|
+
"raw",
|
|
34557
|
+
new TextEncoder().encode(secret),
|
|
34558
|
+
{ name: "HMAC", hash: "SHA-256" },
|
|
34559
|
+
false,
|
|
34560
|
+
["sign"]
|
|
34561
|
+
);
|
|
34562
|
+
return base64url3(await crypto.subtle.sign("HMAC", key, new TextEncoder().encode(payload2)));
|
|
34563
|
+
}
|
|
34564
|
+
function prefixFromBaseUrl(baseUrl) {
|
|
34565
|
+
const path = new URL(baseUrl).pathname.replace(/^\/+|\/+$/g, "");
|
|
34566
|
+
const marker = path.startsWith("b/") ? path.slice(2) : path;
|
|
34567
|
+
return marker;
|
|
34568
|
+
}
|
|
34569
|
+
function createBlobBucket(opts) {
|
|
34570
|
+
const base = opts.baseUrl.replace(/\/+$/, "");
|
|
34571
|
+
const prefix = prefixFromBaseUrl(base);
|
|
34572
|
+
const doFetch = opts.fetchImpl ?? fetch;
|
|
34573
|
+
const ttl = opts.ttlMs ?? DEFAULT_TTL_MS;
|
|
34574
|
+
const now = opts.now ?? (() => Date.now());
|
|
34575
|
+
const full = (key) => `${prefix}/${key}`;
|
|
34576
|
+
const encode3 = (key) => key.split("/").map(encodeURIComponent).join("/");
|
|
34577
|
+
async function signedUrl(key, payload2, exp) {
|
|
34578
|
+
const sig = await hmac(opts.signingKey, payload2);
|
|
34579
|
+
return `${base}/${encode3(key)}?exp=${exp}&sig=${encodeURIComponent(sig)}`;
|
|
34580
|
+
}
|
|
34581
|
+
return {
|
|
34582
|
+
/** Exposed so the media sink can mint read links with the same key. */
|
|
34583
|
+
async signRead(key, expiresAtMs2) {
|
|
34584
|
+
return hmac(opts.signingKey, READ(full(key), expiresAtMs2));
|
|
34585
|
+
},
|
|
34586
|
+
async signWrite(key, contentType, expiresAtMs2) {
|
|
34587
|
+
return hmac(opts.signingKey, WRITE(full(key), contentType, expiresAtMs2));
|
|
34588
|
+
},
|
|
34589
|
+
async put(key, value, options) {
|
|
34590
|
+
const contentType = options?.httpMetadata?.contentType ?? "application/octet-stream";
|
|
34591
|
+
const exp = now() + ttl;
|
|
34592
|
+
const permanent = key.startsWith(`${PERMANENT_PREFIX}/`);
|
|
34593
|
+
const payload2 = permanent ? WRITE_PERMANENT(full(key), contentType, exp) : WRITE(full(key), contentType, exp);
|
|
34594
|
+
const url2 = await signedUrl(key, payload2, exp) + (permanent ? "&retain=permanent" : "");
|
|
34595
|
+
const body = typeof value === "string" ? value : toArrayBuffer(value);
|
|
34596
|
+
const res = await doFetch(url2, { method: "PUT", headers: { "content-type": contentType }, body });
|
|
34597
|
+
if (!res.ok) throw new Error(`blob put failed (${res.status}) for ${key}`);
|
|
34598
|
+
return void 0;
|
|
34599
|
+
},
|
|
34600
|
+
async get(key) {
|
|
34601
|
+
const exp = now() + ttl;
|
|
34602
|
+
const url2 = await signedUrl(key, READ(full(key), exp), exp);
|
|
34603
|
+
const res = await doFetch(url2);
|
|
34604
|
+
if (res.status === 404) return null;
|
|
34605
|
+
if (!res.ok) throw new Error(`blob get failed (${res.status}) for ${key}`);
|
|
34606
|
+
const buf = await res.arrayBuffer();
|
|
34607
|
+
return {
|
|
34608
|
+
arrayBuffer: async () => buf,
|
|
34609
|
+
httpMetadata: { contentType: res.headers.get("content-type") ?? void 0 }
|
|
34610
|
+
};
|
|
34611
|
+
},
|
|
34612
|
+
async delete(keys) {
|
|
34613
|
+
for (const key of Array.isArray(keys) ? keys : [keys]) {
|
|
34614
|
+
const exp = now() + ttl;
|
|
34615
|
+
const url2 = await signedUrl(key, DELETE(full(key), exp), exp);
|
|
34616
|
+
const res = await doFetch(url2, { method: "DELETE" });
|
|
34617
|
+
if (!res.ok && res.status !== 404) {
|
|
34618
|
+
throw new Error(`blob delete failed (${res.status}) for ${key}`);
|
|
34619
|
+
}
|
|
34620
|
+
}
|
|
34621
|
+
},
|
|
34622
|
+
async list(options) {
|
|
34623
|
+
const rel = options.prefix ?? "";
|
|
34624
|
+
const exp = now() + ttl;
|
|
34625
|
+
const sig = await hmac(opts.signingKey, LIST(rel, exp));
|
|
34626
|
+
const params = new URLSearchParams({ exp: String(exp), sig });
|
|
34627
|
+
if (rel) params.set("prefix", rel);
|
|
34628
|
+
if (options.cursor) params.set("cursor", options.cursor);
|
|
34629
|
+
if (options.limit) params.set("limit", String(options.limit));
|
|
34630
|
+
const res = await doFetch(`${base}/?${params}`);
|
|
34631
|
+
if (!res.ok) throw new Error(`blob list failed (${res.status})`);
|
|
34632
|
+
return await res.json();
|
|
34633
|
+
}
|
|
34634
|
+
};
|
|
34635
|
+
}
|
|
34636
|
+
function toArrayBuffer(value) {
|
|
34637
|
+
if (value instanceof ArrayBuffer) return value;
|
|
34638
|
+
const view = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
34639
|
+
return view.slice().buffer;
|
|
34640
|
+
}
|
|
34641
|
+
function blobStoreFromEnv(env = process.env, overrides = {}) {
|
|
34642
|
+
const baseUrl = overrides.baseUrl ?? env.MCP_BLOB_BASE_URL;
|
|
34643
|
+
const signingKey = overrides.signingKey ?? env.MCP_BLOB_SIGNING_KEY;
|
|
34644
|
+
if (!baseUrl || !signingKey) return void 0;
|
|
34645
|
+
const bucket = createBlobBucket({ ...overrides, baseUrl, signingKey });
|
|
34646
|
+
return { bucket, baseUrl, signRead: bucket.signRead, signWrite: bucket.signWrite };
|
|
34647
|
+
}
|
|
34648
|
+
|
|
34216
34649
|
// src/session.ts
|
|
34217
34650
|
var SessionState = class {
|
|
34218
34651
|
/** Idempotency + async-handle registry for this session (issues #52/#53). */
|
|
@@ -34876,7 +35309,34 @@ var GeminiClient = class {
|
|
|
34876
35309
|
return { images, videos, audios, text: textParts.join("\n") || void 0, grounding };
|
|
34877
35310
|
}
|
|
34878
35311
|
};
|
|
34879
|
-
|
|
35312
|
+
function hostedStorage() {
|
|
35313
|
+
const blob = blobStoreFromEnv();
|
|
35314
|
+
if (!blob) return {};
|
|
35315
|
+
const tenant = () => tenantIdFor(readEnvVar("GEMINI_API_KEY") ?? "local");
|
|
35316
|
+
return {
|
|
35317
|
+
mediaSink: createR2Sink(blob.bucket, {
|
|
35318
|
+
signedBaseUrl: blob.baseUrl,
|
|
35319
|
+
sign: blob.signRead,
|
|
35320
|
+
urlTtlMs: BLOB_URL_TTL_MS,
|
|
35321
|
+
// Hard ceiling on any PER-PERSIST override. `gemini_image_set` asks for
|
|
35322
|
+
// a 7-day link (SET_URL_TTL_MS) — reasonable against a bucket we own,
|
|
35323
|
+
// but the blob store refuses any signature over 24h, so without this
|
|
35324
|
+
// clamp every set URL and bundle_url would be minted already-invalid and
|
|
35325
|
+
// 403 on first click. The sink clamps with Math.min, so this only ever
|
|
35326
|
+
// shortens.
|
|
35327
|
+
maxUrlTtlMs: BLOB_MAX_TTL_MS,
|
|
35328
|
+
// Signed uploads (`up/`) and the library (`lib/`) are readable by the
|
|
35329
|
+
// session that owns them; writes still go only under `gen/`.
|
|
35330
|
+
readPrefixes: ["up", "lib"],
|
|
35331
|
+
tenant
|
|
35332
|
+
}),
|
|
35333
|
+
library: createR2Library(blob.bucket, { tenant }),
|
|
35334
|
+
uploadUrls: createUploadUrlMinter({ baseUrl: blob.baseUrl, sign: blob.signWrite, tenant })
|
|
35335
|
+
};
|
|
35336
|
+
}
|
|
35337
|
+
var BLOB_URL_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
35338
|
+
var BLOB_MAX_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
35339
|
+
var client = new GeminiClient(hostedStorage());
|
|
34880
35340
|
|
|
34881
35341
|
// src/tools/interact.ts
|
|
34882
35342
|
init_images();
|
|
@@ -35480,12 +35940,238 @@ function registerFileTools(server, client2) {
|
|
|
35480
35940
|
);
|
|
35481
35941
|
}
|
|
35482
35942
|
|
|
35943
|
+
// src/tools/uploads.ts
|
|
35944
|
+
init_zod();
|
|
35945
|
+
init_dist();
|
|
35946
|
+
function registerUploadUrlTools(server, client2) {
|
|
35947
|
+
const minter = client2.uploadUrls;
|
|
35948
|
+
if (!minter) return;
|
|
35949
|
+
server.registerTool(
|
|
35950
|
+
"gemini_get_upload_url",
|
|
35951
|
+
{
|
|
35952
|
+
description: `Mint a short-lived (~10 min) signed PUT URL for uploading one reference image to this connector with NO auth headers \u2014 usable from any shell: curl -sS -X PUT -H "Content-Type: image/jpeg" --data-binary @photo.jpg "<upload_url>". The response to the PUT returns an \`r2_key\` to reference the upload: pass it in \`images_r2_keys\` on generation tools, save it permanently with gemini_save_character, or convert it to a ~48h Files API reference with gemini_upload_file({ r2_key }). Prefer this over images_base64 (which costs ~14k tokens per photo) whenever the caller has a shell. Images only, up to ${wholeMb(UPLOAD_MAX_BYTES)}MB.`,
|
|
35953
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
35954
|
+
inputSchema: {
|
|
35955
|
+
filename: external_exports.string().min(1).max(120).describe('Filename of the upload (e.g. "finn.jpg") \u2014 sanitized into the object key and the suggested curl command'),
|
|
35956
|
+
content_type: external_exports.string().regex(RASTER_IMAGE_TYPE_PATTERN, "must be a raster image MIME type like image/jpeg (SVG is not accepted)").describe("MIME type of the bytes that will be PUT \u2014 raster images only (jpeg/png/webp/gif/avif/heic/heif/bmp/tiff; not SVG). The PUT must send exactly this Content-Type.")
|
|
35957
|
+
}
|
|
35958
|
+
},
|
|
35959
|
+
async (args) => {
|
|
35960
|
+
let minted;
|
|
35961
|
+
try {
|
|
35962
|
+
minted = await minter.mint(args.filename, args.content_type);
|
|
35963
|
+
} catch (err) {
|
|
35964
|
+
throw new McpToolError(err instanceof Error ? err.message : String(err));
|
|
35965
|
+
}
|
|
35966
|
+
return textResult({
|
|
35967
|
+
upload_url: minted.url,
|
|
35968
|
+
method: "PUT",
|
|
35969
|
+
r2_key: minted.key,
|
|
35970
|
+
content_type: minted.contentType,
|
|
35971
|
+
expires_at: new Date(minted.expiresAtMs).toISOString(),
|
|
35972
|
+
max_bytes: UPLOAD_MAX_BYTES,
|
|
35973
|
+
curl_hint: `curl -sS -X PUT -H "Content-Type: ${minted.contentType}" --data-binary @${args.filename} "${minted.url}"`,
|
|
35974
|
+
hint: "PUT the raw bytes within ~10 minutes; no Authorization header is needed (the signature in the URL is the auth). Then reference the returned r2_key: images_r2_keys on generation tools (master_images_r2_keys on gemini_image_set), gemini_save_character to keep it with no expiry, or gemini_upload_file({ r2_key }) for a ~48h files/\u2026 reference. Uploads themselves follow the media retention schedule (default 7 days)."
|
|
35975
|
+
});
|
|
35976
|
+
}
|
|
35977
|
+
);
|
|
35978
|
+
}
|
|
35979
|
+
|
|
35980
|
+
// src/tools/library.ts
|
|
35981
|
+
init_zod();
|
|
35982
|
+
init_dist();
|
|
35983
|
+
var NAME_FIELD = external_exports.string().regex(LIBRARY_NAME_PATTERN, 'must be 1-40 lowercase letters, digits, "-" or "_"').describe('Library name (slug): 1-40 lowercase letters, digits, "-" or "_", e.g. "finn" or "bold-cartoon-sports"');
|
|
35984
|
+
var USE_CHARACTERS_HINT = 'Pass characters: ["<name>", \u2026] on gemini_image_generate / gemini_image_edit / gemini_image_set and the saved reference image + description are attached to the request automatically \u2014 nothing to re-upload and no bytes in the conversation.';
|
|
35985
|
+
var USE_STYLE_HINT = 'Pass style: "<name>" on gemini_image_generate / gemini_image_edit / gemini_image_set and the saved prompt fragment (and reference image, if any) are applied automatically.';
|
|
35986
|
+
async function resolveLibraryImage(client2, args, required2) {
|
|
35987
|
+
if (args.image_r2_key && args.image_url) {
|
|
35988
|
+
throw new McpToolError("Provide `image_r2_key` OR `image_url`, not both.");
|
|
35989
|
+
}
|
|
35990
|
+
const rasterOnly = (image) => {
|
|
35991
|
+
if (!acceptableUploadType(image.mimeType)) {
|
|
35992
|
+
throw new McpToolError(
|
|
35993
|
+
`The reference image is "${image.mimeType}", but the library accepts raster images only (jpeg/png/webp/gif/avif/heic/heif/bmp/tiff \u2014 not SVG, which can carry scripts). Convert it to PNG or JPEG first.`
|
|
35994
|
+
);
|
|
35995
|
+
}
|
|
35996
|
+
return image;
|
|
35997
|
+
};
|
|
35998
|
+
if (args.image_r2_key) {
|
|
35999
|
+
return rasterOnly(await client2.readStoredMedia(args.image_r2_key));
|
|
36000
|
+
}
|
|
36001
|
+
if (args.image_url) {
|
|
36002
|
+
const fetched = await client2.fetchRemoteImage(args.image_url);
|
|
36003
|
+
return rasterOnly({ bytes: fetched.bytes, mimeType: fetched.mimeType });
|
|
36004
|
+
}
|
|
36005
|
+
if (required2) {
|
|
36006
|
+
throw new McpToolError(
|
|
36007
|
+
"Provide the reference image via `image_r2_key` (from gemini_get_upload_url + PUT, or a generation result's media[].r2_key) or `image_url` (a public https URL the server fetches)."
|
|
36008
|
+
);
|
|
36009
|
+
}
|
|
36010
|
+
return void 0;
|
|
36011
|
+
}
|
|
36012
|
+
function registerLibraryTools(server, client2) {
|
|
36013
|
+
const library = client2.library;
|
|
36014
|
+
if (!library) return;
|
|
36015
|
+
server.registerTool(
|
|
36016
|
+
"gemini_save_character",
|
|
36017
|
+
{
|
|
36018
|
+
description: "Save a named character to this account's persistent reference library: one reference image plus a short description. Saved characters have NO expiry \u2014 unlike uploads (~retention window) and Files API references (~48h) \u2014 so a name saved once keeps working in every later session. Re-saving a name replaces it. " + USE_CHARACTERS_HINT,
|
|
36019
|
+
annotations: { readOnlyHint: false, openWorldHint: false },
|
|
36020
|
+
inputSchema: {
|
|
36021
|
+
name: NAME_FIELD,
|
|
36022
|
+
description: external_exports.string().min(1).describe("Short prose description woven into generation prompts (age, look, defining features, species\u2026)"),
|
|
36023
|
+
image_r2_key: external_exports.string().min(1).optional().describe("Reference image already in this connector's store: an `r2_key` from gemini_get_upload_url + PUT, or from a generation result's media[].r2_key"),
|
|
36024
|
+
image_url: external_exports.string().url().optional().describe("Reference image as a public https URL the SERVER fetches")
|
|
36025
|
+
}
|
|
36026
|
+
},
|
|
36027
|
+
async (args, extra) => {
|
|
36028
|
+
const image = await withProgressHeartbeat(
|
|
36029
|
+
extra,
|
|
36030
|
+
"Loading the reference image",
|
|
36031
|
+
() => resolveLibraryImage(client2, args, true)
|
|
36032
|
+
);
|
|
36033
|
+
const record2 = await library.saveCharacter({ name: args.name, description: args.description, image });
|
|
36034
|
+
return textResult({
|
|
36035
|
+
saved: "character",
|
|
36036
|
+
name: record2.name,
|
|
36037
|
+
description: record2.description,
|
|
36038
|
+
mime_type: record2.mime_type,
|
|
36039
|
+
created_at: record2.created_at,
|
|
36040
|
+
updated_at: record2.updated_at,
|
|
36041
|
+
hint: USE_CHARACTERS_HINT
|
|
36042
|
+
});
|
|
36043
|
+
}
|
|
36044
|
+
);
|
|
36045
|
+
server.registerTool(
|
|
36046
|
+
"gemini_list_characters",
|
|
36047
|
+
{
|
|
36048
|
+
description: "List this account's saved characters (persistent reference library): names, descriptions and timestamps. " + USE_CHARACTERS_HINT,
|
|
36049
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
36050
|
+
inputSchema: {}
|
|
36051
|
+
},
|
|
36052
|
+
async () => {
|
|
36053
|
+
const characters = await library.listCharacters();
|
|
36054
|
+
return textResult({
|
|
36055
|
+
count: characters.length,
|
|
36056
|
+
characters: characters.map((c) => ({
|
|
36057
|
+
name: c.name,
|
|
36058
|
+
description: c.description,
|
|
36059
|
+
mime_type: c.mime_type,
|
|
36060
|
+
created_at: c.created_at,
|
|
36061
|
+
updated_at: c.updated_at
|
|
36062
|
+
})),
|
|
36063
|
+
hint: characters.length ? USE_CHARACTERS_HINT : "No saved characters yet. Save one with gemini_save_character (image via image_r2_key or image_url)."
|
|
36064
|
+
});
|
|
36065
|
+
}
|
|
36066
|
+
);
|
|
36067
|
+
server.registerTool(
|
|
36068
|
+
"gemini_delete_character",
|
|
36069
|
+
{
|
|
36070
|
+
description: "Delete a saved character from this account's reference library. Generation calls naming it will then fail until it is re-saved.",
|
|
36071
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
36072
|
+
inputSchema: { name: NAME_FIELD, confirm: schemaConfirm }
|
|
36073
|
+
},
|
|
36074
|
+
async (args) => {
|
|
36075
|
+
const gate = previewUnlessConfirmed(args.confirm, "Delete a saved character (its reference image and description)", "DELETE", `characters/${args.name}`);
|
|
36076
|
+
if (gate) return gate;
|
|
36077
|
+
const existed = await library.deleteCharacter(args.name);
|
|
36078
|
+
if (!existed) {
|
|
36079
|
+
throw new McpToolError(`No saved character "${args.name}". List what exists with gemini_list_characters.`);
|
|
36080
|
+
}
|
|
36081
|
+
return textResult({ deleted: "character", name: args.name });
|
|
36082
|
+
}
|
|
36083
|
+
);
|
|
36084
|
+
server.registerTool(
|
|
36085
|
+
"gemini_save_style",
|
|
36086
|
+
{
|
|
36087
|
+
description: "Save a named style preset to this account's persistent reference library: a reusable prompt fragment (and optionally a reference image) that a single word then applies to any generation. No expiry; re-saving a name replaces it. " + USE_STYLE_HINT,
|
|
36088
|
+
annotations: { readOnlyHint: false, openWorldHint: false },
|
|
36089
|
+
inputSchema: {
|
|
36090
|
+
name: NAME_FIELD,
|
|
36091
|
+
prompt_fragment: external_exports.string().min(1).describe('The style text appended to generation prompts, e.g. "bold cartoon style, thick outlines, saturated colors"'),
|
|
36092
|
+
image_r2_key: external_exports.string().min(1).optional().describe("Optional style reference image already in this connector's store (an r2_key)"),
|
|
36093
|
+
image_url: external_exports.string().url().optional().describe("Optional style reference image as a public https URL the SERVER fetches")
|
|
36094
|
+
}
|
|
36095
|
+
},
|
|
36096
|
+
async (args, extra) => {
|
|
36097
|
+
const image = await withProgressHeartbeat(
|
|
36098
|
+
extra,
|
|
36099
|
+
"Loading the style reference image",
|
|
36100
|
+
() => resolveLibraryImage(client2, args, false)
|
|
36101
|
+
);
|
|
36102
|
+
const record2 = await library.saveStyle({ name: args.name, promptFragment: args.prompt_fragment, image });
|
|
36103
|
+
return textResult({
|
|
36104
|
+
saved: "style",
|
|
36105
|
+
name: record2.name,
|
|
36106
|
+
prompt_fragment: record2.prompt_fragment,
|
|
36107
|
+
...record2.image_key ? { has_reference_image: true } : {},
|
|
36108
|
+
created_at: record2.created_at,
|
|
36109
|
+
updated_at: record2.updated_at,
|
|
36110
|
+
hint: USE_STYLE_HINT
|
|
36111
|
+
});
|
|
36112
|
+
}
|
|
36113
|
+
);
|
|
36114
|
+
server.registerTool(
|
|
36115
|
+
"gemini_list_styles",
|
|
36116
|
+
{
|
|
36117
|
+
description: "List this account's saved style presets (persistent reference library). " + USE_STYLE_HINT,
|
|
36118
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
36119
|
+
inputSchema: {}
|
|
36120
|
+
},
|
|
36121
|
+
async () => {
|
|
36122
|
+
const styles = await library.listStyles();
|
|
36123
|
+
return textResult({
|
|
36124
|
+
count: styles.length,
|
|
36125
|
+
styles: styles.map((s) => ({
|
|
36126
|
+
name: s.name,
|
|
36127
|
+
prompt_fragment: s.prompt_fragment,
|
|
36128
|
+
...s.image_key ? { has_reference_image: true } : {},
|
|
36129
|
+
created_at: s.created_at,
|
|
36130
|
+
updated_at: s.updated_at
|
|
36131
|
+
})),
|
|
36132
|
+
hint: styles.length ? USE_STYLE_HINT : "No saved styles yet. Save one with gemini_save_style."
|
|
36133
|
+
});
|
|
36134
|
+
}
|
|
36135
|
+
);
|
|
36136
|
+
server.registerTool(
|
|
36137
|
+
"gemini_delete_style",
|
|
36138
|
+
{
|
|
36139
|
+
description: "Delete a saved style preset from this account's reference library.",
|
|
36140
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
36141
|
+
inputSchema: { name: NAME_FIELD, confirm: schemaConfirm }
|
|
36142
|
+
},
|
|
36143
|
+
async (args) => {
|
|
36144
|
+
const gate = previewUnlessConfirmed(args.confirm, "Delete a saved style preset", "DELETE", `styles/${args.name}`);
|
|
36145
|
+
if (gate) return gate;
|
|
36146
|
+
const existed = await library.deleteStyle(args.name);
|
|
36147
|
+
if (!existed) {
|
|
36148
|
+
throw new McpToolError(`No saved style "${args.name}". List what exists with gemini_list_styles.`);
|
|
36149
|
+
}
|
|
36150
|
+
return textResult({ deleted: "style", name: args.name });
|
|
36151
|
+
}
|
|
36152
|
+
);
|
|
36153
|
+
}
|
|
36154
|
+
|
|
35483
36155
|
// src/index.ts
|
|
35484
36156
|
await loadStdioDotenv();
|
|
35485
36157
|
await runMcp({
|
|
35486
36158
|
name: "gemini-mcp",
|
|
35487
36159
|
version: VERSION,
|
|
35488
36160
|
banner: "[gemini-mcp] This project was developed and is maintained by AI (Claude). Use at your own discretion.",
|
|
35489
|
-
tools: [
|
|
36161
|
+
tools: [
|
|
36162
|
+
registerModelTools,
|
|
36163
|
+
registerGenerateTools,
|
|
36164
|
+
registerSetTools,
|
|
36165
|
+
registerInteractTools,
|
|
36166
|
+
registerVideoTools,
|
|
36167
|
+
registerMusicTools,
|
|
36168
|
+
registerJobTools,
|
|
36169
|
+
registerFileTools,
|
|
36170
|
+
// Both gate on the client having somewhere to put bytes: hosted with a
|
|
36171
|
+
// blob store they register, and on a local install they no-op rather than
|
|
36172
|
+
// advertising a tool that cannot work.
|
|
36173
|
+
registerUploadUrlTools,
|
|
36174
|
+
registerLibraryTools
|
|
36175
|
+
],
|
|
35490
36176
|
deps: client
|
|
35491
36177
|
});
|