gogcli-mcp 3.0.0 → 4.0.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/dist/index.js +474 -947
- package/dist/lib.js +575 -983
- package/manifest.json +2 -2
- package/mint.yaml +41 -37
- package/package.json +3 -3
- package/server.json +2 -2
- package/src/attachments.ts +28 -34
- package/src/blob-upload.ts +165 -134
- package/src/blob-urls.ts +3 -5
- package/src/bootstrap-auth.ts +97 -0
- package/src/index.ts +3 -4
- package/src/lib.ts +14 -9
- package/src/runner.ts +27 -176
- package/src/tools/appscript.ts +1 -1
- package/src/tools/auth.ts +5 -5
- package/src/tools/drive.ts +1 -3
- package/src/tools/gmail.ts +9 -9
- package/src/tools/utils.ts +12 -58
- package/tests/attachments.test.ts +11 -14
- package/tests/blob-upload.test.ts +235 -160
- package/tests/bootstrap-auth.test.ts +245 -0
- package/tests/runner-file-args.test.ts +1 -13
- package/tests/runner.test.ts +53 -96
- package/tests/sdk-single-copy.test.ts +4 -12
- package/tests/tools/auth-401-shapes.test.ts +2 -3
- package/tests/tools/auth.test.ts +5 -4
- package/tests/tools/drive.test.ts +11 -3
- package/tests/tools/gmail.test.ts +2 -2
- package/tests/tools/utils.test.ts +1 -50
- package/tests/zod-single-copy.test.ts +6 -14
- package/tsconfig.json +1 -2
- package/vitest.config.ts +2 -12
- package/src/auth-log.ts +0 -205
- package/src/connector-auth.ts +0 -319
- package/src/connector-login.ts +0 -87
- package/src/connector-runtime.ts +0 -910
- package/src/google-probe.ts +0 -113
- package/src/google-token.ts +0 -391
- package/src/remote-runner.ts +0 -77
- package/src/worker.ts +0 -117
- package/tests/auth-log.test.ts +0 -530
- package/tests/connector-auth.test.ts +0 -559
- package/tests/connector-login.test.ts +0 -151
- package/tests/connector-runtime.test.ts +0 -1664
- package/tests/google-probe.test.ts +0 -116
- package/tests/google-token.test.ts +0 -425
- package/tests/remote-runner.test.ts +0 -202
- package/tests/worker.test.ts +0 -167
package/dist/lib.js
CHANGED
|
@@ -74,7 +74,6 @@ __export(external_exports, {
|
|
|
74
74
|
ZodPrefault: () => ZodPrefault,
|
|
75
75
|
ZodPreprocess: () => ZodPreprocess,
|
|
76
76
|
ZodPromise: () => ZodPromise,
|
|
77
|
-
ZodProperties: () => ZodProperties,
|
|
78
77
|
ZodReadonly: () => ZodReadonly,
|
|
79
78
|
ZodRealError: () => ZodRealError,
|
|
80
79
|
ZodRecord: () => ZodRecord,
|
|
@@ -118,6 +117,7 @@ __export(external_exports, {
|
|
|
118
117
|
creditCard: () => creditCard2,
|
|
119
118
|
cuid: () => cuid3,
|
|
120
119
|
cuid2: () => cuid22,
|
|
120
|
+
currencyCode: () => currencyCode2,
|
|
121
121
|
custom: () => custom,
|
|
122
122
|
date: () => date2,
|
|
123
123
|
decode: () => decode2,
|
|
@@ -211,7 +211,7 @@ __export(external_exports, {
|
|
|
211
211
|
preprocess: () => preprocess,
|
|
212
212
|
prettifyError: () => prettifyError,
|
|
213
213
|
promise: () => promise,
|
|
214
|
-
properties: () =>
|
|
214
|
+
properties: () => _properties,
|
|
215
215
|
property: () => _property,
|
|
216
216
|
readonly: () => readonly,
|
|
217
217
|
record: () => record,
|
|
@@ -299,6 +299,7 @@ __export(core_exports2, {
|
|
|
299
299
|
$ZodCheckMultipleOf: () => $ZodCheckMultipleOf,
|
|
300
300
|
$ZodCheckNumberFormat: () => $ZodCheckNumberFormat,
|
|
301
301
|
$ZodCheckOverwrite: () => $ZodCheckOverwrite,
|
|
302
|
+
$ZodCheckProperties: () => $ZodCheckProperties,
|
|
302
303
|
$ZodCheckProperty: () => $ZodCheckProperty,
|
|
303
304
|
$ZodCheckRegex: () => $ZodCheckRegex,
|
|
304
305
|
$ZodCheckSizeEquals: () => $ZodCheckSizeEquals,
|
|
@@ -352,7 +353,6 @@ __export(core_exports2, {
|
|
|
352
353
|
$ZodPrefault: () => $ZodPrefault,
|
|
353
354
|
$ZodPreprocess: () => $ZodPreprocess,
|
|
354
355
|
$ZodPromise: () => $ZodPromise,
|
|
355
|
-
$ZodProperties: () => $ZodProperties,
|
|
356
356
|
$ZodReadonly: () => $ZodReadonly,
|
|
357
357
|
$ZodRealError: () => $ZodRealError,
|
|
358
358
|
$ZodRecord: () => $ZodRecord,
|
|
@@ -520,6 +520,7 @@ __export(core_exports2, {
|
|
|
520
520
|
_xor: () => _xor,
|
|
521
521
|
base64Charset: () => base64Charset,
|
|
522
522
|
base64urlCharset: () => base64urlCharset,
|
|
523
|
+
canParseURL: () => canParseURL,
|
|
523
524
|
clone: () => clone,
|
|
524
525
|
compile: () => compile,
|
|
525
526
|
compileFn: () => compileFn,
|
|
@@ -542,7 +543,6 @@ __export(core_exports2, {
|
|
|
542
543
|
initializeContext: () => initializeContext,
|
|
543
544
|
isBackEdge: () => isBackEdge,
|
|
544
545
|
isRecursiveSchema: () => isRecursiveSchema,
|
|
545
|
-
isTransforming: () => isTransforming,
|
|
546
546
|
isValidBase64: () => isValidBase64,
|
|
547
547
|
isValidBase64URL: () => isValidBase64URL,
|
|
548
548
|
isValidCIDRv6: () => isValidCIDRv6,
|
|
@@ -579,6 +579,7 @@ __export(core_exports2, {
|
|
|
579
579
|
util: () => util_exports,
|
|
580
580
|
validate: () => validate,
|
|
581
581
|
validateAsync: () => validateAsync,
|
|
582
|
+
validateURL: () => validateURL,
|
|
582
583
|
version: () => version,
|
|
583
584
|
withParser: () => withParser
|
|
584
585
|
});
|
|
@@ -1320,9 +1321,6 @@ function members(proto, table) {
|
|
|
1320
1321
|
else
|
|
1321
1322
|
defineBound(proto, key, desc.value);
|
|
1322
1323
|
}
|
|
1323
|
-
for (const sym of Object.getOwnPropertySymbols(table)) {
|
|
1324
|
-
defineBound(proto, sym, table[sym]);
|
|
1325
|
-
}
|
|
1326
1324
|
}
|
|
1327
1325
|
function own(inst, key, value, enumerable = true) {
|
|
1328
1326
|
Object.defineProperty(inst, key, { configurable: true, writable: true, enumerable, value });
|
|
@@ -1475,8 +1473,7 @@ function $constructor(name, initializer3, proto, params) {
|
|
|
1475
1473
|
} finally {
|
|
1476
1474
|
_zodDesc.value = void 0;
|
|
1477
1475
|
}
|
|
1478
|
-
}
|
|
1479
|
-
if (inst._zod.traits.has(name)) {
|
|
1476
|
+
} else if (inst._zod.traits.has(name)) {
|
|
1480
1477
|
return;
|
|
1481
1478
|
}
|
|
1482
1479
|
inst._zod.traits.add(name);
|
|
@@ -1918,6 +1915,7 @@ __export(regexes_exports, {
|
|
|
1918
1915
|
creditCard: () => creditCard,
|
|
1919
1916
|
cuid: () => cuid,
|
|
1920
1917
|
cuid2: () => cuid2,
|
|
1918
|
+
currencyCode: () => currencyCode,
|
|
1921
1919
|
date: () => date,
|
|
1922
1920
|
datetime: () => datetime,
|
|
1923
1921
|
domain: () => domain,
|
|
@@ -2016,6 +2014,7 @@ var domain = /^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a
|
|
|
2016
2014
|
var httpProtocol = /^https?$/;
|
|
2017
2015
|
var e164 = /^\+[1-9]\d{6,14}$/;
|
|
2018
2016
|
var creditCard = /^\d(?:[ -]?\d){11,18}$/;
|
|
2017
|
+
var currencyCode = /^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/;
|
|
2019
2018
|
var iban = /^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/;
|
|
2020
2019
|
var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
2021
2020
|
function anchor(source) {
|
|
@@ -2500,6 +2499,34 @@ var $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst,
|
|
|
2500
2499
|
return;
|
|
2501
2500
|
};
|
|
2502
2501
|
});
|
|
2502
|
+
var $ZodCheckProperties = /* @__PURE__ */ $constructor("$ZodCheckProperties", (inst, def) => {
|
|
2503
|
+
$ZodCheck.init(inst, def);
|
|
2504
|
+
hide(inst, Symbol.iterator, function* () {
|
|
2505
|
+
yield inst;
|
|
2506
|
+
});
|
|
2507
|
+
let entries;
|
|
2508
|
+
inst._zod.check = (payload) => {
|
|
2509
|
+
if (payload.value == null) {
|
|
2510
|
+
payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
|
|
2511
|
+
return void 0;
|
|
2512
|
+
}
|
|
2513
|
+
entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
|
|
2514
|
+
const input2 = payload.value;
|
|
2515
|
+
let proms;
|
|
2516
|
+
for (const [key, schema] of entries) {
|
|
2517
|
+
const result = schema._zod.run({ value: input2[key], issues: [] }, {});
|
|
2518
|
+
if (result instanceof Promise) {
|
|
2519
|
+
proms ?? (proms = []);
|
|
2520
|
+
proms.push(result.then((result2) => handleCheckPropertyResult(result2, payload, key)));
|
|
2521
|
+
} else {
|
|
2522
|
+
handleCheckPropertyResult(result, payload, key);
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
if (proms)
|
|
2526
|
+
return Promise.all(proms).then(() => void 0);
|
|
2527
|
+
return void 0;
|
|
2528
|
+
};
|
|
2529
|
+
});
|
|
2503
2530
|
var $ZodCheckMimeType = /* @__PURE__ */ $constructor("$ZodCheckMimeType", (inst, def) => {
|
|
2504
2531
|
$ZodCheck.init(inst, def);
|
|
2505
2532
|
const mimeSet = new Set(def.mime);
|
|
@@ -2567,7 +2594,7 @@ ${content.join("\n")}
|
|
|
2567
2594
|
var version = {
|
|
2568
2595
|
major: 4,
|
|
2569
2596
|
minor: 6,
|
|
2570
|
-
patch:
|
|
2597
|
+
patch: 5
|
|
2571
2598
|
};
|
|
2572
2599
|
|
|
2573
2600
|
// ../../node_modules/zod/v4/core/schemas.js
|
|
@@ -2755,11 +2782,32 @@ var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
|
2755
2782
|
});
|
|
2756
2783
|
var URL_BAD_FORMAT = 1;
|
|
2757
2784
|
var URL_UNPARSEABLE = 2;
|
|
2785
|
+
function canParseURL(input2) {
|
|
2786
|
+
try {
|
|
2787
|
+
if (typeof URL !== "undefined" && typeof URL.canParse === "function")
|
|
2788
|
+
return URL.canParse(input2);
|
|
2789
|
+
new URL(input2);
|
|
2790
|
+
return true;
|
|
2791
|
+
} catch {
|
|
2792
|
+
return false;
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
function validateURL(trimmed, def) {
|
|
2796
|
+
if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
|
|
2797
|
+
return canParseURL(trimmed) || URL_UNPARSEABLE;
|
|
2798
|
+
}
|
|
2799
|
+
return parseURLObject(trimmed, def);
|
|
2800
|
+
}
|
|
2758
2801
|
function parseURLObject(trimmed, def) {
|
|
2759
2802
|
if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
|
|
2760
2803
|
return URL_BAD_FORMAT;
|
|
2761
2804
|
}
|
|
2762
2805
|
try {
|
|
2806
|
+
if (typeof URL !== "undefined") {
|
|
2807
|
+
const URLStatic = URL;
|
|
2808
|
+
if (typeof URLStatic.parse === "function")
|
|
2809
|
+
return URLStatic.parse(trimmed) ?? URL_UNPARSEABLE;
|
|
2810
|
+
}
|
|
2763
2811
|
return new URL(trimmed);
|
|
2764
2812
|
} catch {
|
|
2765
2813
|
return URL_UNPARSEABLE;
|
|
@@ -2782,7 +2830,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
2782
2830
|
inst._zod.check = (payload) => {
|
|
2783
2831
|
try {
|
|
2784
2832
|
const trimmed = payload.value.trim();
|
|
2785
|
-
const url2 =
|
|
2833
|
+
const url2 = validateURL(trimmed, def);
|
|
2786
2834
|
if (url2 === URL_BAD_FORMAT) {
|
|
2787
2835
|
payload.issues.push({
|
|
2788
2836
|
code: "invalid_format",
|
|
@@ -2804,6 +2852,10 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
2804
2852
|
});
|
|
2805
2853
|
return;
|
|
2806
2854
|
}
|
|
2855
|
+
if (url2 === true) {
|
|
2856
|
+
payload.value = stripTabAndNewline(trimmed);
|
|
2857
|
+
return;
|
|
2858
|
+
}
|
|
2807
2859
|
if (def.hostname && !urlHostnameOk(url2, def.hostname)) {
|
|
2808
2860
|
payload.issues.push({
|
|
2809
2861
|
code: "invalid_format",
|
|
@@ -2893,12 +2945,7 @@ var ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
|
2893
2945
|
function isValidIPv6(value) {
|
|
2894
2946
|
if (!ipv6Alphabet.test(value))
|
|
2895
2947
|
return false;
|
|
2896
|
-
|
|
2897
|
-
new URL(`http://[${value}]`);
|
|
2898
|
-
return true;
|
|
2899
|
-
} catch {
|
|
2900
|
-
return false;
|
|
2901
|
-
}
|
|
2948
|
+
return canParseURL(`http://[${value}]`);
|
|
2902
2949
|
}
|
|
2903
2950
|
var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
2904
2951
|
def.pattern ?? (def.pattern = ipv6);
|
|
@@ -3371,7 +3418,7 @@ function handlePropertyResult(result, final, key, input2, optin, optout) {
|
|
|
3371
3418
|
return;
|
|
3372
3419
|
}
|
|
3373
3420
|
if (result.value === void 0) {
|
|
3374
|
-
if (isPresent) {
|
|
3421
|
+
if (isPresent || optin === "defaulted" && !isOptionalOut) {
|
|
3375
3422
|
final.value[key] = void 0;
|
|
3376
3423
|
}
|
|
3377
3424
|
} else {
|
|
@@ -3607,16 +3654,16 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3607
3654
|
doc.write(`
|
|
3608
3655
|
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
3609
3656
|
}
|
|
3610
|
-
|
|
3611
|
-
if (
|
|
3612
|
-
|
|
3613
|
-
newResult[${k}] = undefined;
|
|
3614
|
-
}
|
|
3657
|
+
`);
|
|
3658
|
+
if (optin === "defaulted") {
|
|
3659
|
+
doc.write(`newResult[${k}] = ${id}.value;`);
|
|
3615
3660
|
} else {
|
|
3661
|
+
doc.write(`
|
|
3662
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
3616
3663
|
newResult[${k}] = ${id}.value;
|
|
3617
3664
|
}
|
|
3618
|
-
|
|
3619
3665
|
`);
|
|
3666
|
+
}
|
|
3620
3667
|
}
|
|
3621
3668
|
}
|
|
3622
3669
|
doc.write(`payload.value = newResult;`);
|
|
@@ -4963,59 +5010,6 @@ function handleRefineResult(result, payload, input2, inst) {
|
|
|
4963
5010
|
payload.issues.push(issue(_iss));
|
|
4964
5011
|
}
|
|
4965
5012
|
}
|
|
4966
|
-
function handlePropertiesResult(result, payload, key) {
|
|
4967
|
-
if (result.issues.length) {
|
|
4968
|
-
payload.issues.push(...prefixIssues(key, result.issues));
|
|
4969
|
-
}
|
|
4970
|
-
}
|
|
4971
|
-
var $ZodProperties = /* @__PURE__ */ $constructor("$ZodProperties", (inst, def) => {
|
|
4972
|
-
$ZodType.init(inst, def);
|
|
4973
|
-
$ZodCheck.init(inst, def);
|
|
4974
|
-
const memo3 = globalConfig.memoizer;
|
|
4975
|
-
memo3?.attach(inst);
|
|
4976
|
-
let entries;
|
|
4977
|
-
const runShape = (payload, ctx) => {
|
|
4978
|
-
entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
|
|
4979
|
-
const input2 = payload.value;
|
|
4980
|
-
let proms;
|
|
4981
|
-
for (const [key, schema] of entries) {
|
|
4982
|
-
const result = schema._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
4983
|
-
if (result instanceof Promise) {
|
|
4984
|
-
proms ?? (proms = []);
|
|
4985
|
-
proms.push(result.then((result2) => handlePropertiesResult(result2, payload, key)));
|
|
4986
|
-
} else {
|
|
4987
|
-
handlePropertiesResult(result, payload, key);
|
|
4988
|
-
}
|
|
4989
|
-
}
|
|
4990
|
-
if (proms)
|
|
4991
|
-
return Promise.all(proms).then(() => void 0);
|
|
4992
|
-
return void 0;
|
|
4993
|
-
};
|
|
4994
|
-
inst._zod.parse = (payload, ctx) => {
|
|
4995
|
-
const input2 = payload.value;
|
|
4996
|
-
if (input2 === null || typeof input2 !== "object" && typeof input2 !== "function") {
|
|
4997
|
-
payload.issues.push({ expected: "object", code: "invalid_type", input: input2, inst });
|
|
4998
|
-
return payload;
|
|
4999
|
-
}
|
|
5000
|
-
if (ctx.direction === "backward")
|
|
5001
|
-
ctx = { ...ctx, direction: "forward" };
|
|
5002
|
-
if (memo3)
|
|
5003
|
-
memo3.alloc(inst, payload, input2, ctx);
|
|
5004
|
-
const result = runShape(payload, ctx);
|
|
5005
|
-
return result instanceof Promise ? result.then(() => payload) : payload;
|
|
5006
|
-
};
|
|
5007
|
-
inst._zod.check = (payload) => {
|
|
5008
|
-
if (payload.value == null) {
|
|
5009
|
-
payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
|
|
5010
|
-
return void 0;
|
|
5011
|
-
}
|
|
5012
|
-
return runShape(payload, {});
|
|
5013
|
-
};
|
|
5014
|
-
}, {
|
|
5015
|
-
*[Symbol.iterator]() {
|
|
5016
|
-
yield this;
|
|
5017
|
-
}
|
|
5018
|
-
});
|
|
5019
5013
|
|
|
5020
5014
|
// ../../node_modules/zod/v4/core/memoizer.js
|
|
5021
5015
|
var $ZodCyclicError = class extends Error {
|
|
@@ -5027,7 +5021,7 @@ var $ZodCyclicError = class extends Error {
|
|
|
5027
5021
|
var STATE = "~memo";
|
|
5028
5022
|
var NO_ISSUES = [];
|
|
5029
5023
|
function isRef(value) {
|
|
5030
|
-
return value !== null &&
|
|
5024
|
+
return value !== null && typeof value === "object";
|
|
5031
5025
|
}
|
|
5032
5026
|
function cloneIssues(issues) {
|
|
5033
5027
|
return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
|
|
@@ -5076,9 +5070,6 @@ function isRecursive(inst, stack, resolve) {
|
|
|
5076
5070
|
check2(def.catchall);
|
|
5077
5071
|
break;
|
|
5078
5072
|
}
|
|
5079
|
-
case "properties":
|
|
5080
|
-
merge2(shape(def.shape, false));
|
|
5081
|
-
break;
|
|
5082
5073
|
case "array":
|
|
5083
5074
|
check2(def.element);
|
|
5084
5075
|
break;
|
|
@@ -5406,6 +5397,7 @@ var error = () => {
|
|
|
5406
5397
|
json_string: "\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",
|
|
5407
5398
|
e164: "\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",
|
|
5408
5399
|
credit_card: "\u0631\u0642\u0645 \u0628\u0637\u0627\u0642\u0629 \u0627\u0644\u0627\u0626\u062A\u0645\u0627\u0646",
|
|
5400
|
+
currency_code: "\u0631\u0645\u0632 \u0627\u0644\u0639\u0645\u0644\u0629",
|
|
5409
5401
|
iban: "IBAN",
|
|
5410
5402
|
jwt: "JWT",
|
|
5411
5403
|
template_literal: "\u0645\u062F\u062E\u0644"
|
|
@@ -5517,6 +5509,7 @@ var error2 = () => {
|
|
|
5517
5509
|
json_string: "JSON string",
|
|
5518
5510
|
e164: "E.164 number",
|
|
5519
5511
|
credit_card: "kredit kart\u0131 n\xF6mr\u0259si",
|
|
5512
|
+
currency_code: "valyuta kodu",
|
|
5520
5513
|
iban: "IBAN",
|
|
5521
5514
|
jwt: "JWT",
|
|
5522
5515
|
template_literal: "input"
|
|
@@ -5677,6 +5670,7 @@ var error3 = () => {
|
|
|
5677
5670
|
json_string: "JSON \u0440\u0430\u0434\u043E\u043A",
|
|
5678
5671
|
e164: "\u043D\u0443\u043C\u0430\u0440 E.164",
|
|
5679
5672
|
credit_card: "\u043D\u0443\u043C\u0430\u0440 \u043A\u0440\u044D\u0434\u044B\u0442\u043D\u0430\u0439 \u043A\u0430\u0440\u0442\u044B",
|
|
5673
|
+
currency_code: "\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B",
|
|
5680
5674
|
iban: "IBAN",
|
|
5681
5675
|
jwt: "JWT",
|
|
5682
5676
|
template_literal: "\u0443\u0432\u043E\u0434"
|
|
@@ -5795,6 +5789,7 @@ var error4 = () => {
|
|
|
5795
5789
|
json_string: "JSON \u043D\u0438\u0437",
|
|
5796
5790
|
e164: "E.164 \u043D\u043E\u043C\u0435\u0440",
|
|
5797
5791
|
credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0430",
|
|
5792
|
+
currency_code: "\u043A\u043E\u0434 \u043D\u0430 \u0432\u0430\u043B\u0443\u0442\u0430",
|
|
5798
5793
|
iban: "IBAN",
|
|
5799
5794
|
jwt: "JWT",
|
|
5800
5795
|
template_literal: "\u0432\u0445\u043E\u0434"
|
|
@@ -5920,6 +5915,7 @@ var error5 = () => {
|
|
|
5920
5915
|
json_string: "JSON \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982",
|
|
5921
5916
|
e164: "E.164 \u09A8\u09AE\u09CD\u09AC\u09B0",
|
|
5922
5917
|
credit_card: "\u0995\u09CD\u09B0\u09C7\u09A1\u09BF\u099F \u0995\u09BE\u09B0\u09CD\u09A1 \u09A8\u09AE\u09CD\u09AC\u09B0",
|
|
5918
|
+
currency_code: "\u09AE\u09C1\u09A6\u09CD\u09B0\u09BE \u0995\u09CB\u09A1",
|
|
5923
5919
|
iban: "IBAN",
|
|
5924
5920
|
jwt: "JWT",
|
|
5925
5921
|
template_literal: "\u0987\u09A8\u09AA\u09C1\u099F"
|
|
@@ -6033,6 +6029,7 @@ var error6 = () => {
|
|
|
6033
6029
|
json_string: "cadena JSON",
|
|
6034
6030
|
e164: "n\xFAmero E.164",
|
|
6035
6031
|
credit_card: "n\xFAmero de targeta de cr\xE8dit",
|
|
6032
|
+
currency_code: "codi de moneda",
|
|
6036
6033
|
iban: "IBAN",
|
|
6037
6034
|
jwt: "JWT",
|
|
6038
6035
|
template_literal: "entrada"
|
|
@@ -6146,6 +6143,7 @@ var error7 = () => {
|
|
|
6146
6143
|
json_string: "\u062F\u06D5\u0642\u06CC JSON",
|
|
6147
6144
|
e164: "\u0698\u0645\u0627\u0631\u06D5\u06CC E.164",
|
|
6148
6145
|
credit_card: "\u0698\u0645\u0627\u0631\u06D5\u06CC \u06A9\u0627\u0631\u062A\u06CC \u06A9\u0631\u06CE\u062F\u06CC\u062A",
|
|
6146
|
+
currency_code: "\u06A9\u06C6\u062F\u06CC \u062F\u0631\u0627\u0648",
|
|
6149
6147
|
iban: "IBAN",
|
|
6150
6148
|
jwt: "JWT",
|
|
6151
6149
|
template_literal: "\u062A\u06CE\u06A9\u0631\u062F\u06D5"
|
|
@@ -6278,6 +6276,7 @@ var error8 = () => {
|
|
|
6278
6276
|
json_string: "\u0159et\u011Bzec ve form\xE1tu JSON",
|
|
6279
6277
|
e164: "\u010D\xEDslo E.164",
|
|
6280
6278
|
credit_card: "\u010D\xEDslo kreditn\xED karty",
|
|
6279
|
+
currency_code: "k\xF3d m\u011Bny",
|
|
6281
6280
|
iban: "IBAN",
|
|
6282
6281
|
jwt: "JWT",
|
|
6283
6282
|
template_literal: "vstup"
|
|
@@ -6394,6 +6393,7 @@ var error9 = () => {
|
|
|
6394
6393
|
json_string: "JSON-streng",
|
|
6395
6394
|
e164: "E.164-nummer",
|
|
6396
6395
|
credit_card: "kreditkortnummer",
|
|
6396
|
+
currency_code: "valutakode",
|
|
6397
6397
|
iban: "IBAN",
|
|
6398
6398
|
jwt: "JWT",
|
|
6399
6399
|
template_literal: "input"
|
|
@@ -6514,6 +6514,7 @@ var error10 = () => {
|
|
|
6514
6514
|
json_string: "JSON-String",
|
|
6515
6515
|
e164: "E.164-Nummer",
|
|
6516
6516
|
credit_card: "Kreditkartennummer",
|
|
6517
|
+
currency_code: "W\xE4hrungscode",
|
|
6517
6518
|
iban: "IBAN",
|
|
6518
6519
|
jwt: "JWT",
|
|
6519
6520
|
template_literal: "Eingabe"
|
|
@@ -6627,6 +6628,7 @@ var error11 = () => {
|
|
|
6627
6628
|
json_string: "\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",
|
|
6628
6629
|
e164: "\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",
|
|
6629
6630
|
credit_card: "\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 \u03C0\u03B9\u03C3\u03C4\u03C9\u03C4\u03B9\u03BA\u03AE\u03C2 \u03BA\u03AC\u03C1\u03C4\u03B1\u03C2",
|
|
6631
|
+
currency_code: "\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03BD\u03BF\u03BC\u03AF\u03C3\u03BC\u03B1\u03C4\u03BF\u03C2",
|
|
6630
6632
|
iban: "IBAN",
|
|
6631
6633
|
jwt: "JWT",
|
|
6632
6634
|
template_literal: "\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"
|
|
@@ -6738,6 +6740,7 @@ var error12 = () => {
|
|
|
6738
6740
|
base64url: "base64url-encoded string",
|
|
6739
6741
|
json_string: "JSON string",
|
|
6740
6742
|
e164: "E.164 number",
|
|
6743
|
+
currency_code: "currency code",
|
|
6741
6744
|
credit_card: "credit card number",
|
|
6742
6745
|
iban: "IBAN",
|
|
6743
6746
|
jwt: "JWT",
|
|
@@ -6863,6 +6866,7 @@ var error13 = () => {
|
|
|
6863
6866
|
json_string: "JSON-karaktraro",
|
|
6864
6867
|
e164: "E.164-nombro",
|
|
6865
6868
|
credit_card: "kreditkarta numero",
|
|
6869
|
+
currency_code: "valuta kodo",
|
|
6866
6870
|
iban: "IBAN",
|
|
6867
6871
|
jwt: "JWT",
|
|
6868
6872
|
template_literal: "enigo"
|
|
@@ -6976,6 +6980,7 @@ var error14 = () => {
|
|
|
6976
6980
|
json_string: "cadena JSON",
|
|
6977
6981
|
e164: "n\xFAmero E.164",
|
|
6978
6982
|
credit_card: "n\xFAmero de tarjeta de cr\xE9dito",
|
|
6983
|
+
currency_code: "c\xF3digo de moneda",
|
|
6979
6984
|
iban: "IBAN",
|
|
6980
6985
|
jwt: "JWT",
|
|
6981
6986
|
template_literal: "entrada"
|
|
@@ -7113,6 +7118,7 @@ var error15 = () => {
|
|
|
7113
7118
|
json_string: "JSON \u0631\u0634\u062A\u0647",
|
|
7114
7119
|
e164: "E.164 \u0639\u062F\u062F",
|
|
7115
7120
|
credit_card: "\u0634\u0645\u0627\u0631\u0647 \u06A9\u0627\u0631\u062A \u0627\u0639\u062A\u0628\u0627\u0631\u06CC",
|
|
7121
|
+
currency_code: "\u06A9\u062F \u0627\u0631\u0632",
|
|
7116
7122
|
iban: "IBAN",
|
|
7117
7123
|
jwt: "JWT",
|
|
7118
7124
|
template_literal: "\u0648\u0631\u0648\u062F\u06CC"
|
|
@@ -7236,6 +7242,7 @@ var error16 = () => {
|
|
|
7236
7242
|
json_string: "JSON-merkkijono",
|
|
7237
7243
|
e164: "E.164-luku",
|
|
7238
7244
|
credit_card: "luottokortin numero",
|
|
7245
|
+
currency_code: "valuuttakoodi",
|
|
7239
7246
|
iban: "IBAN",
|
|
7240
7247
|
jwt: "JWT",
|
|
7241
7248
|
template_literal: "templaattimerkkijono"
|
|
@@ -7348,6 +7355,7 @@ var error17 = () => {
|
|
|
7348
7355
|
json_string: "cha\xEEne de caract\xE8res JSON",
|
|
7349
7356
|
e164: "num\xE9ro au format E.164",
|
|
7350
7357
|
credit_card: "num\xE9ro de carte de cr\xE9dit",
|
|
7358
|
+
currency_code: "code de devise",
|
|
7351
7359
|
iban: "IBAN",
|
|
7352
7360
|
jwt: "JWT",
|
|
7353
7361
|
template_literal: "entr\xE9e"
|
|
@@ -7478,6 +7486,7 @@ var error18 = () => {
|
|
|
7478
7486
|
json_string: "cha\xEEne JSON",
|
|
7479
7487
|
e164: "num\xE9ro E.164",
|
|
7480
7488
|
credit_card: "num\xE9ro de carte de cr\xE9dit",
|
|
7489
|
+
currency_code: "code de devise",
|
|
7481
7490
|
iban: "IBAN",
|
|
7482
7491
|
jwt: "JWT",
|
|
7483
7492
|
template_literal: "entr\xE9e"
|
|
@@ -7590,6 +7599,7 @@ var error19 = () => {
|
|
|
7590
7599
|
json_string: "JSON \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97",
|
|
7591
7600
|
e164: "E.164 \u0AA8\u0A82\u0AAC\u0AB0",
|
|
7592
7601
|
credit_card: "\u0A95\u0ACD\u0AB0\u0AC7\u0AA1\u0ABF\u0A9F \u0A95\u0ABE\u0AB0\u0ACD\u0AA1 \u0AA8\u0A82\u0AAC\u0AB0",
|
|
7602
|
+
currency_code: "\u0A9A\u0AB2\u0AA3 \u0A95\u0ACB\u0AA1",
|
|
7593
7603
|
iban: "IBAN",
|
|
7594
7604
|
jwt: "JWT",
|
|
7595
7605
|
template_literal: "\u0A87\u0AA8\u0AAA\u0AC1\u0A9F"
|
|
@@ -7739,6 +7749,7 @@ var error20 = () => {
|
|
|
7739
7749
|
json_string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON", gender: "f" },
|
|
7740
7750
|
e164: { label: "\u05DE\u05E1\u05E4\u05E8 E.164", gender: "m" },
|
|
7741
7751
|
credit_card: { label: "\u05DE\u05E1\u05E4\u05E8 \u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9", gender: "m" },
|
|
7752
|
+
currency_code: { label: "\u05E7\u05D5\u05D3 \u05DE\u05D8\u05D1\u05E2", gender: "m" },
|
|
7742
7753
|
iban: { label: "IBAN", gender: "m" },
|
|
7743
7754
|
jwt: { label: "JWT", gender: "m" },
|
|
7744
7755
|
template_literal: { label: "\u05E7\u05DC\u05D8", gender: "m" },
|
|
@@ -7904,6 +7915,7 @@ var error21 = () => {
|
|
|
7904
7915
|
json_string: "JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917",
|
|
7905
7916
|
e164: "E.164 \u0938\u0902\u0916\u094D\u092F\u093E",
|
|
7906
7917
|
credit_card: "\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0938\u0902\u0916\u094D\u092F\u093E",
|
|
7918
|
+
currency_code: "\u092E\u0941\u0926\u094D\u0930\u093E \u0915\u094B\u0921",
|
|
7907
7919
|
iban: "IBAN",
|
|
7908
7920
|
jwt: "JWT",
|
|
7909
7921
|
template_literal: "\u0907\u0928\u092A\u0941\u091F"
|
|
@@ -8014,6 +8026,7 @@ var error22 = () => {
|
|
|
8014
8026
|
json_string: "JSON tekst",
|
|
8015
8027
|
e164: "E.164 broj",
|
|
8016
8028
|
credit_card: "broj kreditne kartice",
|
|
8029
|
+
currency_code: "kod valute",
|
|
8017
8030
|
iban: "IBAN",
|
|
8018
8031
|
jwt: "JWT",
|
|
8019
8032
|
template_literal: "unos"
|
|
@@ -8141,6 +8154,7 @@ var error23 = () => {
|
|
|
8141
8154
|
json_string: "JSON string",
|
|
8142
8155
|
e164: "E.164 sz\xE1m",
|
|
8143
8156
|
credit_card: "hitelk\xE1rtyasz\xE1m",
|
|
8157
|
+
currency_code: "p\xE9nznemk\xF3d",
|
|
8144
8158
|
iban: "IBAN",
|
|
8145
8159
|
jwt: "JWT",
|
|
8146
8160
|
template_literal: "bemenet"
|
|
@@ -8294,6 +8308,7 @@ var error24 = () => {
|
|
|
8294
8308
|
json_string: "JSON \u057F\u0578\u0572",
|
|
8295
8309
|
e164: "E.164 \u0570\u0561\u0574\u0561\u0580",
|
|
8296
8310
|
credit_card: "\u056F\u0580\u0565\u0564\u056B\u057F \u0584\u0561\u0580\u057F\u056B \u0570\u0561\u0574\u0561\u0580",
|
|
8311
|
+
currency_code: "\u0561\u0580\u056A\u0578\u0582\u0575\u0569\u056B \u056F\u0578\u0564",
|
|
8297
8312
|
iban: "IBAN",
|
|
8298
8313
|
jwt: "JWT",
|
|
8299
8314
|
template_literal: "\u0574\u0578\u0582\u057F\u0584"
|
|
@@ -8412,6 +8427,7 @@ var error25 = () => {
|
|
|
8412
8427
|
json_string: "string JSON",
|
|
8413
8428
|
e164: "angka E.164",
|
|
8414
8429
|
credit_card: "nomor kartu kredit",
|
|
8430
|
+
currency_code: "kode mata uang",
|
|
8415
8431
|
iban: "IBAN",
|
|
8416
8432
|
jwt: "JWT",
|
|
8417
8433
|
template_literal: "input"
|
|
@@ -8523,6 +8539,7 @@ var error26 = () => {
|
|
|
8523
8539
|
json_string: "JSON strengur",
|
|
8524
8540
|
e164: "E.164 t\xF6lugildi",
|
|
8525
8541
|
credit_card: "kreditkortan\xFAmer",
|
|
8542
|
+
currency_code: "gjaldmi\xF0ilsk\xF3\xF0i",
|
|
8526
8543
|
iban: "IBAN",
|
|
8527
8544
|
jwt: "JWT",
|
|
8528
8545
|
template_literal: "gildi"
|
|
@@ -8637,6 +8654,7 @@ var error27 = () => {
|
|
|
8637
8654
|
json_string: "stringa JSON",
|
|
8638
8655
|
e164: "numero E.164",
|
|
8639
8656
|
credit_card: "numero di carta di credito",
|
|
8657
|
+
currency_code: "codice valuta",
|
|
8640
8658
|
iban: "IBAN",
|
|
8641
8659
|
jwt: "JWT",
|
|
8642
8660
|
template_literal: "input"
|
|
@@ -8750,6 +8768,7 @@ var error28 = () => {
|
|
|
8750
8768
|
json_string: "JSON\u6587\u5B57\u5217",
|
|
8751
8769
|
e164: "E.164\u756A\u53F7",
|
|
8752
8770
|
credit_card: "\u30AF\u30EC\u30B8\u30C3\u30C8\u30AB\u30FC\u30C9\u756A\u53F7",
|
|
8771
|
+
currency_code: "\u901A\u8CA8\u30B3\u30FC\u30C9",
|
|
8753
8772
|
iban: "IBAN",
|
|
8754
8773
|
jwt: "JWT",
|
|
8755
8774
|
template_literal: "\u5165\u529B\u5024"
|
|
@@ -8862,6 +8881,7 @@ var error29 = () => {
|
|
|
8862
8881
|
json_string: "JSON \u10D5\u10D4\u10DA\u10D8",
|
|
8863
8882
|
e164: "E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",
|
|
8864
8883
|
credit_card: "\u10E1\u10D0\u10D9\u10E0\u10D4\u10D3\u10D8\u10E2\u10DD \u10D1\u10D0\u10E0\u10D0\u10D7\u10D8\u10E1 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",
|
|
8884
|
+
currency_code: "\u10D5\u10D0\u10DA\u10E3\u10E2\u10D8\u10E1 \u10D9\u10DD\u10D3\u10D8",
|
|
8865
8885
|
iban: "IBAN",
|
|
8866
8886
|
jwt: "JWT",
|
|
8867
8887
|
template_literal: "\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"
|
|
@@ -8979,6 +8999,7 @@ var error30 = () => {
|
|
|
8979
8999
|
json_string: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",
|
|
8980
9000
|
e164: "\u179B\u17C1\u1781 E.164",
|
|
8981
9001
|
credit_card: "\u179B\u17C1\u1781\u1794\u17D0\u178E\u17D2\u178E\u17A5\u178E\u1791\u17B6\u1793",
|
|
9002
|
+
currency_code: "\u1780\u17BC\u178A\u179A\u17BC\u1794\u17B7\u1799\u1794\u17D0\u178E\u17D2\u178E",
|
|
8982
9003
|
iban: "IBAN",
|
|
8983
9004
|
jwt: "JWT",
|
|
8984
9005
|
template_literal: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"
|
|
@@ -9099,6 +9120,7 @@ var error31 = () => {
|
|
|
9099
9120
|
json_string: "JSON\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD",
|
|
9100
9121
|
e164: "E.164 \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",
|
|
9101
9122
|
credit_card: "\u0C95\u0CCD\u0CB0\u0CC6\u0CA1\u0CBF\u0C9F\u0CCD \u0C95\u0CBE\u0CB0\u0CCD\u0CA1\u0CCD \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",
|
|
9123
|
+
currency_code: "\u0C95\u0CB0\u0CC6\u0CA8\u0CCD\u0CB8\u0CBF \u0C95\u0CCB\u0CA1\u0CCD",
|
|
9102
9124
|
iban: "IBAN",
|
|
9103
9125
|
jwt: "JWT",
|
|
9104
9126
|
template_literal: "\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD"
|
|
@@ -9214,6 +9236,7 @@ var error32 = () => {
|
|
|
9214
9236
|
json_string: "JSON \uBB38\uC790\uC5F4",
|
|
9215
9237
|
e164: "E.164 \uBC88\uD638",
|
|
9216
9238
|
credit_card: "\uC2E0\uC6A9\uCE74\uB4DC \uBC88\uD638",
|
|
9239
|
+
currency_code: "\uD1B5\uD654 \uCF54\uB4DC",
|
|
9217
9240
|
iban: "IBAN",
|
|
9218
9241
|
jwt: "JWT",
|
|
9219
9242
|
template_literal: "\uC785\uB825"
|
|
@@ -9412,6 +9435,7 @@ var error33 = () => {
|
|
|
9412
9435
|
json_string: "JSON eilut\u0117",
|
|
9413
9436
|
e164: "E.164 numeris",
|
|
9414
9437
|
credit_card: "kredito kortel\u0117s numeris",
|
|
9438
|
+
currency_code: "valiutos kodas",
|
|
9415
9439
|
iban: "IBAN",
|
|
9416
9440
|
jwt: "JWT",
|
|
9417
9441
|
template_literal: "\u012Fvestis"
|
|
@@ -9537,6 +9561,7 @@ var error34 = () => {
|
|
|
9537
9561
|
json_string: "JSON \u043D\u0438\u0437\u0430",
|
|
9538
9562
|
e164: "E.164 \u0431\u0440\u043E\u0458",
|
|
9539
9563
|
credit_card: "\u0431\u0440\u043E\u0458 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0438\u0447\u043A\u0430",
|
|
9564
|
+
currency_code: "\u043A\u043E\u0434 \u043D\u0430 \u0432\u0430\u043B\u0443\u0442\u0430",
|
|
9540
9565
|
iban: "IBAN",
|
|
9541
9566
|
jwt: "JWT",
|
|
9542
9567
|
template_literal: "\u0432\u043D\u0435\u0441"
|
|
@@ -9651,6 +9676,7 @@ var error35 = () => {
|
|
|
9651
9676
|
json_string: "string JSON",
|
|
9652
9677
|
e164: "nombor E.164",
|
|
9653
9678
|
credit_card: "nombor kad kredit",
|
|
9679
|
+
currency_code: "kod mata wang",
|
|
9654
9680
|
iban: "IBAN",
|
|
9655
9681
|
jwt: "JWT",
|
|
9656
9682
|
template_literal: "input"
|
|
@@ -9763,6 +9789,7 @@ var error36 = () => {
|
|
|
9763
9789
|
json_string: "JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0919",
|
|
9764
9790
|
e164: "E.164 \u0928\u092E\u094D\u092C\u0930",
|
|
9765
9791
|
credit_card: "\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0928\u092E\u094D\u092C\u0930",
|
|
9792
|
+
currency_code: "\u092E\u0941\u0926\u094D\u0930\u093E \u0915\u094B\u0921",
|
|
9766
9793
|
iban: "IBAN",
|
|
9767
9794
|
jwt: "JWT",
|
|
9768
9795
|
template_literal: "\u0907\u0928\u092A\u0941\u091F"
|
|
@@ -9874,6 +9901,7 @@ var error37 = () => {
|
|
|
9874
9901
|
json_string: "JSON string",
|
|
9875
9902
|
e164: "E.164-nummer",
|
|
9876
9903
|
credit_card: "creditcardnummer",
|
|
9904
|
+
currency_code: "valutacode",
|
|
9877
9905
|
iban: "IBAN",
|
|
9878
9906
|
jwt: "JWT",
|
|
9879
9907
|
template_literal: "invoer"
|
|
@@ -9989,6 +10017,7 @@ var error38 = () => {
|
|
|
9989
10017
|
json_string: "JSON-streng",
|
|
9990
10018
|
e164: "E.164-nummer",
|
|
9991
10019
|
credit_card: "kredittkortnummer",
|
|
10020
|
+
currency_code: "valutakode",
|
|
9992
10021
|
iban: "IBAN",
|
|
9993
10022
|
jwt: "JWT",
|
|
9994
10023
|
template_literal: "input"
|
|
@@ -10102,6 +10131,7 @@ var error39 = () => {
|
|
|
10102
10131
|
json_string: "JSON-streng",
|
|
10103
10132
|
e164: "E.164-nummer",
|
|
10104
10133
|
credit_card: "kredittkortnummer",
|
|
10134
|
+
currency_code: "valutakode",
|
|
10105
10135
|
iban: "IBAN",
|
|
10106
10136
|
jwt: "JWT",
|
|
10107
10137
|
template_literal: "input"
|
|
@@ -10215,6 +10245,7 @@ var error40 = () => {
|
|
|
10215
10245
|
json_string: "JSON metin",
|
|
10216
10246
|
e164: "E.164 say\u0131s\u0131",
|
|
10217
10247
|
credit_card: "i'tib\xE2r kart\u0131 numaras\u0131",
|
|
10248
|
+
currency_code: "para birimi kodu",
|
|
10218
10249
|
iban: "IBAN",
|
|
10219
10250
|
jwt: "JWT",
|
|
10220
10251
|
template_literal: "giren"
|
|
@@ -10329,6 +10360,7 @@ var error41 = () => {
|
|
|
10329
10360
|
json_string: "JSON \u0645\u062A\u0646",
|
|
10330
10361
|
e164: "\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",
|
|
10331
10362
|
credit_card: "\u062F \u06A9\u0631\u06CC\u0689\u06CC\u067C \u06A9\u0627\u0631\u062A \u0634\u0645\u06CC\u0631\u0647",
|
|
10363
|
+
currency_code: "\u062F \u0627\u0633\u0639\u0627\u0631\u0648 \u06A9\u0648\u0689",
|
|
10332
10364
|
iban: "IBAN",
|
|
10333
10365
|
jwt: "JWT",
|
|
10334
10366
|
template_literal: "\u0648\u0631\u0648\u062F\u064A"
|
|
@@ -10448,6 +10480,7 @@ var error42 = () => {
|
|
|
10448
10480
|
json_string: "ci\u0105g znak\xF3w w formacie JSON",
|
|
10449
10481
|
e164: "liczba E.164",
|
|
10450
10482
|
credit_card: "numer karty kredytowej",
|
|
10483
|
+
currency_code: "kod waluty",
|
|
10451
10484
|
iban: "IBAN",
|
|
10452
10485
|
jwt: "JWT",
|
|
10453
10486
|
template_literal: "wej\u015Bcie"
|
|
@@ -10562,6 +10595,7 @@ var error43 = () => {
|
|
|
10562
10595
|
json_string: "o texto JSON",
|
|
10563
10596
|
e164: "o n\xFAmero E.164",
|
|
10564
10597
|
credit_card: "o n\xFAmero de cart\xE3o de cr\xE9dito",
|
|
10598
|
+
currency_code: "o c\xF3digo de moeda",
|
|
10565
10599
|
iban: "o IBAN",
|
|
10566
10600
|
jwt: "o JWT",
|
|
10567
10601
|
template_literal: "a entrada"
|
|
@@ -10705,6 +10739,7 @@ var error44 = () => {
|
|
|
10705
10739
|
json_string: "o texto JSON",
|
|
10706
10740
|
e164: "o n\xFAmero E.164",
|
|
10707
10741
|
credit_card: "o n\xFAmero de cart\xE3o de cr\xE9dito",
|
|
10742
|
+
currency_code: "o c\xF3digo de moeda",
|
|
10708
10743
|
iban: "o IBAN",
|
|
10709
10744
|
jwt: "o JWT",
|
|
10710
10745
|
template_literal: "a entrada"
|
|
@@ -10849,6 +10884,7 @@ var error45 = () => {
|
|
|
10849
10884
|
json_string: "\u0219ir JSON",
|
|
10850
10885
|
e164: "num\u0103r E.164",
|
|
10851
10886
|
credit_card: "num\u0103r de card de credit",
|
|
10887
|
+
currency_code: "cod valutar",
|
|
10852
10888
|
iban: "IBAN",
|
|
10853
10889
|
jwt: "JWT",
|
|
10854
10890
|
template_literal: "intrare"
|
|
@@ -11021,6 +11057,7 @@ var error46 = () => {
|
|
|
11021
11057
|
json_string: "JSON \u0441\u0442\u0440\u043E\u043A\u0430",
|
|
11022
11058
|
e164: "\u043D\u043E\u043C\u0435\u0440 E.164",
|
|
11023
11059
|
credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u044B",
|
|
11060
|
+
currency_code: "\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B",
|
|
11024
11061
|
iban: "IBAN",
|
|
11025
11062
|
jwt: "JWT",
|
|
11026
11063
|
template_literal: "\u0432\u0432\u043E\u0434"
|
|
@@ -11139,6 +11176,7 @@ var error47 = () => {
|
|
|
11139
11176
|
json_string: "re\u0165azec vo form\xE1te JSON",
|
|
11140
11177
|
e164: "\u010D\xEDslo E.164",
|
|
11141
11178
|
credit_card: "\u010D\xEDslo kreditnej karty",
|
|
11179
|
+
currency_code: "k\xF3d meny",
|
|
11142
11180
|
iban: "IBAN",
|
|
11143
11181
|
jwt: "JWT",
|
|
11144
11182
|
template_literal: "vstup"
|
|
@@ -11255,6 +11293,7 @@ var error48 = () => {
|
|
|
11255
11293
|
json_string: "JSON niz",
|
|
11256
11294
|
e164: "E.164 \u0161tevilka",
|
|
11257
11295
|
credit_card: "\u0161tevilka kreditne kartice",
|
|
11296
|
+
currency_code: "koda valute",
|
|
11258
11297
|
iban: "IBAN",
|
|
11259
11298
|
jwt: "JWT",
|
|
11260
11299
|
template_literal: "vnos"
|
|
@@ -11369,6 +11408,7 @@ var error49 = () => {
|
|
|
11369
11408
|
json_string: "JSON-str\xE4ng",
|
|
11370
11409
|
e164: "E.164-nummer",
|
|
11371
11410
|
credit_card: "kreditkortsnummer",
|
|
11411
|
+
currency_code: "valutakod",
|
|
11372
11412
|
iban: "IBAN",
|
|
11373
11413
|
jwt: "JWT",
|
|
11374
11414
|
template_literal: "mall-literal"
|
|
@@ -11484,6 +11524,7 @@ var error50 = () => {
|
|
|
11484
11524
|
json_string: "JSON \u0B9A\u0BB0\u0BAE\u0BCD",
|
|
11485
11525
|
e164: "E.164 \u0B8E\u0BA3\u0BCD",
|
|
11486
11526
|
credit_card: "\u0B95\u0B9F\u0BA9\u0BCD \u0B85\u0B9F\u0BCD\u0B9F\u0BC8 \u0B8E\u0BA3\u0BCD",
|
|
11527
|
+
currency_code: "\u0BA8\u0BBE\u0BA3\u0BAF\u0B95\u0BCD \u0B95\u0BC1\u0BB1\u0BBF\u0BAF\u0BC0\u0B9F\u0BC1",
|
|
11487
11528
|
iban: "IBAN",
|
|
11488
11529
|
jwt: "JWT",
|
|
11489
11530
|
template_literal: "input"
|
|
@@ -11599,6 +11640,7 @@ var error51 = () => {
|
|
|
11599
11640
|
json_string: "\u0441\u0430\u0442\u0440\u0438 JSON",
|
|
11600
11641
|
e164: "\u0440\u0430\u049B\u0430\u043C\u0438 E.164",
|
|
11601
11642
|
credit_card: "\u0440\u0430\u049B\u0430\u043C\u0438 \u043A\u043E\u0440\u0442\u0438 \u043A\u0440\u0435\u0434\u0438\u0442\u04E3",
|
|
11643
|
+
currency_code: "\u0440\u0430\u043C\u0437\u0438 \u0430\u0441\u044A\u043E\u0440",
|
|
11602
11644
|
iban: "IBAN",
|
|
11603
11645
|
jwt: "JWT",
|
|
11604
11646
|
template_literal: "\u0432\u0443\u0440\u0443\u0434"
|
|
@@ -11715,6 +11757,7 @@ var error52 = () => {
|
|
|
11715
11757
|
json_string: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",
|
|
11716
11758
|
e164: "\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",
|
|
11717
11759
|
credit_card: "\u0E2B\u0E21\u0E32\u0E22\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E40\u0E04\u0E23\u0E14\u0E34\u0E15",
|
|
11760
|
+
currency_code: "\u0E23\u0E2B\u0E31\u0E2A\u0E2A\u0E01\u0E38\u0E25\u0E40\u0E07\u0E34\u0E19",
|
|
11718
11761
|
iban: "IBAN",
|
|
11719
11762
|
jwt: "\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",
|
|
11720
11763
|
template_literal: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"
|
|
@@ -11830,6 +11873,7 @@ var error53 = () => {
|
|
|
11830
11873
|
json_string: "JSON setiri",
|
|
11831
11874
|
e164: "E.164 nomeri",
|
|
11832
11875
|
credit_card: "kredit kartyny\u0148 nomeri",
|
|
11876
|
+
currency_code: "wal\xFDuta kody",
|
|
11833
11877
|
iban: "IBAN",
|
|
11834
11878
|
jwt: "JWT",
|
|
11835
11879
|
template_literal: "\u015Fablon"
|
|
@@ -11937,6 +11981,7 @@ var error54 = () => {
|
|
|
11937
11981
|
json_string: "JSON dizesi",
|
|
11938
11982
|
e164: "E.164 say\u0131s\u0131",
|
|
11939
11983
|
credit_card: "kredi kart\u0131 numaras\u0131",
|
|
11984
|
+
currency_code: "para birimi kodu",
|
|
11940
11985
|
iban: "IBAN",
|
|
11941
11986
|
jwt: "JWT",
|
|
11942
11987
|
template_literal: "\u015Eablon dizesi"
|
|
@@ -12047,6 +12092,7 @@ var error55 = () => {
|
|
|
12047
12092
|
json_string: "\u0440\u044F\u0434\u043E\u043A JSON",
|
|
12048
12093
|
e164: "\u043D\u043E\u043C\u0435\u0440 E.164",
|
|
12049
12094
|
credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0457 \u043A\u0430\u0440\u0442\u043A\u0438",
|
|
12095
|
+
currency_code: "\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u0438",
|
|
12050
12096
|
iban: "IBAN",
|
|
12051
12097
|
jwt: "JWT",
|
|
12052
12098
|
template_literal: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"
|
|
@@ -12165,6 +12211,7 @@ var error56 = () => {
|
|
|
12165
12211
|
json_string: "\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",
|
|
12166
12212
|
e164: "\u0627\u06CC 164 \u0646\u0645\u0628\u0631",
|
|
12167
12213
|
credit_card: "\u06A9\u0631\u06CC\u0688\u0679 \u06A9\u0627\u0631\u0688 \u0646\u0645\u0628\u0631",
|
|
12214
|
+
currency_code: "\u06A9\u0631\u0646\u0633\u06CC \u06A9\u0648\u0688",
|
|
12168
12215
|
iban: "IBAN",
|
|
12169
12216
|
jwt: "\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",
|
|
12170
12217
|
template_literal: "\u0627\u0646 \u067E\u0679"
|
|
@@ -12280,6 +12327,7 @@ var error57 = () => {
|
|
|
12280
12327
|
json_string: "JSON satr",
|
|
12281
12328
|
e164: "E.164 raqam",
|
|
12282
12329
|
credit_card: "kredit karta raqami",
|
|
12330
|
+
currency_code: "valyuta kodi",
|
|
12283
12331
|
iban: "IBAN",
|
|
12284
12332
|
jwt: "JWT",
|
|
12285
12333
|
template_literal: "kirish"
|
|
@@ -12393,6 +12441,7 @@ var error58 = () => {
|
|
|
12393
12441
|
json_string: "chu\u1ED7i JSON",
|
|
12394
12442
|
e164: "s\u1ED1 E.164",
|
|
12395
12443
|
credit_card: "s\u1ED1 th\u1EBB t\xEDn d\u1EE5ng",
|
|
12444
|
+
currency_code: "m\xE3 ti\u1EC1n t\u1EC7",
|
|
12396
12445
|
iban: "IBAN",
|
|
12397
12446
|
jwt: "JWT",
|
|
12398
12447
|
template_literal: "\u0111\u1EA7u v\xE0o"
|
|
@@ -12506,6 +12555,7 @@ var error59 = () => {
|
|
|
12506
12555
|
json_string: "JSON\u5B57\u7B26\u4E32",
|
|
12507
12556
|
e164: "E.164\u53F7\u7801",
|
|
12508
12557
|
credit_card: "\u4FE1\u7528\u5361\u53F7",
|
|
12558
|
+
currency_code: "\u8D27\u5E01\u4EE3\u7801",
|
|
12509
12559
|
iban: "IBAN",
|
|
12510
12560
|
jwt: "JWT",
|
|
12511
12561
|
template_literal: "\u8F93\u5165"
|
|
@@ -12620,6 +12670,7 @@ var error60 = () => {
|
|
|
12620
12670
|
json_string: "JSON \u5B57\u4E32",
|
|
12621
12671
|
e164: "E.164 \u6578\u503C",
|
|
12622
12672
|
credit_card: "\u4FE1\u7528\u5361\u865F",
|
|
12673
|
+
currency_code: "\u8CA8\u5E63\u4EE3\u78BC",
|
|
12623
12674
|
iban: "IBAN",
|
|
12624
12675
|
jwt: "JWT",
|
|
12625
12676
|
template_literal: "\u8F38\u5165"
|
|
@@ -12732,6 +12783,7 @@ var error61 = () => {
|
|
|
12732
12783
|
json_string: "\u1ECD\u0300r\u1ECD\u0300 JSON",
|
|
12733
12784
|
e164: "n\u1ECD\u0301mb\xE0 E.164",
|
|
12734
12785
|
credit_card: "n\u1ECDmba kaadi gbese",
|
|
12786
|
+
currency_code: "koodu ow\xF3",
|
|
12735
12787
|
iban: "IBAN",
|
|
12736
12788
|
jwt: "JWT",
|
|
12737
12789
|
template_literal: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"
|
|
@@ -13110,7 +13162,7 @@ function generateChecks(doc, ctx, schema, accessor) {
|
|
|
13110
13162
|
generatePropertyCheck(doc, ctx, def, currentAccessor);
|
|
13111
13163
|
break;
|
|
13112
13164
|
case "properties":
|
|
13113
|
-
generatePropertiesChecks(doc, ctx, def, currentAccessor
|
|
13165
|
+
generatePropertiesChecks(doc, ctx, def, currentAccessor);
|
|
13114
13166
|
break;
|
|
13115
13167
|
case "overwrite": {
|
|
13116
13168
|
const newAccessor = newVar(ctx);
|
|
@@ -13220,11 +13272,11 @@ function generateMimeTypeCheck(doc, ctx, def, accessor) {
|
|
|
13220
13272
|
doc.write(`if (!${mimeSet}.has(${accessor}.type)) return INVALID;`);
|
|
13221
13273
|
}
|
|
13222
13274
|
}
|
|
13223
|
-
function generatePropertiesChecks(doc, ctx, def, accessor
|
|
13275
|
+
function generatePropertiesChecks(doc, ctx, def, accessor) {
|
|
13224
13276
|
if (def.when) {
|
|
13225
13277
|
throw new ZodCompileUnsupportedError(`check with a custom "when" condition`);
|
|
13226
13278
|
}
|
|
13227
|
-
doc.write(
|
|
13279
|
+
doc.write(`if (${accessor} == null) return INVALID;`);
|
|
13228
13280
|
const shape = def.shape;
|
|
13229
13281
|
for (const key of Reflect.ownKeys(shape)) {
|
|
13230
13282
|
const keyExpr = typeof key === "symbol" ? addConstant(ctx, key) : esc(key);
|
|
@@ -13314,7 +13366,7 @@ var PATTERN_IS_COMPLETE = /* @__PURE__ */ new Set([
|
|
|
13314
13366
|
"uuid",
|
|
13315
13367
|
"xid"
|
|
13316
13368
|
]);
|
|
13317
|
-
function generateStringFormatCheck(doc, ctx, def, accessor) {
|
|
13369
|
+
function generateStringFormatCheck(doc, ctx, def, accessor, needsValue = true) {
|
|
13318
13370
|
const fmt = def.format;
|
|
13319
13371
|
if (fmt === "base64") {
|
|
13320
13372
|
const validator = addConstant(ctx, isValidBase64);
|
|
@@ -13354,7 +13406,7 @@ function generateStringFormatCheck(doc, ctx, def, accessor) {
|
|
|
13354
13406
|
}
|
|
13355
13407
|
const formatDef = def;
|
|
13356
13408
|
if (fmt === "url" || fmt === "httpurl" || formatDef.normalize || formatDef.hostname !== void 0 || formatDef.protocol !== void 0) {
|
|
13357
|
-
const parseConst = addConstant(ctx,
|
|
13409
|
+
const parseConst = addConstant(ctx, validateURL);
|
|
13358
13410
|
const defConst = addConstant(ctx, def);
|
|
13359
13411
|
const trimVar = newVar(ctx);
|
|
13360
13412
|
const urlVar = newVar(ctx);
|
|
@@ -13369,6 +13421,8 @@ function generateStringFormatCheck(doc, ctx, def, accessor) {
|
|
|
13369
13421
|
const protocolConst = addConstant(ctx, urlProtocolOk);
|
|
13370
13422
|
doc.write(`if (!${protocolConst}(${urlVar}, ${defConst}.protocol)) return INVALID;`);
|
|
13371
13423
|
}
|
|
13424
|
+
if (!needsValue)
|
|
13425
|
+
return null;
|
|
13372
13426
|
const outputVar = newVar(ctx);
|
|
13373
13427
|
const outputExpr = formatDef.normalize ? `${urlVar}.href` : `${addConstant(ctx, stripTabAndNewline)}(${trimVar})`;
|
|
13374
13428
|
doc.write(`const ${outputVar} = ${outputExpr};`);
|
|
@@ -13428,7 +13482,7 @@ function generateCheck(doc, ctx, schema, accessor, needsValue = true) {
|
|
|
13428
13482
|
let typeAccessor;
|
|
13429
13483
|
switch (type) {
|
|
13430
13484
|
case "string":
|
|
13431
|
-
typeAccessor = generateStringCheck(doc, ctx, schema, accessor);
|
|
13485
|
+
typeAccessor = generateStringCheck(doc, ctx, schema, accessor, buildsValue);
|
|
13432
13486
|
break;
|
|
13433
13487
|
case "number":
|
|
13434
13488
|
typeAccessor = generateNumberCheck(doc, schema, accessor);
|
|
@@ -13534,10 +13588,6 @@ function generateCheck(doc, ctx, schema, accessor, needsValue = true) {
|
|
|
13534
13588
|
case "custom":
|
|
13535
13589
|
typeAccessor = generateCustomCheck(doc, ctx, schema, accessor);
|
|
13536
13590
|
break;
|
|
13537
|
-
case "properties":
|
|
13538
|
-
generatePropertiesChecks(doc, ctx, schema._zod.def, accessor, true);
|
|
13539
|
-
typeAccessor = accessor;
|
|
13540
|
-
break;
|
|
13541
13591
|
case "transform":
|
|
13542
13592
|
typeAccessor = generateTransformCheck(doc, ctx, schema, accessor);
|
|
13543
13593
|
break;
|
|
@@ -13553,12 +13603,12 @@ function generateCheck(doc, ctx, schema, accessor, needsValue = true) {
|
|
|
13553
13603
|
return null;
|
|
13554
13604
|
return generateChecks(doc, ctx, schema, typeAccessor);
|
|
13555
13605
|
}
|
|
13556
|
-
function generateStringCheck(doc, ctx, schema, accessor) {
|
|
13606
|
+
function generateStringCheck(doc, ctx, schema, accessor, needsValue = true) {
|
|
13557
13607
|
doc.write(`if (typeof ${accessor} !== "string") return INVALID;`);
|
|
13558
13608
|
const def = schema._zod.def;
|
|
13559
13609
|
if (def.format === void 0)
|
|
13560
13610
|
return accessor;
|
|
13561
|
-
return generateStringFormatCheck(doc, ctx, def, accessor);
|
|
13611
|
+
return generateStringFormatCheck(doc, ctx, def, accessor, needsValue);
|
|
13562
13612
|
}
|
|
13563
13613
|
function generateNumberCheck(doc, schema, accessor) {
|
|
13564
13614
|
doc.write(`if (typeof ${accessor} !== "number" || !Number.isFinite(${accessor})) return INVALID;`);
|
|
@@ -13676,7 +13726,7 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
|
13676
13726
|
}
|
|
13677
13727
|
}
|
|
13678
13728
|
const outputVar = newVar(ctx);
|
|
13679
|
-
const hasConditionalKeys = allKeys.some((k) =>
|
|
13729
|
+
const hasConditionalKeys = allKeys.some((k) => mayOmitUndefined(propShape[k]) || dropsWhenAbsent(propShape[k]));
|
|
13680
13730
|
if (!buildsValue) {
|
|
13681
13731
|
if (unknownKeysMode === "schema") {
|
|
13682
13732
|
const knownSet = keys.length > 0 ? addConstant(ctx, new Set(keys)) : null;
|
|
@@ -13703,7 +13753,7 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
|
13703
13753
|
const out = propOutputs.get(k);
|
|
13704
13754
|
if (dropsWhenAbsent(propShape[k])) {
|
|
13705
13755
|
doc.write(`if (${kx} in ${accessor}) ${outputVar}[${kx}] = ${out};`);
|
|
13706
|
-
} else if (
|
|
13756
|
+
} else if (mayOmitUndefined(propShape[k])) {
|
|
13707
13757
|
doc.write(`if (${out} !== undefined || ${kx} in ${accessor}) ${outputVar}[${kx}] = ${out};`);
|
|
13708
13758
|
} else {
|
|
13709
13759
|
doc.write(`${outputVar}[${kx}] = ${out};`);
|
|
@@ -13836,6 +13886,9 @@ function fastPathAcceptsAbsence(schema) {
|
|
|
13836
13886
|
function dropsWhenAbsent(schema) {
|
|
13837
13887
|
return schema._zod.optin === "optional" && schema._zod.optout === "optional";
|
|
13838
13888
|
}
|
|
13889
|
+
function mayOmitUndefined(schema) {
|
|
13890
|
+
return (schema._zod.optin !== "defaulted" || schema._zod.optout === "optional") && mayOutputUndefined(schema);
|
|
13891
|
+
}
|
|
13839
13892
|
function mayOutputUndefined(schema) {
|
|
13840
13893
|
const def = schema._zod.def;
|
|
13841
13894
|
switch (def.type) {
|
|
@@ -14455,20 +14508,18 @@ function generateTransformCheck(doc, ctx, schema, accessor) {
|
|
|
14455
14508
|
}
|
|
14456
14509
|
|
|
14457
14510
|
// ../../node_modules/zod/v4/core/api.js
|
|
14511
|
+
function snapshotChecks(def) {
|
|
14512
|
+
if (def.checks)
|
|
14513
|
+
def.checks = [...def.checks];
|
|
14514
|
+
return def;
|
|
14515
|
+
}
|
|
14458
14516
|
// @__NO_SIDE_EFFECTS__
|
|
14459
14517
|
function _string(Class2, params) {
|
|
14460
|
-
return new Class2({
|
|
14461
|
-
type: "string",
|
|
14462
|
-
...normalizeParams(params)
|
|
14463
|
-
});
|
|
14518
|
+
return new Class2(snapshotChecks({ type: "string", ...normalizeParams(params) }));
|
|
14464
14519
|
}
|
|
14465
14520
|
// @__NO_SIDE_EFFECTS__
|
|
14466
14521
|
function _coercedString(Class2, params) {
|
|
14467
|
-
return new Class2({
|
|
14468
|
-
type: "string",
|
|
14469
|
-
coerce: true,
|
|
14470
|
-
...normalizeParams(params)
|
|
14471
|
-
});
|
|
14522
|
+
return new Class2(snapshotChecks({ type: "string", coerce: true, ...normalizeParams(params) }));
|
|
14472
14523
|
}
|
|
14473
14524
|
// @__NO_SIDE_EFFECTS__
|
|
14474
14525
|
function _email(Class2, params) {
|
|
@@ -14772,20 +14823,11 @@ function _isoDuration(Class2, params) {
|
|
|
14772
14823
|
}
|
|
14773
14824
|
// @__NO_SIDE_EFFECTS__
|
|
14774
14825
|
function _number(Class2, params) {
|
|
14775
|
-
return new Class2({
|
|
14776
|
-
type: "number",
|
|
14777
|
-
checks: [],
|
|
14778
|
-
...normalizeParams(params)
|
|
14779
|
-
});
|
|
14826
|
+
return new Class2(snapshotChecks({ type: "number", checks: [], ...normalizeParams(params) }));
|
|
14780
14827
|
}
|
|
14781
14828
|
// @__NO_SIDE_EFFECTS__
|
|
14782
14829
|
function _coercedNumber(Class2, params) {
|
|
14783
|
-
return new Class2({
|
|
14784
|
-
type: "number",
|
|
14785
|
-
coerce: true,
|
|
14786
|
-
checks: [],
|
|
14787
|
-
...normalizeParams(params)
|
|
14788
|
-
});
|
|
14830
|
+
return new Class2(snapshotChecks({ type: "number", coerce: true, checks: [], ...normalizeParams(params) }));
|
|
14789
14831
|
}
|
|
14790
14832
|
// @__NO_SIDE_EFFECTS__
|
|
14791
14833
|
function _int(Class2, params) {
|
|
@@ -15127,9 +15169,8 @@ function _property(property, schema, params) {
|
|
|
15127
15169
|
});
|
|
15128
15170
|
}
|
|
15129
15171
|
// @__NO_SIDE_EFFECTS__
|
|
15130
|
-
function _properties(
|
|
15131
|
-
return new
|
|
15132
|
-
type: "properties",
|
|
15172
|
+
function _properties(shape, params) {
|
|
15173
|
+
return new $ZodCheckProperties({
|
|
15133
15174
|
check: "properties",
|
|
15134
15175
|
shape,
|
|
15135
15176
|
...normalizeParams(params)
|
|
@@ -15764,11 +15805,11 @@ function foldObjects(members2) {
|
|
|
15764
15805
|
}
|
|
15765
15806
|
objects.push(member);
|
|
15766
15807
|
}
|
|
15767
|
-
const
|
|
15808
|
+
const properties = {};
|
|
15768
15809
|
const required2 = /* @__PURE__ */ new Set();
|
|
15769
15810
|
for (const object2 of objects) {
|
|
15770
15811
|
for (const key in object2.properties) {
|
|
15771
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
15812
|
+
if (Object.prototype.hasOwnProperty.call(properties, key))
|
|
15772
15813
|
continue;
|
|
15773
15814
|
const parts = [];
|
|
15774
15815
|
for (const other of objects) {
|
|
@@ -15779,12 +15820,12 @@ function foldObjects(members2) {
|
|
|
15779
15820
|
parts.push(part);
|
|
15780
15821
|
}
|
|
15781
15822
|
const merged = parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts };
|
|
15782
|
-
assignProp(
|
|
15823
|
+
assignProp(properties, key, merged);
|
|
15783
15824
|
}
|
|
15784
15825
|
for (const key of object2.required ?? [])
|
|
15785
15826
|
required2.add(key);
|
|
15786
15827
|
}
|
|
15787
|
-
const folded = { type: "object", properties
|
|
15828
|
+
const folded = { type: "object", properties };
|
|
15788
15829
|
if (required2.size)
|
|
15789
15830
|
folded.required = [...required2];
|
|
15790
15831
|
if (objects.every((object2) => object2.additionalProperties === false)) {
|
|
@@ -16406,17 +16447,15 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
16406
16447
|
path: [...params.path, "properties", key]
|
|
16407
16448
|
}));
|
|
16408
16449
|
}
|
|
16409
|
-
const
|
|
16410
|
-
const
|
|
16450
|
+
const requiredKeys = [];
|
|
16451
|
+
for (const key of Object.keys(shape)) {
|
|
16411
16452
|
const field = def.shape[key];
|
|
16412
|
-
if (ctx.io === "input") {
|
|
16413
|
-
|
|
16414
|
-
} else {
|
|
16415
|
-
return field._zod.optout === void 0;
|
|
16453
|
+
if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) {
|
|
16454
|
+
requiredKeys.push(key);
|
|
16416
16455
|
}
|
|
16417
|
-
}
|
|
16418
|
-
if (requiredKeys.
|
|
16419
|
-
json2.required =
|
|
16456
|
+
}
|
|
16457
|
+
if (requiredKeys.length > 0) {
|
|
16458
|
+
json2.required = requiredKeys;
|
|
16420
16459
|
}
|
|
16421
16460
|
if (def.catchall?._zod.def.type === "never") {
|
|
16422
16461
|
json2.additionalProperties = false;
|
|
@@ -16430,31 +16469,6 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
16430
16469
|
});
|
|
16431
16470
|
}
|
|
16432
16471
|
};
|
|
16433
|
-
var propertiesProcessor = (schema, ctx, _json, params) => {
|
|
16434
|
-
const json2 = _json;
|
|
16435
|
-
const def = schema._zod.def;
|
|
16436
|
-
if (Object.getOwnPropertySymbols(def.shape).length && handleUnrepresentable(schema, ctx, json2, params, "Symbol keys cannot be represented in JSON Schema")) {
|
|
16437
|
-
return;
|
|
16438
|
-
}
|
|
16439
|
-
if (ctx.io === "output") {
|
|
16440
|
-
for (const key in def.shape) {
|
|
16441
|
-
if (isTransforming(def.shape[key]) && handleUnrepresentable(schema, ctx, json2, params, `z.properties() returns its input, so the output of a transforming schema at key "${key}" cannot be represented in JSON Schema`)) {
|
|
16442
|
-
return;
|
|
16443
|
-
}
|
|
16444
|
-
}
|
|
16445
|
-
}
|
|
16446
|
-
json2.type = "object";
|
|
16447
|
-
json2.properties = {};
|
|
16448
|
-
for (const key in def.shape) {
|
|
16449
|
-
assignProp(json2.properties, key, processSchema(def.shape[key], ctx, {
|
|
16450
|
-
...params,
|
|
16451
|
-
path: [...params.path, "properties", key]
|
|
16452
|
-
}));
|
|
16453
|
-
}
|
|
16454
|
-
const required2 = Object.keys(def.shape).filter((key) => inputOptin(def.shape[key]) === void 0);
|
|
16455
|
-
if (required2.length > 0)
|
|
16456
|
-
json2.required = required2;
|
|
16457
|
-
};
|
|
16458
16472
|
var unionProcessor = (schema, ctx, json2, params) => {
|
|
16459
16473
|
const def = schema._zod.def;
|
|
16460
16474
|
const isExclusive = def.inclusive === false;
|
|
@@ -16774,7 +16788,6 @@ var allProcessors = {
|
|
|
16774
16788
|
file: fileProcessor,
|
|
16775
16789
|
success: successProcessor,
|
|
16776
16790
|
custom: customProcessor,
|
|
16777
|
-
properties: propertiesProcessor,
|
|
16778
16791
|
function: functionProcessor,
|
|
16779
16792
|
transform: transformProcessor,
|
|
16780
16793
|
map: mapProcessor,
|
|
@@ -16971,7 +16984,6 @@ __export(schemas_exports2, {
|
|
|
16971
16984
|
ZodPrefault: () => ZodPrefault,
|
|
16972
16985
|
ZodPreprocess: () => ZodPreprocess,
|
|
16973
16986
|
ZodPromise: () => ZodPromise,
|
|
16974
|
-
ZodProperties: () => ZodProperties,
|
|
16975
16987
|
ZodReadonly: () => ZodReadonly,
|
|
16976
16988
|
ZodRecord: () => ZodRecord,
|
|
16977
16989
|
ZodSet: () => ZodSet,
|
|
@@ -17009,6 +17021,7 @@ __export(schemas_exports2, {
|
|
|
17009
17021
|
creditCard: () => creditCard2,
|
|
17010
17022
|
cuid: () => cuid3,
|
|
17011
17023
|
cuid2: () => cuid22,
|
|
17024
|
+
currencyCode: () => currencyCode2,
|
|
17012
17025
|
custom: () => custom,
|
|
17013
17026
|
date: () => date2,
|
|
17014
17027
|
describe: () => describe2,
|
|
@@ -17063,7 +17076,6 @@ __export(schemas_exports2, {
|
|
|
17063
17076
|
prefault: () => prefault,
|
|
17064
17077
|
preprocess: () => preprocess,
|
|
17065
17078
|
promise: () => promise,
|
|
17066
|
-
properties: () => properties,
|
|
17067
17079
|
readonly: () => readonly,
|
|
17068
17080
|
record: () => record,
|
|
17069
17081
|
refine: () => refine,
|
|
@@ -17117,6 +17129,7 @@ __export(checks_exports2, {
|
|
|
17117
17129
|
normalize: () => _normalize,
|
|
17118
17130
|
overwrite: () => _overwrite,
|
|
17119
17131
|
positive: () => _positive,
|
|
17132
|
+
properties: () => _properties,
|
|
17120
17133
|
property: () => _property,
|
|
17121
17134
|
regex: () => _regex,
|
|
17122
17135
|
size: () => _size,
|
|
@@ -17576,8 +17589,8 @@ function url(params) {
|
|
|
17576
17589
|
}
|
|
17577
17590
|
function httpUrl(params) {
|
|
17578
17591
|
return _url(ZodURL, {
|
|
17579
|
-
protocol:
|
|
17580
|
-
hostname:
|
|
17592
|
+
protocol: httpProtocol,
|
|
17593
|
+
hostname: domain,
|
|
17581
17594
|
...util_exports.normalizeParams(params)
|
|
17582
17595
|
});
|
|
17583
17596
|
}
|
|
@@ -17715,10 +17728,13 @@ function stringFormat(format, fnOrRegex, _params = {}) {
|
|
|
17715
17728
|
return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
|
|
17716
17729
|
}
|
|
17717
17730
|
function hostname2(_params) {
|
|
17718
|
-
return _stringFormat(ZodCustomStringFormat, "hostname",
|
|
17731
|
+
return _stringFormat(ZodCustomStringFormat, "hostname", hostname, _params);
|
|
17719
17732
|
}
|
|
17720
17733
|
function hex2(_params) {
|
|
17721
|
-
return _stringFormat(ZodCustomStringFormat, "hex",
|
|
17734
|
+
return _stringFormat(ZodCustomStringFormat, "hex", hex, _params);
|
|
17735
|
+
}
|
|
17736
|
+
function currencyCode2(_params) {
|
|
17737
|
+
return _stringFormat(ZodCustomStringFormat, "currency_code", currencyCode, _params);
|
|
17722
17738
|
}
|
|
17723
17739
|
function hash(alg, params) {
|
|
17724
17740
|
const enc = params?.enc ?? "hex";
|
|
@@ -18583,14 +18599,6 @@ var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
|
18583
18599
|
ZodType.init(inst, def);
|
|
18584
18600
|
inst._zod.processJSONSchema = (ctx, json2, params) => customProcessor(inst, ctx, json2, params);
|
|
18585
18601
|
});
|
|
18586
|
-
var ZodProperties = /* @__PURE__ */ $constructor("ZodProperties", (inst, def) => {
|
|
18587
|
-
_ensureDefaultMemoizer();
|
|
18588
|
-
$ZodProperties.init(inst, def);
|
|
18589
|
-
ZodType.init(inst, def);
|
|
18590
|
-
});
|
|
18591
|
-
function properties(shape, params) {
|
|
18592
|
-
return _properties(ZodProperties, shape, params);
|
|
18593
|
-
}
|
|
18594
18602
|
function check(fn) {
|
|
18595
18603
|
const ch = new $ZodCheck({
|
|
18596
18604
|
check: "custom"
|
|
@@ -18614,7 +18622,7 @@ var ZodInstanceOf = /* @__PURE__ */ $constructor("ZodInstanceOf", (inst, def) =>
|
|
|
18614
18622
|
ZodCustom.init(inst, def);
|
|
18615
18623
|
}, {
|
|
18616
18624
|
properties(shape, params) {
|
|
18617
|
-
return this.check(
|
|
18625
|
+
return this.check(_properties(shape, params));
|
|
18618
18626
|
}
|
|
18619
18627
|
});
|
|
18620
18628
|
function _instanceof(cls, params = {}) {
|
|
@@ -19201,10 +19209,10 @@ function convertBaseSchema(schema, ctx) {
|
|
|
19201
19209
|
}
|
|
19202
19210
|
case "object": {
|
|
19203
19211
|
const shape = {};
|
|
19204
|
-
const
|
|
19212
|
+
const properties = schema.properties || {};
|
|
19205
19213
|
const requiredSet = new Set(schema.required || []);
|
|
19206
19214
|
const additionalSchema = typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : void 0;
|
|
19207
|
-
for (const [key, propSchema] of Object.entries(
|
|
19215
|
+
for (const [key, propSchema] of Object.entries(properties)) {
|
|
19208
19216
|
const propZodSchema = convertSchema(propSchema, ctx);
|
|
19209
19217
|
assignProp(shape, key, requiredSet.has(key) ? propZodSchema : propZodSchema.optional());
|
|
19210
19218
|
}
|
|
@@ -19449,21 +19457,21 @@ function visit(schema, fnOrHandlers) {
|
|
|
19449
19457
|
const h = fnOrHandlers[node2._zod.def.type];
|
|
19450
19458
|
return h ? h(node2, rewritten) : node2;
|
|
19451
19459
|
};
|
|
19452
|
-
const
|
|
19460
|
+
const cache = /* @__PURE__ */ new Map();
|
|
19453
19461
|
function run2(s) {
|
|
19454
|
-
const cached2 =
|
|
19462
|
+
const cached2 = cache.get(s);
|
|
19455
19463
|
if (cached2 === RESOLVING) {
|
|
19456
19464
|
return new $ZodLazy({
|
|
19457
19465
|
type: "lazy",
|
|
19458
|
-
getter: () =>
|
|
19466
|
+
getter: () => cache.get(s)
|
|
19459
19467
|
});
|
|
19460
19468
|
}
|
|
19461
19469
|
if (cached2 !== void 0)
|
|
19462
19470
|
return cached2;
|
|
19463
|
-
|
|
19471
|
+
cache.set(s, RESOLVING);
|
|
19464
19472
|
const inner = mapInner(s);
|
|
19465
19473
|
const mapped = fn(inner, inner !== s);
|
|
19466
|
-
|
|
19474
|
+
cache.set(s, mapped);
|
|
19467
19475
|
return mapped;
|
|
19468
19476
|
}
|
|
19469
19477
|
function mapInner(s) {
|
|
@@ -19565,18 +19573,6 @@ function visit(schema, fnOrHandlers) {
|
|
|
19565
19573
|
const { _cachedInner, ...rest } = def;
|
|
19566
19574
|
return clone(s, { ...rest, getter: () => run2(original()) });
|
|
19567
19575
|
}
|
|
19568
|
-
case "properties": {
|
|
19569
|
-
const oldShape = def.shape;
|
|
19570
|
-
let changed = false;
|
|
19571
|
-
const newShape = {};
|
|
19572
|
-
for (const k of Reflect.ownKeys(oldShape)) {
|
|
19573
|
-
const mapped = run2(oldShape[k]);
|
|
19574
|
-
if (mapped !== oldShape[k])
|
|
19575
|
-
changed = true;
|
|
19576
|
-
newShape[k] = mapped;
|
|
19577
|
-
}
|
|
19578
|
-
return changed ? clone(s, { ...def, shape: newShape }) : s;
|
|
19579
|
-
}
|
|
19580
19576
|
// A leaf by choice: `parts` are regex fragments, not data positions.
|
|
19581
19577
|
case "template_literal":
|
|
19582
19578
|
// Leaves.
|
|
@@ -26549,8 +26545,8 @@ var require_defaults = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
26549
26545
|
const codegen_1 = require_codegen();
|
|
26550
26546
|
const util_1 = require_util();
|
|
26551
26547
|
function assignDefaults(it, ty) {
|
|
26552
|
-
const { properties
|
|
26553
|
-
if (ty === "object" &&
|
|
26548
|
+
const { properties, items } = it.schema;
|
|
26549
|
+
if (ty === "object" && properties) for (const key in properties) assignDefault(it, key, properties[key].default);
|
|
26554
26550
|
else if (ty === "array" && Array.isArray(items)) items.forEach((sch, i) => assignDefault(it, i, sch.default));
|
|
26555
26551
|
}
|
|
26556
26552
|
exports.assignDefaults = assignDefaults;
|
|
@@ -26582,8 +26578,8 @@ var require_code = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
26582
26578
|
});
|
|
26583
26579
|
}
|
|
26584
26580
|
exports.checkReportMissingProp = checkReportMissingProp;
|
|
26585
|
-
function checkMissingProp({ gen, data, it: { opts } },
|
|
26586
|
-
return (0, codegen_1.or)(...
|
|
26581
|
+
function checkMissingProp({ gen, data, it: { opts } }, properties, missing) {
|
|
26582
|
+
return (0, codegen_1.or)(...properties.map((prop) => (0, codegen_1.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1._)`${missing} = ${prop}`)));
|
|
26587
26583
|
}
|
|
26588
26584
|
exports.checkMissingProp = checkMissingProp;
|
|
26589
26585
|
function reportMissingProp(cxt, missing) {
|
|
@@ -28624,8 +28620,8 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
28624
28620
|
return this;
|
|
28625
28621
|
}
|
|
28626
28622
|
case "object": {
|
|
28627
|
-
const
|
|
28628
|
-
this._cache.delete(
|
|
28623
|
+
const cacheKey = schemaKeyRef;
|
|
28624
|
+
this._cache.delete(cacheKey);
|
|
28629
28625
|
let id = schemaKeyRef[this.opts.schemaId];
|
|
28630
28626
|
if (id) {
|
|
28631
28627
|
id = (0, resolve_1.normalizeId)(id);
|
|
@@ -28768,10 +28764,10 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
28768
28764
|
Ajv2.ValidationError = validation_error_1.default;
|
|
28769
28765
|
Ajv2.MissingRefError = ref_error_1.default;
|
|
28770
28766
|
exports.default = Ajv2;
|
|
28771
|
-
function checkOptions(checkOpts, options, msg,
|
|
28767
|
+
function checkOptions(checkOpts, options, msg, log2 = "error") {
|
|
28772
28768
|
for (const key in checkOpts) {
|
|
28773
28769
|
const opt = key;
|
|
28774
|
-
if (opt in options) this.logger[
|
|
28770
|
+
if (opt in options) this.logger[log2](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
28775
28771
|
}
|
|
28776
28772
|
}
|
|
28777
28773
|
function getSchEnv(keyRef) {
|
|
@@ -29859,10 +29855,10 @@ var require_properties = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
29859
29855
|
const allProps = (0, code_1.allSchemaProperties)(schema);
|
|
29860
29856
|
for (const prop of allProps) it.definedProperties.add(prop);
|
|
29861
29857
|
if (it.opts.unevaluated && allProps.length && it.props !== true) it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props);
|
|
29862
|
-
const
|
|
29863
|
-
if (
|
|
29858
|
+
const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p]));
|
|
29859
|
+
if (properties.length === 0) return;
|
|
29864
29860
|
const valid = gen.name("valid");
|
|
29865
|
-
for (const prop of
|
|
29861
|
+
for (const prop of properties) {
|
|
29866
29862
|
if (hasDefault(prop)) applyPropertySchema(prop);
|
|
29867
29863
|
else {
|
|
29868
29864
|
gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties));
|
|
@@ -33040,33 +33036,210 @@ var pageSchema = {
|
|
|
33040
33036
|
};
|
|
33041
33037
|
|
|
33042
33038
|
// src/runner.ts
|
|
33043
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
33044
33039
|
import { delimiter, join } from "node:path";
|
|
33045
|
-
|
|
33046
|
-
|
|
33040
|
+
|
|
33041
|
+
// src/timestamps.ts
|
|
33042
|
+
var DEFAULT_DISPLAY_TZ = "America/New_York";
|
|
33043
|
+
function isValidTimeZone(tz) {
|
|
33044
|
+
try {
|
|
33045
|
+
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
33046
|
+
return true;
|
|
33047
|
+
} catch {
|
|
33048
|
+
return false;
|
|
33049
|
+
}
|
|
33047
33050
|
}
|
|
33048
|
-
|
|
33049
|
-
|
|
33050
|
-
|
|
33051
|
-
|
|
33052
|
-
|
|
33053
|
-
|
|
33054
|
-
|
|
33055
|
-
|
|
33056
|
-
|
|
33057
|
-
|
|
33051
|
+
function displayTimeZone() {
|
|
33052
|
+
const configured = readEnvVar("DISPLAY_TZ");
|
|
33053
|
+
if (configured && isValidTimeZone(configured)) return configured;
|
|
33054
|
+
return DEFAULT_DISPLAY_TZ;
|
|
33055
|
+
}
|
|
33056
|
+
function naiveSourceTimeZone() {
|
|
33057
|
+
const configured = readEnvVar("GOG_TIMEZONE");
|
|
33058
|
+
if (configured && isValidTimeZone(configured)) return configured;
|
|
33059
|
+
return displayTimeZone();
|
|
33060
|
+
}
|
|
33061
|
+
function offsetAt(instant, tz) {
|
|
33062
|
+
const w = wallPartsIn(instant, tz);
|
|
33063
|
+
const asUTC = Date.UTC(w.year, w.month - 1, w.day, w.hour, w.minute, w.second, instant.getUTCMilliseconds());
|
|
33064
|
+
const minutes = Math.round((asUTC - instant.getTime()) / 6e4);
|
|
33065
|
+
const sign2 = minutes < 0 ? "-" : "+";
|
|
33066
|
+
const abs = Math.abs(minutes);
|
|
33067
|
+
return `${sign2}${pad(Math.floor(abs / 60))}:${pad(abs % 60)}`;
|
|
33068
|
+
}
|
|
33069
|
+
function wallPartsIn(instant, tz) {
|
|
33070
|
+
const parts = new Intl.DateTimeFormat("en-US", {
|
|
33071
|
+
timeZone: tz,
|
|
33072
|
+
year: "numeric",
|
|
33073
|
+
month: "2-digit",
|
|
33074
|
+
day: "2-digit",
|
|
33075
|
+
hour: "2-digit",
|
|
33076
|
+
minute: "2-digit",
|
|
33077
|
+
second: "2-digit",
|
|
33078
|
+
// h23 pins midnight to hour 00; without it some ICU builds render hour 24.
|
|
33079
|
+
hourCycle: "h23"
|
|
33080
|
+
}).formatToParts(instant);
|
|
33081
|
+
const out = {};
|
|
33082
|
+
for (const p of parts) {
|
|
33083
|
+
if (p.type !== "literal") out[p.type] = Number(p.value);
|
|
33058
33084
|
}
|
|
33059
|
-
|
|
33060
|
-
|
|
33061
|
-
|
|
33085
|
+
return out;
|
|
33086
|
+
}
|
|
33087
|
+
function wallTimeToInstant(y, mo, d, h, mi, s, ms, tz) {
|
|
33088
|
+
let guess = Date.UTC(y, mo - 1, d, h, mi, s, ms);
|
|
33089
|
+
for (let i = 0; i < 2; i += 1) {
|
|
33090
|
+
const seen = wallPartsIn(new Date(guess), tz);
|
|
33091
|
+
const seenUTC = Date.UTC(seen.year, seen.month - 1, seen.day, seen.hour, seen.minute, seen.second, ms);
|
|
33092
|
+
const drift = Date.UTC(y, mo - 1, d, h, mi, s, ms) - seenUTC;
|
|
33093
|
+
if (drift === 0) break;
|
|
33094
|
+
guess += drift;
|
|
33095
|
+
}
|
|
33096
|
+
return new Date(guess);
|
|
33097
|
+
}
|
|
33098
|
+
function pad(n, width = 2) {
|
|
33099
|
+
return String(n).padStart(width, "0");
|
|
33100
|
+
}
|
|
33101
|
+
function isoWithOffset(instant, tz, offset) {
|
|
33102
|
+
const w = wallPartsIn(instant, tz);
|
|
33103
|
+
const msPart = instant.getUTCMilliseconds();
|
|
33104
|
+
const frac = msPart ? `.${pad(msPart, 3)}` : "";
|
|
33105
|
+
return `${pad(w.year, 4)}-${pad(w.month)}-${pad(w.day)}T${pad(w.hour)}:${pad(w.minute)}:${pad(w.second)}${frac}${offset}`;
|
|
33106
|
+
}
|
|
33107
|
+
function formatInstant(instant, tz = displayTimeZone()) {
|
|
33108
|
+
const offset = offsetAt(instant, tz);
|
|
33109
|
+
const display = new Intl.DateTimeFormat("en-US", {
|
|
33110
|
+
timeZone: tz,
|
|
33111
|
+
weekday: "short",
|
|
33112
|
+
month: "short",
|
|
33113
|
+
day: "numeric",
|
|
33114
|
+
year: "numeric",
|
|
33115
|
+
hour: "numeric",
|
|
33116
|
+
minute: "2-digit",
|
|
33117
|
+
timeZoneName: "short"
|
|
33118
|
+
}).format(instant);
|
|
33119
|
+
return { iso: isoWithOffset(instant, tz, offset), display };
|
|
33120
|
+
}
|
|
33121
|
+
var TIMESTAMP_KEYS = /* @__PURE__ */ new Set([
|
|
33122
|
+
"date",
|
|
33123
|
+
// gog gmail message/thread listings ("2026-07-28 03:36")
|
|
33124
|
+
"dateTime",
|
|
33125
|
+
// Calendar event start/end
|
|
33126
|
+
"internalDate",
|
|
33127
|
+
// Gmail, epoch milliseconds (authoritative)
|
|
33128
|
+
// gog >= 0.35.0 Gmail message AND thread listings. Already offset-bearing
|
|
33129
|
+
// (RFC3339 from internalDate), so it needs no offset repair — it is
|
|
33130
|
+
// allowlisted purely to gain a Display sibling, and to be re-rendered in
|
|
33131
|
+
// DISPLAY_TZ like every other instant. Separately sourced from the sibling
|
|
33132
|
+
// `date`, which is a naive re-format of the sender's Date header; the two may
|
|
33133
|
+
// legitimately disagree. See docs/timestamps.md.
|
|
33134
|
+
"internalDateIso",
|
|
33135
|
+
"modifiedTime",
|
|
33136
|
+
// Drive
|
|
33137
|
+
"createdTime",
|
|
33138
|
+
// Drive
|
|
33139
|
+
"createTime",
|
|
33140
|
+
"updateTime",
|
|
33141
|
+
"updated",
|
|
33142
|
+
"originalStartTime",
|
|
33143
|
+
"expirationTime",
|
|
33144
|
+
"lastModified",
|
|
33145
|
+
"sentAt",
|
|
33146
|
+
"viewedAt",
|
|
33147
|
+
"modifiedAt",
|
|
33148
|
+
"fetchedBodyAt",
|
|
33149
|
+
"asOf"
|
|
33150
|
+
]);
|
|
33151
|
+
var ZONE_NAME_KEYS = /* @__PURE__ */ new Set(["timeZone", "timezone"]);
|
|
33152
|
+
var RFC3339_WITH_OFFSET = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.(\d{1,9}))?(Z|[+-]\d{2}:?\d{2})$/;
|
|
33153
|
+
var NAIVE_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.(\d{1,9}))?$/;
|
|
33154
|
+
var EPOCH_MILLIS = /^\d{13}$/;
|
|
33155
|
+
var DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
33156
|
+
function isRealCalendarDate(p) {
|
|
33157
|
+
const utc = new Date(Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute, p.second));
|
|
33158
|
+
return utc.getUTCFullYear() === p.year && utc.getUTCMonth() === p.month - 1 && utc.getUTCDate() === p.day && utc.getUTCHours() === p.hour && utc.getUTCMinutes() === p.minute && utc.getUTCSeconds() === p.second;
|
|
33062
33159
|
}
|
|
33063
|
-
|
|
33064
|
-
|
|
33065
|
-
|
|
33066
|
-
|
|
33160
|
+
function parseTimestampValue(key, value, assumeNaiveIn) {
|
|
33161
|
+
if (typeof value !== "string") return null;
|
|
33162
|
+
const raw = value.trim();
|
|
33163
|
+
if (raw === "" || DATE_ONLY.test(raw)) return null;
|
|
33164
|
+
if (key === "internalDate" && EPOCH_MILLIS.test(raw)) {
|
|
33165
|
+
return new Date(Number(raw));
|
|
33166
|
+
}
|
|
33167
|
+
if (RFC3339_WITH_OFFSET.test(raw)) {
|
|
33168
|
+
const parsed = new Date(raw.replace(" ", "T"));
|
|
33169
|
+
return Number.isNaN(parsed.getTime()) ? null : parsed;
|
|
33170
|
+
}
|
|
33171
|
+
const naive = NAIVE_DATE_TIME.exec(raw);
|
|
33172
|
+
if (naive) {
|
|
33173
|
+
const [, y, mo, d, h, mi, s, frac] = naive;
|
|
33174
|
+
const ms = frac ? Number(frac.padEnd(3, "0").slice(0, 3)) : 0;
|
|
33175
|
+
const parts = {
|
|
33176
|
+
year: Number(y),
|
|
33177
|
+
month: Number(mo),
|
|
33178
|
+
day: Number(d),
|
|
33179
|
+
hour: Number(h),
|
|
33180
|
+
minute: Number(mi),
|
|
33181
|
+
second: Number(s ?? "0")
|
|
33182
|
+
};
|
|
33183
|
+
if (!isRealCalendarDate(parts)) return null;
|
|
33184
|
+
return wallTimeToInstant(
|
|
33185
|
+
parts.year,
|
|
33186
|
+
parts.month,
|
|
33187
|
+
parts.day,
|
|
33188
|
+
parts.hour,
|
|
33189
|
+
parts.minute,
|
|
33190
|
+
parts.second,
|
|
33191
|
+
ms,
|
|
33192
|
+
assumeNaiveIn
|
|
33193
|
+
);
|
|
33194
|
+
}
|
|
33195
|
+
return null;
|
|
33067
33196
|
}
|
|
33068
|
-
function
|
|
33069
|
-
|
|
33197
|
+
function walk2(node2, tz, naiveTz) {
|
|
33198
|
+
let changed = false;
|
|
33199
|
+
if (Array.isArray(node2)) {
|
|
33200
|
+
for (const item of node2) {
|
|
33201
|
+
if (walk2(item, tz, naiveTz)) changed = true;
|
|
33202
|
+
}
|
|
33203
|
+
return changed;
|
|
33204
|
+
}
|
|
33205
|
+
if (node2 === null || typeof node2 !== "object") return false;
|
|
33206
|
+
const obj = node2;
|
|
33207
|
+
for (const key of Object.keys(obj)) {
|
|
33208
|
+
const value = obj[key];
|
|
33209
|
+
if (value !== null && typeof value === "object") {
|
|
33210
|
+
if (walk2(value, tz, naiveTz)) changed = true;
|
|
33211
|
+
continue;
|
|
33212
|
+
}
|
|
33213
|
+
if (ZONE_NAME_KEYS.has(key) || !TIMESTAMP_KEYS.has(key)) continue;
|
|
33214
|
+
const instant = parseTimestampValue(key, value, naiveTz);
|
|
33215
|
+
if (!instant) continue;
|
|
33216
|
+
const { iso, display } = formatInstant(instant, tz);
|
|
33217
|
+
obj[key] = iso;
|
|
33218
|
+
obj[`${key}Display`] = display;
|
|
33219
|
+
changed = true;
|
|
33220
|
+
}
|
|
33221
|
+
return changed;
|
|
33222
|
+
}
|
|
33223
|
+
function detectIndent(text) {
|
|
33224
|
+
const match = /\n(\s+)\S/.exec(text);
|
|
33225
|
+
return match ? match[1].replace(/\t/g, " ").length : 0;
|
|
33226
|
+
}
|
|
33227
|
+
function normalizeTimestamps(text, tz = displayTimeZone(), naiveTz = naiveSourceTimeZone()) {
|
|
33228
|
+
const trimmed = text.trim();
|
|
33229
|
+
if (trimmed === "" || !/^[[{]/.test(trimmed)) return text;
|
|
33230
|
+
let parsed;
|
|
33231
|
+
try {
|
|
33232
|
+
parsed = JSON.parse(trimmed);
|
|
33233
|
+
} catch {
|
|
33234
|
+
return text;
|
|
33235
|
+
}
|
|
33236
|
+
if (!walk2(parsed, tz, naiveTz)) return text;
|
|
33237
|
+
return JSON.stringify(parsed, null, detectIndent(text));
|
|
33238
|
+
}
|
|
33239
|
+
|
|
33240
|
+
// src/runner.ts
|
|
33241
|
+
function isGogFileArg(arg) {
|
|
33242
|
+
return typeof arg !== "string";
|
|
33070
33243
|
}
|
|
33071
33244
|
var TIMEOUT_MS = 3e4;
|
|
33072
33245
|
var MIN_GOG_VERSION = "0.40.0";
|
|
@@ -33186,7 +33359,7 @@ async function spawnGog(fullArgs, opts) {
|
|
|
33186
33359
|
const spawn = spawner ?? (await import("node:child_process")).spawn;
|
|
33187
33360
|
const effectiveTimeout = timeout ?? TIMEOUT_MS;
|
|
33188
33361
|
return new Promise((resolve, reject) => {
|
|
33189
|
-
const childEnv = { ...sanitizedEnv(), PATH: augmentedPath() };
|
|
33362
|
+
const childEnv = { ...sanitizedEnv(), GOG_TIMEZONE: naiveSourceTimeZone(), PATH: augmentedPath() };
|
|
33190
33363
|
const child = spawn(readEnvVar("GOG_PATH") ?? "gog", fullArgs, { env: childEnv });
|
|
33191
33364
|
const stdoutChunks = [];
|
|
33192
33365
|
const stderrChunks = [];
|
|
@@ -33256,235 +33429,18 @@ async function run(args, options = {}) {
|
|
|
33256
33429
|
const base = redactMode === "tokens" ? redactGoogleTokens : redactSecrets2;
|
|
33257
33430
|
const redact = opaqueFields?.length ? (text) => redactPreservingOpaqueFields(text, opaqueFields, base) : base;
|
|
33258
33431
|
const fullArgs = assembleArgs(args, { account, interactive, readonly: readonly2 });
|
|
33259
|
-
const store = activeExecutor();
|
|
33260
33432
|
try {
|
|
33261
|
-
|
|
33262
|
-
if (spawner) {
|
|
33263
|
-
output2 = await spawnExecutor(fullArgs, { timeout, interactive, spawner });
|
|
33264
|
-
} else if (store) {
|
|
33265
|
-
output2 = await store.executor(fullArgs, { timeout, interactive });
|
|
33266
|
-
} else {
|
|
33267
|
-
output2 = await spawnExecutor(fullArgs, { timeout, interactive });
|
|
33268
|
-
}
|
|
33269
|
-
return redact(output2);
|
|
33433
|
+
return redact(await spawnExecutor(fullArgs, { timeout, interactive, spawner }));
|
|
33270
33434
|
} catch (err) {
|
|
33271
|
-
|
|
33272
|
-
if (isRunnerTransportError(err)) {
|
|
33273
|
-
throw new RunnerTransportError(message, err.kind, err.status);
|
|
33274
|
-
}
|
|
33275
|
-
throw new Error(message);
|
|
33435
|
+
throw new Error(base(err instanceof Error ? err.message : String(err)));
|
|
33276
33436
|
}
|
|
33277
33437
|
}
|
|
33278
33438
|
async function runBinary(args, options = {}) {
|
|
33279
33439
|
const { account, spawner, timeout, readonly: readonly2 = false } = options;
|
|
33280
|
-
if (!spawner && activeExecutor()) {
|
|
33281
|
-
throw new Error(
|
|
33282
|
-
"Raw byte retrieval is not available over the hosted connector (its transport is text-only). Use the text-extraction path instead, or run the local stdio server to fetch bytes."
|
|
33283
|
-
);
|
|
33284
|
-
}
|
|
33285
33440
|
const fullArgs = assembleArgs(args, { account, interactive: false, readonly: readonly2 });
|
|
33286
33441
|
return spawnExecutor(fullArgs, { timeout, interactive: false, spawner, binary: true });
|
|
33287
33442
|
}
|
|
33288
33443
|
|
|
33289
|
-
// src/timestamps.ts
|
|
33290
|
-
var DEFAULT_DISPLAY_TZ = "America/New_York";
|
|
33291
|
-
function isValidTimeZone(tz) {
|
|
33292
|
-
try {
|
|
33293
|
-
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
33294
|
-
return true;
|
|
33295
|
-
} catch {
|
|
33296
|
-
return false;
|
|
33297
|
-
}
|
|
33298
|
-
}
|
|
33299
|
-
function displayTimeZone() {
|
|
33300
|
-
const configured = readEnvVar("DISPLAY_TZ");
|
|
33301
|
-
if (configured && isValidTimeZone(configured)) return configured;
|
|
33302
|
-
return DEFAULT_DISPLAY_TZ;
|
|
33303
|
-
}
|
|
33304
|
-
function naiveSourceTimeZone() {
|
|
33305
|
-
const configured = readEnvVar("GOG_TIMEZONE");
|
|
33306
|
-
if (configured && isValidTimeZone(configured)) return configured;
|
|
33307
|
-
return displayTimeZone();
|
|
33308
|
-
}
|
|
33309
|
-
function offsetAt(instant, tz) {
|
|
33310
|
-
const w = wallPartsIn(instant, tz);
|
|
33311
|
-
const asUTC = Date.UTC(w.year, w.month - 1, w.day, w.hour, w.minute, w.second, instant.getUTCMilliseconds());
|
|
33312
|
-
const minutes = Math.round((asUTC - instant.getTime()) / 6e4);
|
|
33313
|
-
const sign2 = minutes < 0 ? "-" : "+";
|
|
33314
|
-
const abs = Math.abs(minutes);
|
|
33315
|
-
return `${sign2}${pad(Math.floor(abs / 60))}:${pad(abs % 60)}`;
|
|
33316
|
-
}
|
|
33317
|
-
function wallPartsIn(instant, tz) {
|
|
33318
|
-
const parts = new Intl.DateTimeFormat("en-US", {
|
|
33319
|
-
timeZone: tz,
|
|
33320
|
-
year: "numeric",
|
|
33321
|
-
month: "2-digit",
|
|
33322
|
-
day: "2-digit",
|
|
33323
|
-
hour: "2-digit",
|
|
33324
|
-
minute: "2-digit",
|
|
33325
|
-
second: "2-digit",
|
|
33326
|
-
// h23 pins midnight to hour 00; without it some ICU builds render hour 24.
|
|
33327
|
-
hourCycle: "h23"
|
|
33328
|
-
}).formatToParts(instant);
|
|
33329
|
-
const out = {};
|
|
33330
|
-
for (const p of parts) {
|
|
33331
|
-
if (p.type !== "literal") out[p.type] = Number(p.value);
|
|
33332
|
-
}
|
|
33333
|
-
return out;
|
|
33334
|
-
}
|
|
33335
|
-
function wallTimeToInstant(y, mo, d, h, mi, s, ms, tz) {
|
|
33336
|
-
let guess = Date.UTC(y, mo - 1, d, h, mi, s, ms);
|
|
33337
|
-
for (let i = 0; i < 2; i += 1) {
|
|
33338
|
-
const seen = wallPartsIn(new Date(guess), tz);
|
|
33339
|
-
const seenUTC = Date.UTC(seen.year, seen.month - 1, seen.day, seen.hour, seen.minute, seen.second, ms);
|
|
33340
|
-
const drift = Date.UTC(y, mo - 1, d, h, mi, s, ms) - seenUTC;
|
|
33341
|
-
if (drift === 0) break;
|
|
33342
|
-
guess += drift;
|
|
33343
|
-
}
|
|
33344
|
-
return new Date(guess);
|
|
33345
|
-
}
|
|
33346
|
-
function pad(n, width = 2) {
|
|
33347
|
-
return String(n).padStart(width, "0");
|
|
33348
|
-
}
|
|
33349
|
-
function isoWithOffset(instant, tz, offset) {
|
|
33350
|
-
const w = wallPartsIn(instant, tz);
|
|
33351
|
-
const msPart = instant.getUTCMilliseconds();
|
|
33352
|
-
const frac = msPart ? `.${pad(msPart, 3)}` : "";
|
|
33353
|
-
return `${pad(w.year, 4)}-${pad(w.month)}-${pad(w.day)}T${pad(w.hour)}:${pad(w.minute)}:${pad(w.second)}${frac}${offset}`;
|
|
33354
|
-
}
|
|
33355
|
-
function formatInstant(instant, tz = displayTimeZone()) {
|
|
33356
|
-
const offset = offsetAt(instant, tz);
|
|
33357
|
-
const display = new Intl.DateTimeFormat("en-US", {
|
|
33358
|
-
timeZone: tz,
|
|
33359
|
-
weekday: "short",
|
|
33360
|
-
month: "short",
|
|
33361
|
-
day: "numeric",
|
|
33362
|
-
year: "numeric",
|
|
33363
|
-
hour: "numeric",
|
|
33364
|
-
minute: "2-digit",
|
|
33365
|
-
timeZoneName: "short"
|
|
33366
|
-
}).format(instant);
|
|
33367
|
-
return { iso: isoWithOffset(instant, tz, offset), display };
|
|
33368
|
-
}
|
|
33369
|
-
var TIMESTAMP_KEYS = /* @__PURE__ */ new Set([
|
|
33370
|
-
"date",
|
|
33371
|
-
// gog gmail message/thread listings ("2026-07-28 03:36")
|
|
33372
|
-
"dateTime",
|
|
33373
|
-
// Calendar event start/end
|
|
33374
|
-
"internalDate",
|
|
33375
|
-
// Gmail, epoch milliseconds (authoritative)
|
|
33376
|
-
// gog >= 0.35.0 Gmail message AND thread listings. Already offset-bearing
|
|
33377
|
-
// (RFC3339 from internalDate), so it needs no offset repair — it is
|
|
33378
|
-
// allowlisted purely to gain a Display sibling, and to be re-rendered in
|
|
33379
|
-
// DISPLAY_TZ like every other instant. Separately sourced from the sibling
|
|
33380
|
-
// `date`, which is a naive re-format of the sender's Date header; the two may
|
|
33381
|
-
// legitimately disagree. See docs/timestamps.md.
|
|
33382
|
-
"internalDateIso",
|
|
33383
|
-
"modifiedTime",
|
|
33384
|
-
// Drive
|
|
33385
|
-
"createdTime",
|
|
33386
|
-
// Drive
|
|
33387
|
-
"createTime",
|
|
33388
|
-
"updateTime",
|
|
33389
|
-
"updated",
|
|
33390
|
-
"originalStartTime",
|
|
33391
|
-
"expirationTime",
|
|
33392
|
-
"lastModified",
|
|
33393
|
-
"sentAt",
|
|
33394
|
-
"viewedAt",
|
|
33395
|
-
"modifiedAt",
|
|
33396
|
-
"fetchedBodyAt",
|
|
33397
|
-
"asOf"
|
|
33398
|
-
]);
|
|
33399
|
-
var ZONE_NAME_KEYS = /* @__PURE__ */ new Set(["timeZone", "timezone"]);
|
|
33400
|
-
var RFC3339_WITH_OFFSET = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.(\d{1,9}))?(Z|[+-]\d{2}:?\d{2})$/;
|
|
33401
|
-
var NAIVE_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.(\d{1,9}))?$/;
|
|
33402
|
-
var EPOCH_MILLIS = /^\d{13}$/;
|
|
33403
|
-
var DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
33404
|
-
function isRealCalendarDate(p) {
|
|
33405
|
-
const utc = new Date(Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute, p.second));
|
|
33406
|
-
return utc.getUTCFullYear() === p.year && utc.getUTCMonth() === p.month - 1 && utc.getUTCDate() === p.day && utc.getUTCHours() === p.hour && utc.getUTCMinutes() === p.minute && utc.getUTCSeconds() === p.second;
|
|
33407
|
-
}
|
|
33408
|
-
function parseTimestampValue(key, value, assumeNaiveIn) {
|
|
33409
|
-
if (typeof value !== "string") return null;
|
|
33410
|
-
const raw = value.trim();
|
|
33411
|
-
if (raw === "" || DATE_ONLY.test(raw)) return null;
|
|
33412
|
-
if (key === "internalDate" && EPOCH_MILLIS.test(raw)) {
|
|
33413
|
-
return new Date(Number(raw));
|
|
33414
|
-
}
|
|
33415
|
-
if (RFC3339_WITH_OFFSET.test(raw)) {
|
|
33416
|
-
const parsed = new Date(raw.replace(" ", "T"));
|
|
33417
|
-
return Number.isNaN(parsed.getTime()) ? null : parsed;
|
|
33418
|
-
}
|
|
33419
|
-
const naive = NAIVE_DATE_TIME.exec(raw);
|
|
33420
|
-
if (naive) {
|
|
33421
|
-
const [, y, mo, d, h, mi, s, frac] = naive;
|
|
33422
|
-
const ms = frac ? Number(frac.padEnd(3, "0").slice(0, 3)) : 0;
|
|
33423
|
-
const parts = {
|
|
33424
|
-
year: Number(y),
|
|
33425
|
-
month: Number(mo),
|
|
33426
|
-
day: Number(d),
|
|
33427
|
-
hour: Number(h),
|
|
33428
|
-
minute: Number(mi),
|
|
33429
|
-
second: Number(s ?? "0")
|
|
33430
|
-
};
|
|
33431
|
-
if (!isRealCalendarDate(parts)) return null;
|
|
33432
|
-
return wallTimeToInstant(
|
|
33433
|
-
parts.year,
|
|
33434
|
-
parts.month,
|
|
33435
|
-
parts.day,
|
|
33436
|
-
parts.hour,
|
|
33437
|
-
parts.minute,
|
|
33438
|
-
parts.second,
|
|
33439
|
-
ms,
|
|
33440
|
-
assumeNaiveIn
|
|
33441
|
-
);
|
|
33442
|
-
}
|
|
33443
|
-
return null;
|
|
33444
|
-
}
|
|
33445
|
-
function walk2(node2, tz, naiveTz) {
|
|
33446
|
-
let changed = false;
|
|
33447
|
-
if (Array.isArray(node2)) {
|
|
33448
|
-
for (const item of node2) {
|
|
33449
|
-
if (walk2(item, tz, naiveTz)) changed = true;
|
|
33450
|
-
}
|
|
33451
|
-
return changed;
|
|
33452
|
-
}
|
|
33453
|
-
if (node2 === null || typeof node2 !== "object") return false;
|
|
33454
|
-
const obj = node2;
|
|
33455
|
-
for (const key of Object.keys(obj)) {
|
|
33456
|
-
const value = obj[key];
|
|
33457
|
-
if (value !== null && typeof value === "object") {
|
|
33458
|
-
if (walk2(value, tz, naiveTz)) changed = true;
|
|
33459
|
-
continue;
|
|
33460
|
-
}
|
|
33461
|
-
if (ZONE_NAME_KEYS.has(key) || !TIMESTAMP_KEYS.has(key)) continue;
|
|
33462
|
-
const instant = parseTimestampValue(key, value, naiveTz);
|
|
33463
|
-
if (!instant) continue;
|
|
33464
|
-
const { iso, display } = formatInstant(instant, tz);
|
|
33465
|
-
obj[key] = iso;
|
|
33466
|
-
obj[`${key}Display`] = display;
|
|
33467
|
-
changed = true;
|
|
33468
|
-
}
|
|
33469
|
-
return changed;
|
|
33470
|
-
}
|
|
33471
|
-
function detectIndent(text) {
|
|
33472
|
-
const match = /\n(\s+)\S/.exec(text);
|
|
33473
|
-
return match ? match[1].replace(/\t/g, " ").length : 0;
|
|
33474
|
-
}
|
|
33475
|
-
function normalizeTimestamps(text, tz = displayTimeZone(), naiveTz = naiveSourceTimeZone()) {
|
|
33476
|
-
const trimmed = text.trim();
|
|
33477
|
-
if (trimmed === "" || !/^[[{]/.test(trimmed)) return text;
|
|
33478
|
-
let parsed;
|
|
33479
|
-
try {
|
|
33480
|
-
parsed = JSON.parse(trimmed);
|
|
33481
|
-
} catch {
|
|
33482
|
-
return text;
|
|
33483
|
-
}
|
|
33484
|
-
if (!walk2(parsed, tz, naiveTz)) return text;
|
|
33485
|
-
return JSON.stringify(parsed, null, detectIndent(text));
|
|
33486
|
-
}
|
|
33487
|
-
|
|
33488
33444
|
// src/pagination.ts
|
|
33489
33445
|
function detectIndent2(text) {
|
|
33490
33446
|
const match = /\n(\s+)\S/.exec(text);
|
|
@@ -33623,14 +33579,6 @@ var AUTH_HINT = "\n\nAuthentication may have expired. Use gog_auth_add to re-aut
|
|
|
33623
33579
|
var INVALID_GRANT_HINT = '\n\nThe stored refresh token was rejected (invalid_grant): it has expired or been revoked, so the whole account is signed out and re-authorization is required. The most common cause is the 7-day refresh-token limit Google applies to OAuth apps whose consent screen is still in "Testing" mode. Re-authorize with gog_auth_add (opens a browser) or gog_auth_add_url + gog_auth_add_complete (remote/headless). To stop this recurring, publish the OAuth consent screen to "In production" in the Google Cloud project that owns the OAuth client. Ask the user if they would like to re-authenticate.';
|
|
33624
33580
|
var TRANSIENT_HINT = "\n\nThis error is often transient. Retry the same call before trying a different approach (do not fall back to smaller writes or row-by-row operations).";
|
|
33625
33581
|
var GRID_LIMIT_HINT = "\n\nThe target range is outside the sheet's current grid. Add the missing rows or columns first with gog_sheets_insert (dimension: rows or cols), then retry the write.";
|
|
33626
|
-
var RUNNER_TRANSPORT_AUTH_HINT = "\n\nThis is the CONNECTOR's own transport auth failing, not your Google sign-in. The gog-runner backend rejected the bearer token this server sent, so the request never reached gog and no Google credential was checked \u2014 the Google account is not the problem and re-authorizing it cannot fix this. An operator must make the Worker secret GOG_RUNNER_KEY equal RUNNER_KEY on the Fly app (wrangler secret put GOG_RUNNER_KEY / fly secrets set RUNNER_KEY), then retry.";
|
|
33627
|
-
var RUNNER_TRANSPORT_HINTS = {
|
|
33628
|
-
"transport-auth": RUNNER_TRANSPORT_AUTH_HINT,
|
|
33629
|
-
// The request itself was malformed, so the runner will refuse it identically
|
|
33630
|
-
// every time. Nothing to advise beyond the message the runner already gave.
|
|
33631
|
-
"transport-request": "",
|
|
33632
|
-
"transport-retryable": TRANSIENT_HINT
|
|
33633
|
-
};
|
|
33634
33582
|
function formatAccountList(raw) {
|
|
33635
33583
|
try {
|
|
33636
33584
|
const parsed = JSON.parse(raw);
|
|
@@ -33643,12 +33591,11 @@ function formatAccountList(raw) {
|
|
|
33643
33591
|
}
|
|
33644
33592
|
async function diagnose(err) {
|
|
33645
33593
|
const errText = errorText(err);
|
|
33646
|
-
const transportHint = isRunnerTransportError(err) ? RUNNER_TRANSPORT_HINTS[err.kind] : void 0;
|
|
33647
33594
|
const isInvalidGrant = INVALID_GRANT_PATTERN.test(errText);
|
|
33648
33595
|
const isTransientError = !DEFINITE_AUTH_PATTERN.test(errText) && TRANSIENT_ERROR_PATTERN.test(errText);
|
|
33649
33596
|
const isAuthError = !isTransientError && AUTH_ERROR_PATTERN.test(errText);
|
|
33650
33597
|
const isGridLimitError = GRID_LIMIT_ERROR_PATTERN.test(errText);
|
|
33651
|
-
const hint =
|
|
33598
|
+
const hint = isInvalidGrant ? INVALID_GRANT_HINT : isAuthError ? AUTH_HINT : isTransientError ? TRANSIENT_HINT : isGridLimitError ? GRID_LIMIT_HINT : "";
|
|
33652
33599
|
try {
|
|
33653
33600
|
const accounts = formatAccountList(await run(["auth", "list"]));
|
|
33654
33601
|
return errorResult(`${errText}
|
|
@@ -33709,8 +33656,8 @@ function formatOneAccountHealth(a, now) {
|
|
|
33709
33656
|
const age = ageInDays(a.created_at, now);
|
|
33710
33657
|
const ageStr = age === null ? "" : ` Authorized ${age.toFixed(1)} day(s) ago.`;
|
|
33711
33658
|
if (a.valid === false) {
|
|
33712
|
-
const
|
|
33713
|
-
return `\u2717 ${email3}: NEEDS RE-AUTH \u2014 ${
|
|
33659
|
+
const cause = INVALID_GRANT_PATTERN.test(a.error ?? "") ? 'refresh token expired or revoked \u2014 commonly the 7-day limit on OAuth consent screens still in "Testing" mode' : a.error?.trim() || "unknown error";
|
|
33660
|
+
return `\u2717 ${email3}: NEEDS RE-AUTH \u2014 ${cause}.${ageStr} Re-authorize with gog_auth_add (browser) or gog_auth_add_url + gog_auth_add_complete (remote/headless).`;
|
|
33714
33661
|
}
|
|
33715
33662
|
if (a.valid === true) {
|
|
33716
33663
|
let line = `\u2713 ${email3}: token valid.${ageStr}`;
|
|
@@ -33825,7 +33772,7 @@ function registerAppScriptTools(server) {
|
|
|
33825
33772
|
return runOrDiagnose(["appscript", "content", scriptId], { account });
|
|
33826
33773
|
});
|
|
33827
33774
|
server.registerTool("gog_appscript_pull", {
|
|
33828
|
-
description: "Write a project's files into a local directory, for editing a script as ordinary files. THE DIRECTORY IS RESOLVED WHERE GOG RUNS, which is the caller's own machine only on a local (stdio) deployment: on
|
|
33775
|
+
description: "Write a project's files into a local directory, for editing a script as ordinary files. THE DIRECTORY IS RESOLVED WHERE GOG RUNS, which is the caller's own machine only on a local (stdio) deployment: on a hosted deployment (e.g. mcp-host) the files land on that server where the caller cannot reach them. Use gog_appscript_content there instead \u2014 it returns the same source in the response. Existing files are left alone unless overwrite is set. Read-only as far as Google is concerned: nothing is pushed back." + apiEnableNote,
|
|
33829
33776
|
inputSchema: external_exports.object({
|
|
33830
33777
|
scriptId: scriptIdParam,
|
|
33831
33778
|
dir: external_exports.string().describe("Destination directory, resolved on the machine where gog runs"),
|
|
@@ -33936,7 +33883,7 @@ function registerAuthToolsWith(server, defaultServices) {
|
|
|
33936
33883
|
}
|
|
33937
33884
|
});
|
|
33938
33885
|
server.registerTool("gog_auth_health", {
|
|
33939
|
-
description:
|
|
33886
|
+
description: `Check the LIVE health of each stored Google account. Unlike gog_auth_status (which only reports keyring/config setup), this performs a real token refresh against Google, so it detects expired or revoked (invalid_grant) refresh tokens \u2014 the account-wide sign-out that blocks every service. Reports per account: whether the token is currently valid, the mapped cause when it is not, how long ago it was authorized, and a warning as it approaches the 7-day refresh-token limit that applies to OAuth apps whose consent screen is still in "Testing" mode. Run it proactively to re-authorize on your own schedule instead of mid-task. On a hosted deployment this is the ONLY check that measures Google: a connector showing "connected" or "refreshed" has verified the client's connection to the MCP host, and nothing else \u2014 the Google credential lives in gog's keyring on that host and can be dead while the connection looks perfectly healthy.`,
|
|
33940
33887
|
annotations: { readOnlyHint: true },
|
|
33941
33888
|
inputSchema: external_exports.object({})
|
|
33942
33889
|
}, async () => {
|
|
@@ -33978,7 +33925,7 @@ function registerAuthToolsWith(server, defaultServices) {
|
|
|
33978
33925
|
}
|
|
33979
33926
|
});
|
|
33980
33927
|
server.registerTool("gog_auth_add_url", {
|
|
33981
|
-
description: "Begin REMOTE/headless Google authorization (step 1 of 2). Returns a sign-in URL to open in any browser \u2014 no local server or terminal on the gogcli host is needed, so this works
|
|
33928
|
+
description: "Begin REMOTE/headless Google authorization (step 1 of 2). Returns a sign-in URL to open in any browser \u2014 no local server or terminal on the gogcli host is needed, so this works on a hosted deployment where the interactive gog_auth_add cannot. Hand the URL to the user; after they sign in, the browser is redirected to a localhost URL that fails to load \u2014 that is expected. They copy that full redirected URL (from the address bar) and you pass it to gog_auth_add_complete. The link is valid for 10 minutes. If you pass a custom `services` here, pass the SAME value to gog_auth_add_complete or the second step will not match this one.",
|
|
33982
33929
|
inputSchema: external_exports.object({
|
|
33983
33930
|
email: external_exports.string().describe("Google account email to authorize"),
|
|
33984
33931
|
services: external_exports.string().optional().default(defaultServices).describe(servicesDescribe),
|
|
@@ -34227,9 +34174,9 @@ function registerCalendarTools(server) {
|
|
|
34227
34174
|
|
|
34228
34175
|
// src/attachments.ts
|
|
34229
34176
|
var MAX_INLINE_ATTACHMENT_BYTES = 8 * 1024 * 1024;
|
|
34230
|
-
var
|
|
34231
|
-
var
|
|
34232
|
-
var MAX_REQUEST_PAYLOAD_WIRE_BYTES =
|
|
34177
|
+
var REQUEST_MAX_BODY_BYTES = 32 * 1024 * 1024;
|
|
34178
|
+
var REQUEST_BODY_JSON_RESERVE_BYTES = 256 * 1024;
|
|
34179
|
+
var MAX_REQUEST_PAYLOAD_WIRE_BYTES = REQUEST_MAX_BODY_BYTES - REQUEST_BODY_JSON_RESERVE_BYTES;
|
|
34233
34180
|
var MAX_INLINE_ATTACHMENT_TOTAL_BYTES = Math.floor(MAX_REQUEST_PAYLOAD_WIRE_BYTES * 3 / 4);
|
|
34234
34181
|
function wireBytesOf(arg) {
|
|
34235
34182
|
if (typeof arg === "string") return Buffer.byteLength(arg, "utf8");
|
|
@@ -34246,7 +34193,7 @@ var inlineAttachmentSchema = external_exports.object({
|
|
|
34246
34193
|
)
|
|
34247
34194
|
});
|
|
34248
34195
|
var attachInlineParam = external_exports.array(inlineAttachmentSchema).optional().describe(
|
|
34249
|
-
`Attachments supplied as BYTES rather than as server-side paths \u2014 use this whenever you hold a file and the gog server does not, which is always the case on
|
|
34196
|
+
`Attachments supplied as BYTES rather than as server-side paths \u2014 use this whenever you hold a file and the gog server does not, which is always the case on a hosted deployment (e.g. mcp-host). Each entry is {filename, contentBase64} (${INLINE_ATTACHMENT_LIMITS_TEXT}). Can be combined with \`attach\`: the two name disjoint files (paths read on the server vs. bytes sent with the call), and both end up as ordinary attachments on the message.`
|
|
34250
34197
|
);
|
|
34251
34198
|
function validateFilename(filename, where) {
|
|
34252
34199
|
if (/[/\\]/.test(filename)) {
|
|
@@ -35246,7 +35193,7 @@ function registerDriveTools(server) {
|
|
|
35246
35193
|
}
|
|
35247
35194
|
});
|
|
35248
35195
|
server.registerTool("gog_drive_read_bytes", {
|
|
35249
|
-
description: "Fetch a Drive file's raw bytes and return them base64-encoded as an embedded resource \u2014 the generic fallback for callers that want the file itself (to parse locally) rather than extracted text. For readable text from a PDF, prefer gog_drive_extract_text.
|
|
35196
|
+
description: "Fetch a Drive file's raw bytes and return them base64-encoded as an embedded resource \u2014 the generic fallback for callers that want the file itself (to parse locally) rather than extracted text. For readable text from a PDF, prefer gog_drive_extract_text.",
|
|
35250
35197
|
annotations: { readOnlyHint: true },
|
|
35251
35198
|
inputSchema: external_exports.object({
|
|
35252
35199
|
fileId: external_exports.string().describe("Drive file ID"),
|
|
@@ -35458,7 +35405,7 @@ var replySchema = {
|
|
|
35458
35405
|
remove: external_exports.array(external_exports.string()).optional().describe("Remove these recipients from all fields (repeatable) \u2014 e.g. to drop someone from a reply-all."),
|
|
35459
35406
|
subject: external_exports.string().optional().describe('Override reply subject (default: "Re: <original>"). A changed subject starts a NEW Gmail thread.'),
|
|
35460
35407
|
noQuote: external_exports.boolean().optional().describe("Do not include the original message quoted below the reply (default: the original is quoted)"),
|
|
35461
|
-
attach: external_exports.array(external_exports.string()).optional().describe(`File paths to attach (repeatable), resolved ON THE GOG SERVER's filesystem \u2014 NOT this client's. Only usable when gog runs on the same machine you do (local stdio); on
|
|
35408
|
+
attach: external_exports.array(external_exports.string()).optional().describe(`File paths to attach (repeatable), resolved ON THE GOG SERVER's filesystem \u2014 NOT this client's. Only usable when gog runs on the same machine you do (local stdio); on a hosted deployment (e.g. mcp-host) these paths do not exist and the call fails with "no such file or directory" \u2014 use attachInline there. Read on the server, base64-encoded with a MIME type inferred from the extension.`),
|
|
35462
35409
|
attachInline: attachInlineParam,
|
|
35463
35410
|
from: external_exports.string().optional().describe("Send from this email address (must be a verified send-as alias)"),
|
|
35464
35411
|
autoFromAddressedAlias: external_exports.boolean().optional().describe("When from is omitted, send from the verified send-as alias the original message was addressed TO, instead of the account's primary address \u2014 so a reply to mail sent to an alias goes back out from that alias. Ignored when from is set."),
|
|
@@ -35595,7 +35542,7 @@ function registerGmailTools(server) {
|
|
|
35595
35542
|
replyToMessageId: external_exports.string().optional().describe('Message ID to thread this message against \u2014 sets In-Reply-To/References only. It does NOT quote the original (pass quote for that), inherit its recipients, or prefix the subject with "Re:". For an actual reply use gog_gmail_reply.'),
|
|
35596
35543
|
threadId: external_exports.string().optional().describe("Thread ID to thread this message within. Same caveat as replyToMessageId: threading only, no quote and no inherited subject or recipients."),
|
|
35597
35544
|
quote: external_exports.boolean().optional().describe("Include the original message quoted below the body. Requires replyToMessageId or threadId. gog quotes by DEFAULT on gmail reply but never on gmail send, so without this a threaded send arrives with the original nowhere in it."),
|
|
35598
|
-
attach: external_exports.array(external_exports.string()).optional().describe(`File paths to attach (repeatable), resolved ON THE GOG SERVER's filesystem \u2014 NOT this client's. Only usable when gog runs on the same machine you do (local stdio); on
|
|
35545
|
+
attach: external_exports.array(external_exports.string()).optional().describe(`File paths to attach (repeatable), resolved ON THE GOG SERVER's filesystem \u2014 NOT this client's. Only usable when gog runs on the same machine you do (local stdio); on a hosted deployment (e.g. mcp-host) these paths do not exist and the call fails with "no such file or directory" \u2014 use attachInline there. Each file is read on the server, base64-encoded with a MIME type inferred from its extension, and added as a multipart attachment.`),
|
|
35599
35546
|
attachInline: attachInlineParam,
|
|
35600
35547
|
account: accountParam
|
|
35601
35548
|
})
|
|
@@ -35970,7 +35917,7 @@ function registerTasksTools(server) {
|
|
|
35970
35917
|
}
|
|
35971
35918
|
|
|
35972
35919
|
// src/server.ts
|
|
35973
|
-
var VERSION = true ? "
|
|
35920
|
+
var VERSION = true ? "4.0.1" : "0.0.0";
|
|
35974
35921
|
var BASE_TOOL_REGISTRARS = [
|
|
35975
35922
|
registerApiTools,
|
|
35976
35923
|
registerAppScriptTools,
|
|
@@ -35987,488 +35934,68 @@ var BASE_TOOL_REGISTRARS = [
|
|
|
35987
35934
|
registerTasksTools
|
|
35988
35935
|
];
|
|
35989
35936
|
|
|
35990
|
-
// src/auth
|
|
35991
|
-
|
|
35992
|
-
|
|
35993
|
-
|
|
35994
|
-
|
|
35995
|
-
|
|
35996
|
-
|
|
35997
|
-
// An enrolment that could not proceed is a failure even though nobody is at
|
|
35998
|
-
// fault: it is the only trace a half-enrolled connector leaves behind, and
|
|
35999
|
-
// the absence of exactly this record is why DEFECT 4 could not be explained.
|
|
36000
|
-
"connect.runner-unreachable",
|
|
36001
|
-
"connect.google-unhealthy",
|
|
36002
|
-
"refusal.google-unhealthy",
|
|
36003
|
-
// The loudest record on this branch, and the only one that means "we cannot
|
|
36004
|
-
// explain this". Google refused a real call while a live check of the same
|
|
36005
|
-
// credential, taken seconds later, succeeded — so neither the 7-day cliff nor
|
|
36006
|
-
// a revoked grant accounts for it. It is filed as a failure precisely because
|
|
36007
|
-
// it is the record nobody may scroll past: it is the only evidence that could
|
|
36008
|
-
// ever justify building something on the hosted path, and its absence over
|
|
36009
|
-
// time is what retires that theory for good.
|
|
36010
|
-
"refusal.google-ok"
|
|
36011
|
-
]);
|
|
36012
|
-
var PREFIX = "gog-auth ";
|
|
36013
|
-
var TAG_CHARS = 12;
|
|
36014
|
-
function credentialTag(cacheKeyHash) {
|
|
36015
|
-
return cacheKeyHash.slice(0, TAG_CHARS);
|
|
36016
|
-
}
|
|
36017
|
-
function logAuthTransition(event, context) {
|
|
36018
|
-
const record2 = JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), event, ...context });
|
|
36019
|
-
const write = FAILURES.has(event) ? console.error : console.warn;
|
|
36020
|
-
write(PREFIX + redactSecrets2(record2));
|
|
36021
|
-
}
|
|
36022
|
-
|
|
36023
|
-
// src/google-token.ts
|
|
36024
|
-
var TOKEN_ENDPOINT = "https://oauth2.googleapis.com/token";
|
|
36025
|
-
var EXPIRY_MARGIN_MS = 12e4;
|
|
36026
|
-
var cache = /* @__PURE__ */ new Map();
|
|
36027
|
-
var inFlight = /* @__PURE__ */ new Map();
|
|
36028
|
-
async function cacheKey(refreshToken, clientId) {
|
|
36029
|
-
const data = new TextEncoder().encode(`${clientId}\0${refreshToken}`);
|
|
36030
|
-
const digest = await crypto.subtle.digest("SHA-256", data);
|
|
36031
|
-
return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("");
|
|
36032
|
-
}
|
|
36033
|
-
function makeAccessTokenSource(env) {
|
|
36034
|
-
const direct = readEnvVar("GOG_ACCESS_TOKEN", { env });
|
|
36035
|
-
if (direct) return async () => direct;
|
|
36036
|
-
const refreshToken = readEnvVar("GOG_REFRESH_TOKEN", { env });
|
|
36037
|
-
if (!refreshToken) return void 0;
|
|
36038
|
-
const clientId = readEnvVar("GOG_CLIENT_ID", { env });
|
|
36039
|
-
const clientSecret = readEnvVar("GOG_CLIENT_SECRET", { env });
|
|
36040
|
-
if (!clientId || !clientSecret) {
|
|
36041
|
-
const missing = [!clientId && "GOG_CLIENT_ID", !clientSecret && "GOG_CLIENT_SECRET"].filter(Boolean).join(" and ");
|
|
36042
|
-
return async () => {
|
|
36043
|
-
throw new Error(
|
|
36044
|
-
`GOG_REFRESH_TOKEN is set but ${missing} is not, so no access token can be minted. Set the OAuth client alongside the refresh token, or unset GOG_REFRESH_TOKEN to use the backend\u2019s own identity.`
|
|
36045
|
-
);
|
|
36046
|
-
};
|
|
36047
|
-
}
|
|
36048
|
-
let keyPromise;
|
|
36049
|
-
const key = () => keyPromise ??= cacheKey(refreshToken, clientId);
|
|
36050
|
-
const logCacheHits = parseBoolEnv("GOG_AUTH_LOG_CACHE_HITS", { env });
|
|
36051
|
-
const read = async () => {
|
|
36052
|
-
const k = await key();
|
|
36053
|
-
const hit = cache.get(k);
|
|
36054
|
-
if (hit && hit.expiresAt - EXPIRY_MARGIN_MS > Date.now()) {
|
|
36055
|
-
if (logCacheHits) logAuthTransition("token.cache-hit", { credential: credentialTag(k) });
|
|
36056
|
-
return hit.accessToken;
|
|
36057
|
-
}
|
|
36058
|
-
let pending = inFlight.get(k);
|
|
36059
|
-
if (!pending) {
|
|
36060
|
-
pending = exchange(refreshToken, clientId, clientSecret).then((minted2) => {
|
|
36061
|
-
cache.set(k, minted2);
|
|
36062
|
-
logAuthTransition("token.minted", {
|
|
36063
|
-
credential: credentialTag(k),
|
|
36064
|
-
reason: `valid for ${Math.round((minted2.expiresAt - Date.now()) / 1e3)}s`
|
|
36065
|
-
});
|
|
36066
|
-
return minted2;
|
|
36067
|
-
}).catch((err) => {
|
|
36068
|
-
logAuthTransition(err.grantDead ? "grant.dead" : "token.mint-failed", {
|
|
36069
|
-
credential: credentialTag(k),
|
|
36070
|
-
reason: err.message
|
|
36071
|
-
});
|
|
36072
|
-
throw err;
|
|
36073
|
-
}).finally(() => inFlight.delete(k));
|
|
36074
|
-
inFlight.set(k, pending);
|
|
36075
|
-
}
|
|
36076
|
-
const minted = await pending;
|
|
36077
|
-
return minted.accessToken;
|
|
36078
|
-
};
|
|
36079
|
-
const invalidate = async (rejected) => {
|
|
36080
|
-
const k = await key();
|
|
36081
|
-
const hit = cache.get(k);
|
|
36082
|
-
if (!hit || hit.accessToken !== rejected) {
|
|
36083
|
-
logAuthTransition("token.evict-noop", {
|
|
36084
|
-
credential: credentialTag(k),
|
|
36085
|
-
reason: hit ? "a concurrent caller had already replaced this credential\u2019s token" : "no token was cached for this credential"
|
|
36086
|
-
});
|
|
36087
|
-
return false;
|
|
36088
|
-
}
|
|
36089
|
-
cache.delete(k);
|
|
36090
|
-
logAuthTransition("token.evicted", {
|
|
36091
|
-
credential: credentialTag(k),
|
|
36092
|
-
reason: "Google rejected this access token; the next read will mint a new one"
|
|
36093
|
-
});
|
|
36094
|
-
return true;
|
|
36095
|
-
};
|
|
36096
|
-
return Object.assign(read, {
|
|
36097
|
-
invalidate,
|
|
36098
|
-
credentialId: async () => credentialTag(await key())
|
|
36099
|
-
});
|
|
36100
|
-
}
|
|
36101
|
-
var TokenExchangeError = class extends Error {
|
|
36102
|
-
/**
|
|
36103
|
-
* The REFRESH token is dead (Google's `invalid_grant`), not merely the access
|
|
36104
|
-
* token. Carried as a flag rather than re-read from the message, because
|
|
36105
|
-
* inferring the author of a failure from prose several authors can produce is
|
|
36106
|
-
* precisely the mistake this branch exists to undo. `instanceof` is safe: the
|
|
36107
|
-
* class is thrown and caught inside this one module.
|
|
36108
|
-
*/
|
|
36109
|
-
grantDead;
|
|
36110
|
-
constructor(message, grantDead) {
|
|
36111
|
-
super(message);
|
|
36112
|
-
this.grantDead = grantDead;
|
|
36113
|
-
}
|
|
35937
|
+
// src/bootstrap-auth.ts
|
|
35938
|
+
import { join as join2 } from "node:path";
|
|
35939
|
+
var AUTH_BOOTSTRAP_MARKER = "auth-bootstrap.sha256";
|
|
35940
|
+
var VARS = ["GOG_CLIENT_ID", "GOG_CLIENT_SECRET", "GOG_REFRESH_TOKEN", "GOG_ACCOUNT"];
|
|
35941
|
+
var log = (line) => {
|
|
35942
|
+
process.stderr.write(`[gogcli-mcp] auth bootstrap: ${line}
|
|
35943
|
+
`);
|
|
36114
35944
|
};
|
|
36115
|
-
|
|
36116
|
-
|
|
35945
|
+
var jsonFile = (name, payload) => ({
|
|
35946
|
+
kind: "file",
|
|
35947
|
+
flag: name,
|
|
35948
|
+
ext: "json",
|
|
35949
|
+
contents: JSON.stringify(payload),
|
|
35950
|
+
positional: true
|
|
35951
|
+
});
|
|
35952
|
+
async function accountListed(account, spawner) {
|
|
36117
35953
|
try {
|
|
36118
|
-
|
|
36119
|
-
|
|
36120
|
-
|
|
36121
|
-
|
|
36122
|
-
|
|
36123
|
-
refresh_token: refreshToken,
|
|
36124
|
-
client_id: clientId,
|
|
36125
|
-
client_secret: clientSecret
|
|
36126
|
-
}).toString()
|
|
36127
|
-
});
|
|
36128
|
-
} catch (err) {
|
|
36129
|
-
throw new TokenExchangeError(
|
|
36130
|
-
`the Google token exchange could not be reached: ${err instanceof Error ? err.message : String(err)}`,
|
|
36131
|
-
false
|
|
36132
|
-
);
|
|
36133
|
-
}
|
|
36134
|
-
const body = await res.json().catch(() => ({}));
|
|
36135
|
-
if (!res.ok) {
|
|
36136
|
-
if (body.error === "invalid_grant") {
|
|
36137
|
-
throw new TokenExchangeError(
|
|
36138
|
-
'the stored refresh token was rejected (invalid_grant): it has expired or been revoked, so this account must be re-authorized (commonly the 7-day limit on OAuth consent screens still in "Testing" mode). Re-enrol with gog_auth_add_url + gog_auth_add_complete and store the new refresh token.',
|
|
36139
|
-
true
|
|
36140
|
-
);
|
|
36141
|
-
}
|
|
36142
|
-
throw new TokenExchangeError(
|
|
36143
|
-
`the access token could not be refreshed (HTTP ${res.status}${body.error ? `, ${body.error}` : ""})`,
|
|
36144
|
-
false
|
|
36145
|
-
);
|
|
36146
|
-
}
|
|
36147
|
-
if (!body.access_token) {
|
|
36148
|
-
throw new TokenExchangeError(
|
|
36149
|
-
"the access token could not be refreshed: Google returned no access_token",
|
|
36150
|
-
false
|
|
36151
|
-
);
|
|
35954
|
+
const out = await run(["auth", "list"], { spawner, account });
|
|
35955
|
+
const accounts = JSON.parse(out).accounts ?? [];
|
|
35956
|
+
return accounts.some((a) => a.email?.toLowerCase() === account.toLowerCase());
|
|
35957
|
+
} catch {
|
|
35958
|
+
return false;
|
|
36152
35959
|
}
|
|
36153
|
-
const expiresInMs = (body.expires_in ?? 3600) * 1e3;
|
|
36154
|
-
return { accessToken: body.access_token, expiresAt: Date.now() + expiresInMs };
|
|
36155
35960
|
}
|
|
36156
|
-
|
|
36157
|
-
|
|
36158
|
-
|
|
36159
|
-
|
|
36160
|
-
|
|
36161
|
-
|
|
36162
|
-
|
|
36163
|
-
const reported = cause(record2.error);
|
|
36164
|
-
if (measured === false) {
|
|
36165
|
-
return {
|
|
36166
|
-
kind: "unmeasured",
|
|
36167
|
-
reason: reported ?? "the runner reported it could not measure the Google layer"
|
|
36168
|
-
};
|
|
35961
|
+
async function bootstrapGogAuth(env = process.env, options = {}) {
|
|
35962
|
+
const values = VARS.map((key) => readEnvVar(key, { env }));
|
|
35963
|
+
const missing = VARS.filter((_key, i) => values[i] === void 0);
|
|
35964
|
+
if (missing.length === VARS.length) return "unconfigured";
|
|
35965
|
+
if (missing.length > 0) {
|
|
35966
|
+
log(`skipped, missing ${missing.join(", ")}`);
|
|
35967
|
+
return "incomplete";
|
|
36169
35968
|
}
|
|
36170
|
-
|
|
36171
|
-
|
|
36172
|
-
return {
|
|
36173
|
-
kind: "unhealthy",
|
|
36174
|
-
reason: reported ?? "the runner reported the Google layer unhealthy with no cause"
|
|
36175
|
-
};
|
|
36176
|
-
}
|
|
36177
|
-
return {
|
|
36178
|
-
kind: "unmeasured",
|
|
36179
|
-
reason: reported ? `the runner did not report whether it measured the Google layer; it said: ${reported}` : "the runner did not report whether it measured the Google layer"
|
|
36180
|
-
};
|
|
36181
|
-
}
|
|
36182
|
-
|
|
36183
|
-
// src/connector-runtime.ts
|
|
36184
|
-
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
36185
|
-
var DEADLINE_GRACE_MS = 5e3;
|
|
36186
|
-
var MIN_REPLAY_BUDGET_MS = 1e3;
|
|
36187
|
-
var REFUSAL_PROBE_TIMEOUT_MS = 4e3;
|
|
36188
|
-
var MIN_PROBE_BUDGET_MS = 1e3;
|
|
36189
|
-
var PROBE_INTERVAL_MS = 6e4;
|
|
36190
|
-
var RUNNER_GOG_FAILED = 422;
|
|
36191
|
-
var RUNNER_DRAINING = 503;
|
|
36192
|
-
var RUNNER_BAD_REQUEST = 400;
|
|
36193
|
-
var RUNNER_BAD_KEY = 401;
|
|
36194
|
-
var GogFailedError = class extends Error {
|
|
36195
|
-
/** gog's stderr alone, with no echoed argv mixed in. */
|
|
36196
|
-
stderr;
|
|
36197
|
-
constructor(message, stderr) {
|
|
36198
|
-
super(message);
|
|
36199
|
-
this.stderr = stderr;
|
|
36200
|
-
}
|
|
36201
|
-
};
|
|
36202
|
-
var GOOGLE_TOKEN_REJECTED_PATTERN = /Google API error \(401\b|invalid[ _]authentication[ _]credentials|\bACCESS_TOKEN_EXPIRED\b|\binvalid_token\b/i;
|
|
36203
|
-
var REFRESH_TOKEN_DEAD_PATTERN = /\binvalid_grant\b/i;
|
|
36204
|
-
var READ_ONLY_SUBCOMMANDS = /* @__PURE__ */ new Set([
|
|
36205
|
-
"cat",
|
|
36206
|
-
"describe",
|
|
36207
|
-
"get",
|
|
36208
|
-
"info",
|
|
36209
|
-
"list",
|
|
36210
|
-
"list-slides",
|
|
36211
|
-
"ls",
|
|
36212
|
-
"metadata",
|
|
36213
|
-
"read-slide",
|
|
36214
|
-
"search",
|
|
36215
|
-
"services",
|
|
36216
|
-
"status",
|
|
36217
|
-
"structure"
|
|
36218
|
-
]);
|
|
36219
|
-
function gogTarget(args) {
|
|
36220
|
-
const words = args.filter((arg) => typeof arg === "string");
|
|
36221
|
-
let service;
|
|
36222
|
-
for (let i = 0; i < words.length; i += 1) {
|
|
36223
|
-
const word = words[i];
|
|
36224
|
-
if (word.startsWith("-")) {
|
|
36225
|
-
if (word === "--account") i += 1;
|
|
36226
|
-
continue;
|
|
36227
|
-
}
|
|
36228
|
-
if (service === void 0) {
|
|
36229
|
-
service = word;
|
|
36230
|
-
continue;
|
|
36231
|
-
}
|
|
36232
|
-
return { service, subcommand: word };
|
|
36233
|
-
}
|
|
36234
|
-
return { service };
|
|
36235
|
-
}
|
|
36236
|
-
async function remintAfterGoogleRejection(err, used, args, readAccessToken, deadlineAt, probeGoogle) {
|
|
36237
|
-
if (!(err instanceof GogFailedError)) return void 0;
|
|
36238
|
-
const grantDead = REFRESH_TOKEN_DEAD_PATTERN.test(err.stderr);
|
|
36239
|
-
if (!grantDead && !GOOGLE_TOKEN_REJECTED_PATTERN.test(err.stderr)) return void 0;
|
|
36240
|
-
const { service, subcommand } = gogTarget(args);
|
|
36241
|
-
const credential = await readAccessToken?.credentialId?.();
|
|
36242
|
-
const where = { credential, service };
|
|
36243
|
-
if (grantDead) {
|
|
36244
|
-
logAuthTransition("grant.dead", {
|
|
36245
|
-
...where,
|
|
36246
|
-
reason: "gog reported invalid_grant: the stored refresh token is dead, so no token can be minted and this account must be re-authorized"
|
|
36247
|
-
});
|
|
36248
|
-
return void 0;
|
|
36249
|
-
}
|
|
36250
|
-
if (!used) {
|
|
36251
|
-
await probeGoogle(where);
|
|
36252
|
-
logAuthTransition("replay.declined", {
|
|
36253
|
-
...where,
|
|
36254
|
-
reason: "no access token was supplied with the call, so gog acted as the backend volume\u2019s own identity"
|
|
36255
|
-
});
|
|
36256
|
-
return void 0;
|
|
36257
|
-
}
|
|
36258
|
-
if (!readAccessToken?.invalidate) {
|
|
36259
|
-
logAuthTransition("replay.declined", {
|
|
36260
|
-
...where,
|
|
36261
|
-
reason: "this token source cannot mint a replacement, so a replay would resend the rejected token"
|
|
36262
|
-
});
|
|
36263
|
-
return void 0;
|
|
36264
|
-
}
|
|
36265
|
-
const evicted = await readAccessToken.invalidate(used);
|
|
36266
|
-
if (subcommand === void 0 || !READ_ONLY_SUBCOMMANDS.has(subcommand)) {
|
|
36267
|
-
logAuthTransition("replay.declined", {
|
|
36268
|
-
...where,
|
|
36269
|
-
reason: `not replayable: '${subcommand ?? "(none)"}' is not a known read-only subcommand and a write could double-apply`
|
|
36270
|
-
});
|
|
36271
|
-
return void 0;
|
|
36272
|
-
}
|
|
36273
|
-
if (!evicted) {
|
|
36274
|
-
logAuthTransition("replay.declined", {
|
|
36275
|
-
...where,
|
|
36276
|
-
reason: "the rejected token was already superseded, so the cache holds the token a replay would send"
|
|
36277
|
-
});
|
|
36278
|
-
return void 0;
|
|
36279
|
-
}
|
|
36280
|
-
const fresh = await readAccessToken();
|
|
36281
|
-
if (!fresh) {
|
|
36282
|
-
logAuthTransition("replay.declined", {
|
|
36283
|
-
...where,
|
|
36284
|
-
reason: "the token source produced no token after eviction; replaying without one would act as the backend"
|
|
36285
|
-
});
|
|
36286
|
-
return void 0;
|
|
36287
|
-
}
|
|
36288
|
-
const budgetMs = deadlineAt - Date.now();
|
|
36289
|
-
if (budgetMs < MIN_REPLAY_BUDGET_MS) {
|
|
36290
|
-
logAuthTransition("replay.declined", {
|
|
36291
|
-
...where,
|
|
36292
|
-
reason: `only ${budgetMs}ms of the call\u2019s deadline remained, so a replay could only time out; the rejected token was evicted, so the next call mints a fresh one`
|
|
36293
|
-
});
|
|
36294
|
-
return void 0;
|
|
36295
|
-
}
|
|
36296
|
-
return { token: fresh, budgetMs, invalidate: readAccessToken.invalidate, ...where };
|
|
36297
|
-
}
|
|
36298
|
-
function makeFlyExecutor(endpoint, key, readAccessToken) {
|
|
36299
|
-
let lastProbeAt = Number.NEGATIVE_INFINITY;
|
|
36300
|
-
const probeGoogleAfterRefusal = async (where, deadlineAt) => {
|
|
36301
|
-
const record2 = { ...where, endpoint };
|
|
36302
|
-
const now = Date.now();
|
|
36303
|
-
const remainingMs = deadlineAt - now;
|
|
36304
|
-
if (remainingMs < MIN_PROBE_BUDGET_MS) {
|
|
36305
|
-
logAuthTransition("refusal.google-unmeasured", {
|
|
36306
|
-
...record2,
|
|
36307
|
-
reason: `only ${remainingMs}ms of the call\u2019s deadline remained, so the Google layer was not measured rather than delay the caller\u2019s own error`
|
|
36308
|
-
});
|
|
36309
|
-
return;
|
|
36310
|
-
}
|
|
36311
|
-
if (now - lastProbeAt < PROBE_INTERVAL_MS) {
|
|
36312
|
-
logAuthTransition("refusal.google-unmeasured", {
|
|
36313
|
-
...record2,
|
|
36314
|
-
// "attempted", not "measured". `lastProbeAt` is stamped before the
|
|
36315
|
-
// fetch and is deliberately NOT reset when the probe comes back with no
|
|
36316
|
-
// verdict (a 404 from a runner too old to have the endpoint, a timeout,
|
|
36317
|
-
// a dead socket) — the backend cost this throttle exists to bound was
|
|
36318
|
-
// paid either way, and resetting it would let a retry loop storm a
|
|
36319
|
-
// runner that is already unwell. So the timestamp stays and the sentence
|
|
36320
|
-
// has to be the true one: on this branch a log line may not assert a
|
|
36321
|
-
// measurement that never happened, and the previous probe may well have
|
|
36322
|
-
// measured nothing at all.
|
|
36323
|
-
reason: "a Google probe was attempted recently, so another was not sent: this probe spawns gog on the backend and takes the keyring\u2019s exclusive lock"
|
|
36324
|
-
});
|
|
36325
|
-
return;
|
|
36326
|
-
}
|
|
36327
|
-
lastProbeAt = now;
|
|
36328
|
-
let event;
|
|
36329
|
-
let reason;
|
|
36330
|
-
try {
|
|
36331
|
-
const res = await fetch(`${endpoint}/health/google`, {
|
|
36332
|
-
headers: { Authorization: `Bearer ${key}` },
|
|
36333
|
-
// Never more than the probe's own budget, never more than the call has
|
|
36334
|
-
// left. `Math.min` rather than a plain constant because the second
|
|
36335
|
-
// bound is the caller's, and it outranks ours.
|
|
36336
|
-
signal: AbortSignal.timeout(Math.min(REFUSAL_PROBE_TIMEOUT_MS, remainingMs))
|
|
36337
|
-
});
|
|
36338
|
-
if (!res.ok) {
|
|
36339
|
-
event = "refusal.google-unmeasured";
|
|
36340
|
-
reason = `the runner did not answer the Google probe (HTTP ${res.status})`;
|
|
36341
|
-
} else {
|
|
36342
|
-
const verdict = readGoogleProbe(await res.json());
|
|
36343
|
-
if (verdict.kind === "ok") {
|
|
36344
|
-
event = "refusal.google-ok";
|
|
36345
|
-
reason = "Google refused this call, yet a live token check on the same volume succeeded \u2014 so a dead or expired refresh token does not explain this refusal";
|
|
36346
|
-
} else {
|
|
36347
|
-
event = verdict.kind === "unhealthy" ? "refusal.google-unhealthy" : "refusal.google-unmeasured";
|
|
36348
|
-
reason = verdict.reason;
|
|
36349
|
-
}
|
|
36350
|
-
}
|
|
36351
|
-
} catch (err) {
|
|
36352
|
-
event = "refusal.google-unmeasured";
|
|
36353
|
-
reason = err instanceof Error ? err.message : String(err);
|
|
36354
|
-
}
|
|
36355
|
-
logAuthTransition(event, { ...record2, reason });
|
|
36356
|
-
};
|
|
36357
|
-
return async (args, opts) => {
|
|
36358
|
-
const deadlineMs = (opts?.timeout ?? DEFAULT_TIMEOUT_MS) + DEADLINE_GRACE_MS;
|
|
36359
|
-
const accessToken = await readAccessToken?.();
|
|
36360
|
-
const deadlineAt = Date.now() + deadlineMs;
|
|
36361
|
-
try {
|
|
36362
|
-
return await attempt(endpoint, key, args, accessToken, deadlineMs);
|
|
36363
|
-
} catch (err) {
|
|
36364
|
-
const replay = await remintAfterGoogleRejection(
|
|
36365
|
-
err,
|
|
36366
|
-
accessToken,
|
|
36367
|
-
args,
|
|
36368
|
-
readAccessToken,
|
|
36369
|
-
deadlineAt,
|
|
36370
|
-
(where2) => probeGoogleAfterRefusal(where2, deadlineAt)
|
|
36371
|
-
);
|
|
36372
|
-
if (replay === void 0) throw err;
|
|
36373
|
-
const where = { credential: replay.credential, service: replay.service, endpoint };
|
|
36374
|
-
logAuthTransition("replay.attempted", {
|
|
36375
|
-
...where,
|
|
36376
|
-
reason: "Google rejected the access token; replaying this read once with a freshly minted one"
|
|
36377
|
-
});
|
|
36378
|
-
try {
|
|
36379
|
-
const stdout = await attempt(endpoint, key, args, replay.token, replay.budgetMs);
|
|
36380
|
-
logAuthTransition("replay.succeeded", where);
|
|
36381
|
-
return stdout;
|
|
36382
|
-
} catch (replayErr) {
|
|
36383
|
-
logAuthTransition("replay.failed", { ...where, reason: String(replayErr) });
|
|
36384
|
-
if (replayErr instanceof GogFailedError && GOOGLE_TOKEN_REJECTED_PATTERN.test(replayErr.stderr)) {
|
|
36385
|
-
await replay.invalidate(replay.token);
|
|
36386
|
-
}
|
|
36387
|
-
throw replayErr;
|
|
36388
|
-
}
|
|
36389
|
-
}
|
|
36390
|
-
};
|
|
36391
|
-
}
|
|
36392
|
-
async function attempt(endpoint, key, args, accessToken, deadlineMs) {
|
|
36393
|
-
let res;
|
|
35969
|
+
const [clientId, clientSecret, refreshToken, account] = values;
|
|
35970
|
+
const { spawner } = options;
|
|
36394
35971
|
try {
|
|
36395
|
-
|
|
36396
|
-
|
|
36397
|
-
|
|
36398
|
-
|
|
36399
|
-
|
|
36400
|
-
|
|
36401
|
-
|
|
36402
|
-
|
|
36403
|
-
|
|
36404
|
-
|
|
36405
|
-
|
|
36406
|
-
if (name === "TimeoutError" || name === "AbortError") {
|
|
36407
|
-
throw new RunnerTransportError(
|
|
36408
|
-
`gog-runner did not respond within ${deadlineMs}ms (${endpoint}) \u2014 the Fly backend may be cold or wedged`,
|
|
36409
|
-
"transport-retryable"
|
|
36410
|
-
);
|
|
36411
|
-
}
|
|
36412
|
-
throw err;
|
|
36413
|
-
}
|
|
36414
|
-
if (!res.ok) {
|
|
36415
|
-
const body = await res.json().catch(() => null);
|
|
36416
|
-
const detail = body && typeof body.error === "string" ? body.stderr && body.stderr.trim() && body.stderr.trim() !== body.error.trim() ? `${body.error}
|
|
36417
|
-
${body.stderr}` : body.error : "";
|
|
36418
|
-
if (res.status === RUNNER_GOG_FAILED) {
|
|
36419
|
-
throw new GogFailedError(
|
|
36420
|
-
detail || "gog failed on the runner (no detail supplied)",
|
|
36421
|
-
typeof body?.stderr === "string" ? body.stderr : ""
|
|
36422
|
-
);
|
|
36423
|
-
}
|
|
36424
|
-
if (res.status === RUNNER_BAD_KEY) {
|
|
36425
|
-
logAuthTransition("runner.auth-failed", {
|
|
36426
|
-
service: gogTarget(args).service,
|
|
36427
|
-
endpoint,
|
|
36428
|
-
reason: "the gog-runner rejected the connector\u2019s bearer token, so gog never ran and no Google credential was read; GOG_RUNNER_KEY does not match the Fly app\u2019s RUNNER_KEY"
|
|
36429
|
-
});
|
|
36430
|
-
throw new RunnerTransportError(
|
|
36431
|
-
"gog-runner rejected the connector's bearer token, so the request never reached gog and no Google credential was involved. The Worker secret GOG_RUNNER_KEY no longer matches RUNNER_KEY on the Fly app; set them to the same value (wrangler secret put GOG_RUNNER_KEY / fly secrets set RUNNER_KEY) and retry.",
|
|
36432
|
-
"transport-auth",
|
|
36433
|
-
res.status
|
|
36434
|
-
);
|
|
36435
|
-
}
|
|
36436
|
-
if (res.status === RUNNER_BAD_REQUEST) {
|
|
36437
|
-
throw new RunnerTransportError(
|
|
36438
|
-
detail || "gog-runner rejected the request (no detail supplied)",
|
|
36439
|
-
"transport-request",
|
|
36440
|
-
res.status
|
|
36441
|
-
);
|
|
36442
|
-
}
|
|
36443
|
-
if (res.status === RUNNER_DRAINING || body?.retryable === true) {
|
|
36444
|
-
throw new RunnerTransportError(
|
|
36445
|
-
`gog-runner is restarting; retry this call.${detail ? ` ${detail}` : ""}`,
|
|
36446
|
-
"transport-retryable",
|
|
36447
|
-
res.status
|
|
36448
|
-
);
|
|
36449
|
-
}
|
|
36450
|
-
if (detail) {
|
|
36451
|
-
throw new Error(detail);
|
|
36452
|
-
}
|
|
36453
|
-
throw new RunnerTransportError(
|
|
36454
|
-
`gog-runner HTTP ${res.status}: the response did not come from the runner, so the request never reached gog. The backend Machine was most likely starting or shutting down \u2014 this is transient, retry the same call.`,
|
|
36455
|
-
"transport-retryable",
|
|
36456
|
-
res.status
|
|
35972
|
+
const { createHash } = await import("node:crypto");
|
|
35973
|
+
const { mkdir, readFile, writeFile, chmod } = await import("node:fs/promises");
|
|
35974
|
+
const home = options.home ?? (await import("node:os")).homedir();
|
|
35975
|
+
const dir = join2(home, ".gogcli-mcp");
|
|
35976
|
+
const marker = join2(dir, AUTH_BOOTSTRAP_MARKER);
|
|
35977
|
+
const fingerprint = createHash("sha256").update(values.join("\0")).digest("hex");
|
|
35978
|
+
const previous = await readFile(marker, "utf8").catch(() => void 0);
|
|
35979
|
+
if (previous === fingerprint && await accountListed(account, spawner)) return "present";
|
|
35980
|
+
await run(
|
|
35981
|
+
["auth", "credentials", "set", jsonFile("credentials", { installed: { client_id: clientId, client_secret: clientSecret } })],
|
|
35982
|
+
{ spawner, account }
|
|
36457
35983
|
);
|
|
35984
|
+
await run(
|
|
35985
|
+
["auth", "tokens", "import", jsonFile("token", { email: account, refresh_token: refreshToken })],
|
|
35986
|
+
{ spawner, account }
|
|
35987
|
+
);
|
|
35988
|
+
await mkdir(dir, { recursive: true, mode: 448 });
|
|
35989
|
+
await chmod(dir, 448);
|
|
35990
|
+
await writeFile(marker, fingerprint, { mode: 384 });
|
|
35991
|
+
await chmod(marker, 384);
|
|
35992
|
+
return "imported";
|
|
35993
|
+
} catch (err) {
|
|
35994
|
+
let message = redactSecrets2(errorText(err));
|
|
35995
|
+
for (const value of [clientSecret, refreshToken]) message = message.split(value).join("[REDACTED]");
|
|
35996
|
+
log(`failed, ${message}`);
|
|
35997
|
+
return "failed";
|
|
36458
35998
|
}
|
|
36459
|
-
const { stdout } = await res.json();
|
|
36460
|
-
return stdout;
|
|
36461
|
-
}
|
|
36462
|
-
|
|
36463
|
-
// src/remote-runner.ts
|
|
36464
|
-
function useRemoteGogRunner(env = process.env) {
|
|
36465
|
-
const endpoint = readEnvVar("GOG_RUNNER_URL", { env });
|
|
36466
|
-
const key = readEnvVar("GOG_RUNNER_KEY", { env });
|
|
36467
|
-
if (!endpoint || !key) return false;
|
|
36468
|
-
setDefaultGogExecutor(
|
|
36469
|
-
makeFlyExecutor(endpoint.replace(/\/+$/, ""), key, makeAccessTokenSource(env))
|
|
36470
|
-
);
|
|
36471
|
-
return true;
|
|
36472
35999
|
}
|
|
36473
36000
|
|
|
36474
36001
|
// src/blob-urls.ts
|
|
@@ -36547,70 +36074,136 @@ function blobStoreFromEnv() {
|
|
|
36547
36074
|
}
|
|
36548
36075
|
|
|
36549
36076
|
// src/blob-upload.ts
|
|
36550
|
-
var
|
|
36077
|
+
var ATTACHMENT_DOWNLOAD_ROOT = "/tmp/gog-attachments";
|
|
36078
|
+
var MAX_BLOB_UPLOAD_BYTES = 100 * 1024 * 1024;
|
|
36079
|
+
var BLOB_UPLOAD_TIMEOUT_MS = 12e4;
|
|
36080
|
+
var ERROR_BODY_SNIPPET = 512;
|
|
36551
36081
|
function withoutUrlSecrets(message, url2) {
|
|
36552
36082
|
let out = url2 ? message.split(url2).join("<signed url>") : message;
|
|
36553
36083
|
const signature = /[?&]sig=([^&#]+)/.exec(url2)?.[1];
|
|
36554
36084
|
if (signature) out = out.split(signature).join("<signature>");
|
|
36555
36085
|
return out;
|
|
36556
36086
|
}
|
|
36557
|
-
|
|
36558
|
-
|
|
36559
|
-
|
|
36560
|
-
const
|
|
36561
|
-
|
|
36562
|
-
|
|
36563
|
-
|
|
36564
|
-
|
|
36565
|
-
|
|
36566
|
-
|
|
36087
|
+
var UploadError = class extends Error {
|
|
36088
|
+
};
|
|
36089
|
+
async function resolveConfined(root, requested) {
|
|
36090
|
+
const path = await import("node:path");
|
|
36091
|
+
const { realpath, stat } = await import("node:fs/promises");
|
|
36092
|
+
const isInside = (base, candidate2) => candidate2 === base || candidate2.startsWith(base + path.sep);
|
|
36093
|
+
const lexicalRoot = path.resolve(root);
|
|
36094
|
+
const candidate = path.resolve(lexicalRoot, requested);
|
|
36095
|
+
if (!isInside(lexicalRoot, candidate)) {
|
|
36096
|
+
throw new UploadError(`the attachment path must be inside ${lexicalRoot}`);
|
|
36097
|
+
}
|
|
36098
|
+
let realFile;
|
|
36099
|
+
let realRoot;
|
|
36567
36100
|
try {
|
|
36568
|
-
|
|
36569
|
-
|
|
36570
|
-
headers: { Authorization: `Bearer ${key}`, "Content-Type": "application/json" },
|
|
36571
|
-
body: JSON.stringify({ path: request.path, url: request.url, contentType: request.contentType }),
|
|
36572
|
-
signal: AbortSignal.timeout(RUNNER_UPLOAD_TIMEOUT_MS)
|
|
36573
|
-
});
|
|
36101
|
+
realFile = await realpath(candidate);
|
|
36102
|
+
realRoot = await realpath(lexicalRoot);
|
|
36574
36103
|
} catch (err) {
|
|
36575
|
-
throw new
|
|
36576
|
-
`the upload to the blob store did not complete: ${err instanceof Error ? err.message : String(err)}`,
|
|
36577
|
-
request.url
|
|
36578
|
-
));
|
|
36104
|
+
throw new UploadError(`the downloaded attachment could not be found: ${err.message}`);
|
|
36579
36105
|
}
|
|
36580
|
-
|
|
36581
|
-
|
|
36582
|
-
raw = await response.text();
|
|
36583
|
-
} catch (err) {
|
|
36584
|
-
throw new Error(withoutUrlSecrets(
|
|
36585
|
-
`the upload to the blob store did not complete: the runner's answer could not be read: ${err instanceof Error ? err.message : String(err)}`,
|
|
36586
|
-
request.url
|
|
36587
|
-
));
|
|
36106
|
+
if (!isInside(realRoot, realFile)) {
|
|
36107
|
+
throw new UploadError(`the attachment path must be inside ${realRoot}`);
|
|
36588
36108
|
}
|
|
36589
|
-
|
|
36109
|
+
const info = await stat(realFile);
|
|
36110
|
+
if (!info.isFile()) throw new UploadError("the attachment path must name a regular file");
|
|
36111
|
+
if (info.size > MAX_BLOB_UPLOAD_BYTES) {
|
|
36112
|
+
throw new UploadError(
|
|
36113
|
+
`the attachment is ${info.size} bytes; the blob store's maximum is ${MAX_BLOB_UPLOAD_BYTES} bytes`
|
|
36114
|
+
);
|
|
36115
|
+
}
|
|
36116
|
+
return { file: realFile, bytes: info.size };
|
|
36117
|
+
}
|
|
36118
|
+
function parseTarget(url2) {
|
|
36119
|
+
let target;
|
|
36590
36120
|
try {
|
|
36591
|
-
|
|
36121
|
+
target = new URL(url2);
|
|
36592
36122
|
} catch {
|
|
36593
|
-
body = { error: raw };
|
|
36594
36123
|
}
|
|
36595
|
-
if (!
|
|
36596
|
-
throw new
|
|
36597
|
-
|
|
36598
|
-
|
|
36599
|
-
|
|
36124
|
+
if (!target || target.protocol !== "https:" && target.protocol !== "http:") {
|
|
36125
|
+
throw new UploadError("the upload target must be an absolute http(s) URL");
|
|
36126
|
+
}
|
|
36127
|
+
return target;
|
|
36128
|
+
}
|
|
36129
|
+
async function putFile(target, file2, bytes, contentType, timeoutMs) {
|
|
36130
|
+
const { createReadStream } = await import("node:fs");
|
|
36131
|
+
const { pipeline } = await import("node:stream");
|
|
36132
|
+
const transport = target.protocol === "https:" ? await import("node:https") : await import("node:http");
|
|
36133
|
+
return new Promise((resolve, reject) => {
|
|
36134
|
+
let settled = false;
|
|
36135
|
+
const source = createReadStream(file2);
|
|
36136
|
+
const req = transport.request(target, {
|
|
36137
|
+
method: "PUT",
|
|
36138
|
+
headers: { "content-type": contentType, "content-length": String(bytes) }
|
|
36139
|
+
});
|
|
36140
|
+
const finish2 = (settle2) => {
|
|
36141
|
+
if (settled) return;
|
|
36142
|
+
settled = true;
|
|
36143
|
+
clearTimeout(timer);
|
|
36144
|
+
source.destroy();
|
|
36145
|
+
req.destroy();
|
|
36146
|
+
settle2();
|
|
36147
|
+
};
|
|
36148
|
+
const fail = (err) => finish2(() => reject(err));
|
|
36149
|
+
const timer = setTimeout(
|
|
36150
|
+
() => fail(new UploadError(`the upload to the blob store did not finish within ${timeoutMs}ms`)),
|
|
36151
|
+
timeoutMs
|
|
36152
|
+
);
|
|
36153
|
+
req.on("error", fail);
|
|
36154
|
+
req.on("response", (res) => {
|
|
36155
|
+
const chunks = [];
|
|
36156
|
+
let held = 0;
|
|
36157
|
+
res.on("data", (chunk) => {
|
|
36158
|
+
if (held >= ERROR_BODY_SNIPPET) return;
|
|
36159
|
+
chunks.push(chunk);
|
|
36160
|
+
held += chunk.length;
|
|
36161
|
+
});
|
|
36162
|
+
res.on("error", fail);
|
|
36163
|
+
res.on("end", () => finish2(() => resolve({
|
|
36164
|
+
status: res.statusCode,
|
|
36165
|
+
body: Buffer.concat(chunks).toString().slice(0, ERROR_BODY_SNIPPET)
|
|
36166
|
+
})));
|
|
36167
|
+
});
|
|
36168
|
+
pipeline(source, req, (err) => {
|
|
36169
|
+
if (err) fail(err);
|
|
36170
|
+
});
|
|
36171
|
+
});
|
|
36172
|
+
}
|
|
36173
|
+
async function uploadToBlobStore(request, options = {}) {
|
|
36174
|
+
try {
|
|
36175
|
+
const target = parseTarget(request.url);
|
|
36176
|
+
const { file: file2, bytes } = await resolveConfined(options.root ?? ATTACHMENT_DOWNLOAD_ROOT, request.path);
|
|
36177
|
+
const answer = await putFile(
|
|
36178
|
+
target,
|
|
36179
|
+
file2,
|
|
36180
|
+
bytes,
|
|
36181
|
+
request.contentType,
|
|
36182
|
+
options.timeoutMs ?? BLOB_UPLOAD_TIMEOUT_MS
|
|
36183
|
+
);
|
|
36184
|
+
if (answer.status < 200 || answer.status >= 300) {
|
|
36185
|
+
throw new UploadError(`the blob store refused the upload with ${answer.status}: ${answer.body}`.trim());
|
|
36186
|
+
}
|
|
36187
|
+
return { bytes, status: answer.status };
|
|
36188
|
+
} catch (err) {
|
|
36189
|
+
const message = err instanceof UploadError ? err.message : `the upload to the blob store did not complete: ${err.message}`;
|
|
36190
|
+
throw new Error(withoutUrlSecrets(message, request.url));
|
|
36600
36191
|
}
|
|
36601
|
-
return { bytes: body.bytes, status: body.status };
|
|
36602
36192
|
}
|
|
36603
36193
|
export {
|
|
36194
|
+
ATTACHMENT_DOWNLOAD_ROOT,
|
|
36195
|
+
AUTH_BOOTSTRAP_MARKER,
|
|
36604
36196
|
BASE_TOOL_REGISTRARS,
|
|
36197
|
+
BLOB_UPLOAD_TIMEOUT_MS,
|
|
36605
36198
|
BLOB_URL_DEFAULT_TTL_MS,
|
|
36606
36199
|
BLOB_URL_MAX_TTL_MS,
|
|
36607
36200
|
INLINE_ATTACHMENT_LIMITS_TEXT,
|
|
36201
|
+
MAX_BLOB_UPLOAD_BYTES,
|
|
36608
36202
|
MAX_INLINE_ATTACHMENT_BYTES,
|
|
36609
36203
|
MAX_INLINE_ATTACHMENT_TOTAL_BYTES,
|
|
36610
36204
|
MAX_REQUEST_PAYLOAD_WIRE_BYTES,
|
|
36611
36205
|
MIN_GOG_VERSION,
|
|
36612
36206
|
PAYLOAD_INLINE_MAX,
|
|
36613
|
-
RUNNER_UPLOAD_TIMEOUT_MS,
|
|
36614
36207
|
VERSION,
|
|
36615
36208
|
accountParam,
|
|
36616
36209
|
annotateTruncatedList,
|
|
@@ -36619,6 +36212,7 @@ export {
|
|
|
36619
36212
|
attachInlineParam,
|
|
36620
36213
|
authToolsFor,
|
|
36621
36214
|
blobStoreFromEnv,
|
|
36215
|
+
bootstrapGogAuth,
|
|
36622
36216
|
createBlobUrlMinter,
|
|
36623
36217
|
diagnose,
|
|
36624
36218
|
errorText,
|
|
@@ -36657,11 +36251,9 @@ export {
|
|
|
36657
36251
|
resultText,
|
|
36658
36252
|
run,
|
|
36659
36253
|
runBinary,
|
|
36660
|
-
runExecutor,
|
|
36661
36254
|
runOrDiagnose,
|
|
36662
36255
|
stripConsumedPageToken,
|
|
36663
|
-
uploadToBlobStore
|
|
36664
|
-
useRemoteGogRunner
|
|
36256
|
+
uploadToBlobStore
|
|
36665
36257
|
};
|
|
36666
36258
|
/*! Bundled license information:
|
|
36667
36259
|
|