@youdotcom-oss/mcp 1.3.7 → 1.3.9-next.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/README.md +2 -0
- package/bin/stdio.js +900 -781
- package/dist/contents/contents.schemas.d.ts +39 -0
- package/dist/contents/contents.utils.d.ts +28 -0
- package/dist/contents/register-contents-tool.d.ts +10 -0
- package/dist/express/express.schemas.d.ts +56 -0
- package/dist/express/express.utils.d.ts +45 -0
- package/dist/express/register-express-tool.d.ts +6 -0
- package/dist/get-mcp-server.d.ts +2 -0
- package/dist/http.d.ts +3 -0
- package/{src/utils.ts → dist/main.d.ts} +1 -0
- package/dist/search/register-search-tool.d.ts +6 -0
- package/dist/search/search.schemas.d.ts +131 -0
- package/dist/search/search.utils.d.ts +96 -0
- package/dist/shared/api-constants.d.ts +9 -0
- package/dist/shared/check-response-for-errors.d.ts +6 -0
- package/dist/shared/format-search-results-text.d.ts +19 -0
- package/dist/shared/generate-error-report-link.d.ts +9 -0
- package/dist/shared/get-logger.d.ts +7 -0
- package/dist/shared/use-client-version.d.ts +6 -0
- package/dist/stdio.d.ts +2 -0
- package/package.json +15 -7
- package/src/contents/contents.utils.ts +1 -2
- package/src/contents/tests/contents.utils.spec.ts +69 -57
- package/src/express/express.utils.ts +2 -4
- package/src/express/tests/express.utils.spec.ts +74 -62
- package/src/main.ts +9 -0
- package/src/search/search.schemas.ts +23 -4
- package/src/search/search.utils.ts +3 -2
- package/src/search/tests/search.utils.spec.ts +125 -57
- package/src/shared/api-constants.ts +10 -0
- package/src/tests/http.spec.ts +35 -31
- package/src/tests/tool.spec.ts +490 -402
package/bin/stdio.js
CHANGED
|
@@ -6490,9 +6490,9 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
6490
6490
|
});
|
|
6491
6491
|
|
|
6492
6492
|
// ../../node_modules/.bun/@modelcontextprotocol+sdk@1.24.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
6493
|
-
import
|
|
6493
|
+
import process3 from "node:process";
|
|
6494
6494
|
|
|
6495
|
-
// ../../node_modules/.bun/zod@4.
|
|
6495
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/core/core.js
|
|
6496
6496
|
var NEVER = Object.freeze({
|
|
6497
6497
|
status: "aborted"
|
|
6498
6498
|
});
|
|
@@ -6568,7 +6568,7 @@ function config(newConfig) {
|
|
|
6568
6568
|
Object.assign(globalConfig, newConfig);
|
|
6569
6569
|
return globalConfig;
|
|
6570
6570
|
}
|
|
6571
|
-
// ../../node_modules/.bun/zod@4.
|
|
6571
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/core/util.js
|
|
6572
6572
|
var exports_util = {};
|
|
6573
6573
|
__export(exports_util, {
|
|
6574
6574
|
unwrapMessage: () => unwrapMessage,
|
|
@@ -6641,7 +6641,7 @@ function assertNotEqual(val) {
|
|
|
6641
6641
|
}
|
|
6642
6642
|
function assertIs(_arg) {}
|
|
6643
6643
|
function assertNever(_x) {
|
|
6644
|
-
throw new Error;
|
|
6644
|
+
throw new Error("Unexpected value in exhaustive check");
|
|
6645
6645
|
}
|
|
6646
6646
|
function assert(_) {}
|
|
6647
6647
|
function getEnumValues(entries) {
|
|
@@ -7203,7 +7203,7 @@ class Class {
|
|
|
7203
7203
|
constructor(..._args) {}
|
|
7204
7204
|
}
|
|
7205
7205
|
|
|
7206
|
-
// ../../node_modules/.bun/zod@4.
|
|
7206
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/core/errors.js
|
|
7207
7207
|
var initializer = (inst, def) => {
|
|
7208
7208
|
inst.name = "$ZodError";
|
|
7209
7209
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -7269,7 +7269,7 @@ function formatError(error, mapper = (issue2) => issue2.message) {
|
|
|
7269
7269
|
return fieldErrors;
|
|
7270
7270
|
}
|
|
7271
7271
|
|
|
7272
|
-
// ../../node_modules/.bun/zod@4.
|
|
7272
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/core/parse.js
|
|
7273
7273
|
var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
7274
7274
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
7275
7275
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -7348,7 +7348,7 @@ var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
7348
7348
|
var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
7349
7349
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
7350
7350
|
};
|
|
7351
|
-
// ../../node_modules/.bun/zod@4.
|
|
7351
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/core/regexes.js
|
|
7352
7352
|
var cuid = /^[cC][^\s-]{8,}$/;
|
|
7353
7353
|
var cuid2 = /^[0-9a-z]+$/;
|
|
7354
7354
|
var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
@@ -7405,7 +7405,7 @@ var _null = /^null$/i;
|
|
|
7405
7405
|
var lowercase = /^[^A-Z]*$/;
|
|
7406
7406
|
var uppercase = /^[^a-z]*$/;
|
|
7407
7407
|
|
|
7408
|
-
// ../../node_modules/.bun/zod@4.
|
|
7408
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/core/checks.js
|
|
7409
7409
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
7410
7410
|
var _a;
|
|
7411
7411
|
inst._zod ?? (inst._zod = {});
|
|
@@ -7790,7 +7790,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
|
|
|
7790
7790
|
};
|
|
7791
7791
|
});
|
|
7792
7792
|
|
|
7793
|
-
// ../../node_modules/.bun/zod@4.
|
|
7793
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/core/doc.js
|
|
7794
7794
|
class Doc {
|
|
7795
7795
|
constructor(args = []) {
|
|
7796
7796
|
this.content = [];
|
|
@@ -7828,14 +7828,14 @@ class Doc {
|
|
|
7828
7828
|
}
|
|
7829
7829
|
}
|
|
7830
7830
|
|
|
7831
|
-
// ../../node_modules/.bun/zod@4.
|
|
7831
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/core/versions.js
|
|
7832
7832
|
var version = {
|
|
7833
7833
|
major: 4,
|
|
7834
|
-
minor:
|
|
7835
|
-
patch:
|
|
7834
|
+
minor: 2,
|
|
7835
|
+
patch: 0
|
|
7836
7836
|
};
|
|
7837
7837
|
|
|
7838
|
-
// ../../node_modules/.bun/zod@4.
|
|
7838
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/core/schemas.js
|
|
7839
7839
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
7840
7840
|
var _a;
|
|
7841
7841
|
inst ?? (inst = {});
|
|
@@ -8624,6 +8624,7 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
8624
8624
|
};
|
|
8625
8625
|
});
|
|
8626
8626
|
var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
8627
|
+
def.inclusive = false;
|
|
8627
8628
|
$ZodUnion.init(inst, def);
|
|
8628
8629
|
const _super = inst._zod.parse;
|
|
8629
8630
|
defineLazy(inst._zod, "propValues", () => {
|
|
@@ -8825,15 +8826,18 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
8825
8826
|
throw new Error("Async schemas not supported in object keys currently");
|
|
8826
8827
|
}
|
|
8827
8828
|
if (keyResult.issues.length) {
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8829
|
+
if (def.mode === "loose") {
|
|
8830
|
+
payload.value[key] = input[key];
|
|
8831
|
+
} else {
|
|
8832
|
+
payload.issues.push({
|
|
8833
|
+
code: "invalid_key",
|
|
8834
|
+
origin: "record",
|
|
8835
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
8836
|
+
input: key,
|
|
8837
|
+
path: [key],
|
|
8838
|
+
inst
|
|
8839
|
+
});
|
|
8840
|
+
}
|
|
8837
8841
|
continue;
|
|
8838
8842
|
}
|
|
8839
8843
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
@@ -9151,7 +9155,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
9151
9155
|
payload.issues.push(issue(_iss));
|
|
9152
9156
|
}
|
|
9153
9157
|
}
|
|
9154
|
-
// ../../node_modules/.bun/zod@4.
|
|
9158
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/locales/en.js
|
|
9155
9159
|
var parsedType = (data) => {
|
|
9156
9160
|
const t = typeof data;
|
|
9157
9161
|
switch (t) {
|
|
@@ -9269,7 +9273,7 @@ function en_default() {
|
|
|
9269
9273
|
localeError: error()
|
|
9270
9274
|
};
|
|
9271
9275
|
}
|
|
9272
|
-
// ../../node_modules/.bun/zod@4.
|
|
9276
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/core/registries.js
|
|
9273
9277
|
var _a;
|
|
9274
9278
|
var $output = Symbol("ZodOutput");
|
|
9275
9279
|
var $input = Symbol("ZodInput");
|
|
@@ -9322,7 +9326,7 @@ function registry() {
|
|
|
9322
9326
|
}
|
|
9323
9327
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
9324
9328
|
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
9325
|
-
// ../../node_modules/.bun/zod@4.
|
|
9329
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/core/api.js
|
|
9326
9330
|
function _string(Class2, params) {
|
|
9327
9331
|
return new Class2({
|
|
9328
9332
|
type: "string",
|
|
@@ -9793,714 +9797,238 @@ function _check(fn, params) {
|
|
|
9793
9797
|
ch._zod.check = fn;
|
|
9794
9798
|
return ch;
|
|
9795
9799
|
}
|
|
9796
|
-
// ../../node_modules/.bun/zod@4.
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
|
|
9800
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/core/to-json-schema.js
|
|
9801
|
+
function initializeContext(params) {
|
|
9802
|
+
let target = params?.target ?? "draft-2020-12";
|
|
9803
|
+
if (target === "draft-4")
|
|
9804
|
+
target = "draft-04";
|
|
9805
|
+
if (target === "draft-7")
|
|
9806
|
+
target = "draft-07";
|
|
9807
|
+
return {
|
|
9808
|
+
processors: params.processors ?? {},
|
|
9809
|
+
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
9810
|
+
target,
|
|
9811
|
+
unrepresentable: params?.unrepresentable ?? "throw",
|
|
9812
|
+
override: params?.override ?? (() => {}),
|
|
9813
|
+
io: params?.io ?? "output",
|
|
9814
|
+
counter: 0,
|
|
9815
|
+
seen: new Map,
|
|
9816
|
+
cycles: params?.cycles ?? "ref",
|
|
9817
|
+
reused: params?.reused ?? "inline",
|
|
9818
|
+
external: params?.external ?? undefined
|
|
9819
|
+
};
|
|
9820
|
+
}
|
|
9821
|
+
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
9822
|
+
var _a2;
|
|
9823
|
+
const def = schema._zod.def;
|
|
9824
|
+
const seen = ctx.seen.get(schema);
|
|
9825
|
+
if (seen) {
|
|
9826
|
+
seen.count++;
|
|
9827
|
+
const isCycle = _params.schemaPath.includes(schema);
|
|
9828
|
+
if (isCycle) {
|
|
9829
|
+
seen.cycle = _params.path;
|
|
9830
|
+
}
|
|
9831
|
+
return seen.schema;
|
|
9832
|
+
}
|
|
9833
|
+
const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };
|
|
9834
|
+
ctx.seen.set(schema, result);
|
|
9835
|
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
9836
|
+
if (overrideSchema) {
|
|
9837
|
+
result.schema = overrideSchema;
|
|
9838
|
+
} else {
|
|
9839
|
+
const params = {
|
|
9840
|
+
..._params,
|
|
9841
|
+
schemaPath: [..._params.schemaPath, schema],
|
|
9842
|
+
path: _params.path
|
|
9816
9843
|
};
|
|
9817
|
-
const
|
|
9818
|
-
if (
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
return seen.schema;
|
|
9825
|
-
}
|
|
9826
|
-
const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };
|
|
9827
|
-
this.seen.set(schema, result);
|
|
9828
|
-
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
9829
|
-
if (overrideSchema) {
|
|
9830
|
-
result.schema = overrideSchema;
|
|
9844
|
+
const parent = schema._zod.parent;
|
|
9845
|
+
if (parent) {
|
|
9846
|
+
result.ref = parent;
|
|
9847
|
+
process2(parent, ctx, params);
|
|
9848
|
+
ctx.seen.get(parent).isParent = true;
|
|
9849
|
+
} else if (schema._zod.processJSONSchema) {
|
|
9850
|
+
schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
9831
9851
|
} else {
|
|
9832
|
-
const
|
|
9833
|
-
|
|
9834
|
-
|
|
9835
|
-
|
|
9836
|
-
}
|
|
9837
|
-
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
else
|
|
9881
|
-
json.type = "number";
|
|
9882
|
-
if (typeof exclusiveMinimum === "number") {
|
|
9883
|
-
if (this.target === "draft-4" || this.target === "openapi-3.0") {
|
|
9884
|
-
json.minimum = exclusiveMinimum;
|
|
9885
|
-
json.exclusiveMinimum = true;
|
|
9886
|
-
} else {
|
|
9887
|
-
json.exclusiveMinimum = exclusiveMinimum;
|
|
9888
|
-
}
|
|
9889
|
-
}
|
|
9890
|
-
if (typeof minimum === "number") {
|
|
9891
|
-
json.minimum = minimum;
|
|
9892
|
-
if (typeof exclusiveMinimum === "number" && this.target !== "draft-4") {
|
|
9893
|
-
if (exclusiveMinimum >= minimum)
|
|
9894
|
-
delete json.minimum;
|
|
9895
|
-
else
|
|
9896
|
-
delete json.exclusiveMinimum;
|
|
9897
|
-
}
|
|
9898
|
-
}
|
|
9899
|
-
if (typeof exclusiveMaximum === "number") {
|
|
9900
|
-
if (this.target === "draft-4" || this.target === "openapi-3.0") {
|
|
9901
|
-
json.maximum = exclusiveMaximum;
|
|
9902
|
-
json.exclusiveMaximum = true;
|
|
9903
|
-
} else {
|
|
9904
|
-
json.exclusiveMaximum = exclusiveMaximum;
|
|
9905
|
-
}
|
|
9906
|
-
}
|
|
9907
|
-
if (typeof maximum === "number") {
|
|
9908
|
-
json.maximum = maximum;
|
|
9909
|
-
if (typeof exclusiveMaximum === "number" && this.target !== "draft-4") {
|
|
9910
|
-
if (exclusiveMaximum <= maximum)
|
|
9911
|
-
delete json.maximum;
|
|
9912
|
-
else
|
|
9913
|
-
delete json.exclusiveMaximum;
|
|
9914
|
-
}
|
|
9915
|
-
}
|
|
9916
|
-
if (typeof multipleOf === "number")
|
|
9917
|
-
json.multipleOf = multipleOf;
|
|
9918
|
-
break;
|
|
9919
|
-
}
|
|
9920
|
-
case "boolean": {
|
|
9921
|
-
const json = _json;
|
|
9922
|
-
json.type = "boolean";
|
|
9923
|
-
break;
|
|
9924
|
-
}
|
|
9925
|
-
case "bigint": {
|
|
9926
|
-
if (this.unrepresentable === "throw") {
|
|
9927
|
-
throw new Error("BigInt cannot be represented in JSON Schema");
|
|
9928
|
-
}
|
|
9929
|
-
break;
|
|
9930
|
-
}
|
|
9931
|
-
case "symbol": {
|
|
9932
|
-
if (this.unrepresentable === "throw") {
|
|
9933
|
-
throw new Error("Symbols cannot be represented in JSON Schema");
|
|
9934
|
-
}
|
|
9935
|
-
break;
|
|
9936
|
-
}
|
|
9937
|
-
case "null": {
|
|
9938
|
-
if (this.target === "openapi-3.0") {
|
|
9939
|
-
_json.type = "string";
|
|
9940
|
-
_json.nullable = true;
|
|
9941
|
-
_json.enum = [null];
|
|
9942
|
-
} else
|
|
9943
|
-
_json.type = "null";
|
|
9944
|
-
break;
|
|
9945
|
-
}
|
|
9946
|
-
case "any": {
|
|
9947
|
-
break;
|
|
9948
|
-
}
|
|
9949
|
-
case "unknown": {
|
|
9950
|
-
break;
|
|
9951
|
-
}
|
|
9952
|
-
case "undefined": {
|
|
9953
|
-
if (this.unrepresentable === "throw") {
|
|
9954
|
-
throw new Error("Undefined cannot be represented in JSON Schema");
|
|
9955
|
-
}
|
|
9956
|
-
break;
|
|
9957
|
-
}
|
|
9958
|
-
case "void": {
|
|
9959
|
-
if (this.unrepresentable === "throw") {
|
|
9960
|
-
throw new Error("Void cannot be represented in JSON Schema");
|
|
9961
|
-
}
|
|
9962
|
-
break;
|
|
9963
|
-
}
|
|
9964
|
-
case "never": {
|
|
9965
|
-
_json.not = {};
|
|
9966
|
-
break;
|
|
9967
|
-
}
|
|
9968
|
-
case "date": {
|
|
9969
|
-
if (this.unrepresentable === "throw") {
|
|
9970
|
-
throw new Error("Date cannot be represented in JSON Schema");
|
|
9971
|
-
}
|
|
9972
|
-
break;
|
|
9973
|
-
}
|
|
9974
|
-
case "array": {
|
|
9975
|
-
const json = _json;
|
|
9976
|
-
const { minimum, maximum } = schema._zod.bag;
|
|
9977
|
-
if (typeof minimum === "number")
|
|
9978
|
-
json.minItems = minimum;
|
|
9979
|
-
if (typeof maximum === "number")
|
|
9980
|
-
json.maxItems = maximum;
|
|
9981
|
-
json.type = "array";
|
|
9982
|
-
json.items = this.process(def.element, { ...params, path: [...params.path, "items"] });
|
|
9983
|
-
break;
|
|
9984
|
-
}
|
|
9985
|
-
case "object": {
|
|
9986
|
-
const json = _json;
|
|
9987
|
-
json.type = "object";
|
|
9988
|
-
json.properties = {};
|
|
9989
|
-
const shape = def.shape;
|
|
9990
|
-
for (const key in shape) {
|
|
9991
|
-
json.properties[key] = this.process(shape[key], {
|
|
9992
|
-
...params,
|
|
9993
|
-
path: [...params.path, "properties", key]
|
|
9994
|
-
});
|
|
9995
|
-
}
|
|
9996
|
-
const allKeys = new Set(Object.keys(shape));
|
|
9997
|
-
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
9998
|
-
const v = def.shape[key]._zod;
|
|
9999
|
-
if (this.io === "input") {
|
|
10000
|
-
return v.optin === undefined;
|
|
10001
|
-
} else {
|
|
10002
|
-
return v.optout === undefined;
|
|
10003
|
-
}
|
|
10004
|
-
}));
|
|
10005
|
-
if (requiredKeys.size > 0) {
|
|
10006
|
-
json.required = Array.from(requiredKeys);
|
|
10007
|
-
}
|
|
10008
|
-
if (def.catchall?._zod.def.type === "never") {
|
|
10009
|
-
json.additionalProperties = false;
|
|
10010
|
-
} else if (!def.catchall) {
|
|
10011
|
-
if (this.io === "output")
|
|
10012
|
-
json.additionalProperties = false;
|
|
10013
|
-
} else if (def.catchall) {
|
|
10014
|
-
json.additionalProperties = this.process(def.catchall, {
|
|
10015
|
-
...params,
|
|
10016
|
-
path: [...params.path, "additionalProperties"]
|
|
10017
|
-
});
|
|
10018
|
-
}
|
|
10019
|
-
break;
|
|
10020
|
-
}
|
|
10021
|
-
case "union": {
|
|
10022
|
-
const json = _json;
|
|
10023
|
-
const isDiscriminated = def.discriminator !== undefined;
|
|
10024
|
-
const options = def.options.map((x, i) => this.process(x, {
|
|
10025
|
-
...params,
|
|
10026
|
-
path: [...params.path, isDiscriminated ? "oneOf" : "anyOf", i]
|
|
10027
|
-
}));
|
|
10028
|
-
if (isDiscriminated) {
|
|
10029
|
-
json.oneOf = options;
|
|
10030
|
-
} else {
|
|
10031
|
-
json.anyOf = options;
|
|
10032
|
-
}
|
|
10033
|
-
break;
|
|
10034
|
-
}
|
|
10035
|
-
case "intersection": {
|
|
10036
|
-
const json = _json;
|
|
10037
|
-
const a = this.process(def.left, {
|
|
10038
|
-
...params,
|
|
10039
|
-
path: [...params.path, "allOf", 0]
|
|
10040
|
-
});
|
|
10041
|
-
const b = this.process(def.right, {
|
|
10042
|
-
...params,
|
|
10043
|
-
path: [...params.path, "allOf", 1]
|
|
10044
|
-
});
|
|
10045
|
-
const isSimpleIntersection = (val) => ("allOf" in val) && Object.keys(val).length === 1;
|
|
10046
|
-
const allOf = [
|
|
10047
|
-
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
10048
|
-
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
10049
|
-
];
|
|
10050
|
-
json.allOf = allOf;
|
|
10051
|
-
break;
|
|
10052
|
-
}
|
|
10053
|
-
case "tuple": {
|
|
10054
|
-
const json = _json;
|
|
10055
|
-
json.type = "array";
|
|
10056
|
-
const prefixPath = this.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
10057
|
-
const restPath = this.target === "draft-2020-12" ? "items" : this.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
10058
|
-
const prefixItems = def.items.map((x, i) => this.process(x, {
|
|
10059
|
-
...params,
|
|
10060
|
-
path: [...params.path, prefixPath, i]
|
|
10061
|
-
}));
|
|
10062
|
-
const rest = def.rest ? this.process(def.rest, {
|
|
10063
|
-
...params,
|
|
10064
|
-
path: [...params.path, restPath, ...this.target === "openapi-3.0" ? [def.items.length] : []]
|
|
10065
|
-
}) : null;
|
|
10066
|
-
if (this.target === "draft-2020-12") {
|
|
10067
|
-
json.prefixItems = prefixItems;
|
|
10068
|
-
if (rest) {
|
|
10069
|
-
json.items = rest;
|
|
10070
|
-
}
|
|
10071
|
-
} else if (this.target === "openapi-3.0") {
|
|
10072
|
-
json.items = {
|
|
10073
|
-
anyOf: prefixItems
|
|
10074
|
-
};
|
|
10075
|
-
if (rest) {
|
|
10076
|
-
json.items.anyOf.push(rest);
|
|
10077
|
-
}
|
|
10078
|
-
json.minItems = prefixItems.length;
|
|
10079
|
-
if (!rest) {
|
|
10080
|
-
json.maxItems = prefixItems.length;
|
|
10081
|
-
}
|
|
10082
|
-
} else {
|
|
10083
|
-
json.items = prefixItems;
|
|
10084
|
-
if (rest) {
|
|
10085
|
-
json.additionalItems = rest;
|
|
10086
|
-
}
|
|
10087
|
-
}
|
|
10088
|
-
const { minimum, maximum } = schema._zod.bag;
|
|
10089
|
-
if (typeof minimum === "number")
|
|
10090
|
-
json.minItems = minimum;
|
|
10091
|
-
if (typeof maximum === "number")
|
|
10092
|
-
json.maxItems = maximum;
|
|
10093
|
-
break;
|
|
10094
|
-
}
|
|
10095
|
-
case "record": {
|
|
10096
|
-
const json = _json;
|
|
10097
|
-
json.type = "object";
|
|
10098
|
-
if (this.target === "draft-7" || this.target === "draft-2020-12") {
|
|
10099
|
-
json.propertyNames = this.process(def.keyType, {
|
|
10100
|
-
...params,
|
|
10101
|
-
path: [...params.path, "propertyNames"]
|
|
10102
|
-
});
|
|
10103
|
-
}
|
|
10104
|
-
json.additionalProperties = this.process(def.valueType, {
|
|
10105
|
-
...params,
|
|
10106
|
-
path: [...params.path, "additionalProperties"]
|
|
10107
|
-
});
|
|
10108
|
-
break;
|
|
10109
|
-
}
|
|
10110
|
-
case "map": {
|
|
10111
|
-
if (this.unrepresentable === "throw") {
|
|
10112
|
-
throw new Error("Map cannot be represented in JSON Schema");
|
|
10113
|
-
}
|
|
10114
|
-
break;
|
|
10115
|
-
}
|
|
10116
|
-
case "set": {
|
|
10117
|
-
if (this.unrepresentable === "throw") {
|
|
10118
|
-
throw new Error("Set cannot be represented in JSON Schema");
|
|
10119
|
-
}
|
|
10120
|
-
break;
|
|
10121
|
-
}
|
|
10122
|
-
case "enum": {
|
|
10123
|
-
const json = _json;
|
|
10124
|
-
const values = getEnumValues(def.entries);
|
|
10125
|
-
if (values.every((v) => typeof v === "number"))
|
|
10126
|
-
json.type = "number";
|
|
10127
|
-
if (values.every((v) => typeof v === "string"))
|
|
10128
|
-
json.type = "string";
|
|
10129
|
-
json.enum = values;
|
|
10130
|
-
break;
|
|
10131
|
-
}
|
|
10132
|
-
case "literal": {
|
|
10133
|
-
const json = _json;
|
|
10134
|
-
const vals = [];
|
|
10135
|
-
for (const val of def.values) {
|
|
10136
|
-
if (val === undefined) {
|
|
10137
|
-
if (this.unrepresentable === "throw") {
|
|
10138
|
-
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
10139
|
-
} else {}
|
|
10140
|
-
} else if (typeof val === "bigint") {
|
|
10141
|
-
if (this.unrepresentable === "throw") {
|
|
10142
|
-
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
10143
|
-
} else {
|
|
10144
|
-
vals.push(Number(val));
|
|
10145
|
-
}
|
|
10146
|
-
} else {
|
|
10147
|
-
vals.push(val);
|
|
10148
|
-
}
|
|
10149
|
-
}
|
|
10150
|
-
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
10151
|
-
const val = vals[0];
|
|
10152
|
-
json.type = val === null ? "null" : typeof val;
|
|
10153
|
-
if (this.target === "draft-4" || this.target === "openapi-3.0") {
|
|
10154
|
-
json.enum = [val];
|
|
10155
|
-
} else {
|
|
10156
|
-
json.const = val;
|
|
10157
|
-
}
|
|
10158
|
-
} else {
|
|
10159
|
-
if (vals.every((v) => typeof v === "number"))
|
|
10160
|
-
json.type = "number";
|
|
10161
|
-
if (vals.every((v) => typeof v === "string"))
|
|
10162
|
-
json.type = "string";
|
|
10163
|
-
if (vals.every((v) => typeof v === "boolean"))
|
|
10164
|
-
json.type = "string";
|
|
10165
|
-
if (vals.every((v) => v === null))
|
|
10166
|
-
json.type = "null";
|
|
10167
|
-
json.enum = vals;
|
|
10168
|
-
}
|
|
10169
|
-
break;
|
|
10170
|
-
}
|
|
10171
|
-
case "file": {
|
|
10172
|
-
const json = _json;
|
|
10173
|
-
const file = {
|
|
10174
|
-
type: "string",
|
|
10175
|
-
format: "binary",
|
|
10176
|
-
contentEncoding: "binary"
|
|
10177
|
-
};
|
|
10178
|
-
const { minimum, maximum, mime } = schema._zod.bag;
|
|
10179
|
-
if (minimum !== undefined)
|
|
10180
|
-
file.minLength = minimum;
|
|
10181
|
-
if (maximum !== undefined)
|
|
10182
|
-
file.maxLength = maximum;
|
|
10183
|
-
if (mime) {
|
|
10184
|
-
if (mime.length === 1) {
|
|
10185
|
-
file.contentMediaType = mime[0];
|
|
10186
|
-
Object.assign(json, file);
|
|
10187
|
-
} else {
|
|
10188
|
-
json.anyOf = mime.map((m) => {
|
|
10189
|
-
const mFile = { ...file, contentMediaType: m };
|
|
10190
|
-
return mFile;
|
|
10191
|
-
});
|
|
10192
|
-
}
|
|
10193
|
-
} else {
|
|
10194
|
-
Object.assign(json, file);
|
|
10195
|
-
}
|
|
10196
|
-
break;
|
|
10197
|
-
}
|
|
10198
|
-
case "transform": {
|
|
10199
|
-
if (this.unrepresentable === "throw") {
|
|
10200
|
-
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
10201
|
-
}
|
|
10202
|
-
break;
|
|
10203
|
-
}
|
|
10204
|
-
case "nullable": {
|
|
10205
|
-
const inner = this.process(def.innerType, params);
|
|
10206
|
-
if (this.target === "openapi-3.0") {
|
|
10207
|
-
result.ref = def.innerType;
|
|
10208
|
-
_json.nullable = true;
|
|
10209
|
-
} else {
|
|
10210
|
-
_json.anyOf = [inner, { type: "null" }];
|
|
10211
|
-
}
|
|
10212
|
-
break;
|
|
10213
|
-
}
|
|
10214
|
-
case "nonoptional": {
|
|
10215
|
-
this.process(def.innerType, params);
|
|
10216
|
-
result.ref = def.innerType;
|
|
10217
|
-
break;
|
|
10218
|
-
}
|
|
10219
|
-
case "success": {
|
|
10220
|
-
const json = _json;
|
|
10221
|
-
json.type = "boolean";
|
|
10222
|
-
break;
|
|
10223
|
-
}
|
|
10224
|
-
case "default": {
|
|
10225
|
-
this.process(def.innerType, params);
|
|
10226
|
-
result.ref = def.innerType;
|
|
10227
|
-
_json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
10228
|
-
break;
|
|
10229
|
-
}
|
|
10230
|
-
case "prefault": {
|
|
10231
|
-
this.process(def.innerType, params);
|
|
10232
|
-
result.ref = def.innerType;
|
|
10233
|
-
if (this.io === "input")
|
|
10234
|
-
_json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
10235
|
-
break;
|
|
10236
|
-
}
|
|
10237
|
-
case "catch": {
|
|
10238
|
-
this.process(def.innerType, params);
|
|
10239
|
-
result.ref = def.innerType;
|
|
10240
|
-
let catchValue;
|
|
10241
|
-
try {
|
|
10242
|
-
catchValue = def.catchValue(undefined);
|
|
10243
|
-
} catch {
|
|
10244
|
-
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
10245
|
-
}
|
|
10246
|
-
_json.default = catchValue;
|
|
10247
|
-
break;
|
|
10248
|
-
}
|
|
10249
|
-
case "nan": {
|
|
10250
|
-
if (this.unrepresentable === "throw") {
|
|
10251
|
-
throw new Error("NaN cannot be represented in JSON Schema");
|
|
10252
|
-
}
|
|
10253
|
-
break;
|
|
10254
|
-
}
|
|
10255
|
-
case "template_literal": {
|
|
10256
|
-
const json = _json;
|
|
10257
|
-
const pattern = schema._zod.pattern;
|
|
10258
|
-
if (!pattern)
|
|
10259
|
-
throw new Error("Pattern not found in template literal");
|
|
10260
|
-
json.type = "string";
|
|
10261
|
-
json.pattern = pattern.source;
|
|
10262
|
-
break;
|
|
10263
|
-
}
|
|
10264
|
-
case "pipe": {
|
|
10265
|
-
const innerType = this.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
10266
|
-
this.process(innerType, params);
|
|
10267
|
-
result.ref = innerType;
|
|
10268
|
-
break;
|
|
10269
|
-
}
|
|
10270
|
-
case "readonly": {
|
|
10271
|
-
this.process(def.innerType, params);
|
|
10272
|
-
result.ref = def.innerType;
|
|
10273
|
-
_json.readOnly = true;
|
|
10274
|
-
break;
|
|
10275
|
-
}
|
|
10276
|
-
case "promise": {
|
|
10277
|
-
this.process(def.innerType, params);
|
|
10278
|
-
result.ref = def.innerType;
|
|
10279
|
-
break;
|
|
10280
|
-
}
|
|
10281
|
-
case "optional": {
|
|
10282
|
-
this.process(def.innerType, params);
|
|
10283
|
-
result.ref = def.innerType;
|
|
10284
|
-
break;
|
|
10285
|
-
}
|
|
10286
|
-
case "lazy": {
|
|
10287
|
-
const innerType = schema._zod.innerType;
|
|
10288
|
-
this.process(innerType, params);
|
|
10289
|
-
result.ref = innerType;
|
|
10290
|
-
break;
|
|
10291
|
-
}
|
|
10292
|
-
case "custom": {
|
|
10293
|
-
if (this.unrepresentable === "throw") {
|
|
10294
|
-
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
10295
|
-
}
|
|
10296
|
-
break;
|
|
10297
|
-
}
|
|
10298
|
-
case "function": {
|
|
10299
|
-
if (this.unrepresentable === "throw") {
|
|
10300
|
-
throw new Error("Function types cannot be represented in JSON Schema");
|
|
10301
|
-
}
|
|
10302
|
-
break;
|
|
10303
|
-
}
|
|
10304
|
-
default: {}
|
|
10305
|
-
}
|
|
10306
|
-
}
|
|
9852
|
+
const _json = result.schema;
|
|
9853
|
+
const processor = ctx.processors[def.type];
|
|
9854
|
+
if (!processor) {
|
|
9855
|
+
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
9856
|
+
}
|
|
9857
|
+
processor(schema, ctx, _json, params);
|
|
9858
|
+
}
|
|
9859
|
+
}
|
|
9860
|
+
const meta = ctx.metadataRegistry.get(schema);
|
|
9861
|
+
if (meta)
|
|
9862
|
+
Object.assign(result.schema, meta);
|
|
9863
|
+
if (ctx.io === "input" && isTransforming(schema)) {
|
|
9864
|
+
delete result.schema.examples;
|
|
9865
|
+
delete result.schema.default;
|
|
9866
|
+
}
|
|
9867
|
+
if (ctx.io === "input" && result.schema._prefault)
|
|
9868
|
+
(_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
|
|
9869
|
+
delete result.schema._prefault;
|
|
9870
|
+
const _result = ctx.seen.get(schema);
|
|
9871
|
+
return _result.schema;
|
|
9872
|
+
}
|
|
9873
|
+
function extractDefs(ctx, schema) {
|
|
9874
|
+
const root = ctx.seen.get(schema);
|
|
9875
|
+
if (!root)
|
|
9876
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
9877
|
+
const makeURI = (entry) => {
|
|
9878
|
+
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
9879
|
+
if (ctx.external) {
|
|
9880
|
+
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
9881
|
+
const uriGenerator = ctx.external.uri ?? ((id2) => id2);
|
|
9882
|
+
if (externalId) {
|
|
9883
|
+
return { ref: uriGenerator(externalId) };
|
|
9884
|
+
}
|
|
9885
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
9886
|
+
entry[1].defId = id;
|
|
9887
|
+
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
9888
|
+
}
|
|
9889
|
+
if (entry[1] === root) {
|
|
9890
|
+
return { ref: "#" };
|
|
9891
|
+
}
|
|
9892
|
+
const uriPrefix = `#`;
|
|
9893
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
9894
|
+
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
9895
|
+
return { defId, ref: defUriPrefix + defId };
|
|
9896
|
+
};
|
|
9897
|
+
const extractToDef = (entry) => {
|
|
9898
|
+
if (entry[1].schema.$ref) {
|
|
9899
|
+
return;
|
|
10307
9900
|
}
|
|
10308
|
-
const
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
if (
|
|
10312
|
-
|
|
10313
|
-
|
|
9901
|
+
const seen = entry[1];
|
|
9902
|
+
const { ref, defId } = makeURI(entry);
|
|
9903
|
+
seen.def = { ...seen.schema };
|
|
9904
|
+
if (defId)
|
|
9905
|
+
seen.defId = defId;
|
|
9906
|
+
const schema2 = seen.schema;
|
|
9907
|
+
for (const key in schema2) {
|
|
9908
|
+
delete schema2[key];
|
|
10314
9909
|
}
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
const
|
|
10319
|
-
return _result.schema;
|
|
10320
|
-
}
|
|
10321
|
-
emit(schema, _params) {
|
|
10322
|
-
const params = {
|
|
10323
|
-
cycles: _params?.cycles ?? "ref",
|
|
10324
|
-
reused: _params?.reused ?? "inline",
|
|
10325
|
-
external: _params?.external ?? undefined
|
|
10326
|
-
};
|
|
10327
|
-
const root = this.seen.get(schema);
|
|
10328
|
-
if (!root)
|
|
10329
|
-
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
10330
|
-
const makeURI = (entry) => {
|
|
10331
|
-
const defsSegment = this.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
10332
|
-
if (params.external) {
|
|
10333
|
-
const externalId = params.external.registry.get(entry[0])?.id;
|
|
10334
|
-
const uriGenerator = params.external.uri ?? ((id2) => id2);
|
|
10335
|
-
if (externalId) {
|
|
10336
|
-
return { ref: uriGenerator(externalId) };
|
|
10337
|
-
}
|
|
10338
|
-
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${this.counter++}`;
|
|
10339
|
-
entry[1].defId = id;
|
|
10340
|
-
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
10341
|
-
}
|
|
10342
|
-
if (entry[1] === root) {
|
|
10343
|
-
return { ref: "#" };
|
|
10344
|
-
}
|
|
10345
|
-
const uriPrefix = `#`;
|
|
10346
|
-
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
10347
|
-
const defId = entry[1].schema.id ?? `__schema${this.counter++}`;
|
|
10348
|
-
return { defId, ref: defUriPrefix + defId };
|
|
10349
|
-
};
|
|
10350
|
-
const extractToDef = (entry) => {
|
|
10351
|
-
if (entry[1].schema.$ref) {
|
|
10352
|
-
return;
|
|
10353
|
-
}
|
|
9910
|
+
schema2.$ref = ref;
|
|
9911
|
+
};
|
|
9912
|
+
if (ctx.cycles === "throw") {
|
|
9913
|
+
for (const entry of ctx.seen.entries()) {
|
|
10354
9914
|
const seen = entry[1];
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
if (defId)
|
|
10358
|
-
seen.defId = defId;
|
|
10359
|
-
const schema2 = seen.schema;
|
|
10360
|
-
for (const key in schema2) {
|
|
10361
|
-
delete schema2[key];
|
|
10362
|
-
}
|
|
10363
|
-
schema2.$ref = ref;
|
|
10364
|
-
};
|
|
10365
|
-
if (params.cycles === "throw") {
|
|
10366
|
-
for (const entry of this.seen.entries()) {
|
|
10367
|
-
const seen = entry[1];
|
|
10368
|
-
if (seen.cycle) {
|
|
10369
|
-
throw new Error("Cycle detected: " + `#/${seen.cycle?.join("/")}/<root>` + '\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.');
|
|
10370
|
-
}
|
|
9915
|
+
if (seen.cycle) {
|
|
9916
|
+
throw new Error("Cycle detected: " + `#/${seen.cycle?.join("/")}/<root>` + '\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.');
|
|
10371
9917
|
}
|
|
10372
9918
|
}
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
continue;
|
|
10384
|
-
}
|
|
10385
|
-
}
|
|
10386
|
-
const id = this.metadataRegistry.get(entry[0])?.id;
|
|
10387
|
-
if (id) {
|
|
10388
|
-
extractToDef(entry);
|
|
10389
|
-
continue;
|
|
10390
|
-
}
|
|
10391
|
-
if (seen.cycle) {
|
|
9919
|
+
}
|
|
9920
|
+
for (const entry of ctx.seen.entries()) {
|
|
9921
|
+
const seen = entry[1];
|
|
9922
|
+
if (schema === entry[0]) {
|
|
9923
|
+
extractToDef(entry);
|
|
9924
|
+
continue;
|
|
9925
|
+
}
|
|
9926
|
+
if (ctx.external) {
|
|
9927
|
+
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
9928
|
+
if (schema !== entry[0] && ext) {
|
|
10392
9929
|
extractToDef(entry);
|
|
10393
9930
|
continue;
|
|
10394
9931
|
}
|
|
10395
|
-
if (seen.count > 1) {
|
|
10396
|
-
if (params.reused === "ref") {
|
|
10397
|
-
extractToDef(entry);
|
|
10398
|
-
continue;
|
|
10399
|
-
}
|
|
10400
|
-
}
|
|
10401
9932
|
}
|
|
10402
|
-
const
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
if (seen.ref === null) {
|
|
10407
|
-
return;
|
|
10408
|
-
}
|
|
10409
|
-
const ref = seen.ref;
|
|
10410
|
-
seen.ref = null;
|
|
10411
|
-
if (ref) {
|
|
10412
|
-
flattenRef(ref, params2);
|
|
10413
|
-
const refSchema = this.seen.get(ref).schema;
|
|
10414
|
-
if (refSchema.$ref && (params2.target === "draft-7" || params2.target === "draft-4" || params2.target === "openapi-3.0")) {
|
|
10415
|
-
schema2.allOf = schema2.allOf ?? [];
|
|
10416
|
-
schema2.allOf.push(refSchema);
|
|
10417
|
-
} else {
|
|
10418
|
-
Object.assign(schema2, refSchema);
|
|
10419
|
-
Object.assign(schema2, _cached);
|
|
10420
|
-
}
|
|
10421
|
-
}
|
|
10422
|
-
if (!seen.isParent)
|
|
10423
|
-
this.override({
|
|
10424
|
-
zodSchema,
|
|
10425
|
-
jsonSchema: schema2,
|
|
10426
|
-
path: seen.path ?? []
|
|
10427
|
-
});
|
|
10428
|
-
};
|
|
10429
|
-
for (const entry of [...this.seen.entries()].reverse()) {
|
|
10430
|
-
flattenRef(entry[0], { target: this.target });
|
|
10431
|
-
}
|
|
10432
|
-
const result = {};
|
|
10433
|
-
if (this.target === "draft-2020-12") {
|
|
10434
|
-
result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
10435
|
-
} else if (this.target === "draft-7") {
|
|
10436
|
-
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
10437
|
-
} else if (this.target === "draft-4") {
|
|
10438
|
-
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
10439
|
-
} else if (this.target === "openapi-3.0") {} else {
|
|
10440
|
-
console.warn(`Invalid target: ${this.target}`);
|
|
10441
|
-
}
|
|
10442
|
-
if (params.external?.uri) {
|
|
10443
|
-
const id = params.external.registry.get(schema)?.id;
|
|
10444
|
-
if (!id)
|
|
10445
|
-
throw new Error("Schema is missing an `id` property");
|
|
10446
|
-
result.$id = params.external.uri(id);
|
|
10447
|
-
}
|
|
10448
|
-
Object.assign(result, root.def);
|
|
10449
|
-
const defs = params.external?.defs ?? {};
|
|
10450
|
-
for (const entry of this.seen.entries()) {
|
|
10451
|
-
const seen = entry[1];
|
|
10452
|
-
if (seen.def && seen.defId) {
|
|
10453
|
-
defs[seen.defId] = seen.def;
|
|
10454
|
-
}
|
|
9933
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
9934
|
+
if (id) {
|
|
9935
|
+
extractToDef(entry);
|
|
9936
|
+
continue;
|
|
10455
9937
|
}
|
|
10456
|
-
if (
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
result.$defs = defs;
|
|
10460
|
-
} else {
|
|
10461
|
-
result.definitions = defs;
|
|
10462
|
-
}
|
|
10463
|
-
}
|
|
9938
|
+
if (seen.cycle) {
|
|
9939
|
+
extractToDef(entry);
|
|
9940
|
+
continue;
|
|
10464
9941
|
}
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
9942
|
+
if (seen.count > 1) {
|
|
9943
|
+
if (ctx.reused === "ref") {
|
|
9944
|
+
extractToDef(entry);
|
|
9945
|
+
continue;
|
|
9946
|
+
}
|
|
10469
9947
|
}
|
|
10470
9948
|
}
|
|
10471
9949
|
}
|
|
10472
|
-
function
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
9950
|
+
function finalize(ctx, schema) {
|
|
9951
|
+
const root = ctx.seen.get(schema);
|
|
9952
|
+
if (!root)
|
|
9953
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
9954
|
+
const flattenRef = (zodSchema) => {
|
|
9955
|
+
const seen = ctx.seen.get(zodSchema);
|
|
9956
|
+
const schema2 = seen.def ?? seen.schema;
|
|
9957
|
+
const _cached = { ...schema2 };
|
|
9958
|
+
if (seen.ref === null) {
|
|
9959
|
+
return;
|
|
10479
9960
|
}
|
|
10480
|
-
const
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
}
|
|
9961
|
+
const ref = seen.ref;
|
|
9962
|
+
seen.ref = null;
|
|
9963
|
+
if (ref) {
|
|
9964
|
+
flattenRef(ref);
|
|
9965
|
+
const refSchema = ctx.seen.get(ref).schema;
|
|
9966
|
+
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
9967
|
+
schema2.allOf = schema2.allOf ?? [];
|
|
9968
|
+
schema2.allOf.push(refSchema);
|
|
9969
|
+
} else {
|
|
9970
|
+
Object.assign(schema2, refSchema);
|
|
9971
|
+
Object.assign(schema2, _cached);
|
|
9972
|
+
}
|
|
10492
9973
|
}
|
|
9974
|
+
if (!seen.isParent)
|
|
9975
|
+
ctx.override({
|
|
9976
|
+
zodSchema,
|
|
9977
|
+
jsonSchema: schema2,
|
|
9978
|
+
path: seen.path ?? []
|
|
9979
|
+
});
|
|
9980
|
+
};
|
|
9981
|
+
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
9982
|
+
flattenRef(entry[0]);
|
|
9983
|
+
}
|
|
9984
|
+
const result = {};
|
|
9985
|
+
if (ctx.target === "draft-2020-12") {
|
|
9986
|
+
result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
9987
|
+
} else if (ctx.target === "draft-07") {
|
|
9988
|
+
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
9989
|
+
} else if (ctx.target === "draft-04") {
|
|
9990
|
+
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
9991
|
+
} else if (ctx.target === "openapi-3.0") {} else {}
|
|
9992
|
+
if (ctx.external?.uri) {
|
|
9993
|
+
const id = ctx.external.registry.get(schema)?.id;
|
|
9994
|
+
if (!id)
|
|
9995
|
+
throw new Error("Schema is missing an `id` property");
|
|
9996
|
+
result.$id = ctx.external.uri(id);
|
|
9997
|
+
}
|
|
9998
|
+
Object.assign(result, root.def ?? root.schema);
|
|
9999
|
+
const defs = ctx.external?.defs ?? {};
|
|
10000
|
+
for (const entry of ctx.seen.entries()) {
|
|
10001
|
+
const seen = entry[1];
|
|
10002
|
+
if (seen.def && seen.defId) {
|
|
10003
|
+
defs[seen.defId] = seen.def;
|
|
10004
|
+
}
|
|
10005
|
+
}
|
|
10006
|
+
if (ctx.external) {} else {
|
|
10493
10007
|
if (Object.keys(defs).length > 0) {
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10008
|
+
if (ctx.target === "draft-2020-12") {
|
|
10009
|
+
result.$defs = defs;
|
|
10010
|
+
} else {
|
|
10011
|
+
result.definitions = defs;
|
|
10012
|
+
}
|
|
10498
10013
|
}
|
|
10499
|
-
return { schemas };
|
|
10500
10014
|
}
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10015
|
+
try {
|
|
10016
|
+
const finalized = JSON.parse(JSON.stringify(result));
|
|
10017
|
+
Object.defineProperty(finalized, "~standard", {
|
|
10018
|
+
value: {
|
|
10019
|
+
...schema["~standard"],
|
|
10020
|
+
jsonSchema: {
|
|
10021
|
+
input: createStandardJSONSchemaMethod(schema, "input"),
|
|
10022
|
+
output: createStandardJSONSchemaMethod(schema, "output")
|
|
10023
|
+
}
|
|
10024
|
+
},
|
|
10025
|
+
enumerable: false,
|
|
10026
|
+
writable: false
|
|
10027
|
+
});
|
|
10028
|
+
return finalized;
|
|
10029
|
+
} catch (_err) {
|
|
10030
|
+
throw new Error("Error converting schema to JSON.");
|
|
10031
|
+
}
|
|
10504
10032
|
}
|
|
10505
10033
|
function isTransforming(_schema, _ctx) {
|
|
10506
10034
|
const ctx = _ctx ?? { seen: new Set };
|
|
@@ -10553,7 +10081,543 @@ function isTransforming(_schema, _ctx) {
|
|
|
10553
10081
|
}
|
|
10554
10082
|
return false;
|
|
10555
10083
|
}
|
|
10556
|
-
|
|
10084
|
+
var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
10085
|
+
const ctx = initializeContext({ ...params, processors });
|
|
10086
|
+
process2(schema, ctx);
|
|
10087
|
+
extractDefs(ctx, schema);
|
|
10088
|
+
return finalize(ctx, schema);
|
|
10089
|
+
};
|
|
10090
|
+
var createStandardJSONSchemaMethod = (schema, io) => (params) => {
|
|
10091
|
+
const { libraryOptions, target } = params ?? {};
|
|
10092
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors: {} });
|
|
10093
|
+
process2(schema, ctx);
|
|
10094
|
+
extractDefs(ctx, schema);
|
|
10095
|
+
return finalize(ctx, schema);
|
|
10096
|
+
};
|
|
10097
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/core/json-schema-processors.js
|
|
10098
|
+
var formatMap = {
|
|
10099
|
+
guid: "uuid",
|
|
10100
|
+
url: "uri",
|
|
10101
|
+
datetime: "date-time",
|
|
10102
|
+
json_string: "json-string",
|
|
10103
|
+
regex: ""
|
|
10104
|
+
};
|
|
10105
|
+
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
10106
|
+
const json = _json;
|
|
10107
|
+
json.type = "string";
|
|
10108
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
10109
|
+
if (typeof minimum === "number")
|
|
10110
|
+
json.minLength = minimum;
|
|
10111
|
+
if (typeof maximum === "number")
|
|
10112
|
+
json.maxLength = maximum;
|
|
10113
|
+
if (format) {
|
|
10114
|
+
json.format = formatMap[format] ?? format;
|
|
10115
|
+
if (json.format === "")
|
|
10116
|
+
delete json.format;
|
|
10117
|
+
}
|
|
10118
|
+
if (contentEncoding)
|
|
10119
|
+
json.contentEncoding = contentEncoding;
|
|
10120
|
+
if (patterns && patterns.size > 0) {
|
|
10121
|
+
const regexes = [...patterns];
|
|
10122
|
+
if (regexes.length === 1)
|
|
10123
|
+
json.pattern = regexes[0].source;
|
|
10124
|
+
else if (regexes.length > 1) {
|
|
10125
|
+
json.allOf = [
|
|
10126
|
+
...regexes.map((regex) => ({
|
|
10127
|
+
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
10128
|
+
pattern: regex.source
|
|
10129
|
+
}))
|
|
10130
|
+
];
|
|
10131
|
+
}
|
|
10132
|
+
}
|
|
10133
|
+
};
|
|
10134
|
+
var numberProcessor = (schema, ctx, _json, _params) => {
|
|
10135
|
+
const json = _json;
|
|
10136
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
10137
|
+
if (typeof format === "string" && format.includes("int"))
|
|
10138
|
+
json.type = "integer";
|
|
10139
|
+
else
|
|
10140
|
+
json.type = "number";
|
|
10141
|
+
if (typeof exclusiveMinimum === "number") {
|
|
10142
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
10143
|
+
json.minimum = exclusiveMinimum;
|
|
10144
|
+
json.exclusiveMinimum = true;
|
|
10145
|
+
} else {
|
|
10146
|
+
json.exclusiveMinimum = exclusiveMinimum;
|
|
10147
|
+
}
|
|
10148
|
+
}
|
|
10149
|
+
if (typeof minimum === "number") {
|
|
10150
|
+
json.minimum = minimum;
|
|
10151
|
+
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
|
|
10152
|
+
if (exclusiveMinimum >= minimum)
|
|
10153
|
+
delete json.minimum;
|
|
10154
|
+
else
|
|
10155
|
+
delete json.exclusiveMinimum;
|
|
10156
|
+
}
|
|
10157
|
+
}
|
|
10158
|
+
if (typeof exclusiveMaximum === "number") {
|
|
10159
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
10160
|
+
json.maximum = exclusiveMaximum;
|
|
10161
|
+
json.exclusiveMaximum = true;
|
|
10162
|
+
} else {
|
|
10163
|
+
json.exclusiveMaximum = exclusiveMaximum;
|
|
10164
|
+
}
|
|
10165
|
+
}
|
|
10166
|
+
if (typeof maximum === "number") {
|
|
10167
|
+
json.maximum = maximum;
|
|
10168
|
+
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
|
|
10169
|
+
if (exclusiveMaximum <= maximum)
|
|
10170
|
+
delete json.maximum;
|
|
10171
|
+
else
|
|
10172
|
+
delete json.exclusiveMaximum;
|
|
10173
|
+
}
|
|
10174
|
+
}
|
|
10175
|
+
if (typeof multipleOf === "number")
|
|
10176
|
+
json.multipleOf = multipleOf;
|
|
10177
|
+
};
|
|
10178
|
+
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
10179
|
+
json.type = "boolean";
|
|
10180
|
+
};
|
|
10181
|
+
var bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
10182
|
+
if (ctx.unrepresentable === "throw") {
|
|
10183
|
+
throw new Error("BigInt cannot be represented in JSON Schema");
|
|
10184
|
+
}
|
|
10185
|
+
};
|
|
10186
|
+
var symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
10187
|
+
if (ctx.unrepresentable === "throw") {
|
|
10188
|
+
throw new Error("Symbols cannot be represented in JSON Schema");
|
|
10189
|
+
}
|
|
10190
|
+
};
|
|
10191
|
+
var nullProcessor = (_schema, ctx, json, _params) => {
|
|
10192
|
+
if (ctx.target === "openapi-3.0") {
|
|
10193
|
+
json.type = "string";
|
|
10194
|
+
json.nullable = true;
|
|
10195
|
+
json.enum = [null];
|
|
10196
|
+
} else {
|
|
10197
|
+
json.type = "null";
|
|
10198
|
+
}
|
|
10199
|
+
};
|
|
10200
|
+
var undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
10201
|
+
if (ctx.unrepresentable === "throw") {
|
|
10202
|
+
throw new Error("Undefined cannot be represented in JSON Schema");
|
|
10203
|
+
}
|
|
10204
|
+
};
|
|
10205
|
+
var voidProcessor = (_schema, ctx, _json, _params) => {
|
|
10206
|
+
if (ctx.unrepresentable === "throw") {
|
|
10207
|
+
throw new Error("Void cannot be represented in JSON Schema");
|
|
10208
|
+
}
|
|
10209
|
+
};
|
|
10210
|
+
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
10211
|
+
json.not = {};
|
|
10212
|
+
};
|
|
10213
|
+
var anyProcessor = (_schema, _ctx, _json, _params) => {};
|
|
10214
|
+
var unknownProcessor = (_schema, _ctx, _json, _params) => {};
|
|
10215
|
+
var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
10216
|
+
if (ctx.unrepresentable === "throw") {
|
|
10217
|
+
throw new Error("Date cannot be represented in JSON Schema");
|
|
10218
|
+
}
|
|
10219
|
+
};
|
|
10220
|
+
var enumProcessor = (schema, _ctx, json, _params) => {
|
|
10221
|
+
const def = schema._zod.def;
|
|
10222
|
+
const values = getEnumValues(def.entries);
|
|
10223
|
+
if (values.every((v) => typeof v === "number"))
|
|
10224
|
+
json.type = "number";
|
|
10225
|
+
if (values.every((v) => typeof v === "string"))
|
|
10226
|
+
json.type = "string";
|
|
10227
|
+
json.enum = values;
|
|
10228
|
+
};
|
|
10229
|
+
var literalProcessor = (schema, ctx, json, _params) => {
|
|
10230
|
+
const def = schema._zod.def;
|
|
10231
|
+
const vals = [];
|
|
10232
|
+
for (const val of def.values) {
|
|
10233
|
+
if (val === undefined) {
|
|
10234
|
+
if (ctx.unrepresentable === "throw") {
|
|
10235
|
+
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
10236
|
+
} else {}
|
|
10237
|
+
} else if (typeof val === "bigint") {
|
|
10238
|
+
if (ctx.unrepresentable === "throw") {
|
|
10239
|
+
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
10240
|
+
} else {
|
|
10241
|
+
vals.push(Number(val));
|
|
10242
|
+
}
|
|
10243
|
+
} else {
|
|
10244
|
+
vals.push(val);
|
|
10245
|
+
}
|
|
10246
|
+
}
|
|
10247
|
+
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
10248
|
+
const val = vals[0];
|
|
10249
|
+
json.type = val === null ? "null" : typeof val;
|
|
10250
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
10251
|
+
json.enum = [val];
|
|
10252
|
+
} else {
|
|
10253
|
+
json.const = val;
|
|
10254
|
+
}
|
|
10255
|
+
} else {
|
|
10256
|
+
if (vals.every((v) => typeof v === "number"))
|
|
10257
|
+
json.type = "number";
|
|
10258
|
+
if (vals.every((v) => typeof v === "string"))
|
|
10259
|
+
json.type = "string";
|
|
10260
|
+
if (vals.every((v) => typeof v === "boolean"))
|
|
10261
|
+
json.type = "boolean";
|
|
10262
|
+
if (vals.every((v) => v === null))
|
|
10263
|
+
json.type = "null";
|
|
10264
|
+
json.enum = vals;
|
|
10265
|
+
}
|
|
10266
|
+
};
|
|
10267
|
+
var nanProcessor = (_schema, ctx, _json, _params) => {
|
|
10268
|
+
if (ctx.unrepresentable === "throw") {
|
|
10269
|
+
throw new Error("NaN cannot be represented in JSON Schema");
|
|
10270
|
+
}
|
|
10271
|
+
};
|
|
10272
|
+
var templateLiteralProcessor = (schema, _ctx, json, _params) => {
|
|
10273
|
+
const _json = json;
|
|
10274
|
+
const pattern = schema._zod.pattern;
|
|
10275
|
+
if (!pattern)
|
|
10276
|
+
throw new Error("Pattern not found in template literal");
|
|
10277
|
+
_json.type = "string";
|
|
10278
|
+
_json.pattern = pattern.source;
|
|
10279
|
+
};
|
|
10280
|
+
var fileProcessor = (schema, _ctx, json, _params) => {
|
|
10281
|
+
const _json = json;
|
|
10282
|
+
const file = {
|
|
10283
|
+
type: "string",
|
|
10284
|
+
format: "binary",
|
|
10285
|
+
contentEncoding: "binary"
|
|
10286
|
+
};
|
|
10287
|
+
const { minimum, maximum, mime } = schema._zod.bag;
|
|
10288
|
+
if (minimum !== undefined)
|
|
10289
|
+
file.minLength = minimum;
|
|
10290
|
+
if (maximum !== undefined)
|
|
10291
|
+
file.maxLength = maximum;
|
|
10292
|
+
if (mime) {
|
|
10293
|
+
if (mime.length === 1) {
|
|
10294
|
+
file.contentMediaType = mime[0];
|
|
10295
|
+
Object.assign(_json, file);
|
|
10296
|
+
} else {
|
|
10297
|
+
_json.anyOf = mime.map((m) => {
|
|
10298
|
+
const mFile = { ...file, contentMediaType: m };
|
|
10299
|
+
return mFile;
|
|
10300
|
+
});
|
|
10301
|
+
}
|
|
10302
|
+
} else {
|
|
10303
|
+
Object.assign(_json, file);
|
|
10304
|
+
}
|
|
10305
|
+
};
|
|
10306
|
+
var successProcessor = (_schema, _ctx, json, _params) => {
|
|
10307
|
+
json.type = "boolean";
|
|
10308
|
+
};
|
|
10309
|
+
var customProcessor = (_schema, ctx, _json, _params) => {
|
|
10310
|
+
if (ctx.unrepresentable === "throw") {
|
|
10311
|
+
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
10312
|
+
}
|
|
10313
|
+
};
|
|
10314
|
+
var functionProcessor = (_schema, ctx, _json, _params) => {
|
|
10315
|
+
if (ctx.unrepresentable === "throw") {
|
|
10316
|
+
throw new Error("Function types cannot be represented in JSON Schema");
|
|
10317
|
+
}
|
|
10318
|
+
};
|
|
10319
|
+
var transformProcessor = (_schema, ctx, _json, _params) => {
|
|
10320
|
+
if (ctx.unrepresentable === "throw") {
|
|
10321
|
+
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
10322
|
+
}
|
|
10323
|
+
};
|
|
10324
|
+
var mapProcessor = (_schema, ctx, _json, _params) => {
|
|
10325
|
+
if (ctx.unrepresentable === "throw") {
|
|
10326
|
+
throw new Error("Map cannot be represented in JSON Schema");
|
|
10327
|
+
}
|
|
10328
|
+
};
|
|
10329
|
+
var setProcessor = (_schema, ctx, _json, _params) => {
|
|
10330
|
+
if (ctx.unrepresentable === "throw") {
|
|
10331
|
+
throw new Error("Set cannot be represented in JSON Schema");
|
|
10332
|
+
}
|
|
10333
|
+
};
|
|
10334
|
+
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
10335
|
+
const json = _json;
|
|
10336
|
+
const def = schema._zod.def;
|
|
10337
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
10338
|
+
if (typeof minimum === "number")
|
|
10339
|
+
json.minItems = minimum;
|
|
10340
|
+
if (typeof maximum === "number")
|
|
10341
|
+
json.maxItems = maximum;
|
|
10342
|
+
json.type = "array";
|
|
10343
|
+
json.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
|
|
10344
|
+
};
|
|
10345
|
+
var objectProcessor = (schema, ctx, _json, params) => {
|
|
10346
|
+
const json = _json;
|
|
10347
|
+
const def = schema._zod.def;
|
|
10348
|
+
json.type = "object";
|
|
10349
|
+
json.properties = {};
|
|
10350
|
+
const shape = def.shape;
|
|
10351
|
+
for (const key in shape) {
|
|
10352
|
+
json.properties[key] = process2(shape[key], ctx, {
|
|
10353
|
+
...params,
|
|
10354
|
+
path: [...params.path, "properties", key]
|
|
10355
|
+
});
|
|
10356
|
+
}
|
|
10357
|
+
const allKeys = new Set(Object.keys(shape));
|
|
10358
|
+
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
10359
|
+
const v = def.shape[key]._zod;
|
|
10360
|
+
if (ctx.io === "input") {
|
|
10361
|
+
return v.optin === undefined;
|
|
10362
|
+
} else {
|
|
10363
|
+
return v.optout === undefined;
|
|
10364
|
+
}
|
|
10365
|
+
}));
|
|
10366
|
+
if (requiredKeys.size > 0) {
|
|
10367
|
+
json.required = Array.from(requiredKeys);
|
|
10368
|
+
}
|
|
10369
|
+
if (def.catchall?._zod.def.type === "never") {
|
|
10370
|
+
json.additionalProperties = false;
|
|
10371
|
+
} else if (!def.catchall) {
|
|
10372
|
+
if (ctx.io === "output")
|
|
10373
|
+
json.additionalProperties = false;
|
|
10374
|
+
} else if (def.catchall) {
|
|
10375
|
+
json.additionalProperties = process2(def.catchall, ctx, {
|
|
10376
|
+
...params,
|
|
10377
|
+
path: [...params.path, "additionalProperties"]
|
|
10378
|
+
});
|
|
10379
|
+
}
|
|
10380
|
+
};
|
|
10381
|
+
var unionProcessor = (schema, ctx, json, params) => {
|
|
10382
|
+
const def = schema._zod.def;
|
|
10383
|
+
const isExclusive = def.inclusive === false;
|
|
10384
|
+
const options = def.options.map((x, i) => process2(x, ctx, {
|
|
10385
|
+
...params,
|
|
10386
|
+
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
10387
|
+
}));
|
|
10388
|
+
if (isExclusive) {
|
|
10389
|
+
json.oneOf = options;
|
|
10390
|
+
} else {
|
|
10391
|
+
json.anyOf = options;
|
|
10392
|
+
}
|
|
10393
|
+
};
|
|
10394
|
+
var intersectionProcessor = (schema, ctx, json, params) => {
|
|
10395
|
+
const def = schema._zod.def;
|
|
10396
|
+
const a = process2(def.left, ctx, {
|
|
10397
|
+
...params,
|
|
10398
|
+
path: [...params.path, "allOf", 0]
|
|
10399
|
+
});
|
|
10400
|
+
const b = process2(def.right, ctx, {
|
|
10401
|
+
...params,
|
|
10402
|
+
path: [...params.path, "allOf", 1]
|
|
10403
|
+
});
|
|
10404
|
+
const isSimpleIntersection = (val) => ("allOf" in val) && Object.keys(val).length === 1;
|
|
10405
|
+
const allOf = [
|
|
10406
|
+
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
10407
|
+
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
10408
|
+
];
|
|
10409
|
+
json.allOf = allOf;
|
|
10410
|
+
};
|
|
10411
|
+
var tupleProcessor = (schema, ctx, _json, params) => {
|
|
10412
|
+
const json = _json;
|
|
10413
|
+
const def = schema._zod.def;
|
|
10414
|
+
json.type = "array";
|
|
10415
|
+
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
10416
|
+
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
10417
|
+
const prefixItems = def.items.map((x, i) => process2(x, ctx, {
|
|
10418
|
+
...params,
|
|
10419
|
+
path: [...params.path, prefixPath, i]
|
|
10420
|
+
}));
|
|
10421
|
+
const rest = def.rest ? process2(def.rest, ctx, {
|
|
10422
|
+
...params,
|
|
10423
|
+
path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
|
|
10424
|
+
}) : null;
|
|
10425
|
+
if (ctx.target === "draft-2020-12") {
|
|
10426
|
+
json.prefixItems = prefixItems;
|
|
10427
|
+
if (rest) {
|
|
10428
|
+
json.items = rest;
|
|
10429
|
+
}
|
|
10430
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
10431
|
+
json.items = {
|
|
10432
|
+
anyOf: prefixItems
|
|
10433
|
+
};
|
|
10434
|
+
if (rest) {
|
|
10435
|
+
json.items.anyOf.push(rest);
|
|
10436
|
+
}
|
|
10437
|
+
json.minItems = prefixItems.length;
|
|
10438
|
+
if (!rest) {
|
|
10439
|
+
json.maxItems = prefixItems.length;
|
|
10440
|
+
}
|
|
10441
|
+
} else {
|
|
10442
|
+
json.items = prefixItems;
|
|
10443
|
+
if (rest) {
|
|
10444
|
+
json.additionalItems = rest;
|
|
10445
|
+
}
|
|
10446
|
+
}
|
|
10447
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
10448
|
+
if (typeof minimum === "number")
|
|
10449
|
+
json.minItems = minimum;
|
|
10450
|
+
if (typeof maximum === "number")
|
|
10451
|
+
json.maxItems = maximum;
|
|
10452
|
+
};
|
|
10453
|
+
var recordProcessor = (schema, ctx, _json, params) => {
|
|
10454
|
+
const json = _json;
|
|
10455
|
+
const def = schema._zod.def;
|
|
10456
|
+
json.type = "object";
|
|
10457
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
10458
|
+
json.propertyNames = process2(def.keyType, ctx, {
|
|
10459
|
+
...params,
|
|
10460
|
+
path: [...params.path, "propertyNames"]
|
|
10461
|
+
});
|
|
10462
|
+
}
|
|
10463
|
+
json.additionalProperties = process2(def.valueType, ctx, {
|
|
10464
|
+
...params,
|
|
10465
|
+
path: [...params.path, "additionalProperties"]
|
|
10466
|
+
});
|
|
10467
|
+
};
|
|
10468
|
+
var nullableProcessor = (schema, ctx, json, params) => {
|
|
10469
|
+
const def = schema._zod.def;
|
|
10470
|
+
const inner = process2(def.innerType, ctx, params);
|
|
10471
|
+
const seen = ctx.seen.get(schema);
|
|
10472
|
+
if (ctx.target === "openapi-3.0") {
|
|
10473
|
+
seen.ref = def.innerType;
|
|
10474
|
+
json.nullable = true;
|
|
10475
|
+
} else {
|
|
10476
|
+
json.anyOf = [inner, { type: "null" }];
|
|
10477
|
+
}
|
|
10478
|
+
};
|
|
10479
|
+
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
10480
|
+
const def = schema._zod.def;
|
|
10481
|
+
process2(def.innerType, ctx, params);
|
|
10482
|
+
const seen = ctx.seen.get(schema);
|
|
10483
|
+
seen.ref = def.innerType;
|
|
10484
|
+
};
|
|
10485
|
+
var defaultProcessor = (schema, ctx, json, params) => {
|
|
10486
|
+
const def = schema._zod.def;
|
|
10487
|
+
process2(def.innerType, ctx, params);
|
|
10488
|
+
const seen = ctx.seen.get(schema);
|
|
10489
|
+
seen.ref = def.innerType;
|
|
10490
|
+
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
10491
|
+
};
|
|
10492
|
+
var prefaultProcessor = (schema, ctx, json, params) => {
|
|
10493
|
+
const def = schema._zod.def;
|
|
10494
|
+
process2(def.innerType, ctx, params);
|
|
10495
|
+
const seen = ctx.seen.get(schema);
|
|
10496
|
+
seen.ref = def.innerType;
|
|
10497
|
+
if (ctx.io === "input")
|
|
10498
|
+
json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
10499
|
+
};
|
|
10500
|
+
var catchProcessor = (schema, ctx, json, params) => {
|
|
10501
|
+
const def = schema._zod.def;
|
|
10502
|
+
process2(def.innerType, ctx, params);
|
|
10503
|
+
const seen = ctx.seen.get(schema);
|
|
10504
|
+
seen.ref = def.innerType;
|
|
10505
|
+
let catchValue;
|
|
10506
|
+
try {
|
|
10507
|
+
catchValue = def.catchValue(undefined);
|
|
10508
|
+
} catch {
|
|
10509
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
10510
|
+
}
|
|
10511
|
+
json.default = catchValue;
|
|
10512
|
+
};
|
|
10513
|
+
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
10514
|
+
const def = schema._zod.def;
|
|
10515
|
+
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
10516
|
+
process2(innerType, ctx, params);
|
|
10517
|
+
const seen = ctx.seen.get(schema);
|
|
10518
|
+
seen.ref = innerType;
|
|
10519
|
+
};
|
|
10520
|
+
var readonlyProcessor = (schema, ctx, json, params) => {
|
|
10521
|
+
const def = schema._zod.def;
|
|
10522
|
+
process2(def.innerType, ctx, params);
|
|
10523
|
+
const seen = ctx.seen.get(schema);
|
|
10524
|
+
seen.ref = def.innerType;
|
|
10525
|
+
json.readOnly = true;
|
|
10526
|
+
};
|
|
10527
|
+
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
10528
|
+
const def = schema._zod.def;
|
|
10529
|
+
process2(def.innerType, ctx, params);
|
|
10530
|
+
const seen = ctx.seen.get(schema);
|
|
10531
|
+
seen.ref = def.innerType;
|
|
10532
|
+
};
|
|
10533
|
+
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
10534
|
+
const def = schema._zod.def;
|
|
10535
|
+
process2(def.innerType, ctx, params);
|
|
10536
|
+
const seen = ctx.seen.get(schema);
|
|
10537
|
+
seen.ref = def.innerType;
|
|
10538
|
+
};
|
|
10539
|
+
var lazyProcessor = (schema, ctx, _json, params) => {
|
|
10540
|
+
const innerType = schema._zod.innerType;
|
|
10541
|
+
process2(innerType, ctx, params);
|
|
10542
|
+
const seen = ctx.seen.get(schema);
|
|
10543
|
+
seen.ref = innerType;
|
|
10544
|
+
};
|
|
10545
|
+
var allProcessors = {
|
|
10546
|
+
string: stringProcessor,
|
|
10547
|
+
number: numberProcessor,
|
|
10548
|
+
boolean: booleanProcessor,
|
|
10549
|
+
bigint: bigintProcessor,
|
|
10550
|
+
symbol: symbolProcessor,
|
|
10551
|
+
null: nullProcessor,
|
|
10552
|
+
undefined: undefinedProcessor,
|
|
10553
|
+
void: voidProcessor,
|
|
10554
|
+
never: neverProcessor,
|
|
10555
|
+
any: anyProcessor,
|
|
10556
|
+
unknown: unknownProcessor,
|
|
10557
|
+
date: dateProcessor,
|
|
10558
|
+
enum: enumProcessor,
|
|
10559
|
+
literal: literalProcessor,
|
|
10560
|
+
nan: nanProcessor,
|
|
10561
|
+
template_literal: templateLiteralProcessor,
|
|
10562
|
+
file: fileProcessor,
|
|
10563
|
+
success: successProcessor,
|
|
10564
|
+
custom: customProcessor,
|
|
10565
|
+
function: functionProcessor,
|
|
10566
|
+
transform: transformProcessor,
|
|
10567
|
+
map: mapProcessor,
|
|
10568
|
+
set: setProcessor,
|
|
10569
|
+
array: arrayProcessor,
|
|
10570
|
+
object: objectProcessor,
|
|
10571
|
+
union: unionProcessor,
|
|
10572
|
+
intersection: intersectionProcessor,
|
|
10573
|
+
tuple: tupleProcessor,
|
|
10574
|
+
record: recordProcessor,
|
|
10575
|
+
nullable: nullableProcessor,
|
|
10576
|
+
nonoptional: nonoptionalProcessor,
|
|
10577
|
+
default: defaultProcessor,
|
|
10578
|
+
prefault: prefaultProcessor,
|
|
10579
|
+
catch: catchProcessor,
|
|
10580
|
+
pipe: pipeProcessor,
|
|
10581
|
+
readonly: readonlyProcessor,
|
|
10582
|
+
promise: promiseProcessor,
|
|
10583
|
+
optional: optionalProcessor,
|
|
10584
|
+
lazy: lazyProcessor
|
|
10585
|
+
};
|
|
10586
|
+
function toJSONSchema(input, params) {
|
|
10587
|
+
if ("_idmap" in input) {
|
|
10588
|
+
const registry2 = input;
|
|
10589
|
+
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
10590
|
+
const defs = {};
|
|
10591
|
+
for (const entry of registry2._idmap.entries()) {
|
|
10592
|
+
const [_, schema] = entry;
|
|
10593
|
+
process2(schema, ctx2);
|
|
10594
|
+
}
|
|
10595
|
+
const schemas = {};
|
|
10596
|
+
const external = {
|
|
10597
|
+
registry: registry2,
|
|
10598
|
+
uri: params?.uri,
|
|
10599
|
+
defs
|
|
10600
|
+
};
|
|
10601
|
+
ctx2.external = external;
|
|
10602
|
+
for (const entry of registry2._idmap.entries()) {
|
|
10603
|
+
const [key, schema] = entry;
|
|
10604
|
+
extractDefs(ctx2, schema);
|
|
10605
|
+
schemas[key] = finalize(ctx2, schema);
|
|
10606
|
+
}
|
|
10607
|
+
if (Object.keys(defs).length > 0) {
|
|
10608
|
+
const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
10609
|
+
schemas.__shared = {
|
|
10610
|
+
[defsSegment]: defs
|
|
10611
|
+
};
|
|
10612
|
+
}
|
|
10613
|
+
return { schemas };
|
|
10614
|
+
}
|
|
10615
|
+
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
10616
|
+
process2(input, ctx);
|
|
10617
|
+
extractDefs(ctx, input);
|
|
10618
|
+
return finalize(ctx, input);
|
|
10619
|
+
}
|
|
10620
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/classic/iso.js
|
|
10557
10621
|
var exports_iso = {};
|
|
10558
10622
|
__export(exports_iso, {
|
|
10559
10623
|
time: () => time2,
|
|
@@ -10594,7 +10658,7 @@ function duration2(params) {
|
|
|
10594
10658
|
return _isoDuration(ZodISODuration, params);
|
|
10595
10659
|
}
|
|
10596
10660
|
|
|
10597
|
-
// ../../node_modules/.bun/zod@4.
|
|
10661
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/classic/errors.js
|
|
10598
10662
|
var initializer2 = (inst, issues) => {
|
|
10599
10663
|
$ZodError.init(inst, issues);
|
|
10600
10664
|
inst.name = "ZodError";
|
|
@@ -10629,7 +10693,7 @@ var ZodRealError = $constructor("ZodError", initializer2, {
|
|
|
10629
10693
|
Parent: Error
|
|
10630
10694
|
});
|
|
10631
10695
|
|
|
10632
|
-
// ../../node_modules/.bun/zod@4.
|
|
10696
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/classic/parse.js
|
|
10633
10697
|
var parse3 = /* @__PURE__ */ _parse(ZodRealError);
|
|
10634
10698
|
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
10635
10699
|
var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -10643,9 +10707,16 @@ var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
|
10643
10707
|
var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
10644
10708
|
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
10645
10709
|
|
|
10646
|
-
// ../../node_modules/.bun/zod@4.
|
|
10710
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/classic/schemas.js
|
|
10647
10711
|
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
10648
10712
|
$ZodType.init(inst, def);
|
|
10713
|
+
Object.assign(inst["~standard"], {
|
|
10714
|
+
jsonSchema: {
|
|
10715
|
+
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
10716
|
+
output: createStandardJSONSchemaMethod(inst, "output")
|
|
10717
|
+
}
|
|
10718
|
+
});
|
|
10719
|
+
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
10649
10720
|
inst.def = def;
|
|
10650
10721
|
inst.type = def.type;
|
|
10651
10722
|
Object.defineProperty(inst, "_def", { value: def });
|
|
@@ -10718,6 +10789,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
10718
10789
|
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
10719
10790
|
$ZodString.init(inst, def);
|
|
10720
10791
|
ZodType.init(inst, def);
|
|
10792
|
+
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
10721
10793
|
const bag = inst._zod.bag;
|
|
10722
10794
|
inst.format = bag.format ?? null;
|
|
10723
10795
|
inst.minLength = bag.minimum ?? null;
|
|
@@ -10855,6 +10927,7 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
|
10855
10927
|
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
10856
10928
|
$ZodNumber.init(inst, def);
|
|
10857
10929
|
ZodType.init(inst, def);
|
|
10930
|
+
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
10858
10931
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
10859
10932
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
10860
10933
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
@@ -10890,6 +10963,7 @@ function int(params) {
|
|
|
10890
10963
|
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
10891
10964
|
$ZodBoolean.init(inst, def);
|
|
10892
10965
|
ZodType.init(inst, def);
|
|
10966
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
10893
10967
|
});
|
|
10894
10968
|
function boolean2(params) {
|
|
10895
10969
|
return _boolean(ZodBoolean, params);
|
|
@@ -10897,6 +10971,7 @@ function boolean2(params) {
|
|
|
10897
10971
|
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
10898
10972
|
$ZodNull.init(inst, def);
|
|
10899
10973
|
ZodType.init(inst, def);
|
|
10974
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
|
|
10900
10975
|
});
|
|
10901
10976
|
function _null3(params) {
|
|
10902
10977
|
return _null2(ZodNull, params);
|
|
@@ -10904,6 +10979,7 @@ function _null3(params) {
|
|
|
10904
10979
|
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
10905
10980
|
$ZodAny.init(inst, def);
|
|
10906
10981
|
ZodType.init(inst, def);
|
|
10982
|
+
inst._zod.processJSONSchema = (ctx, json, params) => anyProcessor(inst, ctx, json, params);
|
|
10907
10983
|
});
|
|
10908
10984
|
function any() {
|
|
10909
10985
|
return _any(ZodAny);
|
|
@@ -10911,6 +10987,7 @@ function any() {
|
|
|
10911
10987
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
10912
10988
|
$ZodUnknown.init(inst, def);
|
|
10913
10989
|
ZodType.init(inst, def);
|
|
10990
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
|
|
10914
10991
|
});
|
|
10915
10992
|
function unknown() {
|
|
10916
10993
|
return _unknown(ZodUnknown);
|
|
@@ -10918,6 +10995,7 @@ function unknown() {
|
|
|
10918
10995
|
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
10919
10996
|
$ZodNever.init(inst, def);
|
|
10920
10997
|
ZodType.init(inst, def);
|
|
10998
|
+
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
10921
10999
|
});
|
|
10922
11000
|
function never(params) {
|
|
10923
11001
|
return _never(ZodNever, params);
|
|
@@ -10925,6 +11003,7 @@ function never(params) {
|
|
|
10925
11003
|
var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
10926
11004
|
$ZodArray.init(inst, def);
|
|
10927
11005
|
ZodType.init(inst, def);
|
|
11006
|
+
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
10928
11007
|
inst.element = def.element;
|
|
10929
11008
|
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
|
|
10930
11009
|
inst.nonempty = (params) => inst.check(_minLength(1, params));
|
|
@@ -10938,6 +11017,7 @@ function array(element, params) {
|
|
|
10938
11017
|
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
10939
11018
|
$ZodObjectJIT.init(inst, def);
|
|
10940
11019
|
ZodType.init(inst, def);
|
|
11020
|
+
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
10941
11021
|
exports_util.defineLazy(inst, "shape", () => {
|
|
10942
11022
|
return def.shape;
|
|
10943
11023
|
});
|
|
@@ -10978,6 +11058,7 @@ function looseObject(shape, params) {
|
|
|
10978
11058
|
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
10979
11059
|
$ZodUnion.init(inst, def);
|
|
10980
11060
|
ZodType.init(inst, def);
|
|
11061
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
10981
11062
|
inst.options = def.options;
|
|
10982
11063
|
});
|
|
10983
11064
|
function union(options, params) {
|
|
@@ -11002,6 +11083,7 @@ function discriminatedUnion(discriminator, options, params) {
|
|
|
11002
11083
|
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
11003
11084
|
$ZodIntersection.init(inst, def);
|
|
11004
11085
|
ZodType.init(inst, def);
|
|
11086
|
+
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
11005
11087
|
});
|
|
11006
11088
|
function intersection(left, right) {
|
|
11007
11089
|
return new ZodIntersection({
|
|
@@ -11013,6 +11095,7 @@ function intersection(left, right) {
|
|
|
11013
11095
|
var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
11014
11096
|
$ZodRecord.init(inst, def);
|
|
11015
11097
|
ZodType.init(inst, def);
|
|
11098
|
+
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
11016
11099
|
inst.keyType = def.keyType;
|
|
11017
11100
|
inst.valueType = def.valueType;
|
|
11018
11101
|
});
|
|
@@ -11027,6 +11110,7 @@ function record(keyType, valueType, params) {
|
|
|
11027
11110
|
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
11028
11111
|
$ZodEnum.init(inst, def);
|
|
11029
11112
|
ZodType.init(inst, def);
|
|
11113
|
+
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
11030
11114
|
inst.enum = def.entries;
|
|
11031
11115
|
inst.options = Object.values(def.entries);
|
|
11032
11116
|
const keys = new Set(Object.keys(def.entries));
|
|
@@ -11072,6 +11156,7 @@ function _enum(values, params) {
|
|
|
11072
11156
|
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
11073
11157
|
$ZodLiteral.init(inst, def);
|
|
11074
11158
|
ZodType.init(inst, def);
|
|
11159
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
11075
11160
|
inst.values = new Set(def.values);
|
|
11076
11161
|
Object.defineProperty(inst, "value", {
|
|
11077
11162
|
get() {
|
|
@@ -11092,6 +11177,7 @@ function literal(value, params) {
|
|
|
11092
11177
|
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
11093
11178
|
$ZodTransform.init(inst, def);
|
|
11094
11179
|
ZodType.init(inst, def);
|
|
11180
|
+
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
11095
11181
|
inst._zod.parse = (payload, _ctx) => {
|
|
11096
11182
|
if (_ctx.direction === "backward") {
|
|
11097
11183
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
@@ -11129,6 +11215,7 @@ function transform(fn) {
|
|
|
11129
11215
|
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
11130
11216
|
$ZodOptional.init(inst, def);
|
|
11131
11217
|
ZodType.init(inst, def);
|
|
11218
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
11132
11219
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
11133
11220
|
});
|
|
11134
11221
|
function optional(innerType) {
|
|
@@ -11140,6 +11227,7 @@ function optional(innerType) {
|
|
|
11140
11227
|
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
11141
11228
|
$ZodNullable.init(inst, def);
|
|
11142
11229
|
ZodType.init(inst, def);
|
|
11230
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
11143
11231
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
11144
11232
|
});
|
|
11145
11233
|
function nullable(innerType) {
|
|
@@ -11151,6 +11239,7 @@ function nullable(innerType) {
|
|
|
11151
11239
|
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
11152
11240
|
$ZodDefault.init(inst, def);
|
|
11153
11241
|
ZodType.init(inst, def);
|
|
11242
|
+
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
11154
11243
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
11155
11244
|
inst.removeDefault = inst.unwrap;
|
|
11156
11245
|
});
|
|
@@ -11166,6 +11255,7 @@ function _default(innerType, defaultValue) {
|
|
|
11166
11255
|
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
11167
11256
|
$ZodPrefault.init(inst, def);
|
|
11168
11257
|
ZodType.init(inst, def);
|
|
11258
|
+
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
11169
11259
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
11170
11260
|
});
|
|
11171
11261
|
function prefault(innerType, defaultValue) {
|
|
@@ -11180,6 +11270,7 @@ function prefault(innerType, defaultValue) {
|
|
|
11180
11270
|
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
11181
11271
|
$ZodNonOptional.init(inst, def);
|
|
11182
11272
|
ZodType.init(inst, def);
|
|
11273
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
11183
11274
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
11184
11275
|
});
|
|
11185
11276
|
function nonoptional(innerType, params) {
|
|
@@ -11192,6 +11283,7 @@ function nonoptional(innerType, params) {
|
|
|
11192
11283
|
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
11193
11284
|
$ZodCatch.init(inst, def);
|
|
11194
11285
|
ZodType.init(inst, def);
|
|
11286
|
+
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
11195
11287
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
11196
11288
|
inst.removeCatch = inst.unwrap;
|
|
11197
11289
|
});
|
|
@@ -11205,6 +11297,7 @@ function _catch(innerType, catchValue) {
|
|
|
11205
11297
|
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
11206
11298
|
$ZodPipe.init(inst, def);
|
|
11207
11299
|
ZodType.init(inst, def);
|
|
11300
|
+
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
11208
11301
|
inst.in = def.in;
|
|
11209
11302
|
inst.out = def.out;
|
|
11210
11303
|
});
|
|
@@ -11218,6 +11311,7 @@ function pipe(in_, out) {
|
|
|
11218
11311
|
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
11219
11312
|
$ZodReadonly.init(inst, def);
|
|
11220
11313
|
ZodType.init(inst, def);
|
|
11314
|
+
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
11221
11315
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
11222
11316
|
});
|
|
11223
11317
|
function readonly(innerType) {
|
|
@@ -11229,6 +11323,7 @@ function readonly(innerType) {
|
|
|
11229
11323
|
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
11230
11324
|
$ZodCustom.init(inst, def);
|
|
11231
11325
|
ZodType.init(inst, def);
|
|
11326
|
+
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
11232
11327
|
});
|
|
11233
11328
|
function custom(fn, _params) {
|
|
11234
11329
|
return _custom(ZodCustom, fn ?? (() => true), _params);
|
|
@@ -11242,7 +11337,7 @@ function superRefine(fn) {
|
|
|
11242
11337
|
function preprocess(fn, schema) {
|
|
11243
11338
|
return pipe(transform(fn), schema);
|
|
11244
11339
|
}
|
|
11245
|
-
// ../../node_modules/.bun/zod@4.
|
|
11340
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/classic/external.js
|
|
11246
11341
|
config(en_default());
|
|
11247
11342
|
|
|
11248
11343
|
// ../../node_modules/.bun/@modelcontextprotocol+sdk@1.24.3/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
@@ -12094,7 +12189,7 @@ function serializeMessage(message) {
|
|
|
12094
12189
|
|
|
12095
12190
|
// ../../node_modules/.bun/@modelcontextprotocol+sdk@1.24.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
12096
12191
|
class StdioServerTransport {
|
|
12097
|
-
constructor(_stdin =
|
|
12192
|
+
constructor(_stdin = process3.stdin, _stdout = process3.stdout) {
|
|
12098
12193
|
this._stdin = _stdin;
|
|
12099
12194
|
this._stdout = _stdout;
|
|
12100
12195
|
this._readBuffer = new ReadBuffer;
|
|
@@ -12155,7 +12250,7 @@ class StdioServerTransport {
|
|
|
12155
12250
|
// package.json
|
|
12156
12251
|
var package_default = {
|
|
12157
12252
|
name: "@youdotcom-oss/mcp",
|
|
12158
|
-
version: "1.3.
|
|
12253
|
+
version: "1.3.9-next.1",
|
|
12159
12254
|
description: "You.com API Model Context Protocol Server",
|
|
12160
12255
|
license: "MIT",
|
|
12161
12256
|
engines: {
|
|
@@ -12179,14 +12274,18 @@ var package_default = {
|
|
|
12179
12274
|
],
|
|
12180
12275
|
bin: "bin/stdio.js",
|
|
12181
12276
|
type: "module",
|
|
12182
|
-
main: "./src/
|
|
12277
|
+
main: "./src/main.ts",
|
|
12183
12278
|
exports: {
|
|
12184
|
-
".":
|
|
12279
|
+
".": {
|
|
12280
|
+
types: "./dist/main.d.ts",
|
|
12281
|
+
default: "./src/main.ts"
|
|
12282
|
+
},
|
|
12185
12283
|
"./http": "./src/http.ts",
|
|
12186
12284
|
"./stdio": "./src/stdio.ts"
|
|
12187
12285
|
},
|
|
12188
12286
|
files: [
|
|
12189
12287
|
"bin/stdio.js",
|
|
12288
|
+
"./dist/**",
|
|
12190
12289
|
"./src/**",
|
|
12191
12290
|
"!./src/**/tests/*",
|
|
12192
12291
|
"!./src/**/*.spec.@(tsx|ts)"
|
|
@@ -12195,7 +12294,9 @@ var package_default = {
|
|
|
12195
12294
|
access: "public"
|
|
12196
12295
|
},
|
|
12197
12296
|
scripts: {
|
|
12198
|
-
build: "bun build
|
|
12297
|
+
build: "bun run build:stdio && bun run build:types",
|
|
12298
|
+
"build:stdio": "bun build ./src/stdio.ts --outfile ./bin/stdio.js --target=node",
|
|
12299
|
+
"build:types": "tsc --project tsconfig.json --declaration --emitDeclarationOnly --noEmit false",
|
|
12199
12300
|
check: "bun run check:biome && bun run check:types && bun run check:package",
|
|
12200
12301
|
"check:biome": "biome check",
|
|
12201
12302
|
"check:package": "format-package --check",
|
|
@@ -12214,11 +12315,13 @@ var package_default = {
|
|
|
12214
12315
|
"test:coverage:watch": "bun test --coverage --watch",
|
|
12215
12316
|
"test:watch": "bun test --watch"
|
|
12216
12317
|
},
|
|
12318
|
+
mcpName: "io.github.youdotcom-oss/mcp",
|
|
12319
|
+
types: "./dist/main.d.ts",
|
|
12217
12320
|
dependencies: {
|
|
12218
|
-
zod: "^4.
|
|
12219
|
-
"@hono/mcp": "^0.2.
|
|
12321
|
+
zod: "^4.2.0",
|
|
12322
|
+
"@hono/mcp": "^0.2.2",
|
|
12220
12323
|
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
12221
|
-
hono: "^4.
|
|
12324
|
+
hono: "^4.11.1"
|
|
12222
12325
|
},
|
|
12223
12326
|
devDependencies: {
|
|
12224
12327
|
"@modelcontextprotocol/inspector": "0.17.5"
|
|
@@ -12281,6 +12384,11 @@ var ContentsStructuredContentSchema = object({
|
|
|
12281
12384
|
})).describe("Extracted items")
|
|
12282
12385
|
});
|
|
12283
12386
|
|
|
12387
|
+
// src/shared/api-constants.ts
|
|
12388
|
+
var SEARCH_API_URL = "https://ydc-index.io/v1/search";
|
|
12389
|
+
var EXPRESS_API_URL = "https://api.you.com/v1/agents/runs";
|
|
12390
|
+
var CONTENTS_API_URL = "https://ydc-index.io/v1/contents";
|
|
12391
|
+
|
|
12284
12392
|
// src/shared/check-response-for-errors.ts
|
|
12285
12393
|
var checkResponseForErrors = (responseData) => {
|
|
12286
12394
|
if (typeof responseData === "object" && responseData !== null && "error" in responseData) {
|
|
@@ -12291,7 +12399,6 @@ var checkResponseForErrors = (responseData) => {
|
|
|
12291
12399
|
};
|
|
12292
12400
|
|
|
12293
12401
|
// src/contents/contents.utils.ts
|
|
12294
|
-
var CONTENTS_API_URL = "https://ydc-index.io/v1/contents";
|
|
12295
12402
|
var fetchContents = async ({
|
|
12296
12403
|
contentsQuery: { urls, format = "markdown" },
|
|
12297
12404
|
YDC_API_KEY = process.env.YDC_API_KEY,
|
|
@@ -12523,7 +12630,6 @@ var formatSearchResultsText = (results) => {
|
|
|
12523
12630
|
};
|
|
12524
12631
|
|
|
12525
12632
|
// src/express/express.utils.ts
|
|
12526
|
-
var AGENTS_RUN_URL = "https://api.you.com/v1/agents/runs";
|
|
12527
12633
|
var agentThrowOnFailedStatus = async (response) => {
|
|
12528
12634
|
const errorCode = response.status;
|
|
12529
12635
|
const errorData = await response.json();
|
|
@@ -12562,7 +12668,7 @@ var callExpressAgent = async ({
|
|
|
12562
12668
|
}),
|
|
12563
12669
|
body: JSON.stringify(requestBody)
|
|
12564
12670
|
};
|
|
12565
|
-
const response = await fetch(
|
|
12671
|
+
const response = await fetch(EXPRESS_API_URL, options);
|
|
12566
12672
|
if (!response.ok) {
|
|
12567
12673
|
await agentThrowOnFailedStatus(response);
|
|
12568
12674
|
}
|
|
@@ -12679,7 +12785,7 @@ Report this issue: ${reportLink}`
|
|
|
12679
12785
|
});
|
|
12680
12786
|
};
|
|
12681
12787
|
|
|
12682
|
-
// ../../node_modules/.bun/zod@4.
|
|
12788
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v3/helpers/util.js
|
|
12683
12789
|
var util;
|
|
12684
12790
|
(function(util2) {
|
|
12685
12791
|
util2.assertEqual = (_) => {};
|
|
@@ -12810,7 +12916,7 @@ var getParsedType2 = (data) => {
|
|
|
12810
12916
|
}
|
|
12811
12917
|
};
|
|
12812
12918
|
|
|
12813
|
-
// ../../node_modules/.bun/zod@4.
|
|
12919
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v3/ZodError.js
|
|
12814
12920
|
var ZodIssueCode = util.arrayToEnum([
|
|
12815
12921
|
"invalid_type",
|
|
12816
12922
|
"invalid_literal",
|
|
@@ -12924,7 +13030,7 @@ ZodError2.create = (issues) => {
|
|
|
12924
13030
|
return error2;
|
|
12925
13031
|
};
|
|
12926
13032
|
|
|
12927
|
-
// ../../node_modules/.bun/zod@4.
|
|
13033
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v3/locales/en.js
|
|
12928
13034
|
var errorMap = (issue2, _ctx) => {
|
|
12929
13035
|
let message;
|
|
12930
13036
|
switch (issue2.code) {
|
|
@@ -13027,13 +13133,13 @@ var errorMap = (issue2, _ctx) => {
|
|
|
13027
13133
|
};
|
|
13028
13134
|
var en_default2 = errorMap;
|
|
13029
13135
|
|
|
13030
|
-
// ../../node_modules/.bun/zod@4.
|
|
13136
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v3/errors.js
|
|
13031
13137
|
var overrideErrorMap = en_default2;
|
|
13032
13138
|
function getErrorMap() {
|
|
13033
13139
|
return overrideErrorMap;
|
|
13034
13140
|
}
|
|
13035
13141
|
|
|
13036
|
-
// ../../node_modules/.bun/zod@4.
|
|
13142
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v3/helpers/parseUtil.js
|
|
13037
13143
|
var makeIssue = (params) => {
|
|
13038
13144
|
const { data, path, errorMaps, issueData } = params;
|
|
13039
13145
|
const fullPath = [...path, ...issueData.path || []];
|
|
@@ -13139,14 +13245,14 @@ var isDirty = (x) => x.status === "dirty";
|
|
|
13139
13245
|
var isValid = (x) => x.status === "valid";
|
|
13140
13246
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
13141
13247
|
|
|
13142
|
-
// ../../node_modules/.bun/zod@4.
|
|
13248
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v3/helpers/errorUtil.js
|
|
13143
13249
|
var errorUtil;
|
|
13144
13250
|
(function(errorUtil2) {
|
|
13145
13251
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
13146
13252
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
13147
13253
|
})(errorUtil || (errorUtil = {}));
|
|
13148
13254
|
|
|
13149
|
-
// ../../node_modules/.bun/zod@4.
|
|
13255
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v3/types.js
|
|
13150
13256
|
class ParseInputLazyPath {
|
|
13151
13257
|
constructor(parent, value, path, key) {
|
|
13152
13258
|
this._cachedPath = [];
|
|
@@ -16489,7 +16595,7 @@ var optionalType = ZodOptional2.create;
|
|
|
16489
16595
|
var nullableType = ZodNullable2.create;
|
|
16490
16596
|
var preprocessType = ZodEffects.createWithPreprocess;
|
|
16491
16597
|
var pipelineType = ZodPipeline.create;
|
|
16492
|
-
// ../../node_modules/.bun/zod@4.
|
|
16598
|
+
// ../../node_modules/.bun/zod@4.2.0/node_modules/zod/v4/mini/schemas.js
|
|
16493
16599
|
var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
16494
16600
|
if (!inst._zod)
|
|
16495
16601
|
throw new Error("Uninitialized schema in ZodMiniType.");
|
|
@@ -16688,7 +16794,7 @@ function isTerminal(status) {
|
|
|
16688
16794
|
return status === "completed" || status === "failed" || status === "cancelled";
|
|
16689
16795
|
}
|
|
16690
16796
|
|
|
16691
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
16797
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
16692
16798
|
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
16693
16799
|
var defaultOptions = {
|
|
16694
16800
|
name: undefined,
|
|
@@ -16721,7 +16827,7 @@ var getDefaultOptions = (options) => typeof options === "string" ? {
|
|
|
16721
16827
|
...defaultOptions,
|
|
16722
16828
|
...options
|
|
16723
16829
|
};
|
|
16724
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
16830
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
16725
16831
|
var getRefs = (options) => {
|
|
16726
16832
|
const _options = getDefaultOptions(options);
|
|
16727
16833
|
const currentPath = _options.name !== undefined ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
@@ -16740,7 +16846,7 @@ var getRefs = (options) => {
|
|
|
16740
16846
|
]))
|
|
16741
16847
|
};
|
|
16742
16848
|
};
|
|
16743
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
16849
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
16744
16850
|
function addErrorMessage(res, key, errorMessage, refs) {
|
|
16745
16851
|
if (!refs?.errorMessages)
|
|
16746
16852
|
return;
|
|
@@ -16755,7 +16861,7 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
|
16755
16861
|
res[key] = value;
|
|
16756
16862
|
addErrorMessage(res, key, errorMessage, refs);
|
|
16757
16863
|
}
|
|
16758
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
16864
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
16759
16865
|
var getRelativePath = (pathA, pathB) => {
|
|
16760
16866
|
let i = 0;
|
|
16761
16867
|
for (;i < pathA.length && i < pathB.length; i++) {
|
|
@@ -16764,7 +16870,7 @@ var getRelativePath = (pathA, pathB) => {
|
|
|
16764
16870
|
}
|
|
16765
16871
|
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
16766
16872
|
};
|
|
16767
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
16873
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
16768
16874
|
function parseAnyDef(refs) {
|
|
16769
16875
|
if (refs.target !== "openAi") {
|
|
16770
16876
|
return {};
|
|
@@ -16780,7 +16886,7 @@ function parseAnyDef(refs) {
|
|
|
16780
16886
|
};
|
|
16781
16887
|
}
|
|
16782
16888
|
|
|
16783
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
16889
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
|
|
16784
16890
|
function parseArrayDef(def, refs) {
|
|
16785
16891
|
const res = {
|
|
16786
16892
|
type: "array"
|
|
@@ -16804,7 +16910,7 @@ function parseArrayDef(def, refs) {
|
|
|
16804
16910
|
return res;
|
|
16805
16911
|
}
|
|
16806
16912
|
|
|
16807
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
16913
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
16808
16914
|
function parseBigintDef(def, refs) {
|
|
16809
16915
|
const res = {
|
|
16810
16916
|
type: "integer",
|
|
@@ -16850,24 +16956,24 @@ function parseBigintDef(def, refs) {
|
|
|
16850
16956
|
return res;
|
|
16851
16957
|
}
|
|
16852
16958
|
|
|
16853
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
16959
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
16854
16960
|
function parseBooleanDef() {
|
|
16855
16961
|
return {
|
|
16856
16962
|
type: "boolean"
|
|
16857
16963
|
};
|
|
16858
16964
|
}
|
|
16859
16965
|
|
|
16860
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
16966
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
16861
16967
|
function parseBrandedDef(_def, refs) {
|
|
16862
16968
|
return parseDef(_def.type._def, refs);
|
|
16863
16969
|
}
|
|
16864
16970
|
|
|
16865
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
16971
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
16866
16972
|
var parseCatchDef = (def, refs) => {
|
|
16867
16973
|
return parseDef(def.innerType._def, refs);
|
|
16868
16974
|
};
|
|
16869
16975
|
|
|
16870
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
16976
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
16871
16977
|
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
16872
16978
|
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
16873
16979
|
if (Array.isArray(strategy)) {
|
|
@@ -16912,7 +17018,7 @@ var integerDateParser = (def, refs) => {
|
|
|
16912
17018
|
return res;
|
|
16913
17019
|
};
|
|
16914
17020
|
|
|
16915
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17021
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
16916
17022
|
function parseDefaultDef(_def, refs) {
|
|
16917
17023
|
return {
|
|
16918
17024
|
...parseDef(_def.innerType._def, refs),
|
|
@@ -16920,12 +17026,12 @@ function parseDefaultDef(_def, refs) {
|
|
|
16920
17026
|
};
|
|
16921
17027
|
}
|
|
16922
17028
|
|
|
16923
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17029
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
16924
17030
|
function parseEffectsDef(_def, refs) {
|
|
16925
17031
|
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
|
|
16926
17032
|
}
|
|
16927
17033
|
|
|
16928
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17034
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
16929
17035
|
function parseEnumDef(def) {
|
|
16930
17036
|
return {
|
|
16931
17037
|
type: "string",
|
|
@@ -16933,7 +17039,7 @@ function parseEnumDef(def) {
|
|
|
16933
17039
|
};
|
|
16934
17040
|
}
|
|
16935
17041
|
|
|
16936
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17042
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
16937
17043
|
var isJsonSchema7AllOfType = (type) => {
|
|
16938
17044
|
if ("type" in type && type.type === "string")
|
|
16939
17045
|
return false;
|
|
@@ -16975,7 +17081,7 @@ function parseIntersectionDef(def, refs) {
|
|
|
16975
17081
|
} : undefined;
|
|
16976
17082
|
}
|
|
16977
17083
|
|
|
16978
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17084
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
16979
17085
|
function parseLiteralDef(def, refs) {
|
|
16980
17086
|
const parsedType2 = typeof def.value;
|
|
16981
17087
|
if (parsedType2 !== "bigint" && parsedType2 !== "number" && parsedType2 !== "boolean" && parsedType2 !== "string") {
|
|
@@ -16995,7 +17101,7 @@ function parseLiteralDef(def, refs) {
|
|
|
16995
17101
|
};
|
|
16996
17102
|
}
|
|
16997
17103
|
|
|
16998
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17104
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
16999
17105
|
var emojiRegex2 = undefined;
|
|
17000
17106
|
var zodPatterns = {
|
|
17001
17107
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
@@ -17292,7 +17398,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
17292
17398
|
return pattern;
|
|
17293
17399
|
}
|
|
17294
17400
|
|
|
17295
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17401
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
17296
17402
|
function parseRecordDef(def, refs) {
|
|
17297
17403
|
if (refs.target === "openAi") {
|
|
17298
17404
|
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
@@ -17344,7 +17450,7 @@ function parseRecordDef(def, refs) {
|
|
|
17344
17450
|
return schema;
|
|
17345
17451
|
}
|
|
17346
17452
|
|
|
17347
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17453
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
17348
17454
|
function parseMapDef(def, refs) {
|
|
17349
17455
|
if (refs.mapStrategy === "record") {
|
|
17350
17456
|
return parseRecordDef(def, refs);
|
|
@@ -17369,7 +17475,7 @@ function parseMapDef(def, refs) {
|
|
|
17369
17475
|
};
|
|
17370
17476
|
}
|
|
17371
17477
|
|
|
17372
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17478
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
17373
17479
|
function parseNativeEnumDef(def) {
|
|
17374
17480
|
const object3 = def.values;
|
|
17375
17481
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
@@ -17383,7 +17489,7 @@ function parseNativeEnumDef(def) {
|
|
|
17383
17489
|
};
|
|
17384
17490
|
}
|
|
17385
17491
|
|
|
17386
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17492
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
17387
17493
|
function parseNeverDef(refs) {
|
|
17388
17494
|
return refs.target === "openAi" ? undefined : {
|
|
17389
17495
|
not: parseAnyDef({
|
|
@@ -17393,7 +17499,7 @@ function parseNeverDef(refs) {
|
|
|
17393
17499
|
};
|
|
17394
17500
|
}
|
|
17395
17501
|
|
|
17396
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17502
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
17397
17503
|
function parseNullDef(refs) {
|
|
17398
17504
|
return refs.target === "openApi3" ? {
|
|
17399
17505
|
enum: ["null"],
|
|
@@ -17403,7 +17509,7 @@ function parseNullDef(refs) {
|
|
|
17403
17509
|
};
|
|
17404
17510
|
}
|
|
17405
17511
|
|
|
17406
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17512
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
17407
17513
|
var primitiveMappings = {
|
|
17408
17514
|
ZodString: "string",
|
|
17409
17515
|
ZodNumber: "number",
|
|
@@ -17471,7 +17577,7 @@ var asAnyOf = (def, refs) => {
|
|
|
17471
17577
|
return anyOf.length ? { anyOf } : undefined;
|
|
17472
17578
|
};
|
|
17473
17579
|
|
|
17474
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17580
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
17475
17581
|
function parseNullableDef(def, refs) {
|
|
17476
17582
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
17477
17583
|
if (refs.target === "openApi3") {
|
|
@@ -17503,7 +17609,7 @@ function parseNullableDef(def, refs) {
|
|
|
17503
17609
|
return base && { anyOf: [base, { type: "null" }] };
|
|
17504
17610
|
}
|
|
17505
17611
|
|
|
17506
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17612
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
17507
17613
|
function parseNumberDef(def, refs) {
|
|
17508
17614
|
const res = {
|
|
17509
17615
|
type: "number"
|
|
@@ -17552,7 +17658,7 @@ function parseNumberDef(def, refs) {
|
|
|
17552
17658
|
return res;
|
|
17553
17659
|
}
|
|
17554
17660
|
|
|
17555
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17661
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
17556
17662
|
function parseObjectDef(def, refs) {
|
|
17557
17663
|
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
17558
17664
|
const result = {
|
|
@@ -17622,7 +17728,7 @@ function safeIsOptional(schema) {
|
|
|
17622
17728
|
}
|
|
17623
17729
|
}
|
|
17624
17730
|
|
|
17625
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17731
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
17626
17732
|
var parseOptionalDef = (def, refs) => {
|
|
17627
17733
|
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
17628
17734
|
return parseDef(def.innerType._def, refs);
|
|
@@ -17641,7 +17747,7 @@ var parseOptionalDef = (def, refs) => {
|
|
|
17641
17747
|
} : parseAnyDef(refs);
|
|
17642
17748
|
};
|
|
17643
17749
|
|
|
17644
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17750
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
17645
17751
|
var parsePipelineDef = (def, refs) => {
|
|
17646
17752
|
if (refs.pipeStrategy === "input") {
|
|
17647
17753
|
return parseDef(def.in._def, refs);
|
|
@@ -17661,12 +17767,12 @@ var parsePipelineDef = (def, refs) => {
|
|
|
17661
17767
|
};
|
|
17662
17768
|
};
|
|
17663
17769
|
|
|
17664
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17770
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
17665
17771
|
function parsePromiseDef(def, refs) {
|
|
17666
17772
|
return parseDef(def.type._def, refs);
|
|
17667
17773
|
}
|
|
17668
17774
|
|
|
17669
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17775
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
17670
17776
|
function parseSetDef(def, refs) {
|
|
17671
17777
|
const items = parseDef(def.valueType._def, {
|
|
17672
17778
|
...refs,
|
|
@@ -17686,7 +17792,7 @@ function parseSetDef(def, refs) {
|
|
|
17686
17792
|
return schema;
|
|
17687
17793
|
}
|
|
17688
17794
|
|
|
17689
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17795
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
17690
17796
|
function parseTupleDef(def, refs) {
|
|
17691
17797
|
if (def.rest) {
|
|
17692
17798
|
return {
|
|
@@ -17714,24 +17820,24 @@ function parseTupleDef(def, refs) {
|
|
|
17714
17820
|
}
|
|
17715
17821
|
}
|
|
17716
17822
|
|
|
17717
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17823
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
17718
17824
|
function parseUndefinedDef(refs) {
|
|
17719
17825
|
return {
|
|
17720
17826
|
not: parseAnyDef(refs)
|
|
17721
17827
|
};
|
|
17722
17828
|
}
|
|
17723
17829
|
|
|
17724
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17830
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
17725
17831
|
function parseUnknownDef(refs) {
|
|
17726
17832
|
return parseAnyDef(refs);
|
|
17727
17833
|
}
|
|
17728
17834
|
|
|
17729
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17835
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
17730
17836
|
var parseReadonlyDef = (def, refs) => {
|
|
17731
17837
|
return parseDef(def.innerType._def, refs);
|
|
17732
17838
|
};
|
|
17733
17839
|
|
|
17734
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17840
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
17735
17841
|
var selectParser = (def, typeName, refs) => {
|
|
17736
17842
|
switch (typeName) {
|
|
17737
17843
|
case ZodFirstPartyTypeKind.ZodString:
|
|
@@ -17809,7 +17915,7 @@ var selectParser = (def, typeName, refs) => {
|
|
|
17809
17915
|
}
|
|
17810
17916
|
};
|
|
17811
17917
|
|
|
17812
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17918
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
17813
17919
|
function parseDef(def, refs, forceResolution = false) {
|
|
17814
17920
|
const seenItem = refs.seen.get(def);
|
|
17815
17921
|
if (refs.override) {
|
|
@@ -17864,7 +17970,7 @@ var addMeta = (def, refs, jsonSchema) => {
|
|
|
17864
17970
|
}
|
|
17865
17971
|
return jsonSchema;
|
|
17866
17972
|
};
|
|
17867
|
-
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+
|
|
17973
|
+
// ../../node_modules/.bun/zod-to-json-schema@3.25.0+d28af003e585004e/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
17868
17974
|
var zodToJsonSchema = (schema, options) => {
|
|
17869
17975
|
const refs = getRefs(options);
|
|
17870
17976
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => ({
|
|
@@ -20062,8 +20168,8 @@ var getMCpServer = () => new McpServer({
|
|
|
20062
20168
|
// src/search/search.schemas.ts
|
|
20063
20169
|
var SearchQuerySchema = object({
|
|
20064
20170
|
query: string2().min(1, "Query is required").describe("Search query (supports +, -, site:, filetype:, lang:)"),
|
|
20065
|
-
count: number2().int().min(1).max(
|
|
20066
|
-
freshness:
|
|
20171
|
+
count: number2().int().min(1).max(100).optional().describe("Max results per section"),
|
|
20172
|
+
freshness: string2().optional().describe("day/week/month/year or YYYY-MM-DDtoYYYY-MM-DD"),
|
|
20067
20173
|
offset: number2().int().min(0).max(9).optional().describe("Pagination offset"),
|
|
20068
20174
|
country: _enum([
|
|
20069
20175
|
"AR",
|
|
@@ -20108,7 +20214,9 @@ var SearchQuerySchema = object({
|
|
|
20108
20214
|
fileType: string2().optional().describe("File type"),
|
|
20109
20215
|
language: string2().optional().describe("ISO 639-1 language code"),
|
|
20110
20216
|
excludeTerms: string2().optional().describe("Terms to exclude (pipe-separated)"),
|
|
20111
|
-
exactTerms: string2().optional().describe("Exact terms (pipe-separated)")
|
|
20217
|
+
exactTerms: string2().optional().describe("Exact terms (pipe-separated)"),
|
|
20218
|
+
livecrawl: _enum(["web", "news", "all"]).optional().describe("Live-crawl sections for full content"),
|
|
20219
|
+
livecrawl_formats: _enum(["html", "markdown"]).optional().describe("Format for crawled content")
|
|
20112
20220
|
});
|
|
20113
20221
|
var WebResultSchema = object({
|
|
20114
20222
|
url: string2().describe("URL"),
|
|
@@ -20116,16 +20224,27 @@ var WebResultSchema = object({
|
|
|
20116
20224
|
description: string2().describe("Description"),
|
|
20117
20225
|
snippets: array(string2()).describe("Content snippets"),
|
|
20118
20226
|
page_age: string2().optional().describe("Publication timestamp"),
|
|
20119
|
-
authors: array(string2()).optional().describe("Authors")
|
|
20227
|
+
authors: array(string2()).optional().describe("Authors"),
|
|
20228
|
+
thumbnail_url: string2().optional().describe("Thumbnail image URL"),
|
|
20229
|
+
favicon_url: string2().optional().describe("Favicon URL"),
|
|
20230
|
+
contents: object({
|
|
20231
|
+
html: string2().optional().describe("Full HTML content"),
|
|
20232
|
+
markdown: string2().optional().describe("Full Markdown content")
|
|
20233
|
+
}).optional().describe("Live-crawled page content")
|
|
20120
20234
|
});
|
|
20121
20235
|
var NewsResultSchema = object({
|
|
20122
20236
|
title: string2().describe("Title"),
|
|
20123
20237
|
description: string2().describe("Description"),
|
|
20124
20238
|
page_age: string2().describe("Publication timestamp"),
|
|
20125
|
-
url: string2().describe("URL")
|
|
20239
|
+
url: string2().describe("URL"),
|
|
20240
|
+
thumbnail_url: string2().optional().describe("Thumbnail image URL"),
|
|
20241
|
+
contents: object({
|
|
20242
|
+
html: string2().optional().describe("Full HTML content"),
|
|
20243
|
+
markdown: string2().optional().describe("Full Markdown content")
|
|
20244
|
+
}).optional().describe("Live-crawled page content")
|
|
20126
20245
|
});
|
|
20127
20246
|
var MetadataSchema = object({
|
|
20128
|
-
|
|
20247
|
+
search_uuid: string2().optional().describe("Unique search request ID"),
|
|
20129
20248
|
query: string2().describe("Query"),
|
|
20130
20249
|
latency: number2().describe("Latency in seconds")
|
|
20131
20250
|
});
|
|
@@ -20160,11 +20279,11 @@ var fetchSearchResults = async ({
|
|
|
20160
20279
|
searchQuery: { query, site, fileType, language, exactTerms, excludeTerms, ...rest },
|
|
20161
20280
|
getUserAgent
|
|
20162
20281
|
}) => {
|
|
20163
|
-
const url = new URL(
|
|
20282
|
+
const url = new URL(SEARCH_API_URL);
|
|
20164
20283
|
const searchParams = new URLSearchParams;
|
|
20165
20284
|
const searchQuery = [query];
|
|
20166
20285
|
site && searchQuery.push(`site:${site}`);
|
|
20167
|
-
fileType && searchQuery.push(`
|
|
20286
|
+
fileType && searchQuery.push(`filetype:${fileType}`);
|
|
20168
20287
|
language && searchQuery.push(`lang:${language}`);
|
|
20169
20288
|
if (exactTerms && excludeTerms) {
|
|
20170
20289
|
throw new Error("Cannot specify both exactTerms and excludeTerms - please use only one");
|