@ray-js/robot-data-stream 0.0.14 → 0.0.15-beta.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/lib/mqtt/createCommonOptions.d.ts +4 -2
- package/lib/mqtt/createCommonOptions.js +10 -5
- package/lib/mqtt/hooks/useStructuredMessage.d.ts +14 -0
- package/lib/mqtt/hooks/useStructuredMessage.js +131 -0
- package/lib/mqtt/mqttProvider.d.ts +19 -1
- package/lib/mqtt/mqttProvider.js +69 -8
- package/lib/mqtt/promise.d.ts +57 -4
- package/lib/mqtt/promise.js +115 -36
- package/lib/mqtt/type/fun.d.ts +49 -0
- package/lib/mqtt/type/fun.js +145 -0
- package/lib/mqtt/type/index.d.ts +0 -7
- package/lib/mqtt/type/index.js +0 -1
- package/lib/mqtt/type/protocols/base.d.ts +5 -0
- package/lib/mqtt/type/protocols/base.js +32 -0
- package/lib/mqtt/type/protocols/carpetCleanProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/carpetCleanProtocol.js +16 -0
- package/lib/mqtt/type/protocols/carpetProtocol.d.ts +41 -0
- package/lib/mqtt/type/protocols/carpetProtocol.js +202 -0
- package/lib/mqtt/type/protocols/devInfoProtocol.d.ts +5 -0
- package/lib/mqtt/type/protocols/devInfoProtocol.js +12 -0
- package/lib/mqtt/type/protocols/deviceModelProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/deviceModelProtocol.js +34 -0
- package/lib/mqtt/type/protocols/furnitureModelProtocol.d.ts +10 -0
- package/lib/mqtt/type/protocols/furnitureModelProtocol.js +35 -0
- package/lib/mqtt/type/protocols/historyMapProtocol.d.ts +17 -0
- package/lib/mqtt/type/protocols/historyMapProtocol.js +37 -0
- package/lib/mqtt/type/protocols/index.d.ts +20 -0
- package/lib/mqtt/type/protocols/index.js +20 -0
- package/lib/mqtt/type/protocols/partDivisionProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/partDivisionProtocol.js +12 -0
- package/lib/mqtt/type/protocols/partMergeProtocol.d.ts +7 -0
- package/lib/mqtt/type/protocols/partMergeProtocol.js +12 -0
- package/lib/mqtt/type/protocols/passwordProtocol.d.ts +11 -0
- package/lib/mqtt/type/protocols/passwordProtocol.js +25 -0
- package/lib/mqtt/type/protocols/quietHoursProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/quietHoursProtocol.js +35 -0
- package/lib/mqtt/type/protocols/resetMapProtocol.d.ts +4 -0
- package/lib/mqtt/type/protocols/resetMapProtocol.js +1 -0
- package/lib/mqtt/type/protocols/roomPropertyProtocol.d.ts +14 -0
- package/lib/mqtt/type/protocols/roomPropertyProtocol.js +113 -0
- package/lib/mqtt/type/protocols/scheduleProtocol.d.ts +18 -0
- package/lib/mqtt/type/protocols/scheduleProtocol.js +100 -0
- package/lib/mqtt/type/protocols/selectRoomCleanProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/selectRoomCleanProtocol.js +40 -0
- package/lib/mqtt/type/protocols/spotCleanProtocol.d.ts +9 -0
- package/lib/mqtt/type/protocols/spotCleanProtocol.js +72 -0
- package/lib/mqtt/type/protocols/virtualAreaProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/virtualAreaProtocol.js +36 -0
- package/lib/mqtt/type/protocols/virtualWallProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/virtualWallProtocol.js +25 -0
- package/lib/mqtt/type/protocols/voiceProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/voiceProtocol.js +23 -0
- package/lib/mqtt/type/protocols/wifiMapProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/wifiMapProtocol.js +14 -0
- package/lib/mqtt/type/protocols/zoneCleanProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/zoneCleanProtocol.js +49 -0
- package/lib/mqtt/useCarpet.d.ts +7 -67
- package/lib/mqtt/useCarpet.js +101 -181
- package/lib/mqtt/useCarpetClean.d.ts +2 -11
- package/lib/mqtt/useCarpetClean.js +24 -51
- package/lib/mqtt/useDevInfo.d.ts +8 -6
- package/lib/mqtt/useDevInfo.js +44 -36
- package/lib/mqtt/useDeviceModel.d.ts +6 -19
- package/lib/mqtt/useDeviceModel.js +29 -42
- package/lib/mqtt/useFurnitureModel.d.ts +6 -18
- package/lib/mqtt/useFurnitureModel.js +29 -43
- package/lib/mqtt/useHistoryMap.d.ts +2 -18
- package/lib/mqtt/useHistoryMap.js +102 -119
- package/lib/mqtt/usePartDivision.d.ts +2 -9
- package/lib/mqtt/usePartDivision.js +48 -57
- package/lib/mqtt/usePartMerge.d.ts +2 -8
- package/lib/mqtt/usePartMerge.js +34 -49
- package/lib/mqtt/usePassword.d.ts +6 -13
- package/lib/mqtt/usePassword.js +84 -74
- package/lib/mqtt/useQuiteHours.d.ts +4 -37
- package/lib/mqtt/useQuiteHours.js +66 -100
- package/lib/mqtt/useResetMap.d.ts +2 -8
- package/lib/mqtt/useResetMap.js +27 -34
- package/lib/mqtt/useRoomProperty.d.ts +8 -9
- package/lib/mqtt/useRoomProperty.js +67 -65
- package/lib/mqtt/useSchedule.d.ts +3 -23
- package/lib/mqtt/useSchedule.js +72 -101
- package/lib/mqtt/useSelectRoomClean.d.ts +3 -24
- package/lib/mqtt/useSelectRoomClean.js +107 -133
- package/lib/mqtt/useSpotClean.d.ts +5 -15
- package/lib/mqtt/useSpotClean.js +68 -121
- package/lib/mqtt/useVirtualArea.d.ts +6 -17
- package/lib/mqtt/useVirtualArea.js +109 -119
- package/lib/mqtt/useVirtualWall.d.ts +2 -18
- package/lib/mqtt/useVirtualWall.js +69 -90
- package/lib/mqtt/useVoice.d.ts +2 -16
- package/lib/mqtt/useVoice.js +48 -68
- package/lib/mqtt/useWifiMap.d.ts +6 -5
- package/lib/mqtt/useWifiMap.js +43 -42
- package/lib/mqtt/useZoneClean.d.ts +2 -21
- package/lib/mqtt/useZoneClean.js +125 -137
- package/lib/myLib/zod/mini/index.d.cts +1 -0
- package/lib/myLib/zod/mini/index.d.ts +1 -0
- package/lib/myLib/zod/mini/index.js +1 -0
- package/lib/myLib/zod/mini/package.json +6 -0
- package/lib/myLib/zod/src/mini/index.d.ts +1 -0
- package/lib/myLib/zod/src/mini/index.js +1 -0
- package/lib/myLib/zod/src/v4/core/api.d.ts +306 -0
- package/lib/myLib/zod/src/v4/core/api.js +1256 -0
- package/lib/myLib/zod/src/v4/core/checks.d.ts +278 -0
- package/lib/myLib/zod/src/v4/core/checks.js +816 -0
- package/lib/myLib/zod/src/v4/core/config.d.ts +9 -0
- package/lib/myLib/zod/src/v4/core/config.js +5 -0
- package/lib/myLib/zod/src/v4/core/core.d.ts +70 -0
- package/lib/myLib/zod/src/v4/core/core.js +95 -0
- package/lib/myLib/zod/src/v4/core/doc.d.ts +14 -0
- package/lib/myLib/zod/src/v4/core/doc.js +42 -0
- package/lib/myLib/zod/src/v4/core/errors.d.ts +220 -0
- package/lib/myLib/zod/src/v4/core/errors.js +232 -0
- package/lib/myLib/zod/src/v4/core/index.d.ts +15 -0
- package/lib/myLib/zod/src/v4/core/index.js +15 -0
- package/lib/myLib/zod/src/v4/core/json-schema-generator.d.ts +65 -0
- package/lib/myLib/zod/src/v4/core/json-schema-generator.js +120 -0
- package/lib/myLib/zod/src/v4/core/json-schema-processors.d.ts +49 -0
- package/lib/myLib/zod/src/v4/core/json-schema-processors.js +593 -0
- package/lib/myLib/zod/src/v4/core/json-schema.d.ts +88 -0
- package/lib/myLib/zod/src/v4/core/json-schema.js +1 -0
- package/lib/myLib/zod/src/v4/core/parse.d.ts +49 -0
- package/lib/myLib/zod/src/v4/core/parse.js +147 -0
- package/lib/myLib/zod/src/v4/core/regexes.d.ts +78 -0
- package/lib/myLib/zod/src/v4/core/regexes.js +146 -0
- package/lib/myLib/zod/src/v4/core/registries.d.ts +35 -0
- package/lib/myLib/zod/src/v4/core/registries.js +51 -0
- package/lib/myLib/zod/src/v4/core/schemas.d.ts +1136 -0
- package/lib/myLib/zod/src/v4/core/schemas.js +2745 -0
- package/lib/myLib/zod/src/v4/core/standard-schema.d.ts +126 -0
- package/lib/myLib/zod/src/v4/core/standard-schema.js +1 -0
- package/lib/myLib/zod/src/v4/core/to-json-schema.d.ts +114 -0
- package/lib/myLib/zod/src/v4/core/to-json-schema.js +488 -0
- package/lib/myLib/zod/src/v4/core/util.d.ts +199 -0
- package/lib/myLib/zod/src/v4/core/util.js +656 -0
- package/lib/myLib/zod/src/v4/core/versions.d.ts +5 -0
- package/lib/myLib/zod/src/v4/core/versions.js +5 -0
- package/lib/myLib/zod/src/v4/core/zsf.d.ts +91 -0
- package/lib/myLib/zod/src/v4/core/zsf.js +1 -0
- package/lib/myLib/zod/src/v4/mini/checks.d.ts +1 -0
- package/lib/myLib/zod/src/v4/mini/checks.js +1 -0
- package/lib/myLib/zod/src/v4/mini/coerce.d.ts +7 -0
- package/lib/myLib/zod/src/v4/mini/coerce.js +27 -0
- package/lib/myLib/zod/src/v4/mini/external.d.ts +11 -0
- package/lib/myLib/zod/src/v4/mini/external.js +16 -0
- package/lib/myLib/zod/src/v4/mini/index.d.ts +3 -0
- package/lib/myLib/zod/src/v4/mini/index.js +3 -0
- package/lib/myLib/zod/src/v4/mini/iso.d.ts +22 -0
- package/lib/myLib/zod/src/v4/mini/iso.js +46 -0
- package/lib/myLib/zod/src/v4/mini/parse.d.ts +1 -0
- package/lib/myLib/zod/src/v4/mini/parse.js +1 -0
- package/lib/myLib/zod/src/v4/mini/schemas.js +1244 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +2 -1
- package/package.json +5 -3
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/** The Standard interface. */
|
|
2
|
+
export interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
3
|
+
/** The Standard properties. */
|
|
4
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
5
|
+
}
|
|
6
|
+
export declare namespace StandardTypedV1 {
|
|
7
|
+
/** The Standard properties interface. */
|
|
8
|
+
interface Props<Input = unknown, Output = Input> {
|
|
9
|
+
/** The version number of the standard. */
|
|
10
|
+
readonly version: 1;
|
|
11
|
+
/** The vendor name of the schema library. */
|
|
12
|
+
readonly vendor: string;
|
|
13
|
+
/** Inferred types associated with the schema. */
|
|
14
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
15
|
+
}
|
|
16
|
+
/** The Standard types interface. */
|
|
17
|
+
interface Types<Input = unknown, Output = Input> {
|
|
18
|
+
/** The input type of the schema. */
|
|
19
|
+
readonly input: Input;
|
|
20
|
+
/** The output type of the schema. */
|
|
21
|
+
readonly output: Output;
|
|
22
|
+
}
|
|
23
|
+
/** Infers the input type of a Standard. */
|
|
24
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
25
|
+
/** Infers the output type of a Standard. */
|
|
26
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
27
|
+
}
|
|
28
|
+
/** The Standard Schema interface. */
|
|
29
|
+
export interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
30
|
+
/** The Standard Schema properties. */
|
|
31
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
32
|
+
}
|
|
33
|
+
export declare namespace StandardSchemaV1 {
|
|
34
|
+
/** The Standard Schema properties interface. */
|
|
35
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
36
|
+
/** Validates unknown input values. */
|
|
37
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
38
|
+
}
|
|
39
|
+
/** The result interface of the validate function. */
|
|
40
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
41
|
+
/** The result interface if validation succeeds. */
|
|
42
|
+
interface SuccessResult<Output> {
|
|
43
|
+
/** The typed output value. */
|
|
44
|
+
readonly value: Output;
|
|
45
|
+
/** The absence of issues indicates success. */
|
|
46
|
+
readonly issues?: undefined;
|
|
47
|
+
}
|
|
48
|
+
interface Options {
|
|
49
|
+
/** Implicit support for additional vendor-specific parameters, if needed. */
|
|
50
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
51
|
+
}
|
|
52
|
+
/** The result interface if validation fails. */
|
|
53
|
+
interface FailureResult {
|
|
54
|
+
/** The issues of failed validation. */
|
|
55
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
56
|
+
}
|
|
57
|
+
/** The issue interface of the failure output. */
|
|
58
|
+
interface Issue {
|
|
59
|
+
/** The error message of the issue. */
|
|
60
|
+
readonly message: string;
|
|
61
|
+
/** The path of the issue, if any. */
|
|
62
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
63
|
+
}
|
|
64
|
+
/** The path segment interface of the issue. */
|
|
65
|
+
interface PathSegment {
|
|
66
|
+
/** The key representing a path segment. */
|
|
67
|
+
readonly key: PropertyKey;
|
|
68
|
+
}
|
|
69
|
+
/** The Standard types interface. */
|
|
70
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {
|
|
71
|
+
}
|
|
72
|
+
/** Infers the input type of a Standard. */
|
|
73
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
74
|
+
/** Infers the output type of a Standard. */
|
|
75
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
76
|
+
}
|
|
77
|
+
/** The Standard JSON Schema interface. */
|
|
78
|
+
export interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
|
|
79
|
+
/** The Standard JSON Schema properties. */
|
|
80
|
+
readonly "~standard": StandardJSONSchemaV1.Props<Input, Output>;
|
|
81
|
+
}
|
|
82
|
+
export declare namespace StandardJSONSchemaV1 {
|
|
83
|
+
/** The Standard JSON Schema properties interface. */
|
|
84
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
85
|
+
/** Methods for generating the input/output JSON Schema. */
|
|
86
|
+
readonly jsonSchema: Converter;
|
|
87
|
+
}
|
|
88
|
+
/** The Standard JSON Schema converter interface. */
|
|
89
|
+
interface Converter {
|
|
90
|
+
/** Converts the input type to JSON Schema. May throw if conversion is not supported. */
|
|
91
|
+
readonly input: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
|
|
92
|
+
/** Converts the output type to JSON Schema. May throw if conversion is not supported. */
|
|
93
|
+
readonly output: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
|
|
94
|
+
}
|
|
95
|
+
/** The target version of the generated JSON Schema.
|
|
96
|
+
*
|
|
97
|
+
* It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use.
|
|
98
|
+
*
|
|
99
|
+
* The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`.
|
|
100
|
+
*
|
|
101
|
+
* All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target.
|
|
102
|
+
*/
|
|
103
|
+
type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string);
|
|
104
|
+
/** The options for the input/output methods. */
|
|
105
|
+
interface Options {
|
|
106
|
+
/** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */
|
|
107
|
+
readonly target: Target;
|
|
108
|
+
/** Implicit support for additional vendor-specific parameters, if needed. */
|
|
109
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
110
|
+
}
|
|
111
|
+
/** The Standard types interface. */
|
|
112
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {
|
|
113
|
+
}
|
|
114
|
+
/** Infers the input type of a Standard. */
|
|
115
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
116
|
+
/** Infers the output type of a Standard. */
|
|
117
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
118
|
+
}
|
|
119
|
+
export interface StandardSchemaWithJSONProps<Input = unknown, Output = Input> extends StandardSchemaV1.Props<Input, Output>, StandardJSONSchemaV1.Props<Input, Output> {
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* An interface that combines StandardJSONSchema and StandardSchema.
|
|
123
|
+
*/
|
|
124
|
+
export interface StandardSchemaWithJSON<Input = unknown, Output = Input> {
|
|
125
|
+
"~standard": StandardSchemaWithJSONProps<Input, Output>;
|
|
126
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type * as core from "./index.js";
|
|
2
|
+
import type * as JSONSchema from "./json-schema.js";
|
|
3
|
+
import { type $ZodRegistry } from "./registries.js";
|
|
4
|
+
import type * as schemas from "./schemas.js";
|
|
5
|
+
import type { StandardJSONSchemaV1, StandardSchemaWithJSONProps } from "./standard-schema.js";
|
|
6
|
+
export type Processor<T extends schemas.$ZodType = schemas.$ZodType> = (schema: T, ctx: ToJSONSchemaContext, json: JSONSchema.BaseSchema, params: ProcessParams) => void;
|
|
7
|
+
export interface JSONSchemaGeneratorParams {
|
|
8
|
+
processors: Record<string, Processor>;
|
|
9
|
+
/** A registry used to look up metadata for each schema. Any schema with an `id` property will be extracted as a $def.
|
|
10
|
+
* @default globalRegistry */
|
|
11
|
+
metadata?: $ZodRegistry<Record<string, any>>;
|
|
12
|
+
/** The JSON Schema version to target.
|
|
13
|
+
* - `"draft-2020-12"` — Default. JSON Schema Draft 2020-12
|
|
14
|
+
* - `"draft-07"` — JSON Schema Draft 7
|
|
15
|
+
* - `"draft-04"` — JSON Schema Draft 4
|
|
16
|
+
* - `"openapi-3.0"` — OpenAPI 3.0 Schema Object */
|
|
17
|
+
target?: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string) | undefined;
|
|
18
|
+
/** How to handle unrepresentable types.
|
|
19
|
+
* - `"throw"` — Default. Unrepresentable types throw an error
|
|
20
|
+
* - `"any"` — Unrepresentable types become `{}` */
|
|
21
|
+
unrepresentable?: "throw" | "any";
|
|
22
|
+
/** Arbitrary custom logic that can be used to modify the generated JSON Schema. */
|
|
23
|
+
override?: (ctx: {
|
|
24
|
+
zodSchema: schemas.$ZodTypes;
|
|
25
|
+
jsonSchema: JSONSchema.BaseSchema;
|
|
26
|
+
path: (string | number)[];
|
|
27
|
+
}) => void;
|
|
28
|
+
/** Whether to extract the `"input"` or `"output"` type. Relevant to transforms, defaults, coerced primitives, etc.
|
|
29
|
+
* - `"output"` — Default. Convert the output schema.
|
|
30
|
+
* - `"input"` — Convert the input schema. */
|
|
31
|
+
io?: "input" | "output";
|
|
32
|
+
cycles?: "ref" | "throw";
|
|
33
|
+
reused?: "ref" | "inline";
|
|
34
|
+
external?: {
|
|
35
|
+
registry: $ZodRegistry<{
|
|
36
|
+
id?: string | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
uri?: ((id: string) => string) | undefined;
|
|
39
|
+
defs: Record<string, JSONSchema.BaseSchema>;
|
|
40
|
+
} | undefined;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Parameters for the toJSONSchema function.
|
|
44
|
+
*/
|
|
45
|
+
export type ToJSONSchemaParams = Omit<JSONSchemaGeneratorParams, "processors" | "external">;
|
|
46
|
+
/**
|
|
47
|
+
* Parameters for the toJSONSchema function when passing a registry.
|
|
48
|
+
*/
|
|
49
|
+
export interface RegistryToJSONSchemaParams extends ToJSONSchemaParams {
|
|
50
|
+
uri?: (id: string) => string;
|
|
51
|
+
}
|
|
52
|
+
export interface ProcessParams {
|
|
53
|
+
schemaPath: schemas.$ZodType[];
|
|
54
|
+
path: (string | number)[];
|
|
55
|
+
}
|
|
56
|
+
export interface Seen {
|
|
57
|
+
/** JSON Schema result for this Zod schema */
|
|
58
|
+
schema: JSONSchema.BaseSchema;
|
|
59
|
+
/** A cached version of the schema that doesn't get overwritten during ref resolution */
|
|
60
|
+
def?: JSONSchema.BaseSchema;
|
|
61
|
+
defId?: string | undefined;
|
|
62
|
+
/** Number of times this schema was encountered during traversal */
|
|
63
|
+
count: number;
|
|
64
|
+
/** Cycle path */
|
|
65
|
+
cycle?: (string | number)[] | undefined;
|
|
66
|
+
isParent?: boolean | undefined;
|
|
67
|
+
/** Schema to inherit JSON Schema properties from (set by processor for wrappers) */
|
|
68
|
+
ref?: schemas.$ZodType | null;
|
|
69
|
+
/** JSON Schema property path for this schema */
|
|
70
|
+
path?: (string | number)[] | undefined;
|
|
71
|
+
}
|
|
72
|
+
export interface ToJSONSchemaContext {
|
|
73
|
+
processors: Record<string, Processor>;
|
|
74
|
+
metadataRegistry: $ZodRegistry<Record<string, any>>;
|
|
75
|
+
target: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string);
|
|
76
|
+
unrepresentable: "throw" | "any";
|
|
77
|
+
override: (ctx: {
|
|
78
|
+
zodSchema: schemas.$ZodType;
|
|
79
|
+
jsonSchema: JSONSchema.BaseSchema;
|
|
80
|
+
path: (string | number)[];
|
|
81
|
+
}) => void;
|
|
82
|
+
io: "input" | "output";
|
|
83
|
+
counter: number;
|
|
84
|
+
seen: Map<schemas.$ZodType, Seen>;
|
|
85
|
+
cycles: "ref" | "throw";
|
|
86
|
+
reused: "ref" | "inline";
|
|
87
|
+
external?: {
|
|
88
|
+
registry: $ZodRegistry<{
|
|
89
|
+
id?: string | undefined;
|
|
90
|
+
}>;
|
|
91
|
+
uri?: ((id: string) => string) | undefined;
|
|
92
|
+
defs: Record<string, JSONSchema.BaseSchema>;
|
|
93
|
+
} | undefined;
|
|
94
|
+
}
|
|
95
|
+
export declare function initializeContext(params: JSONSchemaGeneratorParams): ToJSONSchemaContext;
|
|
96
|
+
export declare function process<T extends schemas.$ZodType>(schema: T, ctx: ToJSONSchemaContext, _params?: ProcessParams): JSONSchema.BaseSchema;
|
|
97
|
+
export declare function extractDefs<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): void;
|
|
98
|
+
export declare function finalize<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): ZodStandardJSONSchemaPayload<T>;
|
|
99
|
+
export type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<core.input<T>, core.output<T>>;
|
|
100
|
+
export interface ZodStandardJSONSchemaPayload<T> extends JSONSchema.BaseSchema {
|
|
101
|
+
"~standard": ZodStandardSchemaWithJSON<T>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Creates a toJSONSchema method for a schema instance.
|
|
105
|
+
* This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
|
|
106
|
+
*/
|
|
107
|
+
export declare const createToJSONSchemaMethod: <T extends core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>(schema: T, processors?: Record<string, Processor>) => (params?: ToJSONSchemaParams) => core.ZodStandardJSONSchemaPayload<T>;
|
|
108
|
+
/**
|
|
109
|
+
* Creates a toJSONSchema method for a schema instance.
|
|
110
|
+
* This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
|
|
111
|
+
*/
|
|
112
|
+
type StandardJSONSchemaMethodParams = Parameters<StandardJSONSchemaV1["~standard"]["jsonSchema"]["input"]>[0];
|
|
113
|
+
export declare const createStandardJSONSchemaMethod: <T extends core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>(schema: T, io: "input" | "output", processors?: Record<string, Processor>) => (params?: StandardJSONSchemaMethodParams) => JSONSchema.BaseSchema;
|
|
114
|
+
export {};
|