@nocobase/plugin-mcp-server 2.2.0-alpha.3 → 2.2.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/externalVersion.js +6 -6
- package/dist/node_modules/light-my-request/package.json +1 -1
- package/dist/node_modules/openapi-types/package.json +1 -1
- package/package.json +2 -2
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/.github/CR_logotype-full-color.png +0 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/.github/FUNDING.yml +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/.prettierrc.json +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/LICENSE +0 -15
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/README.md +0 -390
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/changelog.md +0 -83
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/contributing.md +0 -9
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/createIndex.ts +0 -32
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/Options.js +0 -51
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/Refs.js +0 -26
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/errorMessages.js +0 -19
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/getRelativePath.js +0 -12
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/index.js +0 -56
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/package.json +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parseDef.js +0 -66
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parseTypes.js +0 -2
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/any.js +0 -21
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/array.js +0 -30
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/bigint.js +0 -53
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/boolean.js +0 -9
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/branded.js +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/catch.js +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/date.js +0 -50
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/default.js +0 -11
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/effects.js +0 -11
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/enum.js +0 -10
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/intersection.js +0 -56
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/literal.js +0 -25
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/map.js +0 -30
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/nativeEnum.js +0 -20
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/never.js +0 -15
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/null.js +0 -14
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/nullable.js +0 -37
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/number.js +0 -56
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/object.js +0 -76
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/optional.js +0 -25
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/pipeline.js +0 -24
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/promise.js +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/readonly.js +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/record.js +0 -65
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/set.js +0 -24
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/string.js +0 -356
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/tuple.js +0 -36
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/undefined.js +0 -10
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/union.js +0 -84
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/unknown.js +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/selectParser.js +0 -109
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/zodToJsonSchema.js +0 -90
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/Options.js +0 -46
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/Refs.js +0 -22
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/errorMessages.js +0 -14
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/index.js +0 -40
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/package.json +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parseDef.js +0 -62
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parseTypes.js +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/any.js +0 -17
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/array.js +0 -26
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js +0 -49
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js +0 -5
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +0 -46
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/default.js +0 -7
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js +0 -7
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js +0 -6
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +0 -52
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js +0 -21
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/map.js +0 -26
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js +0 -16
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/never.js +0 -11
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/null.js +0 -10
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js +0 -33
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/number.js +0 -52
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/object.js +0 -72
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +0 -21
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +0 -20
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/record.js +0 -61
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/set.js +0 -20
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +0 -352
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js +0 -32
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js +0 -6
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +0 -80
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/selectParser.js +0 -105
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +0 -87
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/Options.d.ts +0 -37
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/Refs.d.ts +0 -17
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/errorMessages.d.ts +0 -15
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/getRelativePath.d.ts +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/index.d.ts +0 -40
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parseDef.d.ts +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parseTypes.d.ts +0 -34
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/any.d.ts +0 -5
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/array.d.ts +0 -12
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/bigint.d.ts +0 -14
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/boolean.d.ts +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/branded.d.ts +0 -3
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/catch.d.ts +0 -3
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/date.d.ts +0 -15
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/default.d.ts +0 -6
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/effects.d.ts +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/enum.d.ts +0 -6
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/intersection.d.ts +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/literal.d.ts +0 -9
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/map.d.ts +0 -15
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/nativeEnum.d.ts +0 -6
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/never.d.ts +0 -6
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/null.d.ts +0 -5
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/nullable.d.ts +0 -10
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/number.d.ts +0 -13
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/object.d.ts +0 -10
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/optional.d.ts +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/pipeline.d.ts +0 -5
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/promise.d.ts +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/readonly.d.ts +0 -3
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/record.d.ts +0 -13
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/set.d.ts +0 -13
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/string.d.ts +0 -73
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/tuple.d.ts +0 -13
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/undefined.d.ts +0 -6
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/union.d.ts +0 -23
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/unknown.d.ts +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/selectParser.d.ts +0 -5
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/zodToJsonSchema.d.ts +0 -10
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/package.json +0 -85
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/postcjs.ts +0 -3
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/postesm.ts +0 -3
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { parseDef } from "../parseDef.js";
|
|
2
|
-
export const primitiveMappings = {
|
|
3
|
-
ZodString: "string",
|
|
4
|
-
ZodNumber: "number",
|
|
5
|
-
ZodBigInt: "integer",
|
|
6
|
-
ZodBoolean: "boolean",
|
|
7
|
-
ZodNull: "null",
|
|
8
|
-
};
|
|
9
|
-
export function parseUnionDef(def, refs) {
|
|
10
|
-
if (refs.target === "openApi3")
|
|
11
|
-
return asAnyOf(def, refs);
|
|
12
|
-
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
13
|
-
// This blocks tries to look ahead a bit to produce nicer looking schemas with type array instead of anyOf.
|
|
14
|
-
if (options.every((x) => x._def.typeName in primitiveMappings &&
|
|
15
|
-
(!x._def.checks || !x._def.checks.length))) {
|
|
16
|
-
// all types in union are primitive and lack checks, so might as well squash into {type: [...]}
|
|
17
|
-
const types = options.reduce((types, x) => {
|
|
18
|
-
const type = primitiveMappings[x._def.typeName]; //Can be safely casted due to row 43
|
|
19
|
-
return type && !types.includes(type) ? [...types, type] : types;
|
|
20
|
-
}, []);
|
|
21
|
-
return {
|
|
22
|
-
type: types.length > 1 ? types : types[0],
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
|
|
26
|
-
// all options literals
|
|
27
|
-
const types = options.reduce((acc, x) => {
|
|
28
|
-
const type = typeof x._def.value;
|
|
29
|
-
switch (type) {
|
|
30
|
-
case "string":
|
|
31
|
-
case "number":
|
|
32
|
-
case "boolean":
|
|
33
|
-
return [...acc, type];
|
|
34
|
-
case "bigint":
|
|
35
|
-
return [...acc, "integer"];
|
|
36
|
-
case "object":
|
|
37
|
-
if (x._def.value === null)
|
|
38
|
-
return [...acc, "null"];
|
|
39
|
-
case "symbol":
|
|
40
|
-
case "undefined":
|
|
41
|
-
case "function":
|
|
42
|
-
default:
|
|
43
|
-
return acc;
|
|
44
|
-
}
|
|
45
|
-
}, []);
|
|
46
|
-
if (types.length === options.length) {
|
|
47
|
-
// all the literals are primitive, as far as null can be considered primitive
|
|
48
|
-
const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
|
|
49
|
-
return {
|
|
50
|
-
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
51
|
-
enum: options.reduce((acc, x) => {
|
|
52
|
-
return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
|
|
53
|
-
}, []),
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
else if (options.every((x) => x._def.typeName === "ZodEnum")) {
|
|
58
|
-
return {
|
|
59
|
-
type: "string",
|
|
60
|
-
enum: options.reduce((acc, x) => [
|
|
61
|
-
...acc,
|
|
62
|
-
...x._def.values.filter((x) => !acc.includes(x)),
|
|
63
|
-
], []),
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
return asAnyOf(def, refs);
|
|
67
|
-
}
|
|
68
|
-
const asAnyOf = (def, refs) => {
|
|
69
|
-
const anyOf = (def.options instanceof Map
|
|
70
|
-
? Array.from(def.options.values())
|
|
71
|
-
: def.options)
|
|
72
|
-
.map((x, i) => parseDef(x._def, {
|
|
73
|
-
...refs,
|
|
74
|
-
currentPath: [...refs.currentPath, "anyOf", `${i}`],
|
|
75
|
-
}))
|
|
76
|
-
.filter((x) => !!x &&
|
|
77
|
-
(!refs.strictUnions ||
|
|
78
|
-
(typeof x === "object" && Object.keys(x).length > 0)));
|
|
79
|
-
return anyOf.length ? { anyOf } : undefined;
|
|
80
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { ZodFirstPartyTypeKind } from "zod/v3";
|
|
2
|
-
import { parseAnyDef } from "./parsers/any.js";
|
|
3
|
-
import { parseArrayDef } from "./parsers/array.js";
|
|
4
|
-
import { parseBigintDef } from "./parsers/bigint.js";
|
|
5
|
-
import { parseBooleanDef } from "./parsers/boolean.js";
|
|
6
|
-
import { parseBrandedDef } from "./parsers/branded.js";
|
|
7
|
-
import { parseCatchDef } from "./parsers/catch.js";
|
|
8
|
-
import { parseDateDef } from "./parsers/date.js";
|
|
9
|
-
import { parseDefaultDef } from "./parsers/default.js";
|
|
10
|
-
import { parseEffectsDef } from "./parsers/effects.js";
|
|
11
|
-
import { parseEnumDef } from "./parsers/enum.js";
|
|
12
|
-
import { parseIntersectionDef } from "./parsers/intersection.js";
|
|
13
|
-
import { parseLiteralDef } from "./parsers/literal.js";
|
|
14
|
-
import { parseMapDef } from "./parsers/map.js";
|
|
15
|
-
import { parseNativeEnumDef } from "./parsers/nativeEnum.js";
|
|
16
|
-
import { parseNeverDef } from "./parsers/never.js";
|
|
17
|
-
import { parseNullDef } from "./parsers/null.js";
|
|
18
|
-
import { parseNullableDef } from "./parsers/nullable.js";
|
|
19
|
-
import { parseNumberDef } from "./parsers/number.js";
|
|
20
|
-
import { parseObjectDef } from "./parsers/object.js";
|
|
21
|
-
import { parseOptionalDef } from "./parsers/optional.js";
|
|
22
|
-
import { parsePipelineDef } from "./parsers/pipeline.js";
|
|
23
|
-
import { parsePromiseDef } from "./parsers/promise.js";
|
|
24
|
-
import { parseRecordDef } from "./parsers/record.js";
|
|
25
|
-
import { parseSetDef } from "./parsers/set.js";
|
|
26
|
-
import { parseStringDef } from "./parsers/string.js";
|
|
27
|
-
import { parseTupleDef } from "./parsers/tuple.js";
|
|
28
|
-
import { parseUndefinedDef } from "./parsers/undefined.js";
|
|
29
|
-
import { parseUnionDef } from "./parsers/union.js";
|
|
30
|
-
import { parseUnknownDef } from "./parsers/unknown.js";
|
|
31
|
-
import { parseReadonlyDef } from "./parsers/readonly.js";
|
|
32
|
-
export const selectParser = (def, typeName, refs) => {
|
|
33
|
-
switch (typeName) {
|
|
34
|
-
case ZodFirstPartyTypeKind.ZodString:
|
|
35
|
-
return parseStringDef(def, refs);
|
|
36
|
-
case ZodFirstPartyTypeKind.ZodNumber:
|
|
37
|
-
return parseNumberDef(def, refs);
|
|
38
|
-
case ZodFirstPartyTypeKind.ZodObject:
|
|
39
|
-
return parseObjectDef(def, refs);
|
|
40
|
-
case ZodFirstPartyTypeKind.ZodBigInt:
|
|
41
|
-
return parseBigintDef(def, refs);
|
|
42
|
-
case ZodFirstPartyTypeKind.ZodBoolean:
|
|
43
|
-
return parseBooleanDef();
|
|
44
|
-
case ZodFirstPartyTypeKind.ZodDate:
|
|
45
|
-
return parseDateDef(def, refs);
|
|
46
|
-
case ZodFirstPartyTypeKind.ZodUndefined:
|
|
47
|
-
return parseUndefinedDef(refs);
|
|
48
|
-
case ZodFirstPartyTypeKind.ZodNull:
|
|
49
|
-
return parseNullDef(refs);
|
|
50
|
-
case ZodFirstPartyTypeKind.ZodArray:
|
|
51
|
-
return parseArrayDef(def, refs);
|
|
52
|
-
case ZodFirstPartyTypeKind.ZodUnion:
|
|
53
|
-
case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
54
|
-
return parseUnionDef(def, refs);
|
|
55
|
-
case ZodFirstPartyTypeKind.ZodIntersection:
|
|
56
|
-
return parseIntersectionDef(def, refs);
|
|
57
|
-
case ZodFirstPartyTypeKind.ZodTuple:
|
|
58
|
-
return parseTupleDef(def, refs);
|
|
59
|
-
case ZodFirstPartyTypeKind.ZodRecord:
|
|
60
|
-
return parseRecordDef(def, refs);
|
|
61
|
-
case ZodFirstPartyTypeKind.ZodLiteral:
|
|
62
|
-
return parseLiteralDef(def, refs);
|
|
63
|
-
case ZodFirstPartyTypeKind.ZodEnum:
|
|
64
|
-
return parseEnumDef(def);
|
|
65
|
-
case ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
66
|
-
return parseNativeEnumDef(def);
|
|
67
|
-
case ZodFirstPartyTypeKind.ZodNullable:
|
|
68
|
-
return parseNullableDef(def, refs);
|
|
69
|
-
case ZodFirstPartyTypeKind.ZodOptional:
|
|
70
|
-
return parseOptionalDef(def, refs);
|
|
71
|
-
case ZodFirstPartyTypeKind.ZodMap:
|
|
72
|
-
return parseMapDef(def, refs);
|
|
73
|
-
case ZodFirstPartyTypeKind.ZodSet:
|
|
74
|
-
return parseSetDef(def, refs);
|
|
75
|
-
case ZodFirstPartyTypeKind.ZodLazy:
|
|
76
|
-
return () => def.getter()._def;
|
|
77
|
-
case ZodFirstPartyTypeKind.ZodPromise:
|
|
78
|
-
return parsePromiseDef(def, refs);
|
|
79
|
-
case ZodFirstPartyTypeKind.ZodNaN:
|
|
80
|
-
case ZodFirstPartyTypeKind.ZodNever:
|
|
81
|
-
return parseNeverDef(refs);
|
|
82
|
-
case ZodFirstPartyTypeKind.ZodEffects:
|
|
83
|
-
return parseEffectsDef(def, refs);
|
|
84
|
-
case ZodFirstPartyTypeKind.ZodAny:
|
|
85
|
-
return parseAnyDef(refs);
|
|
86
|
-
case ZodFirstPartyTypeKind.ZodUnknown:
|
|
87
|
-
return parseUnknownDef(refs);
|
|
88
|
-
case ZodFirstPartyTypeKind.ZodDefault:
|
|
89
|
-
return parseDefaultDef(def, refs);
|
|
90
|
-
case ZodFirstPartyTypeKind.ZodBranded:
|
|
91
|
-
return parseBrandedDef(def, refs);
|
|
92
|
-
case ZodFirstPartyTypeKind.ZodReadonly:
|
|
93
|
-
return parseReadonlyDef(def, refs);
|
|
94
|
-
case ZodFirstPartyTypeKind.ZodCatch:
|
|
95
|
-
return parseCatchDef(def, refs);
|
|
96
|
-
case ZodFirstPartyTypeKind.ZodPipeline:
|
|
97
|
-
return parsePipelineDef(def, refs);
|
|
98
|
-
case ZodFirstPartyTypeKind.ZodFunction:
|
|
99
|
-
case ZodFirstPartyTypeKind.ZodVoid:
|
|
100
|
-
case ZodFirstPartyTypeKind.ZodSymbol:
|
|
101
|
-
return undefined;
|
|
102
|
-
default:
|
|
103
|
-
return ((_) => undefined)(typeName);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { parseDef } from "./parseDef.js";
|
|
2
|
-
import { getRefs } from "./Refs.js";
|
|
3
|
-
import { parseAnyDef } from "./parsers/any.js";
|
|
4
|
-
const zodToJsonSchema = (schema, options) => {
|
|
5
|
-
const refs = getRefs(options);
|
|
6
|
-
let definitions = typeof options === "object" && options.definitions
|
|
7
|
-
? Object.entries(options.definitions).reduce((acc, [name, schema]) => ({
|
|
8
|
-
...acc,
|
|
9
|
-
[name]: parseDef(schema._def, {
|
|
10
|
-
...refs,
|
|
11
|
-
currentPath: [...refs.basePath, refs.definitionPath, name],
|
|
12
|
-
}, true) ?? parseAnyDef(refs),
|
|
13
|
-
}), {})
|
|
14
|
-
: undefined;
|
|
15
|
-
const name = typeof options === "string"
|
|
16
|
-
? options
|
|
17
|
-
: options?.nameStrategy === "title"
|
|
18
|
-
? undefined
|
|
19
|
-
: options?.name;
|
|
20
|
-
const main = parseDef(schema._def, name === undefined
|
|
21
|
-
? refs
|
|
22
|
-
: {
|
|
23
|
-
...refs,
|
|
24
|
-
currentPath: [...refs.basePath, refs.definitionPath, name],
|
|
25
|
-
}, false) ?? parseAnyDef(refs);
|
|
26
|
-
const title = typeof options === "object" &&
|
|
27
|
-
options.name !== undefined &&
|
|
28
|
-
options.nameStrategy === "title"
|
|
29
|
-
? options.name
|
|
30
|
-
: undefined;
|
|
31
|
-
if (title !== undefined) {
|
|
32
|
-
main.title = title;
|
|
33
|
-
}
|
|
34
|
-
if (refs.flags.hasReferencedOpenAiAnyType) {
|
|
35
|
-
if (!definitions) {
|
|
36
|
-
definitions = {};
|
|
37
|
-
}
|
|
38
|
-
if (!definitions[refs.openAiAnyTypeName]) {
|
|
39
|
-
definitions[refs.openAiAnyTypeName] = {
|
|
40
|
-
// Skipping "object" as no properties can be defined and additionalProperties must be "false"
|
|
41
|
-
type: ["string", "number", "integer", "boolean", "array", "null"],
|
|
42
|
-
items: {
|
|
43
|
-
$ref: refs.$refStrategy === "relative"
|
|
44
|
-
? "1"
|
|
45
|
-
: [
|
|
46
|
-
...refs.basePath,
|
|
47
|
-
refs.definitionPath,
|
|
48
|
-
refs.openAiAnyTypeName,
|
|
49
|
-
].join("/"),
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const combined = name === undefined
|
|
55
|
-
? definitions
|
|
56
|
-
? {
|
|
57
|
-
...main,
|
|
58
|
-
[refs.definitionPath]: definitions,
|
|
59
|
-
}
|
|
60
|
-
: main
|
|
61
|
-
: {
|
|
62
|
-
$ref: [
|
|
63
|
-
...(refs.$refStrategy === "relative" ? [] : refs.basePath),
|
|
64
|
-
refs.definitionPath,
|
|
65
|
-
name,
|
|
66
|
-
].join("/"),
|
|
67
|
-
[refs.definitionPath]: {
|
|
68
|
-
...definitions,
|
|
69
|
-
[name]: main,
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
if (refs.target === "jsonSchema7") {
|
|
73
|
-
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
74
|
-
}
|
|
75
|
-
else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
|
|
76
|
-
combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
|
|
77
|
-
}
|
|
78
|
-
if (refs.target === "openAi" &&
|
|
79
|
-
("anyOf" in combined ||
|
|
80
|
-
"oneOf" in combined ||
|
|
81
|
-
"allOf" in combined ||
|
|
82
|
-
("type" in combined && Array.isArray(combined.type)))) {
|
|
83
|
-
console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
|
|
84
|
-
}
|
|
85
|
-
return combined;
|
|
86
|
-
};
|
|
87
|
-
export { zodToJsonSchema };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ZodSchema, ZodTypeDef } from "zod/v3";
|
|
2
|
-
import { Refs, Seen } from "./Refs";
|
|
3
|
-
import { JsonSchema7Type } from "./parseTypes";
|
|
4
|
-
export type Targets = "jsonSchema7" | "jsonSchema2019-09" | "openApi3" | "openAi";
|
|
5
|
-
export type DateStrategy = "format:date-time" | "format:date" | "string" | "integer";
|
|
6
|
-
export declare const ignoreOverride: unique symbol;
|
|
7
|
-
export type OverrideCallback = (def: ZodTypeDef, refs: Refs, seen: Seen | undefined, forceResolution?: boolean) => JsonSchema7Type | undefined | typeof ignoreOverride;
|
|
8
|
-
export type PostProcessCallback = (jsonSchema: JsonSchema7Type | undefined, def: ZodTypeDef, refs: Refs) => JsonSchema7Type | undefined;
|
|
9
|
-
export declare const jsonDescription: PostProcessCallback;
|
|
10
|
-
export type Options<Target extends Targets = "jsonSchema7"> = {
|
|
11
|
-
name: string | undefined;
|
|
12
|
-
$refStrategy: "root" | "relative" | "none" | "seen";
|
|
13
|
-
basePath: string[];
|
|
14
|
-
effectStrategy: "input" | "any";
|
|
15
|
-
pipeStrategy: "input" | "output" | "all";
|
|
16
|
-
dateStrategy: DateStrategy | DateStrategy[];
|
|
17
|
-
mapStrategy: "entries" | "record";
|
|
18
|
-
removeAdditionalStrategy: "passthrough" | "strict";
|
|
19
|
-
allowedAdditionalProperties: true | undefined;
|
|
20
|
-
rejectedAdditionalProperties: false | undefined;
|
|
21
|
-
target: Target;
|
|
22
|
-
strictUnions: boolean;
|
|
23
|
-
definitionPath: string;
|
|
24
|
-
definitions: Record<string, ZodSchema>;
|
|
25
|
-
errorMessages: boolean;
|
|
26
|
-
markdownDescription: boolean;
|
|
27
|
-
patternStrategy: "escape" | "preserve";
|
|
28
|
-
applyRegexFlags: boolean;
|
|
29
|
-
emailStrategy: "format:email" | "format:idn-email" | "pattern:zod";
|
|
30
|
-
base64Strategy: "format:binary" | "contentEncoding:base64" | "pattern:zod";
|
|
31
|
-
nameStrategy: "ref" | "title";
|
|
32
|
-
override?: OverrideCallback;
|
|
33
|
-
postProcess?: PostProcessCallback;
|
|
34
|
-
openAiAnyTypeName: string;
|
|
35
|
-
};
|
|
36
|
-
export declare const defaultOptions: Options;
|
|
37
|
-
export declare const getDefaultOptions: <Target extends Targets>(options: string | Partial<Options<Target>> | undefined) => Options<Target>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ZodTypeDef } from "zod/v3";
|
|
2
|
-
import { Options, Targets } from "./Options.js";
|
|
3
|
-
import { JsonSchema7Type } from "./parseTypes.js";
|
|
4
|
-
export type Refs = {
|
|
5
|
-
seen: Map<ZodTypeDef, Seen>;
|
|
6
|
-
currentPath: string[];
|
|
7
|
-
propertyPath: string[] | undefined;
|
|
8
|
-
flags: {
|
|
9
|
-
hasReferencedOpenAiAnyType: boolean;
|
|
10
|
-
};
|
|
11
|
-
} & Options<Targets>;
|
|
12
|
-
export type Seen = {
|
|
13
|
-
def: ZodTypeDef;
|
|
14
|
-
path: string[];
|
|
15
|
-
jsonSchema: JsonSchema7Type | undefined;
|
|
16
|
-
};
|
|
17
|
-
export declare const getRefs: (options?: string | Partial<Options<Targets>>) => Refs;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { JsonSchema7TypeUnion } from "./parseTypes.js";
|
|
2
|
-
import { Refs } from "./Refs.js";
|
|
3
|
-
export type ErrorMessages<T extends JsonSchema7TypeUnion | {
|
|
4
|
-
format: string;
|
|
5
|
-
} | {
|
|
6
|
-
pattern: string;
|
|
7
|
-
}, OmitProperties extends string = ""> = Partial<Omit<{
|
|
8
|
-
[key in keyof T]: string;
|
|
9
|
-
}, OmitProperties | "type" | "errorMessages">>;
|
|
10
|
-
export declare function addErrorMessage<T extends {
|
|
11
|
-
errorMessage?: ErrorMessages<any>;
|
|
12
|
-
}>(res: T, key: keyof T, errorMessage: string | undefined, refs: Refs): void;
|
|
13
|
-
export declare function setResponseValueAndErrors<Json7Type extends JsonSchema7TypeUnion & {
|
|
14
|
-
errorMessage?: ErrorMessages<Json7Type>;
|
|
15
|
-
}, Key extends keyof Omit<Json7Type, "errorMessage">>(res: Json7Type, key: Key, value: Json7Type[Key], errorMessage: string | undefined, refs: Refs): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getRelativePath: (pathA: string[], pathB: string[]) => string;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export * from "./Options.js";
|
|
2
|
-
export * from "./Refs.js";
|
|
3
|
-
export * from "./errorMessages.js";
|
|
4
|
-
export * from "./getRelativePath.js";
|
|
5
|
-
export * from "./parseDef.js";
|
|
6
|
-
export * from "./parseTypes.js";
|
|
7
|
-
export * from "./parsers/any.js";
|
|
8
|
-
export * from "./parsers/array.js";
|
|
9
|
-
export * from "./parsers/bigint.js";
|
|
10
|
-
export * from "./parsers/boolean.js";
|
|
11
|
-
export * from "./parsers/branded.js";
|
|
12
|
-
export * from "./parsers/catch.js";
|
|
13
|
-
export * from "./parsers/date.js";
|
|
14
|
-
export * from "./parsers/default.js";
|
|
15
|
-
export * from "./parsers/effects.js";
|
|
16
|
-
export * from "./parsers/enum.js";
|
|
17
|
-
export * from "./parsers/intersection.js";
|
|
18
|
-
export * from "./parsers/literal.js";
|
|
19
|
-
export * from "./parsers/map.js";
|
|
20
|
-
export * from "./parsers/nativeEnum.js";
|
|
21
|
-
export * from "./parsers/never.js";
|
|
22
|
-
export * from "./parsers/null.js";
|
|
23
|
-
export * from "./parsers/nullable.js";
|
|
24
|
-
export * from "./parsers/number.js";
|
|
25
|
-
export * from "./parsers/object.js";
|
|
26
|
-
export * from "./parsers/optional.js";
|
|
27
|
-
export * from "./parsers/pipeline.js";
|
|
28
|
-
export * from "./parsers/promise.js";
|
|
29
|
-
export * from "./parsers/readonly.js";
|
|
30
|
-
export * from "./parsers/record.js";
|
|
31
|
-
export * from "./parsers/set.js";
|
|
32
|
-
export * from "./parsers/string.js";
|
|
33
|
-
export * from "./parsers/tuple.js";
|
|
34
|
-
export * from "./parsers/undefined.js";
|
|
35
|
-
export * from "./parsers/union.js";
|
|
36
|
-
export * from "./parsers/unknown.js";
|
|
37
|
-
export * from "./selectParser.js";
|
|
38
|
-
export * from "./zodToJsonSchema.js";
|
|
39
|
-
import { zodToJsonSchema } from "./zodToJsonSchema.js";
|
|
40
|
-
export default zodToJsonSchema;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { JsonSchema7AnyType } from "./parsers/any.js";
|
|
2
|
-
import { JsonSchema7ArrayType } from "./parsers/array.js";
|
|
3
|
-
import { JsonSchema7BigintType } from "./parsers/bigint.js";
|
|
4
|
-
import { JsonSchema7BooleanType } from "./parsers/boolean.js";
|
|
5
|
-
import { JsonSchema7DateType } from "./parsers/date.js";
|
|
6
|
-
import { JsonSchema7EnumType } from "./parsers/enum.js";
|
|
7
|
-
import { JsonSchema7AllOfType } from "./parsers/intersection.js";
|
|
8
|
-
import { JsonSchema7LiteralType } from "./parsers/literal.js";
|
|
9
|
-
import { JsonSchema7MapType } from "./parsers/map.js";
|
|
10
|
-
import { JsonSchema7NativeEnumType } from "./parsers/nativeEnum.js";
|
|
11
|
-
import { JsonSchema7NeverType } from "./parsers/never.js";
|
|
12
|
-
import { JsonSchema7NullType } from "./parsers/null.js";
|
|
13
|
-
import { JsonSchema7NullableType } from "./parsers/nullable.js";
|
|
14
|
-
import { JsonSchema7NumberType } from "./parsers/number.js";
|
|
15
|
-
import { JsonSchema7ObjectType } from "./parsers/object.js";
|
|
16
|
-
import { JsonSchema7RecordType } from "./parsers/record.js";
|
|
17
|
-
import { JsonSchema7SetType } from "./parsers/set.js";
|
|
18
|
-
import { JsonSchema7StringType } from "./parsers/string.js";
|
|
19
|
-
import { JsonSchema7TupleType } from "./parsers/tuple.js";
|
|
20
|
-
import { JsonSchema7UndefinedType } from "./parsers/undefined.js";
|
|
21
|
-
import { JsonSchema7UnionType } from "./parsers/union.js";
|
|
22
|
-
import { JsonSchema7UnknownType } from "./parsers/unknown.js";
|
|
23
|
-
type JsonSchema7RefType = {
|
|
24
|
-
$ref: string;
|
|
25
|
-
};
|
|
26
|
-
type JsonSchema7Meta = {
|
|
27
|
-
title?: string;
|
|
28
|
-
default?: any;
|
|
29
|
-
description?: string;
|
|
30
|
-
markdownDescription?: string;
|
|
31
|
-
};
|
|
32
|
-
export type JsonSchema7TypeUnion = JsonSchema7StringType | JsonSchema7ArrayType | JsonSchema7NumberType | JsonSchema7BigintType | JsonSchema7BooleanType | JsonSchema7DateType | JsonSchema7EnumType | JsonSchema7LiteralType | JsonSchema7NativeEnumType | JsonSchema7NullType | JsonSchema7NumberType | JsonSchema7ObjectType | JsonSchema7RecordType | JsonSchema7TupleType | JsonSchema7UnionType | JsonSchema7UndefinedType | JsonSchema7RefType | JsonSchema7NeverType | JsonSchema7MapType | JsonSchema7AnyType | JsonSchema7NullableType | JsonSchema7AllOfType | JsonSchema7UnknownType | JsonSchema7SetType;
|
|
33
|
-
export type JsonSchema7Type = JsonSchema7TypeUnion & JsonSchema7Meta;
|
|
34
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ZodArrayDef } from "zod/v3";
|
|
2
|
-
import { ErrorMessages } from "../errorMessages.js";
|
|
3
|
-
import { JsonSchema7Type } from "../parseTypes.js";
|
|
4
|
-
import { Refs } from "../Refs.js";
|
|
5
|
-
export type JsonSchema7ArrayType = {
|
|
6
|
-
type: "array";
|
|
7
|
-
items?: JsonSchema7Type;
|
|
8
|
-
minItems?: number;
|
|
9
|
-
maxItems?: number;
|
|
10
|
-
errorMessages?: ErrorMessages<JsonSchema7ArrayType, "items">;
|
|
11
|
-
};
|
|
12
|
-
export declare function parseArrayDef(def: ZodArrayDef, refs: Refs): JsonSchema7ArrayType;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ZodBigIntDef } from "zod/v3";
|
|
2
|
-
import { Refs } from "../Refs.js";
|
|
3
|
-
import { ErrorMessages } from "../errorMessages.js";
|
|
4
|
-
export type JsonSchema7BigintType = {
|
|
5
|
-
type: "integer";
|
|
6
|
-
format: "int64";
|
|
7
|
-
minimum?: BigInt;
|
|
8
|
-
exclusiveMinimum?: BigInt;
|
|
9
|
-
maximum?: BigInt;
|
|
10
|
-
exclusiveMaximum?: BigInt;
|
|
11
|
-
multipleOf?: BigInt;
|
|
12
|
-
errorMessage?: ErrorMessages<JsonSchema7BigintType>;
|
|
13
|
-
};
|
|
14
|
-
export declare function parseBigintDef(def: ZodBigIntDef, refs: Refs): JsonSchema7BigintType;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ZodDateDef } from "zod/v3";
|
|
2
|
-
import { Refs } from "../Refs.js";
|
|
3
|
-
import { ErrorMessages } from "../errorMessages.js";
|
|
4
|
-
import { JsonSchema7NumberType } from "./number.js";
|
|
5
|
-
import { DateStrategy } from "../Options.js";
|
|
6
|
-
export type JsonSchema7DateType = {
|
|
7
|
-
type: "integer" | "string";
|
|
8
|
-
format: "unix-time" | "date-time" | "date";
|
|
9
|
-
minimum?: number;
|
|
10
|
-
maximum?: number;
|
|
11
|
-
errorMessage?: ErrorMessages<JsonSchema7NumberType>;
|
|
12
|
-
} | {
|
|
13
|
-
anyOf: JsonSchema7DateType[];
|
|
14
|
-
};
|
|
15
|
-
export declare function parseDateDef(def: ZodDateDef, refs: Refs, overrideDateStrategy?: DateStrategy): JsonSchema7DateType;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ZodIntersectionDef } from "zod/v3";
|
|
2
|
-
import { JsonSchema7Type } from "../parseTypes.js";
|
|
3
|
-
import { Refs } from "../Refs.js";
|
|
4
|
-
export type JsonSchema7AllOfType = {
|
|
5
|
-
allOf: JsonSchema7Type[];
|
|
6
|
-
unevaluatedProperties?: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare function parseIntersectionDef(def: ZodIntersectionDef, refs: Refs): JsonSchema7AllOfType | JsonSchema7Type | undefined;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ZodLiteralDef } from "zod/v3";
|
|
2
|
-
import { Refs } from "../Refs.js";
|
|
3
|
-
export type JsonSchema7LiteralType = {
|
|
4
|
-
type: "string" | "number" | "integer" | "boolean";
|
|
5
|
-
const: string | number | boolean;
|
|
6
|
-
} | {
|
|
7
|
-
type: "object" | "array";
|
|
8
|
-
};
|
|
9
|
-
export declare function parseLiteralDef(def: ZodLiteralDef, refs: Refs): JsonSchema7LiteralType;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ZodMapDef } from "zod/v3";
|
|
2
|
-
import { JsonSchema7Type } from "../parseTypes.js";
|
|
3
|
-
import { Refs } from "../Refs.js";
|
|
4
|
-
import { JsonSchema7RecordType } from "./record.js";
|
|
5
|
-
export type JsonSchema7MapType = {
|
|
6
|
-
type: "array";
|
|
7
|
-
maxItems: 125;
|
|
8
|
-
items: {
|
|
9
|
-
type: "array";
|
|
10
|
-
items: [JsonSchema7Type, JsonSchema7Type];
|
|
11
|
-
minItems: 2;
|
|
12
|
-
maxItems: 2;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export declare function parseMapDef(def: ZodMapDef, refs: Refs): JsonSchema7MapType | JsonSchema7RecordType;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ZodNullableDef } from "zod/v3";
|
|
2
|
-
import { JsonSchema7Type } from "../parseTypes.js";
|
|
3
|
-
import { Refs } from "../Refs.js";
|
|
4
|
-
import { JsonSchema7NullType } from "./null.js";
|
|
5
|
-
export type JsonSchema7NullableType = {
|
|
6
|
-
anyOf: [JsonSchema7Type, JsonSchema7NullType];
|
|
7
|
-
} | {
|
|
8
|
-
type: [string, "null"];
|
|
9
|
-
};
|
|
10
|
-
export declare function parseNullableDef(def: ZodNullableDef, refs: Refs): JsonSchema7NullableType | undefined;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ZodNumberDef } from "zod/v3";
|
|
2
|
-
import { ErrorMessages } from "../errorMessages.js";
|
|
3
|
-
import { Refs } from "../Refs.js";
|
|
4
|
-
export type JsonSchema7NumberType = {
|
|
5
|
-
type: "number" | "integer";
|
|
6
|
-
minimum?: number;
|
|
7
|
-
exclusiveMinimum?: number;
|
|
8
|
-
maximum?: number;
|
|
9
|
-
exclusiveMaximum?: number;
|
|
10
|
-
multipleOf?: number;
|
|
11
|
-
errorMessage?: ErrorMessages<JsonSchema7NumberType>;
|
|
12
|
-
};
|
|
13
|
-
export declare function parseNumberDef(def: ZodNumberDef, refs: Refs): JsonSchema7NumberType;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ZodObjectDef } from "zod/v3";
|
|
2
|
-
import { JsonSchema7Type } from "../parseTypes.js";
|
|
3
|
-
import { Refs } from "../Refs.js";
|
|
4
|
-
export type JsonSchema7ObjectType = {
|
|
5
|
-
type: "object";
|
|
6
|
-
properties: Record<string, JsonSchema7Type>;
|
|
7
|
-
additionalProperties?: boolean | JsonSchema7Type;
|
|
8
|
-
required?: string[];
|
|
9
|
-
};
|
|
10
|
-
export declare function parseObjectDef(def: ZodObjectDef, refs: Refs): JsonSchema7ObjectType;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ZodPipelineDef } from "zod/v3";
|
|
2
|
-
import { JsonSchema7Type } from "../parseTypes.js";
|
|
3
|
-
import { Refs } from "../Refs.js";
|
|
4
|
-
import { JsonSchema7AllOfType } from "./intersection.js";
|
|
5
|
-
export declare const parsePipelineDef: (def: ZodPipelineDef<any, any>, refs: Refs) => JsonSchema7AllOfType | JsonSchema7Type | undefined;
|