@tsed/platform-mcp 8.28.6 → 8.28.8

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.
Files changed (86) hide show
  1. package/lib/esm/index.js +0 -26
  2. package/lib/esm/utils/toZod.js +3 -2
  3. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  4. package/lib/types/fn/defineResource.d.ts +4 -4
  5. package/lib/types/index.d.ts +0 -26
  6. package/package.json +8 -7
  7. package/src/index.ts +0 -26
  8. package/src/utils/toZod.ts +4 -3
  9. package/lib/esm/utils/json-schema-to-zod/Types.js +0 -1
  10. package/lib/esm/utils/json-schema-to-zod/cli.js +0 -83
  11. package/lib/esm/utils/json-schema-to-zod/index.js +0 -25
  12. package/lib/esm/utils/json-schema-to-zod/jsonSchemaToZod.js +0 -52
  13. package/lib/esm/utils/json-schema-to-zod/parsers/parseAllOf.js +0 -43
  14. package/lib/esm/utils/json-schema-to-zod/parsers/parseAnyOf.js +0 -17
  15. package/lib/esm/utils/json-schema-to-zod/parsers/parseArray.js +0 -22
  16. package/lib/esm/utils/json-schema-to-zod/parsers/parseBoolean.js +0 -9
  17. package/lib/esm/utils/json-schema-to-zod/parsers/parseConst.js +0 -9
  18. package/lib/esm/utils/json-schema-to-zod/parsers/parseDefault.js +0 -9
  19. package/lib/esm/utils/json-schema-to-zod/parsers/parseEnum.js +0 -21
  20. package/lib/esm/utils/json-schema-to-zod/parsers/parseIfThenElse.js +0 -26
  21. package/lib/esm/utils/json-schema-to-zod/parsers/parseMultipleType.js +0 -10
  22. package/lib/esm/utils/json-schema-to-zod/parsers/parseNot.js +0 -13
  23. package/lib/esm/utils/json-schema-to-zod/parsers/parseNull.js +0 -9
  24. package/lib/esm/utils/json-schema-to-zod/parsers/parseNullable.js +0 -11
  25. package/lib/esm/utils/json-schema-to-zod/parsers/parseNumber.js +0 -52
  26. package/lib/esm/utils/json-schema-to-zod/parsers/parseObject.js +0 -177
  27. package/lib/esm/utils/json-schema-to-zod/parsers/parseOneOf.js +0 -40
  28. package/lib/esm/utils/json-schema-to-zod/parsers/parseSchema.js +0 -153
  29. package/lib/esm/utils/json-schema-to-zod/parsers/parseString.js +0 -63
  30. package/lib/esm/utils/json-schema-to-zod/utils/cliTools.js +0 -126
  31. package/lib/esm/utils/json-schema-to-zod/utils/half.js +0 -9
  32. package/lib/esm/utils/json-schema-to-zod/utils/jsdocs.js +0 -24
  33. package/lib/esm/utils/json-schema-to-zod/utils/omit.js +0 -12
  34. package/lib/esm/utils/json-schema-to-zod/utils/withMessage.js +0 -28
  35. package/lib/types/utils/json-schema-to-zod/Types.d.ts +0 -116
  36. package/lib/types/utils/json-schema-to-zod/cli.d.ts +0 -2
  37. package/lib/types/utils/json-schema-to-zod/index.d.ts +0 -25
  38. package/lib/types/utils/json-schema-to-zod/jsonSchemaToZod.d.ts +0 -11
  39. package/lib/types/utils/json-schema-to-zod/parsers/parseAllOf.d.ts +0 -10
  40. package/lib/types/utils/json-schema-to-zod/parsers/parseAnyOf.d.ts +0 -10
  41. package/lib/types/utils/json-schema-to-zod/parsers/parseArray.d.ts +0 -10
  42. package/lib/types/utils/json-schema-to-zod/parsers/parseBoolean.d.ts +0 -10
  43. package/lib/types/utils/json-schema-to-zod/parsers/parseConst.d.ts +0 -10
  44. package/lib/types/utils/json-schema-to-zod/parsers/parseDefault.d.ts +0 -8
  45. package/lib/types/utils/json-schema-to-zod/parsers/parseEnum.d.ts +0 -10
  46. package/lib/types/utils/json-schema-to-zod/parsers/parseIfThenElse.d.ts +0 -12
  47. package/lib/types/utils/json-schema-to-zod/parsers/parseMultipleType.d.ts +0 -10
  48. package/lib/types/utils/json-schema-to-zod/parsers/parseNot.d.ts +0 -10
  49. package/lib/types/utils/json-schema-to-zod/parsers/parseNull.d.ts +0 -10
  50. package/lib/types/utils/json-schema-to-zod/parsers/parseNullable.d.ts +0 -10
  51. package/lib/types/utils/json-schema-to-zod/parsers/parseNumber.d.ts +0 -10
  52. package/lib/types/utils/json-schema-to-zod/parsers/parseObject.d.ts +0 -10
  53. package/lib/types/utils/json-schema-to-zod/parsers/parseOneOf.d.ts +0 -10
  54. package/lib/types/utils/json-schema-to-zod/parsers/parseSchema.d.ts +0 -61
  55. package/lib/types/utils/json-schema-to-zod/parsers/parseString.d.ts +0 -10
  56. package/lib/types/utils/json-schema-to-zod/utils/cliTools.d.ts +0 -67
  57. package/lib/types/utils/json-schema-to-zod/utils/half.d.ts +0 -7
  58. package/lib/types/utils/json-schema-to-zod/utils/jsdocs.d.ts +0 -15
  59. package/lib/types/utils/json-schema-to-zod/utils/omit.d.ts +0 -7
  60. package/lib/types/utils/json-schema-to-zod/utils/withMessage.d.ts +0 -19
  61. package/src/utils/json-schema-to-zod/Types.ts +0 -123
  62. package/src/utils/json-schema-to-zod/cli.ts +0 -88
  63. package/src/utils/json-schema-to-zod/index.ts +0 -26
  64. package/src/utils/json-schema-to-zod/jsonSchemaToZod.ts +0 -60
  65. package/src/utils/json-schema-to-zod/parsers/parseAllOf.ts +0 -50
  66. package/src/utils/json-schema-to-zod/parsers/parseAnyOf.ts +0 -19
  67. package/src/utils/json-schema-to-zod/parsers/parseArray.ts +0 -28
  68. package/src/utils/json-schema-to-zod/parsers/parseBoolean.ts +0 -11
  69. package/src/utils/json-schema-to-zod/parsers/parseConst.ts +0 -11
  70. package/src/utils/json-schema-to-zod/parsers/parseDefault.ts +0 -11
  71. package/src/utils/json-schema-to-zod/parsers/parseEnum.ts +0 -20
  72. package/src/utils/json-schema-to-zod/parsers/parseIfThenElse.ts +0 -35
  73. package/src/utils/json-schema-to-zod/parsers/parseMultipleType.ts +0 -12
  74. package/src/utils/json-schema-to-zod/parsers/parseNot.ts +0 -15
  75. package/src/utils/json-schema-to-zod/parsers/parseNull.ts +0 -11
  76. package/src/utils/json-schema-to-zod/parsers/parseNullable.ts +0 -13
  77. package/src/utils/json-schema-to-zod/parsers/parseNumber.ts +0 -56
  78. package/src/utils/json-schema-to-zod/parsers/parseObject.ts +0 -220
  79. package/src/utils/json-schema-to-zod/parsers/parseOneOf.ts +0 -44
  80. package/src/utils/json-schema-to-zod/parsers/parseSchema.ts +0 -190
  81. package/src/utils/json-schema-to-zod/parsers/parseString.ts +0 -73
  82. package/src/utils/json-schema-to-zod/utils/cliTools.ts +0 -189
  83. package/src/utils/json-schema-to-zod/utils/half.ts +0 -9
  84. package/src/utils/json-schema-to-zod/utils/jsdocs.ts +0 -29
  85. package/src/utils/json-schema-to-zod/utils/omit.ts +0 -14
  86. package/src/utils/json-schema-to-zod/utils/withMessage.ts +0 -42
