@kaito-http/core 3.1.0 → 3.1.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.
@@ -1,282 +0,0 @@
1
- import { SchemaObject, ReferenceObject } from 'openapi3-ts/oas31';
2
-
3
- type JSONPrimitive = string | number | boolean | null;
4
- type JSONValue = JSONPrimitive | JSONValue[] | {
5
- [key: string]: JSONValue;
6
- };
7
- interface BaseSchemaDef<Input extends JSONValue> {
8
- example?: Input | undefined;
9
- description?: string | undefined;
10
- }
11
- interface Issue {
12
- message: string;
13
- path: string[];
14
- }
15
- type ParseResult<T> = {
16
- success: true;
17
- result: T;
18
- } | {
19
- success: false;
20
- issues: Set<Issue>;
21
- };
22
- declare class SchemaError extends Error {
23
- readonly issues: Set<Issue>;
24
- constructor(issues: Set<Issue>);
25
- }
26
- declare class ParseContext {
27
- #private;
28
- private static readonly ISSUE;
29
- readonly ISSUE: typeof ParseContext.ISSUE;
30
- addIssue(message: string, path: string[]): typeof ParseContext.ISSUE;
31
- addIssues(issues: Iterable<Issue>, path: string[]): typeof ParseContext.ISSUE;
32
- get issues(): Set<Issue>;
33
- static result<T>(fn: (ctx: ParseContext) => T | typeof ParseContext.ISSUE): ParseResult<T>;
34
- static with<T>(fn: (ctx: ParseContext) => T | typeof ParseContext.ISSUE): {
35
- type: "FATAL";
36
- issues: Set<Issue>;
37
- result?: never;
38
- } | {
39
- type: "PARSED";
40
- issues: Set<Issue>;
41
- result: T;
42
- };
43
- }
44
- type AnySchemaFor<T extends JSONValue> = BaseSchema<T, T, BaseSchemaDef<T>>;
45
- declare abstract class BaseSchema<Input extends JSONValue, Output, Def extends BaseSchemaDef<Input>> {
46
- /** @internal */
47
- readonly _input: Input;
48
- /** @internal */
49
- readonly _output: Output;
50
- abstract parse(json: unknown): Output;
51
- abstract parseSafe(json: unknown): ParseResult<Output>;
52
- abstract serialize(value: Output): Input;
53
- abstract toOpenAPI(): SchemaObject | ReferenceObject;
54
- protected readonly def: Def;
55
- protected clone(def: Partial<Def>): this;
56
- protected constructor(def: Def);
57
- example(example: Input): this;
58
- example(): Input | undefined;
59
- description(description: string): this;
60
- description(): string | undefined;
61
- }
62
- type Check<T extends string, P extends {} = {}> = {
63
- type: T;
64
- message?: string | undefined;
65
- } & Omit<P, 'message'>;
66
- type StringFormat = 'date' | 'date-time' | 'password' | 'byte' | 'binary' | 'email' | 'uuid' | 'uri' | 'hostname' | 'ipv4' | 'ipv6';
67
- declare const STRING_FORMAT_REGEXES: {
68
- readonly uuid: RegExp;
69
- readonly email: RegExp;
70
- readonly ipv4: RegExp;
71
- readonly ipv6: RegExp;
72
- readonly date: RegExp;
73
- readonly uri: RegExp;
74
- readonly hostname: RegExp;
75
- };
76
- interface StringChecks {
77
- min?: Check<'min', {
78
- val: number;
79
- }>;
80
- max?: Check<'max', {
81
- val: number;
82
- }>;
83
- regex?: Check<'regex', {
84
- regex: RegExp;
85
- }>;
86
- format?: Check<'format', {
87
- format: StringFormat;
88
- }>;
89
- }
90
- interface StringDef extends BaseSchemaDef<string>, StringChecks {
91
- }
92
- declare class KString extends BaseSchema<string, string, StringDef> {
93
- static create: () => KString;
94
- serialize(value: string): string;
95
- private setCheck;
96
- toOpenAPI(): SchemaObject | ReferenceObject;
97
- /**
98
- * Sets the minimum length of the string
99
- *
100
- * @param min The minimum length of the string
101
- * @returns A clone of the schema with the minimum length set
102
- */
103
- max(min: number, message?: string): this;
104
- /**
105
- * Sets the maximum length of the string
106
- *
107
- * @param max The maximum length of the string
108
- * @returns A clone of the schema with the maximum length set
109
- */
110
- min(max: number, message?: string): this;
111
- regex(regex: RegExp, message?: string): this;
112
- private format;
113
- uri(message?: string): this;
114
- /**
115
- * Deprecated because OpenAPI uses the term "uri"
116
- * but this method exists for making migration from
117
- * Zod easier.
118
- *
119
- * @deprecated Use {@link uri} instead
120
- */
121
- url(message?: string): this;
122
- email(message?: string): this;
123
- uuid(message?: string): this;
124
- ipv4(message?: string): this;
125
- ipv6(message?: string): this;
126
- date(message?: string): this;
127
- dateTime(message?: string): this;
128
- password(message?: string): this;
129
- byte(message?: string): this;
130
- binary(message?: string): this;
131
- hostname(message?: string): this;
132
- parseSafe(json: unknown): ParseResult<string>;
133
- parse(json: unknown): string;
134
- }
135
- type NumberFormat = 'float' | 'double' | 'int32' | 'int64';
136
- interface NumberChecks {
137
- min?: Check<'min', {
138
- val: number;
139
- }>;
140
- max?: Check<'max', {
141
- val: number;
142
- }>;
143
- integer?: Check<'integer'>;
144
- multipleOf?: Check<'multipleOf', {
145
- val: number;
146
- }>;
147
- format?: Check<'format', {
148
- format: NumberFormat;
149
- }>;
150
- }
151
- interface NumberDef extends BaseSchemaDef<number>, NumberChecks {
152
- }
153
- declare class KNumber extends BaseSchema<number, number, NumberDef> {
154
- static create: () => KNumber;
155
- serialize(value: number): number;
156
- private setCheck;
157
- toOpenAPI(): SchemaObject | ReferenceObject;
158
- min(min: number): this;
159
- max(max: number): this;
160
- integer(): this;
161
- multipleOf(multipleOf: number): this;
162
- float(): this;
163
- double(): this;
164
- int32(): this;
165
- int64(): this;
166
- parseSafe(json: unknown): ParseResult<number>;
167
- parse(json: unknown): number;
168
- }
169
- interface BooleanDef extends BaseSchemaDef<boolean> {
170
- }
171
- declare class KBoolean extends BaseSchema<boolean, boolean, BooleanDef> {
172
- static create: () => KBoolean;
173
- serialize(value: boolean): boolean;
174
- toOpenAPI(): SchemaObject | ReferenceObject;
175
- parseSafe(json: unknown): ParseResult<boolean>;
176
- parse(json: unknown): boolean;
177
- }
178
- interface ArrayChecks {
179
- minItems?: Check<'minItems', {
180
- val: number;
181
- }>;
182
- maxItems?: Check<'maxItems', {
183
- val: number;
184
- }>;
185
- uniqueItems?: Check<'uniqueItems', {
186
- val: boolean;
187
- }>;
188
- }
189
- interface ArrayDef<Input extends JSONValue, Output> extends BaseSchemaDef<Input[]>, ArrayChecks {
190
- items: BaseSchema<Input, Output, BaseSchemaDef<Input>>;
191
- }
192
- declare class KArray<Input extends JSONValue, Output> extends BaseSchema<Input[], Output[], ArrayDef<Input, Output>> {
193
- static create: <ItemsInput extends JSONValue, ItemsOutput, Def extends BaseSchemaDef<ItemsInput>>(items: BaseSchema<ItemsInput, ItemsOutput, Def>) => KArray<ItemsInput, ItemsOutput>;
194
- serialize(value: Output[]): Input[];
195
- private setCheck;
196
- toOpenAPI(): SchemaObject | ReferenceObject;
197
- min(minItems: number): this;
198
- max(maxItems: number): this;
199
- unique(): this;
200
- notUnique(): this;
201
- parseSafe(json: unknown): ParseResult<Output[]>;
202
- parse(json: unknown): Output[];
203
- }
204
- interface NullDef extends BaseSchemaDef<null> {
205
- }
206
- declare class KNull extends BaseSchema<null, null, NullDef> {
207
- static create: () => KNull;
208
- serialize(value: null): null;
209
- toOpenAPI(): SchemaObject | ReferenceObject;
210
- parseSafe(json: unknown): ParseResult<null>;
211
- parse(json: unknown): null;
212
- }
213
- interface ObjectDef<Input extends Record<keyof Output, JSONValue>, Output extends Record<keyof Input, JSONValue>> extends BaseSchemaDef<Input> {
214
- shape: {
215
- [K in keyof Input]: BaseSchema<Input[K], Output[K], BaseSchemaDef<Input[K]>>;
216
- };
217
- }
218
- declare class KObject<Input extends Record<keyof Output, JSONValue>, Output extends Record<keyof Input, JSONValue>> extends BaseSchema<Input, Output, ObjectDef<Input, Output>> {
219
- static create: <Input_1 extends Record<keyof Output_1, JSONValue>, Output_1 extends Record<keyof Input_1, JSONValue>>(shape: { [K in keyof Input_1 | keyof Output_1]: BaseSchema<Input_1[K], Output_1[K], BaseSchemaDef<Input_1[K]>>; }) => KObject<Input_1, Output_1>;
220
- serialize(value: Output): Input;
221
- toOpenAPI(): SchemaObject;
222
- parseSafe(json: unknown): ParseResult<Output>;
223
- parse(json: unknown): Output;
224
- get shape(): { [K in keyof Input]: BaseSchema<Input[K], Output[K], BaseSchemaDef<Input[K]>>; };
225
- }
226
- interface RefDef<Input extends Record<keyof Output, JSONValue>, Output extends Record<keyof Input, JSONValue>> extends ObjectDef<Input, Output> {
227
- name: string;
228
- summary?: string | undefined;
229
- }
230
- declare class KRef<Input extends Record<keyof Output, JSONValue>, Output extends Record<keyof Input, JSONValue>> extends BaseSchema<Input, Output, RefDef<Input, Output>> {
231
- static create: <Input_1 extends Record<keyof Output_1, JSONValue>, Output_1 extends Record<keyof Input_1, JSONValue>>(name: string, shape: { [K in keyof Input_1 | keyof Output_1]: BaseSchema<Input_1[K], Output_1[K], BaseSchemaDef<Input_1[K]>>; }) => KRef<Input_1, Output_1>;
232
- serialize(value: Output): Input;
233
- toOpenAPI(): ReferenceObject;
234
- parseSafe(json: unknown): ParseResult<Output>;
235
- parse(json: unknown): Output;
236
- summary(): string | undefined;
237
- summary(summary: string): this;
238
- get shape(): { [K in keyof Input]: BaseSchema<Input[K], Output[K], BaseSchemaDef<Input[K]>>; };
239
- get name(): string;
240
- }
241
- interface ScalarOptions<ClientRepresentation extends JSONPrimitive, ServerRepresentation> {
242
- schema: BaseSchema<ClientRepresentation, ClientRepresentation, BaseSchemaDef<ClientRepresentation>>;
243
- toServer: (jsonValue: ClientRepresentation) => ServerRepresentation;
244
- toClient: (clientValue: ServerRepresentation) => ClientRepresentation;
245
- }
246
- interface ScalarDef<ClientRepresentation extends JSONPrimitive, ServerRepresentation> extends BaseSchemaDef<ClientRepresentation>, ScalarOptions<ClientRepresentation, ServerRepresentation> {
247
- }
248
- declare class KScalar<ClientRepresentation extends JSONPrimitive, ServerRepresentation> extends BaseSchema<ClientRepresentation, ServerRepresentation, ScalarDef<ClientRepresentation, ServerRepresentation>> {
249
- static create: <ClientRepresentation_1 extends JSONPrimitive, ServerRepresentation_1>(options: ScalarOptions<ClientRepresentation_1, ServerRepresentation_1>) => KScalar<ClientRepresentation_1, ServerRepresentation_1>;
250
- constructor(def: ScalarDef<ClientRepresentation, ServerRepresentation>);
251
- serialize(value: ServerRepresentation): ClientRepresentation;
252
- toOpenAPI(): SchemaObject | ReferenceObject;
253
- parseSafe(json: unknown): ParseResult<ServerRepresentation>;
254
- parse(json: unknown): ServerRepresentation;
255
- }
256
- interface UnionDef<Input extends JSONValue, Output> extends BaseSchemaDef<Input> {
257
- items: [
258
- a: BaseSchema<Input, Output, BaseSchemaDef<Input>>,
259
- b: BaseSchema<Input, Output, BaseSchemaDef<Input>>,
260
- ...remaining: BaseSchema<Input, Output, BaseSchemaDef<Input>>[]
261
- ];
262
- }
263
- declare class KUnion<Input extends JSONValue, Output> extends BaseSchema<Input, Output, UnionDef<Input, Output>> {
264
- static create: <Items extends [a: BaseSchema<JSONValue, unknown, BaseSchemaDef<JSONValue>>, b: BaseSchema<JSONValue, unknown, BaseSchemaDef<JSONValue>>, ...remaining: BaseSchema<JSONValue, unknown, BaseSchemaDef<JSONValue>>[]]>(items: Items) => KUnion<Items[number]["_input"], Items[number]["_output"]>;
265
- serialize(value: Output): Input;
266
- toOpenAPI(): SchemaObject | ReferenceObject;
267
- parseSafe(json: unknown): ParseResult<Output>;
268
- parse(json: unknown): Output;
269
- }
270
- declare const k: {
271
- string: () => KString;
272
- number: () => KNumber;
273
- boolean: () => KBoolean;
274
- array: <ItemsInput extends JSONValue, ItemsOutput, Def extends BaseSchemaDef<ItemsInput>>(items: BaseSchema<ItemsInput, ItemsOutput, Def>) => KArray<ItemsInput, ItemsOutput>;
275
- null: () => KNull;
276
- ref: <Input extends Record<keyof Output, JSONValue>, Output extends Record<keyof Input, JSONValue>>(name: string, shape: { [K in keyof Input | keyof Output]: BaseSchema<Input[K], Output[K], BaseSchemaDef<Input[K]>>; }) => KRef<Input, Output>;
277
- object: <Input extends Record<keyof Output, JSONValue>, Output extends Record<keyof Input, JSONValue>>(shape: { [K in keyof Input | keyof Output]: BaseSchema<Input[K], Output[K], BaseSchemaDef<Input[K]>>; }) => KObject<Input, Output>;
278
- scalar: <ClientRepresentation extends JSONPrimitive, ServerRepresentation>(options: ScalarOptions<ClientRepresentation, ServerRepresentation>) => KScalar<ClientRepresentation, ServerRepresentation>;
279
- union: <Items extends [a: BaseSchema<JSONValue, unknown, BaseSchemaDef<JSONValue>>, b: BaseSchema<JSONValue, unknown, BaseSchemaDef<JSONValue>>, ...remaining: BaseSchema<JSONValue, unknown, BaseSchemaDef<JSONValue>>[]]>(items: Items) => KUnion<Items[number]["_input"], Items[number]["_output"]>;
280
- };
281
-
282
- export { type AnySchemaFor, type ArrayChecks, type ArrayDef, BaseSchema, type BaseSchemaDef, type BooleanDef, type Issue, type JSONPrimitive, type JSONValue, KArray, KBoolean, KNull, KNumber, KObject, KRef, KScalar, KString, KUnion, type NullDef, type NumberChecks, type NumberDef, type NumberFormat, type ObjectDef, ParseContext, type ParseResult, type RefDef, STRING_FORMAT_REGEXES, type ScalarDef, type ScalarOptions, SchemaError, type StringChecks, type StringDef, type StringFormat, type UnionDef, k };
@@ -1,282 +0,0 @@
1
- import { SchemaObject, ReferenceObject } from 'openapi3-ts/oas31';
2
-
3
- type JSONPrimitive = string | number | boolean | null;
4
- type JSONValue = JSONPrimitive | JSONValue[] | {
5
- [key: string]: JSONValue;
6
- };
7
- interface BaseSchemaDef<Input extends JSONValue> {
8
- example?: Input | undefined;
9
- description?: string | undefined;
10
- }
11
- interface Issue {
12
- message: string;
13
- path: string[];
14
- }
15
- type ParseResult<T> = {
16
- success: true;
17
- result: T;
18
- } | {
19
- success: false;
20
- issues: Set<Issue>;
21
- };
22
- declare class SchemaError extends Error {
23
- readonly issues: Set<Issue>;
24
- constructor(issues: Set<Issue>);
25
- }
26
- declare class ParseContext {
27
- #private;
28
- private static readonly ISSUE;
29
- readonly ISSUE: typeof ParseContext.ISSUE;
30
- addIssue(message: string, path: string[]): typeof ParseContext.ISSUE;
31
- addIssues(issues: Iterable<Issue>, path: string[]): typeof ParseContext.ISSUE;
32
- get issues(): Set<Issue>;
33
- static result<T>(fn: (ctx: ParseContext) => T | typeof ParseContext.ISSUE): ParseResult<T>;
34
- static with<T>(fn: (ctx: ParseContext) => T | typeof ParseContext.ISSUE): {
35
- type: "FATAL";
36
- issues: Set<Issue>;
37
- result?: never;
38
- } | {
39
- type: "PARSED";
40
- issues: Set<Issue>;
41
- result: T;
42
- };
43
- }
44
- type AnySchemaFor<T extends JSONValue> = BaseSchema<T, T, BaseSchemaDef<T>>;
45
- declare abstract class BaseSchema<Input extends JSONValue, Output, Def extends BaseSchemaDef<Input>> {
46
- /** @internal */
47
- readonly _input: Input;
48
- /** @internal */
49
- readonly _output: Output;
50
- abstract parse(json: unknown): Output;
51
- abstract parseSafe(json: unknown): ParseResult<Output>;
52
- abstract serialize(value: Output): Input;
53
- abstract toOpenAPI(): SchemaObject | ReferenceObject;
54
- protected readonly def: Def;
55
- protected clone(def: Partial<Def>): this;
56
- protected constructor(def: Def);
57
- example(example: Input): this;
58
- example(): Input | undefined;
59
- description(description: string): this;
60
- description(): string | undefined;
61
- }
62
- type Check<T extends string, P extends {} = {}> = {
63
- type: T;
64
- message?: string | undefined;
65
- } & Omit<P, 'message'>;
66
- type StringFormat = 'date' | 'date-time' | 'password' | 'byte' | 'binary' | 'email' | 'uuid' | 'uri' | 'hostname' | 'ipv4' | 'ipv6';
67
- declare const STRING_FORMAT_REGEXES: {
68
- readonly uuid: RegExp;
69
- readonly email: RegExp;
70
- readonly ipv4: RegExp;
71
- readonly ipv6: RegExp;
72
- readonly date: RegExp;
73
- readonly uri: RegExp;
74
- readonly hostname: RegExp;
75
- };
76
- interface StringChecks {
77
- min?: Check<'min', {
78
- val: number;
79
- }>;
80
- max?: Check<'max', {
81
- val: number;
82
- }>;
83
- regex?: Check<'regex', {
84
- regex: RegExp;
85
- }>;
86
- format?: Check<'format', {
87
- format: StringFormat;
88
- }>;
89
- }
90
- interface StringDef extends BaseSchemaDef<string>, StringChecks {
91
- }
92
- declare class KString extends BaseSchema<string, string, StringDef> {
93
- static create: () => KString;
94
- serialize(value: string): string;
95
- private setCheck;
96
- toOpenAPI(): SchemaObject | ReferenceObject;
97
- /**
98
- * Sets the minimum length of the string
99
- *
100
- * @param min The minimum length of the string
101
- * @returns A clone of the schema with the minimum length set
102
- */
103
- max(min: number, message?: string): this;
104
- /**
105
- * Sets the maximum length of the string
106
- *
107
- * @param max The maximum length of the string
108
- * @returns A clone of the schema with the maximum length set
109
- */
110
- min(max: number, message?: string): this;
111
- regex(regex: RegExp, message?: string): this;
112
- private format;
113
- uri(message?: string): this;
114
- /**
115
- * Deprecated because OpenAPI uses the term "uri"
116
- * but this method exists for making migration from
117
- * Zod easier.
118
- *
119
- * @deprecated Use {@link uri} instead
120
- */
121
- url(message?: string): this;
122
- email(message?: string): this;
123
- uuid(message?: string): this;
124
- ipv4(message?: string): this;
125
- ipv6(message?: string): this;
126
- date(message?: string): this;
127
- dateTime(message?: string): this;
128
- password(message?: string): this;
129
- byte(message?: string): this;
130
- binary(message?: string): this;
131
- hostname(message?: string): this;
132
- parseSafe(json: unknown): ParseResult<string>;
133
- parse(json: unknown): string;
134
- }
135
- type NumberFormat = 'float' | 'double' | 'int32' | 'int64';
136
- interface NumberChecks {
137
- min?: Check<'min', {
138
- val: number;
139
- }>;
140
- max?: Check<'max', {
141
- val: number;
142
- }>;
143
- integer?: Check<'integer'>;
144
- multipleOf?: Check<'multipleOf', {
145
- val: number;
146
- }>;
147
- format?: Check<'format', {
148
- format: NumberFormat;
149
- }>;
150
- }
151
- interface NumberDef extends BaseSchemaDef<number>, NumberChecks {
152
- }
153
- declare class KNumber extends BaseSchema<number, number, NumberDef> {
154
- static create: () => KNumber;
155
- serialize(value: number): number;
156
- private setCheck;
157
- toOpenAPI(): SchemaObject | ReferenceObject;
158
- min(min: number): this;
159
- max(max: number): this;
160
- integer(): this;
161
- multipleOf(multipleOf: number): this;
162
- float(): this;
163
- double(): this;
164
- int32(): this;
165
- int64(): this;
166
- parseSafe(json: unknown): ParseResult<number>;
167
- parse(json: unknown): number;
168
- }
169
- interface BooleanDef extends BaseSchemaDef<boolean> {
170
- }
171
- declare class KBoolean extends BaseSchema<boolean, boolean, BooleanDef> {
172
- static create: () => KBoolean;
173
- serialize(value: boolean): boolean;
174
- toOpenAPI(): SchemaObject | ReferenceObject;
175
- parseSafe(json: unknown): ParseResult<boolean>;
176
- parse(json: unknown): boolean;
177
- }
178
- interface ArrayChecks {
179
- minItems?: Check<'minItems', {
180
- val: number;
181
- }>;
182
- maxItems?: Check<'maxItems', {
183
- val: number;
184
- }>;
185
- uniqueItems?: Check<'uniqueItems', {
186
- val: boolean;
187
- }>;
188
- }
189
- interface ArrayDef<Input extends JSONValue, Output> extends BaseSchemaDef<Input[]>, ArrayChecks {
190
- items: BaseSchema<Input, Output, BaseSchemaDef<Input>>;
191
- }
192
- declare class KArray<Input extends JSONValue, Output> extends BaseSchema<Input[], Output[], ArrayDef<Input, Output>> {
193
- static create: <ItemsInput extends JSONValue, ItemsOutput, Def extends BaseSchemaDef<ItemsInput>>(items: BaseSchema<ItemsInput, ItemsOutput, Def>) => KArray<ItemsInput, ItemsOutput>;
194
- serialize(value: Output[]): Input[];
195
- private setCheck;
196
- toOpenAPI(): SchemaObject | ReferenceObject;
197
- min(minItems: number): this;
198
- max(maxItems: number): this;
199
- unique(): this;
200
- notUnique(): this;
201
- parseSafe(json: unknown): ParseResult<Output[]>;
202
- parse(json: unknown): Output[];
203
- }
204
- interface NullDef extends BaseSchemaDef<null> {
205
- }
206
- declare class KNull extends BaseSchema<null, null, NullDef> {
207
- static create: () => KNull;
208
- serialize(value: null): null;
209
- toOpenAPI(): SchemaObject | ReferenceObject;
210
- parseSafe(json: unknown): ParseResult<null>;
211
- parse(json: unknown): null;
212
- }
213
- interface ObjectDef<Input extends Record<keyof Output, JSONValue>, Output extends Record<keyof Input, JSONValue>> extends BaseSchemaDef<Input> {
214
- shape: {
215
- [K in keyof Input]: BaseSchema<Input[K], Output[K], BaseSchemaDef<Input[K]>>;
216
- };
217
- }
218
- declare class KObject<Input extends Record<keyof Output, JSONValue>, Output extends Record<keyof Input, JSONValue>> extends BaseSchema<Input, Output, ObjectDef<Input, Output>> {
219
- static create: <Input_1 extends Record<keyof Output_1, JSONValue>, Output_1 extends Record<keyof Input_1, JSONValue>>(shape: { [K in keyof Input_1 | keyof Output_1]: BaseSchema<Input_1[K], Output_1[K], BaseSchemaDef<Input_1[K]>>; }) => KObject<Input_1, Output_1>;
220
- serialize(value: Output): Input;
221
- toOpenAPI(): SchemaObject;
222
- parseSafe(json: unknown): ParseResult<Output>;
223
- parse(json: unknown): Output;
224
- get shape(): { [K in keyof Input]: BaseSchema<Input[K], Output[K], BaseSchemaDef<Input[K]>>; };
225
- }
226
- interface RefDef<Input extends Record<keyof Output, JSONValue>, Output extends Record<keyof Input, JSONValue>> extends ObjectDef<Input, Output> {
227
- name: string;
228
- summary?: string | undefined;
229
- }
230
- declare class KRef<Input extends Record<keyof Output, JSONValue>, Output extends Record<keyof Input, JSONValue>> extends BaseSchema<Input, Output, RefDef<Input, Output>> {
231
- static create: <Input_1 extends Record<keyof Output_1, JSONValue>, Output_1 extends Record<keyof Input_1, JSONValue>>(name: string, shape: { [K in keyof Input_1 | keyof Output_1]: BaseSchema<Input_1[K], Output_1[K], BaseSchemaDef<Input_1[K]>>; }) => KRef<Input_1, Output_1>;
232
- serialize(value: Output): Input;
233
- toOpenAPI(): ReferenceObject;
234
- parseSafe(json: unknown): ParseResult<Output>;
235
- parse(json: unknown): Output;
236
- summary(): string | undefined;
237
- summary(summary: string): this;
238
- get shape(): { [K in keyof Input]: BaseSchema<Input[K], Output[K], BaseSchemaDef<Input[K]>>; };
239
- get name(): string;
240
- }
241
- interface ScalarOptions<ClientRepresentation extends JSONPrimitive, ServerRepresentation> {
242
- schema: BaseSchema<ClientRepresentation, ClientRepresentation, BaseSchemaDef<ClientRepresentation>>;
243
- toServer: (jsonValue: ClientRepresentation) => ServerRepresentation;
244
- toClient: (clientValue: ServerRepresentation) => ClientRepresentation;
245
- }
246
- interface ScalarDef<ClientRepresentation extends JSONPrimitive, ServerRepresentation> extends BaseSchemaDef<ClientRepresentation>, ScalarOptions<ClientRepresentation, ServerRepresentation> {
247
- }
248
- declare class KScalar<ClientRepresentation extends JSONPrimitive, ServerRepresentation> extends BaseSchema<ClientRepresentation, ServerRepresentation, ScalarDef<ClientRepresentation, ServerRepresentation>> {
249
- static create: <ClientRepresentation_1 extends JSONPrimitive, ServerRepresentation_1>(options: ScalarOptions<ClientRepresentation_1, ServerRepresentation_1>) => KScalar<ClientRepresentation_1, ServerRepresentation_1>;
250
- constructor(def: ScalarDef<ClientRepresentation, ServerRepresentation>);
251
- serialize(value: ServerRepresentation): ClientRepresentation;
252
- toOpenAPI(): SchemaObject | ReferenceObject;
253
- parseSafe(json: unknown): ParseResult<ServerRepresentation>;
254
- parse(json: unknown): ServerRepresentation;
255
- }
256
- interface UnionDef<Input extends JSONValue, Output> extends BaseSchemaDef<Input> {
257
- items: [
258
- a: BaseSchema<Input, Output, BaseSchemaDef<Input>>,
259
- b: BaseSchema<Input, Output, BaseSchemaDef<Input>>,
260
- ...remaining: BaseSchema<Input, Output, BaseSchemaDef<Input>>[]
261
- ];
262
- }
263
- declare class KUnion<Input extends JSONValue, Output> extends BaseSchema<Input, Output, UnionDef<Input, Output>> {
264
- static create: <Items extends [a: BaseSchema<JSONValue, unknown, BaseSchemaDef<JSONValue>>, b: BaseSchema<JSONValue, unknown, BaseSchemaDef<JSONValue>>, ...remaining: BaseSchema<JSONValue, unknown, BaseSchemaDef<JSONValue>>[]]>(items: Items) => KUnion<Items[number]["_input"], Items[number]["_output"]>;
265
- serialize(value: Output): Input;
266
- toOpenAPI(): SchemaObject | ReferenceObject;
267
- parseSafe(json: unknown): ParseResult<Output>;
268
- parse(json: unknown): Output;
269
- }
270
- declare const k: {
271
- string: () => KString;
272
- number: () => KNumber;
273
- boolean: () => KBoolean;
274
- array: <ItemsInput extends JSONValue, ItemsOutput, Def extends BaseSchemaDef<ItemsInput>>(items: BaseSchema<ItemsInput, ItemsOutput, Def>) => KArray<ItemsInput, ItemsOutput>;
275
- null: () => KNull;
276
- ref: <Input extends Record<keyof Output, JSONValue>, Output extends Record<keyof Input, JSONValue>>(name: string, shape: { [K in keyof Input | keyof Output]: BaseSchema<Input[K], Output[K], BaseSchemaDef<Input[K]>>; }) => KRef<Input, Output>;
277
- object: <Input extends Record<keyof Output, JSONValue>, Output extends Record<keyof Input, JSONValue>>(shape: { [K in keyof Input | keyof Output]: BaseSchema<Input[K], Output[K], BaseSchemaDef<Input[K]>>; }) => KObject<Input, Output>;
278
- scalar: <ClientRepresentation extends JSONPrimitive, ServerRepresentation>(options: ScalarOptions<ClientRepresentation, ServerRepresentation>) => KScalar<ClientRepresentation, ServerRepresentation>;
279
- union: <Items extends [a: BaseSchema<JSONValue, unknown, BaseSchemaDef<JSONValue>>, b: BaseSchema<JSONValue, unknown, BaseSchemaDef<JSONValue>>, ...remaining: BaseSchema<JSONValue, unknown, BaseSchemaDef<JSONValue>>[]]>(items: Items) => KUnion<Items[number]["_input"], Items[number]["_output"]>;
280
- };
281
-
282
- export { type AnySchemaFor, type ArrayChecks, type ArrayDef, BaseSchema, type BaseSchemaDef, type BooleanDef, type Issue, type JSONPrimitive, type JSONValue, KArray, KBoolean, KNull, KNumber, KObject, KRef, KScalar, KString, KUnion, type NullDef, type NumberChecks, type NumberDef, type NumberFormat, type ObjectDef, ParseContext, type ParseResult, type RefDef, STRING_FORMAT_REGEXES, type ScalarDef, type ScalarOptions, SchemaError, type StringChecks, type StringDef, type StringFormat, type UnionDef, k };
@@ -1,32 +0,0 @@
1
- import {
2
- BaseSchema,
3
- KArray,
4
- KBoolean,
5
- KNull,
6
- KNumber,
7
- KObject,
8
- KRef,
9
- KScalar,
10
- KString,
11
- KUnion,
12
- ParseContext,
13
- STRING_FORMAT_REGEXES,
14
- SchemaError,
15
- k
16
- } from "../chunk-KQK2M7K6.js";
17
- export {
18
- BaseSchema,
19
- KArray,
20
- KBoolean,
21
- KNull,
22
- KNumber,
23
- KObject,
24
- KRef,
25
- KScalar,
26
- KString,
27
- KUnion,
28
- ParseContext,
29
- STRING_FORMAT_REGEXES,
30
- SchemaError,
31
- k
32
- };