@keystrokehq/cli 0.0.137 → 0.0.139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{discovery-XqwkB9H_-C2XdYbG2.mjs → discovery-DV7FkTRA-BFmtZG9u.mjs} +432 -6
- package/dist/discovery-DV7FkTRA-BFmtZG9u.mjs.map +1 -0
- package/dist/dist-B27Z3YpE.mjs +1737 -0
- package/dist/dist-B27Z3YpE.mjs.map +1 -0
- package/dist/{dist-uZuvgIVp.mjs → dist-CSolAKQe.mjs} +25 -29
- package/dist/dist-CSolAKQe.mjs.map +1 -0
- package/dist/dist-Efdscyea.mjs +676 -0
- package/dist/dist-Efdscyea.mjs.map +1 -0
- package/dist/index.mjs +338 -2473
- package/dist/index.mjs.map +1 -1
- package/dist/walk-project-171B4cvO-DJy3qZKd.mjs +102 -0
- package/dist/walk-project-171B4cvO-DJy3qZKd.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/discovery-XqwkB9H_-C2XdYbG2.mjs.map +0 -1
- package/dist/dist-uZuvgIVp.mjs.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { relative, sep } from "node:path";
|
|
2
|
+
import { join, relative, sep } from "node:path";
|
|
3
|
+
import { readdir, stat } from "node:fs/promises";
|
|
3
4
|
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
4
5
|
var _a$1;
|
|
5
6
|
function $constructor(name, initializer, params) {
|
|
@@ -449,6 +450,7 @@ const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
449
450
|
}
|
|
450
451
|
return result.value;
|
|
451
452
|
};
|
|
453
|
+
const parse$1 = /* @__PURE__ */ _parse($ZodRealError);
|
|
452
454
|
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
453
455
|
const ctx = _ctx ? {
|
|
454
456
|
..._ctx,
|
|
@@ -466,6 +468,7 @@ const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
|
466
468
|
}
|
|
467
469
|
return result.value;
|
|
468
470
|
};
|
|
471
|
+
const parseAsync$1 = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
469
472
|
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
470
473
|
const ctx = _ctx ? {
|
|
471
474
|
..._ctx,
|
|
@@ -1917,6 +1920,98 @@ function handleIntersectionResults(result, left, right) {
|
|
|
1917
1920
|
result.value = merged.data;
|
|
1918
1921
|
return result;
|
|
1919
1922
|
}
|
|
1923
|
+
const $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
1924
|
+
$ZodType.init(inst, def);
|
|
1925
|
+
const items = def.items;
|
|
1926
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1927
|
+
const input = payload.value;
|
|
1928
|
+
if (!Array.isArray(input)) {
|
|
1929
|
+
payload.issues.push({
|
|
1930
|
+
input,
|
|
1931
|
+
inst,
|
|
1932
|
+
expected: "tuple",
|
|
1933
|
+
code: "invalid_type"
|
|
1934
|
+
});
|
|
1935
|
+
return payload;
|
|
1936
|
+
}
|
|
1937
|
+
payload.value = [];
|
|
1938
|
+
const proms = [];
|
|
1939
|
+
const optinStart = getTupleOptStart(items, "optin");
|
|
1940
|
+
const optoutStart = getTupleOptStart(items, "optout");
|
|
1941
|
+
if (!def.rest) {
|
|
1942
|
+
if (input.length < optinStart) {
|
|
1943
|
+
payload.issues.push({
|
|
1944
|
+
code: "too_small",
|
|
1945
|
+
minimum: optinStart,
|
|
1946
|
+
inclusive: true,
|
|
1947
|
+
input,
|
|
1948
|
+
inst,
|
|
1949
|
+
origin: "array"
|
|
1950
|
+
});
|
|
1951
|
+
return payload;
|
|
1952
|
+
}
|
|
1953
|
+
if (input.length > items.length) payload.issues.push({
|
|
1954
|
+
code: "too_big",
|
|
1955
|
+
maximum: items.length,
|
|
1956
|
+
inclusive: true,
|
|
1957
|
+
input,
|
|
1958
|
+
inst,
|
|
1959
|
+
origin: "array"
|
|
1960
|
+
});
|
|
1961
|
+
}
|
|
1962
|
+
const itemResults = new Array(items.length);
|
|
1963
|
+
for (let i = 0; i < items.length; i++) {
|
|
1964
|
+
const r = items[i]._zod.run({
|
|
1965
|
+
value: input[i],
|
|
1966
|
+
issues: []
|
|
1967
|
+
}, ctx);
|
|
1968
|
+
if (r instanceof Promise) proms.push(r.then((rr) => {
|
|
1969
|
+
itemResults[i] = rr;
|
|
1970
|
+
}));
|
|
1971
|
+
else itemResults[i] = r;
|
|
1972
|
+
}
|
|
1973
|
+
if (def.rest) {
|
|
1974
|
+
let i = items.length - 1;
|
|
1975
|
+
const rest = input.slice(items.length);
|
|
1976
|
+
for (const el of rest) {
|
|
1977
|
+
i++;
|
|
1978
|
+
const result = def.rest._zod.run({
|
|
1979
|
+
value: el,
|
|
1980
|
+
issues: []
|
|
1981
|
+
}, ctx);
|
|
1982
|
+
if (result instanceof Promise) proms.push(result.then((r) => handleTupleResult(r, payload, i)));
|
|
1983
|
+
else handleTupleResult(result, payload, i);
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
if (proms.length) return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
|
|
1987
|
+
return handleTupleResults(itemResults, payload, items, input, optoutStart);
|
|
1988
|
+
};
|
|
1989
|
+
});
|
|
1990
|
+
function getTupleOptStart(items, key) {
|
|
1991
|
+
for (let i = items.length - 1; i >= 0; i--) if (items[i]._zod[key] !== "optional") return i + 1;
|
|
1992
|
+
return 0;
|
|
1993
|
+
}
|
|
1994
|
+
function handleTupleResult(result, final, index) {
|
|
1995
|
+
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
1996
|
+
final.value[index] = result.value;
|
|
1997
|
+
}
|
|
1998
|
+
function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
1999
|
+
for (let i = 0; i < items.length; i++) {
|
|
2000
|
+
const r = itemResults[i];
|
|
2001
|
+
const isPresent = i < input.length;
|
|
2002
|
+
if (r.issues.length) {
|
|
2003
|
+
if (!isPresent && i >= optoutStart) {
|
|
2004
|
+
final.value.length = i;
|
|
2005
|
+
break;
|
|
2006
|
+
}
|
|
2007
|
+
final.issues.push(...prefixIssues(i, r.issues));
|
|
2008
|
+
}
|
|
2009
|
+
final.value[i] = r.value;
|
|
2010
|
+
}
|
|
2011
|
+
for (let i = final.value.length - 1; i >= input.length; i--) if (items[i]._zod.optout === "optional" && final.value[i] === void 0) final.value.length = i;
|
|
2012
|
+
else break;
|
|
2013
|
+
return final;
|
|
2014
|
+
}
|
|
1920
2015
|
const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
1921
2016
|
$ZodType.init(inst, def);
|
|
1922
2017
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -2264,6 +2359,69 @@ function handleReadonlyResult(payload) {
|
|
|
2264
2359
|
payload.value = Object.freeze(payload.value);
|
|
2265
2360
|
return payload;
|
|
2266
2361
|
}
|
|
2362
|
+
const $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
2363
|
+
$ZodType.init(inst, def);
|
|
2364
|
+
inst._def = def;
|
|
2365
|
+
inst._zod.def = def;
|
|
2366
|
+
inst.implement = (func) => {
|
|
2367
|
+
if (typeof func !== "function") throw new Error("implement() must be called with a function");
|
|
2368
|
+
return function(...args) {
|
|
2369
|
+
const parsedArgs = inst._def.input ? parse$1(inst._def.input, args) : args;
|
|
2370
|
+
const result = Reflect.apply(func, this, parsedArgs);
|
|
2371
|
+
if (inst._def.output) return parse$1(inst._def.output, result);
|
|
2372
|
+
return result;
|
|
2373
|
+
};
|
|
2374
|
+
};
|
|
2375
|
+
inst.implementAsync = (func) => {
|
|
2376
|
+
if (typeof func !== "function") throw new Error("implementAsync() must be called with a function");
|
|
2377
|
+
return async function(...args) {
|
|
2378
|
+
const parsedArgs = inst._def.input ? await parseAsync$1(inst._def.input, args) : args;
|
|
2379
|
+
const result = await Reflect.apply(func, this, parsedArgs);
|
|
2380
|
+
if (inst._def.output) return await parseAsync$1(inst._def.output, result);
|
|
2381
|
+
return result;
|
|
2382
|
+
};
|
|
2383
|
+
};
|
|
2384
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
2385
|
+
if (typeof payload.value !== "function") {
|
|
2386
|
+
payload.issues.push({
|
|
2387
|
+
code: "invalid_type",
|
|
2388
|
+
expected: "function",
|
|
2389
|
+
input: payload.value,
|
|
2390
|
+
inst
|
|
2391
|
+
});
|
|
2392
|
+
return payload;
|
|
2393
|
+
}
|
|
2394
|
+
if (inst._def.output && inst._def.output._zod.def.type === "promise") payload.value = inst.implementAsync(payload.value);
|
|
2395
|
+
else payload.value = inst.implement(payload.value);
|
|
2396
|
+
return payload;
|
|
2397
|
+
};
|
|
2398
|
+
inst.input = (...args) => {
|
|
2399
|
+
const F = inst.constructor;
|
|
2400
|
+
if (Array.isArray(args[0])) return new F({
|
|
2401
|
+
type: "function",
|
|
2402
|
+
input: new $ZodTuple({
|
|
2403
|
+
type: "tuple",
|
|
2404
|
+
items: args[0],
|
|
2405
|
+
rest: args[1]
|
|
2406
|
+
}),
|
|
2407
|
+
output: inst._def.output
|
|
2408
|
+
});
|
|
2409
|
+
return new F({
|
|
2410
|
+
type: "function",
|
|
2411
|
+
input: args[0],
|
|
2412
|
+
output: inst._def.output
|
|
2413
|
+
});
|
|
2414
|
+
};
|
|
2415
|
+
inst.output = (output) => {
|
|
2416
|
+
const F = inst.constructor;
|
|
2417
|
+
return new F({
|
|
2418
|
+
type: "function",
|
|
2419
|
+
input: inst._def.input,
|
|
2420
|
+
output
|
|
2421
|
+
});
|
|
2422
|
+
};
|
|
2423
|
+
return inst;
|
|
2424
|
+
});
|
|
2267
2425
|
const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
2268
2426
|
$ZodCheck.init(inst, def);
|
|
2269
2427
|
$ZodType.init(inst, def);
|
|
@@ -3208,9 +3366,33 @@ const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
3208
3366
|
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
3209
3367
|
json.type = "boolean";
|
|
3210
3368
|
};
|
|
3369
|
+
const bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
3370
|
+
if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
|
|
3371
|
+
};
|
|
3372
|
+
const symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
3373
|
+
if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
|
|
3374
|
+
};
|
|
3375
|
+
const nullProcessor = (_schema, ctx, json, _params) => {
|
|
3376
|
+
if (ctx.target === "openapi-3.0") {
|
|
3377
|
+
json.type = "string";
|
|
3378
|
+
json.nullable = true;
|
|
3379
|
+
json.enum = [null];
|
|
3380
|
+
} else json.type = "null";
|
|
3381
|
+
};
|
|
3382
|
+
const undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
3383
|
+
if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
|
|
3384
|
+
};
|
|
3385
|
+
const voidProcessor = (_schema, ctx, _json, _params) => {
|
|
3386
|
+
if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
|
|
3387
|
+
};
|
|
3211
3388
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
3212
3389
|
json.not = {};
|
|
3213
3390
|
};
|
|
3391
|
+
const anyProcessor = (_schema, _ctx, _json, _params) => {};
|
|
3392
|
+
const unknownProcessor = (_schema, _ctx, _json, _params) => {};
|
|
3393
|
+
const dateProcessor = (_schema, ctx, _json, _params) => {
|
|
3394
|
+
if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
|
|
3395
|
+
};
|
|
3214
3396
|
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
3215
3397
|
const def = schema._zod.def;
|
|
3216
3398
|
const values = getEnumValues(def.entries);
|
|
@@ -3239,12 +3421,53 @@ const literalProcessor = (schema, ctx, json, _params) => {
|
|
|
3239
3421
|
json.enum = vals;
|
|
3240
3422
|
}
|
|
3241
3423
|
};
|
|
3424
|
+
const nanProcessor = (_schema, ctx, _json, _params) => {
|
|
3425
|
+
if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
|
|
3426
|
+
};
|
|
3427
|
+
const templateLiteralProcessor = (schema, _ctx, json, _params) => {
|
|
3428
|
+
const _json = json;
|
|
3429
|
+
const pattern = schema._zod.pattern;
|
|
3430
|
+
if (!pattern) throw new Error("Pattern not found in template literal");
|
|
3431
|
+
_json.type = "string";
|
|
3432
|
+
_json.pattern = pattern.source;
|
|
3433
|
+
};
|
|
3434
|
+
const fileProcessor = (schema, _ctx, json, _params) => {
|
|
3435
|
+
const _json = json;
|
|
3436
|
+
const file = {
|
|
3437
|
+
type: "string",
|
|
3438
|
+
format: "binary",
|
|
3439
|
+
contentEncoding: "binary"
|
|
3440
|
+
};
|
|
3441
|
+
const { minimum, maximum, mime } = schema._zod.bag;
|
|
3442
|
+
if (minimum !== void 0) file.minLength = minimum;
|
|
3443
|
+
if (maximum !== void 0) file.maxLength = maximum;
|
|
3444
|
+
if (mime) if (mime.length === 1) {
|
|
3445
|
+
file.contentMediaType = mime[0];
|
|
3446
|
+
Object.assign(_json, file);
|
|
3447
|
+
} else {
|
|
3448
|
+
Object.assign(_json, file);
|
|
3449
|
+
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
3450
|
+
}
|
|
3451
|
+
else Object.assign(_json, file);
|
|
3452
|
+
};
|
|
3453
|
+
const successProcessor = (_schema, _ctx, json, _params) => {
|
|
3454
|
+
json.type = "boolean";
|
|
3455
|
+
};
|
|
3242
3456
|
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
3243
3457
|
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
3244
3458
|
};
|
|
3459
|
+
const functionProcessor = (_schema, ctx, _json, _params) => {
|
|
3460
|
+
if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
|
|
3461
|
+
};
|
|
3245
3462
|
const transformProcessor = (_schema, ctx, _json, _params) => {
|
|
3246
3463
|
if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
3247
3464
|
};
|
|
3465
|
+
const mapProcessor = (_schema, ctx, _json, _params) => {
|
|
3466
|
+
if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
|
|
3467
|
+
};
|
|
3468
|
+
const setProcessor = (_schema, ctx, _json, _params) => {
|
|
3469
|
+
if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
|
|
3470
|
+
};
|
|
3248
3471
|
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
3249
3472
|
const json = _json;
|
|
3250
3473
|
const def = schema._zod.def;
|
|
@@ -3321,6 +3544,44 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
3321
3544
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
3322
3545
|
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
3323
3546
|
};
|
|
3547
|
+
const tupleProcessor = (schema, ctx, _json, params) => {
|
|
3548
|
+
const json = _json;
|
|
3549
|
+
const def = schema._zod.def;
|
|
3550
|
+
json.type = "array";
|
|
3551
|
+
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
3552
|
+
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
3553
|
+
const prefixItems = def.items.map((x, i) => process(x, ctx, {
|
|
3554
|
+
...params,
|
|
3555
|
+
path: [
|
|
3556
|
+
...params.path,
|
|
3557
|
+
prefixPath,
|
|
3558
|
+
i
|
|
3559
|
+
]
|
|
3560
|
+
}));
|
|
3561
|
+
const rest = def.rest ? process(def.rest, ctx, {
|
|
3562
|
+
...params,
|
|
3563
|
+
path: [
|
|
3564
|
+
...params.path,
|
|
3565
|
+
restPath,
|
|
3566
|
+
...ctx.target === "openapi-3.0" ? [def.items.length] : []
|
|
3567
|
+
]
|
|
3568
|
+
}) : null;
|
|
3569
|
+
if (ctx.target === "draft-2020-12") {
|
|
3570
|
+
json.prefixItems = prefixItems;
|
|
3571
|
+
if (rest) json.items = rest;
|
|
3572
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
3573
|
+
json.items = { anyOf: prefixItems };
|
|
3574
|
+
if (rest) json.items.anyOf.push(rest);
|
|
3575
|
+
json.minItems = prefixItems.length;
|
|
3576
|
+
if (!rest) json.maxItems = prefixItems.length;
|
|
3577
|
+
} else {
|
|
3578
|
+
json.items = prefixItems;
|
|
3579
|
+
if (rest) json.additionalItems = rest;
|
|
3580
|
+
}
|
|
3581
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
3582
|
+
if (typeof minimum === "number") json.minItems = minimum;
|
|
3583
|
+
if (typeof maximum === "number") json.maxItems = maximum;
|
|
3584
|
+
};
|
|
3324
3585
|
const recordProcessor = (schema, ctx, _json, params) => {
|
|
3325
3586
|
const json = _json;
|
|
3326
3587
|
const def = schema._zod.def;
|
|
@@ -3411,12 +3672,99 @@ const readonlyProcessor = (schema, ctx, json, params) => {
|
|
|
3411
3672
|
seen.ref = def.innerType;
|
|
3412
3673
|
json.readOnly = true;
|
|
3413
3674
|
};
|
|
3675
|
+
const promiseProcessor = (schema, ctx, _json, params) => {
|
|
3676
|
+
const def = schema._zod.def;
|
|
3677
|
+
process(def.innerType, ctx, params);
|
|
3678
|
+
const seen = ctx.seen.get(schema);
|
|
3679
|
+
seen.ref = def.innerType;
|
|
3680
|
+
};
|
|
3414
3681
|
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
3415
3682
|
const def = schema._zod.def;
|
|
3416
3683
|
process(def.innerType, ctx, params);
|
|
3417
3684
|
const seen = ctx.seen.get(schema);
|
|
3418
3685
|
seen.ref = def.innerType;
|
|
3419
3686
|
};
|
|
3687
|
+
const lazyProcessor = (schema, ctx, _json, params) => {
|
|
3688
|
+
const innerType = schema._zod.innerType;
|
|
3689
|
+
process(innerType, ctx, params);
|
|
3690
|
+
const seen = ctx.seen.get(schema);
|
|
3691
|
+
seen.ref = innerType;
|
|
3692
|
+
};
|
|
3693
|
+
const allProcessors = {
|
|
3694
|
+
string: stringProcessor,
|
|
3695
|
+
number: numberProcessor,
|
|
3696
|
+
boolean: booleanProcessor,
|
|
3697
|
+
bigint: bigintProcessor,
|
|
3698
|
+
symbol: symbolProcessor,
|
|
3699
|
+
null: nullProcessor,
|
|
3700
|
+
undefined: undefinedProcessor,
|
|
3701
|
+
void: voidProcessor,
|
|
3702
|
+
never: neverProcessor,
|
|
3703
|
+
any: anyProcessor,
|
|
3704
|
+
unknown: unknownProcessor,
|
|
3705
|
+
date: dateProcessor,
|
|
3706
|
+
enum: enumProcessor,
|
|
3707
|
+
literal: literalProcessor,
|
|
3708
|
+
nan: nanProcessor,
|
|
3709
|
+
template_literal: templateLiteralProcessor,
|
|
3710
|
+
file: fileProcessor,
|
|
3711
|
+
success: successProcessor,
|
|
3712
|
+
custom: customProcessor,
|
|
3713
|
+
function: functionProcessor,
|
|
3714
|
+
transform: transformProcessor,
|
|
3715
|
+
map: mapProcessor,
|
|
3716
|
+
set: setProcessor,
|
|
3717
|
+
array: arrayProcessor,
|
|
3718
|
+
object: objectProcessor,
|
|
3719
|
+
union: unionProcessor,
|
|
3720
|
+
intersection: intersectionProcessor,
|
|
3721
|
+
tuple: tupleProcessor,
|
|
3722
|
+
record: recordProcessor,
|
|
3723
|
+
nullable: nullableProcessor,
|
|
3724
|
+
nonoptional: nonoptionalProcessor,
|
|
3725
|
+
default: defaultProcessor,
|
|
3726
|
+
prefault: prefaultProcessor,
|
|
3727
|
+
catch: catchProcessor,
|
|
3728
|
+
pipe: pipeProcessor,
|
|
3729
|
+
readonly: readonlyProcessor,
|
|
3730
|
+
promise: promiseProcessor,
|
|
3731
|
+
optional: optionalProcessor,
|
|
3732
|
+
lazy: lazyProcessor
|
|
3733
|
+
};
|
|
3734
|
+
function toJSONSchema(input, params) {
|
|
3735
|
+
if ("_idmap" in input) {
|
|
3736
|
+
const registry = input;
|
|
3737
|
+
const ctx = initializeContext({
|
|
3738
|
+
...params,
|
|
3739
|
+
processors: allProcessors
|
|
3740
|
+
});
|
|
3741
|
+
const defs = {};
|
|
3742
|
+
for (const entry of registry._idmap.entries()) {
|
|
3743
|
+
const [_, schema] = entry;
|
|
3744
|
+
process(schema, ctx);
|
|
3745
|
+
}
|
|
3746
|
+
const schemas = {};
|
|
3747
|
+
ctx.external = {
|
|
3748
|
+
registry,
|
|
3749
|
+
uri: params?.uri,
|
|
3750
|
+
defs
|
|
3751
|
+
};
|
|
3752
|
+
for (const entry of registry._idmap.entries()) {
|
|
3753
|
+
const [key, schema] = entry;
|
|
3754
|
+
extractDefs(ctx, schema);
|
|
3755
|
+
schemas[key] = finalize(ctx, schema);
|
|
3756
|
+
}
|
|
3757
|
+
if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
|
|
3758
|
+
return { schemas };
|
|
3759
|
+
}
|
|
3760
|
+
const ctx = initializeContext({
|
|
3761
|
+
...params,
|
|
3762
|
+
processors: allProcessors
|
|
3763
|
+
});
|
|
3764
|
+
process(input, ctx);
|
|
3765
|
+
extractDefs(ctx, input);
|
|
3766
|
+
return finalize(ctx, input);
|
|
3767
|
+
}
|
|
3420
3768
|
//#endregion
|
|
3421
3769
|
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
|
|
3422
3770
|
const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
@@ -4051,6 +4399,24 @@ function intersection(left, right) {
|
|
|
4051
4399
|
right
|
|
4052
4400
|
});
|
|
4053
4401
|
}
|
|
4402
|
+
const ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
4403
|
+
$ZodTuple.init(inst, def);
|
|
4404
|
+
ZodType.init(inst, def);
|
|
4405
|
+
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
|
|
4406
|
+
inst.rest = (rest) => inst.clone({
|
|
4407
|
+
...inst._zod.def,
|
|
4408
|
+
rest
|
|
4409
|
+
});
|
|
4410
|
+
});
|
|
4411
|
+
function tuple(items, _paramsOrRest, _params) {
|
|
4412
|
+
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
4413
|
+
return new ZodTuple({
|
|
4414
|
+
type: "tuple",
|
|
4415
|
+
items,
|
|
4416
|
+
rest: hasRest ? _paramsOrRest : null,
|
|
4417
|
+
...normalizeParams(hasRest ? _params : _paramsOrRest)
|
|
4418
|
+
});
|
|
4419
|
+
}
|
|
4054
4420
|
const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
4055
4421
|
$ZodRecord.init(inst, def);
|
|
4056
4422
|
ZodType.init(inst, def);
|
|
@@ -4280,6 +4646,18 @@ function readonly(innerType) {
|
|
|
4280
4646
|
innerType
|
|
4281
4647
|
});
|
|
4282
4648
|
}
|
|
4649
|
+
const ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
|
|
4650
|
+
$ZodFunction.init(inst, def);
|
|
4651
|
+
ZodType.init(inst, def);
|
|
4652
|
+
inst._zod.processJSONSchema = (ctx, json, params) => functionProcessor(inst, ctx, json, params);
|
|
4653
|
+
});
|
|
4654
|
+
function _function(params) {
|
|
4655
|
+
return new ZodFunction({
|
|
4656
|
+
type: "function",
|
|
4657
|
+
input: Array.isArray(params?.input) ? tuple(params?.input) : params?.input ?? array(unknown()),
|
|
4658
|
+
output: params?.output ?? unknown()
|
|
4659
|
+
});
|
|
4660
|
+
}
|
|
4283
4661
|
const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
4284
4662
|
$ZodCustom.init(inst, def);
|
|
4285
4663
|
ZodType.init(inst, def);
|
|
@@ -4295,11 +4673,11 @@ function superRefine(fn, params) {
|
|
|
4295
4673
|
return /* @__PURE__ */ _superRefine(fn, params);
|
|
4296
4674
|
}
|
|
4297
4675
|
//#endregion
|
|
4298
|
-
//#region ../../packages/
|
|
4676
|
+
//#region ../../packages/manifest/dist/discovery-DV7FkTRA.mjs
|
|
4299
4677
|
const SOURCE_EXT = /\.(ts|mts|mjs|js)$/;
|
|
4300
|
-
const DECLARATION_FILE = /\.d\.(ts|mts|cts)$/;
|
|
4678
|
+
const DECLARATION_FILE$1 = /\.d\.(ts|mts|cts)$/;
|
|
4301
4679
|
function entryIdFromFile(rootDir, filePath, options) {
|
|
4302
|
-
if (DECLARATION_FILE.test(filePath)) return null;
|
|
4680
|
+
if (DECLARATION_FILE$1.test(filePath)) return null;
|
|
4303
4681
|
const baseName = filePath.split(sep).at(-1) ?? "";
|
|
4304
4682
|
if (/\.(int\.)?test\.(ts|mts)$/.test(baseName)) return null;
|
|
4305
4683
|
const segments = relative(rootDir, filePath).replace(SOURCE_EXT, "").split(sep).filter((segment) => segment.length > 0);
|
|
@@ -4311,7 +4689,55 @@ function entryIdFromFile(rootDir, filePath, options) {
|
|
|
4311
4689
|
const id = segments.slice(0, -1).join("/");
|
|
4312
4690
|
return id.length > 0 ? id : null;
|
|
4313
4691
|
}
|
|
4692
|
+
const SOURCE_FILE = /\.(ts|mts|mjs|js)$/;
|
|
4693
|
+
const TEST_FILE = /\.(int\.)?test\.(ts|mts)$/;
|
|
4694
|
+
const DECLARATION_FILE = /\.d\.(ts|mts|cts)$/;
|
|
4695
|
+
const JUNK_FILE = /^\._|\.DS_Store$/;
|
|
4696
|
+
async function walkTypeScriptFiles(dir) {
|
|
4697
|
+
let names;
|
|
4698
|
+
try {
|
|
4699
|
+
names = await readdir(dir);
|
|
4700
|
+
} catch (error) {
|
|
4701
|
+
if (error.code === "ENOENT") return [];
|
|
4702
|
+
throw error;
|
|
4703
|
+
}
|
|
4704
|
+
const files = [];
|
|
4705
|
+
for (const name of names) {
|
|
4706
|
+
const path = join(dir, name);
|
|
4707
|
+
if ((await stat(path)).isDirectory()) files.push(...await walkTypeScriptFiles(path));
|
|
4708
|
+
else if (!JUNK_FILE.test(name) && SOURCE_FILE.test(name) && !DECLARATION_FILE.test(name) && !TEST_FILE.test(name)) files.push(path);
|
|
4709
|
+
}
|
|
4710
|
+
return files;
|
|
4711
|
+
}
|
|
4712
|
+
async function discoverEntries(rootDir, options) {
|
|
4713
|
+
const files = await walkTypeScriptFiles(rootDir);
|
|
4714
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
4715
|
+
for (const filePath of files) {
|
|
4716
|
+
const id = entryIdFromFile(rootDir, filePath, options);
|
|
4717
|
+
if (!id) continue;
|
|
4718
|
+
const key = options.formatKey(id);
|
|
4719
|
+
const moduleFile = relative(rootDir, filePath);
|
|
4720
|
+
const existing = byKey.get(key);
|
|
4721
|
+
if (existing) throw new Error(`Duplicate ${options.duplicateLabel} ${key}: ${existing.filePath} and ${filePath}`);
|
|
4722
|
+
byKey.set(key, {
|
|
4723
|
+
key,
|
|
4724
|
+
filePath,
|
|
4725
|
+
moduleFile
|
|
4726
|
+
});
|
|
4727
|
+
}
|
|
4728
|
+
return [...byKey.values()];
|
|
4729
|
+
}
|
|
4730
|
+
async function discoverModuleFileEntries(rootDir, options) {
|
|
4731
|
+
return (await discoverEntries(rootDir, {
|
|
4732
|
+
nestedEntry: options.nestedEntry,
|
|
4733
|
+
formatKey: (id) => id,
|
|
4734
|
+
duplicateLabel: options.duplicateLabel
|
|
4735
|
+
})).filter((entry) => options.shouldDiscoverFile?.(entry.filePath) ?? true).map(({ filePath, moduleFile }) => ({
|
|
4736
|
+
filePath,
|
|
4737
|
+
moduleFile
|
|
4738
|
+
}));
|
|
4739
|
+
}
|
|
4314
4740
|
//#endregion
|
|
4315
|
-
export { _coercedNumber as _,
|
|
4741
|
+
export { _coercedNumber as S, string as _, ZodNumber as a, url as b, _function as c, custom as d, discriminatedUnion as f, record as g, object as h, walkTypeScriptFiles as i, array as l, number as m, discoverModuleFileEntries as n, ZodType as o, literal as p, entryIdFromFile as r, _enum as s, discoverEntries as t, boolean as u, union as v, toJSONSchema as x, unknown as y };
|
|
4316
4742
|
|
|
4317
|
-
//# sourceMappingURL=discovery-
|
|
4743
|
+
//# sourceMappingURL=discovery-DV7FkTRA-BFmtZG9u.mjs.map
|