@@ -1,116 +0,0 @@
1
- /**
2
- * JSON-compatible shape preserved when translating between schemas.
3
- *
4
- * @module platform/mcp
5
- * @since 8.17.0
6
- */
7
- export type Serializable = {
8
- [key: string]: Serializable;
9
- } | Serializable[] | string | number | boolean | null;
10
- /**
11
- * Minimal JSON Schema representation supported by the conversion utilities.
12
- *
13
- * @module platform/mcp
14
- * @since 8.17.0
15
- */
16
- export type JsonSchema = JsonSchemaObject | boolean;
17
- /**
18
- * Object-based JSON Schema node with permissive indexing for vendor keywords.
19
- *
20
- * @module platform/mcp
21
- * @since 8.17.0
22
- */
23
- export type JsonSchemaObject = {
24
- type?: string | string[];
25
- properties?: {
26
- [key: string]: JsonSchema;
27
- };
28
- additionalProperties?: JsonSchema;
29
- unevaluatedProperties?: JsonSchema;
30
- patternProperties?: {
31
- [key: string]: JsonSchema;
32
- };
33
- minProperties?: number;
34
- maxProperties?: number;
35
- required?: string[] | boolean;
36
- propertyNames?: JsonSchema;
37
- items?: JsonSchema | JsonSchema[];
38
- additionalItems?: JsonSchema;
39
- minItems?: number;
40
- maxItems?: number;
41
- uniqueItems?: boolean;
42
- minLength?: number;
43
- maxLength?: number;
44
- pattern?: string;
45
- format?: string;
46
- minimum?: number;
47
- maximum?: number;
48
- exclusiveMinimum?: number | boolean;
49
- exclusiveMaximum?: number | boolean;
50
- multipleOf?: number;
51
- anyOf?: JsonSchema[];
52
- allOf?: JsonSchema[];
53
- oneOf?: JsonSchema[];
54
- if?: JsonSchema;
55
- then?: JsonSchema;
56
- else?: JsonSchema;
57
- const?: Serializable;
58
- enum?: Serializable[];
59
- errorMessage?: {
60
- [key: string]: string | undefined;
61
- };
62
- } & {
63
- [key: string]: any;
64
- };
65
- /**
66
- * Function signature used to pick the correct parser for a JSON Schema node.
67
- *
68
- * @module platform/mcp
69
- * @since 8.17.0
70
- */
71
- export type ParserSelector = (schema: JsonSchemaObject, refs: Refs) => string;
72
- /**
73
- * Optional hook that allows callers to override parsing logic for specific nodes.
74
- *
75
- * @module platform/mcp
76
- * @since 8.17.0
77
- */
78
- export type ParserOverride = (schema: JsonSchemaObject, refs: Refs) => string | void;
79
- /**
80
- * Supported Zod major versions targeted by the generator.
81
- *
82
- * @module platform/mcp
83
- * @since 8.17.0
84
- */
85
- export type ZodVersion = 3 | 4;
86
- /**
87
- * Options accepted by {@link jsonSchemaToZod} and downstream helpers.
88
- *
89
- * @module platform/mcp
90
- * @since 8.17.0
91
- */
92
- export type Options = {
93
- name?: string;
94
- module?: "cjs" | "esm" | "none";
95
- withoutDefaults?: boolean;
96
- withoutDescribes?: boolean;
97
- withJsdocs?: boolean;
98
- parserOverride?: ParserOverride;
99
- depth?: number;
100
- type?: boolean | string;
101
- noImport?: boolean;
102
- zodVersion?: ZodVersion;
103
- };
104
- /**
105
- * Internal reference tracker used during recursive parsing.
106
- *
107
- * @module platform/mcp
108
- * @since 8.17.0
109
- */
110
- export type Refs = Options & {
111
- path: (string | number)[];
112
- seen: Map<object | boolean, {
113
- n: number;
114
- r: string | undefined;
115
- }>;
116
- };
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,25 +0,0 @@
1
- export * from "./jsonSchemaToZod.js";
2
- export * from "./parsers/parseAllOf.js";
3
- export * from "./parsers/parseAnyOf.js";
4
- export * from "./parsers/parseArray.js";
5
- export * from "./parsers/parseBoolean.js";
6
- export * from "./parsers/parseConst.js";
7
- export * from "./parsers/parseDefault.js";
8
- export * from "./parsers/parseEnum.js";
9
- export * from "./parsers/parseIfThenElse.js";
10
- export * from "./parsers/parseMultipleType.js";
11
- export * from "./parsers/parseNot.js";
12
- export * from "./parsers/parseNull.js";
13
- export * from "./parsers/parseNullable.js";
14
- export * from "./parsers/parseNumber.js";
15
- export * from "./parsers/parseObject.js";
16
- export * from "./parsers/parseOneOf.js";
17
- export * from "./parsers/parseSchema.js";
18
- export * from "./parsers/parseString.js";
19
- export * from "./Types.js";
20
- export * from "./utils/half.js";
21
- export * from "./utils/jsdocs.js";
22
- export * from "./utils/omit.js";
23
- export * from "./utils/withMessage.js";
24
- import { jsonSchemaToZod } from "./jsonSchemaToZod.js";
25
- export default jsonSchemaToZod;
@@ -1,11 +0,0 @@
1
- import { JsonSchema, Options } from "./Types.js";
2
- /**
3
- * Generates Zod code from a JSON Schema, optionally targeting specific module systems and versions.
4
- *
5
- * @param schema JSON Schema definition to translate.
6
- * @param options Generation options such as module format, naming, and version targets.
7
- * @returns A string of executable JavaScript/TypeScript that constructs an equivalent Zod schema.
8
- * @module platform/mcp
9
- * @since 8.17.0
10
- */
11
- export declare const jsonSchemaToZod: (schema: JsonSchema, { module, name, type, noImport, zodVersion, ...rest }?: Options) => string;
@@ -1,10 +0,0 @@
1
- import { JsonSchema, JsonSchemaObject, Refs } from "../Types.js";
2
- /**
3
- * Parses an `allOf` schema by intersecting all child schemas, preserving evaluation order for accurate metadata.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare function parseAllOf(schema: JsonSchemaObject & {
9
- allOf: JsonSchema[];
10
- }, refs: Refs): string;
@@ -1,10 +0,0 @@
1
- import { JsonSchema, JsonSchemaObject, Refs } from "../Types.js";
2
- /**
3
- * Parses an `anyOf` node into a Zod union across all nested schemas.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const parseAnyOf: (schema: JsonSchemaObject & {
9
- anyOf: JsonSchema[];
10
- }, refs: Refs) => string;
@@ -1,10 +0,0 @@
1
- import { JsonSchemaObject, Refs } from "../Types.js";
2
- /**
3
- * Parses array schemas into the appropriate tuple or array expressions with validation hints.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const parseArray: (schema: JsonSchemaObject & {
9
- type: "array";
10
- }, refs: Refs) => string;
@@ -1,10 +0,0 @@
1
- import { JsonSchemaObject } from "../Types.js";
2
- /**
3
- * Parses boolean schemas into `z.boolean()`.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const parseBoolean: (_schema: JsonSchemaObject & {
9
- type: "boolean";
10
- }) => string;
@@ -1,10 +0,0 @@
1
- import { JsonSchemaObject, Serializable } from "../Types.js";
2
- /**
3
- * Parses constant schemas into `z.literal` expressions.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const parseConst: (schema: JsonSchemaObject & {
9
- const: Serializable;
10
- }) => string;
@@ -1,8 +0,0 @@
1
- import { JsonSchemaObject } from "../Types.js";
2
- /**
3
- * Fallback parser that maps unknown structures to `z.any()`.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const parseDefault: (_schema: JsonSchemaObject) => string;
@@ -1,10 +0,0 @@
1
- import { JsonSchemaObject, Serializable } from "../Types.js";
2
- /**
3
- * Parses enum schemas into either `z.enum` or unions of literals depending on value types.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const parseEnum: (schema: JsonSchemaObject & {
9
- enum: Serializable[];
10
- }) => string;
@@ -1,12 +0,0 @@
1
- import { JsonSchema, JsonSchemaObject, Refs } from "../Types.js";
2
- /**
3
- * Parses conditional schemas by generating union refinements that evaluate `if/then/else` logic at runtime.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const parseIfThenElse: (schema: JsonSchemaObject & {
9
- if: JsonSchema;
10
- then: JsonSchema;
11
- else: JsonSchema;
12
- }, refs: Refs) => string;
@@ -1,10 +0,0 @@
1
- import { JsonSchemaObject, Refs } from "../Types.js";
2
- /**
3
- * Parses schemas whose `type` keyword is an array, creating a union of each primitive variant.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const parseMultipleType: (schema: JsonSchemaObject & {
9
- type: string[];
10
- }, refs: Refs) => string;
@@ -1,10 +0,0 @@
1
- import { JsonSchema, JsonSchemaObject, Refs } from "../Types.js";
2
- /**
3
- * Parses the `not` keyword into a refinement that fails when the nested schema succeeds.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const parseNot: (schema: JsonSchemaObject & {
9
- not: JsonSchema;
10
- }, refs: Refs) => string;
@@ -1,10 +0,0 @@
1
- import { JsonSchemaObject } from "../Types.js";
2
- /**
3
- * Parses `type: null` nodes into `z.null()`.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const parseNull: (_schema: JsonSchemaObject & {
9
- type: "null";
10
- }) => string;
@@ -1,10 +0,0 @@
1
- import { JsonSchemaObject, Refs } from "../Types.js";
2
- /**
3
- * Handles OpenAPI-style `nullable` keywords by delegating to the underlying schema and marking it nullable.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const parseNullable: (schema: JsonSchemaObject & {
9
- nullable: true;
10
- }, refs: Refs) => string;
@@ -1,10 +0,0 @@
1
- import { JsonSchemaObject } from "../Types.js";
2
- /**
3
- * Parses numeric schemas, emitting integer formats and range constraints as chained Zod modifiers.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const parseNumber: (schema: JsonSchemaObject & {
9
- type: "number" | "integer";
10
- }) => string;
@@ -1,10 +0,0 @@
1
- import { JsonSchemaObject, Refs } from "../Types.js";
2
- /**
3
- * Parses object schemas, wiring properties, patternProperties, and catchall behavior into the resulting Zod object.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare function parseObject(objectSchema: JsonSchemaObject & {
9
- type: "object";
10
- }, refs: Refs): string;
@@ -1,10 +0,0 @@
1
- import { JsonSchema, JsonSchemaObject, Refs } from "../Types.js";
2
- /**
3
- * Parses `oneOf` schemas by generating super refinements that ensure exactly one child schema matches.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const parseOneOf: (schema: JsonSchemaObject & {
9
- oneOf: JsonSchema[];
10
- }, refs: Refs) => string;
@@ -1,61 +0,0 @@
1
- import { JsonSchema, JsonSchemaObject, Refs, Serializable } from "../Types.js";
2
- /**
3
- * Recursively parses a JSON Schema node into a Zod expression string.
4
- *
5
- * @param schema JSON Schema node to inspect.
6
- * @param refs Shared parsing context and options.
7
- * @param blockMeta When true, skips describe/default annotations for nested invocations.
8
- * @module platform/mcp
9
- * @since 8.17.0
10
- */
11
- export declare const parseSchema: (schema: JsonSchema, refs?: Refs, blockMeta?: boolean) => string;
12
- /**
13
- * Type guards used by the schema parser to detect structural patterns.
14
- *
15
- * @module platform/mcp
16
- * @since 8.17.0
17
- */
18
- export declare const its: {
19
- an: {
20
- object: (x: JsonSchemaObject) => x is JsonSchemaObject & {
21
- type: "object";
22
- };
23
- array: (x: JsonSchemaObject) => x is JsonSchemaObject & {
24
- type: "array";
25
- };
26
- anyOf: (x: JsonSchemaObject) => x is JsonSchemaObject & {
27
- anyOf: JsonSchema[];
28
- };
29
- allOf: (x: JsonSchemaObject) => x is JsonSchemaObject & {
30
- allOf: JsonSchema[];
31
- };
32
- enum: (x: JsonSchemaObject) => x is JsonSchemaObject & {
33
- enum: Serializable | Serializable[];
34
- };
35
- };
36
- a: {
37
- nullable: (x: JsonSchemaObject) => x is JsonSchemaObject & {
38
- nullable: true;
39
- };
40
- multipleType: (x: JsonSchemaObject) => x is JsonSchemaObject & {
41
- type: string[];
42
- };
43
- not: (x: JsonSchemaObject) => x is JsonSchemaObject & {
44
- not: JsonSchema;
45
- };
46
- const: (x: JsonSchemaObject) => x is JsonSchemaObject & {
47
- const: Serializable;
48
- };
49
- primitive: <T extends "string" | "number" | "integer" | "boolean" | "null">(x: JsonSchemaObject, p: T) => x is JsonSchemaObject & {
50
- type: T;
51
- };
52
- conditional: (x: JsonSchemaObject) => x is JsonSchemaObject & {
53
- if: JsonSchema;
54
- then: JsonSchema;
55
- else: JsonSchema;
56
- };
57
- oneOf: (x: JsonSchemaObject) => x is JsonSchemaObject & {
58
- oneOf: JsonSchema[];
59
- };
60
- };
61
- };
@@ -1,10 +0,0 @@
1
- import { JsonSchemaObject } from "../Types.js";
2
- /**
3
- * Parses string schemas, supporting format-specific helpers, regex constraints, and content media transformations.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const parseString: (schema: JsonSchemaObject & {
9
- type: "string";
10
- }) => string;
@@ -1,67 +0,0 @@
1
- /**
2
- * CLI parameter definition consumed by {@link parseArgs}.
3
- *
4
- * @module platform/mcp
5
- * @since 8.17.0
6
- */
7
- export type Param = {
8
- shorthand?: string;
9
- description?: string;
10
- required?: boolean | string | undefined;
11
- } & ({
12
- value?: "boolean";
13
- } | {
14
- value: "number";
15
- } | {
16
- value: "string";
17
- } | {
18
- value: {
19
- [key: number]: string;
20
- };
21
- });
22
- /**
23
- * Map of CLI parameter definitions.
24
- *
25
- * @module platform/mcp
26
- * @since 8.17.0
27
- */
28
- export type Params = {
29
- [name: string]: Param;
30
- };
31
- type InferReturnType<T extends Params> = {
32
- [name in keyof T]: (T[name]["value"] extends "number" ? number : T[name]["value"] extends "string" ? string : T[name]["value"] extends {
33
- [key: number]: string;
34
- } ? T[name]["value"][number] : T[name]["value"] extends never ? boolean : boolean) | (T[name]["required"] extends string | true ? never : undefined);
35
- };
36
- /**
37
- * Lightweight CLI arg parser honoring shorthands, type coercion, and required flags.
38
- *
39
- * @param params Parameter metadata map.
40
- * @param args Argument vector (usually `process.argv`).
41
- * @param help Optional help flag description; when provided, `-h/--help` prints usage.
42
- * @module platform/mcp
43
- * @since 8.17.0
44
- */
45
- export declare function parseArgs<T extends Params>(params: T, args: string[], help?: boolean | string): InferReturnType<T>;
46
- /**
47
- * Parses inline JSON or reads JSON from a file path (auto-detected by stat).
48
- *
49
- * @module platform/mcp
50
- * @since 8.17.0
51
- */
52
- export declare function parseOrReadJSON(jsonOrPath: string): unknown;
53
- /**
54
- * Reads piped stdin into a UTF-8 string.
55
- *
56
- * @module platform/mcp
57
- * @since 8.17.0
58
- */
59
- export declare function readPipe(): Promise<string>;
60
- /**
61
- * Prints a simple help table describing available CLI parameters.
62
- *
63
- * @module platform/mcp
64
- * @since 8.17.0
65
- */
66
- export declare function printParams(params: Record<string, Param>): void;
67
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * Splits an array in half, returning the left and right segments.
3
- *
4
- * @module platform/mcp
5
- * @since 8.17.0
6
- */
7
- export declare const half: <T>(arr: T[]) => [T[], T[]];
@@ -1,15 +0,0 @@
1
- import { JsonSchemaObject } from "../Types.js";
2
- /**
3
- * Expands a description string into a formatted JSDoc block suitable for emitted code.
4
- *
5
- * @module platform/mcp
6
- * @since 8.17.0
7
- */
8
- export declare const expandJsdocs: (jsdocs: string) => string;
9
- /**
10
- * Adds inline JSDoc to a parsed snippet when the source schema exposes a description.
11
- *
12
- * @module platform/mcp
13
- * @since 8.17.0
14
- */
15
- export declare const addJsdocs: (schema: JsonSchemaObject, parsed: string) => string;
@@ -1,7 +0,0 @@
1
- /**
2
- * Returns a shallow copy of an object without the provided keys.
3
- *
4
- * @module platform/mcp
5
- * @since 8.17.0
6
- */
7
- export declare const omit: <T extends object, K extends keyof T>(obj: T, ...keys: K[]) => Omit<T, K>;
@@ -1,19 +0,0 @@
1
- import { JsonSchemaObject } from "../Types.js";
2
- type Opener = string;
3
- type MessagePrefix = string;
4
- type Closer = string;
5
- type Builder = [Opener, Closer] | [Opener, MessagePrefix, Closer];
6
- /**
7
- * Utility that appends chained Zod calls while preserving custom error messages defined on the JSON Schema node.
8
- *
9
- * @param schema Schema containing potential validation keywords.
10
- * @param key Keyword to inspect (e.g., `minLength`).
11
- * @param get Builder that returns the string fragments to append.
12
- * @module platform/mcp
13
- * @since 8.17.0
14
- */
15
- export declare function withMessage(schema: JsonSchemaObject, key: string, get: (props: {
16
- value: unknown;
17
- json: string;
18
- }) => Builder | void): string;
19
- export {};
@@ -1,123 +0,0 @@
1
- /**
2
- * JSON-compatible shape preserved when translating between schemas.
3
- *
4
- * @module platform/mcp
5
- * @since 8.17.0
6
- */
7
- export type Serializable = {[key: string]: Serializable} | Serializable[] | string | number | boolean | null;
8
-
9
- /**
10
- * Minimal JSON Schema representation supported by the conversion utilities.
11
- *
12
- * @module platform/mcp
13
- * @since 8.17.0
14
- */
15
- export type JsonSchema = JsonSchemaObject | boolean;
16
- /**
17
- * Object-based JSON Schema node with permissive indexing for vendor keywords.
18
- *
19
- * @module platform/mcp
20
- * @since 8.17.0
21
- */
22
- export type JsonSchemaObject = {
23
- // left permissive by design
24
- type?: string | string[];
25
-
26
- // object
27
- properties?: {[key: string]: JsonSchema};
28
- additionalProperties?: JsonSchema;
29
- unevaluatedProperties?: JsonSchema;
30
- patternProperties?: {[key: string]: JsonSchema};
31
- minProperties?: number;
32
- maxProperties?: number;
33
- required?: string[] | boolean;
34
- propertyNames?: JsonSchema;
35
-
36
- // array
37
- items?: JsonSchema | JsonSchema[];
38
- additionalItems?: JsonSchema;
39
- minItems?: number;
40
- maxItems?: number;
41
- uniqueItems?: boolean;
42
-
43
- // string
44
- minLength?: number;
45
- maxLength?: number;
46
- pattern?: string;
47
- format?: string;
48
-
49
- // number
50
- minimum?: number;
51
- maximum?: number;
52
- exclusiveMinimum?: number | boolean;
53
- exclusiveMaximum?: number | boolean;
54
- multipleOf?: number;
55
-
56
- // unions
57
- anyOf?: JsonSchema[];
58
- allOf?: JsonSchema[];
59
- oneOf?: JsonSchema[];
60
-
61
- if?: JsonSchema;
62
- then?: JsonSchema;
63
- else?: JsonSchema;
64
-
65
- // shared
66
- const?: Serializable;
67
- enum?: Serializable[];
68
-
69
- errorMessage?: {[key: string]: string | undefined};
70
- } & {[key: string]: any};
71
-
72
- /**
73
- * Function signature used to pick the correct parser for a JSON Schema node.
74
- *
75
- * @module platform/mcp
76
- * @since 8.17.0
77
- */
78
- export type ParserSelector = (schema: JsonSchemaObject, refs: Refs) => string;
79
- /**
80
- * Optional hook that allows callers to override parsing logic for specific nodes.
81
- *
82
- * @module platform/mcp
83
- * @since 8.17.0
84
- */
85
- export type ParserOverride = (schema: JsonSchemaObject, refs: Refs) => string | void;
86
-
87
- /**
88
- * Supported Zod major versions targeted by the generator.
89
- *
90
- * @module platform/mcp
91
- * @since 8.17.0
92
- */
93
- export type ZodVersion = 3 | 4;
94
-
95
- /**
96
- * Options accepted by {@link jsonSchemaToZod} and downstream helpers.
97
- *
98
- * @module platform/mcp
99
- * @since 8.17.0
100
- */
101
- export type Options = {
102
- name?: string;
103
- module?: "cjs" | "esm" | "none";
104
- withoutDefaults?: boolean;
105
- withoutDescribes?: boolean;
106
- withJsdocs?: boolean;
107
- parserOverride?: ParserOverride;
108
- depth?: number;
109
- type?: boolean | string;
110
- noImport?: boolean;
111
- zodVersion?: ZodVersion;
112
- };
113
-
114
- /**
115
- * Internal reference tracker used during recursive parsing.
116
- *
117
- * @module platform/mcp
118
- * @since 8.17.0
119
- */
120
- export type Refs = Options & {
121
- path: (string | number)[];
122
- seen: Map<object | boolean, {n: number; r: string | undefined}>;
123
- };