@arrirpc/schema 0.45.0
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/LICENSE +9 -0
- package/README.md +983 -0
- package/dist/index.cjs +2186 -0
- package/dist/index.d.cts +379 -0
- package/dist/index.d.mts +379 -0
- package/dist/index.d.ts +379 -0
- package/dist/index.mjs +2108 -0
- package/dist/shared/schema.34cb5fb7.cjs +1758 -0
- package/dist/shared/schema.66772201.mjs +1687 -0
- package/dist/shared/schema.b7c77149.d.cts +167 -0
- package/dist/shared/schema.b7c77149.d.mts +167 -0
- package/dist/shared/schema.b7c77149.d.ts +167 -0
- package/dist/testSuites.cjs +1305 -0
- package/dist/testSuites.d.cts +38 -0
- package/dist/testSuites.d.mts +38 -0
- package/dist/testSuites.d.ts +38 -0
- package/dist/testSuites.mjs +1300 -0
- package/package.json +34 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import { A as ASchemaOptions, a as ASchema, b as AArraySchema, c as AScalarSchema, d as AObjectSchema, e as ADiscriminatorSchema, I as InferType, R as ResolveObject, f as AStringEnumSchema, g as AObjectSchemaOptions, h as InferObjectOutput, V as ValidationData, i as ARecordSchema, j as ARefSchema, S as SafeResult, k as coerce, l as errors, m as InferSubType, p as parse, s as safeCoerce, n as safeParse, o as serialize, v as validate, q as SchemaValidator, r as SchemaMetadata, t as SCHEMA_METADATA } from './shared/schema.b7c77149.mjs';
|
|
2
|
+
export { K as InferObjectRawType, M as MaybeNullable, D as NumberType, N as NumberTypeValues, P as PartialBy, B as Resolve, x as ValidationError, w as ValueError, E as isAAraySchema, G as isADiscriminatorSchema, J as isAObjectSchema, H as isARecordSchema, O as isARefSchema, C as isAScalarSchema, z as isASchema, F as isAStringEnumSchema, L as isObject, y as isValidationError, u as sanitizeJson } from './shared/schema.b7c77149.mjs';
|
|
3
|
+
import { Schema } from 'jtd-utils';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Create a schema that accepts anything
|
|
7
|
+
*/
|
|
8
|
+
declare function any(options?: ASchemaOptions): ASchema<any>;
|
|
9
|
+
|
|
10
|
+
declare function array<TInnerSchema extends ASchema<any> = any>(schema: TInnerSchema, opts?: ASchemaOptions): AArraySchema<TInnerSchema>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @example
|
|
14
|
+
* const Schema = a.boolean();
|
|
15
|
+
* a.validate(Schema, true) // true;
|
|
16
|
+
* a.validate(Schema, false) // true;
|
|
17
|
+
*/
|
|
18
|
+
declare function boolean(opts?: ASchemaOptions): AScalarSchema<"boolean", boolean>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Create a discriminated union / tagged union
|
|
22
|
+
*
|
|
23
|
+
* This is an implementation of https://jsontypedef.com/docs/jtd-in-5-minutes/#discriminator-schemas
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const Schema = a.discriminator("eventType", {
|
|
27
|
+
* CREATED: a.object({
|
|
28
|
+
* id: a.string(),
|
|
29
|
+
* createdAt: a.timestamp(),
|
|
30
|
+
* }),
|
|
31
|
+
* UPDATED: a.object({
|
|
32
|
+
* id: a.string(),
|
|
33
|
+
* createdAt: a.timestamp(),
|
|
34
|
+
* updatedAt: a.timestamp(),
|
|
35
|
+
* })
|
|
36
|
+
* })
|
|
37
|
+
* a.validate(Schema, {
|
|
38
|
+
* eventType: "CREATED",
|
|
39
|
+
* id: "1",
|
|
40
|
+
* createdAt: new Date()
|
|
41
|
+
* }) // true
|
|
42
|
+
* a.validate(Schema, {
|
|
43
|
+
* eventType: "UPDATED",
|
|
44
|
+
* id: "2",
|
|
45
|
+
* createdAt: new Date(),
|
|
46
|
+
* updatedAt: new Date(),
|
|
47
|
+
* }) // true
|
|
48
|
+
* a.validate(Schema, {
|
|
49
|
+
* eventType: "DELETED",
|
|
50
|
+
* id: "1",
|
|
51
|
+
* createdAt: new Date(),
|
|
52
|
+
* }) // false
|
|
53
|
+
*/
|
|
54
|
+
declare function discriminator<TDiscriminatorKey extends string, TMapping extends Record<string, AObjectSchema<any>>>(discriminator: TDiscriminatorKey, mapping: TMapping, opts?: ASchemaOptions): ADiscriminatorSchema<InferDiscriminatorType<TDiscriminatorKey, TMapping, JoinedDiscriminator<TDiscriminatorKey, TMapping>>>;
|
|
55
|
+
declare function discriminator<TDiscriminatorKey extends string, TMapping extends Record<string, AObjectSchema<any>>>(id: string, discriminator: TDiscriminatorKey, mapping: TMapping): ADiscriminatorSchema<InferDiscriminatorType<TDiscriminatorKey, TMapping, JoinedDiscriminator<TDiscriminatorKey, TMapping>>>;
|
|
56
|
+
type JoinedDiscriminator<TUnionKey extends string, TInput extends Record<string, AObjectSchema<any>>> = {
|
|
57
|
+
[TKey in keyof TInput]: InferType<TInput[TKey]> & Record<TUnionKey, TKey>;
|
|
58
|
+
};
|
|
59
|
+
type InferDiscriminatorType<TDiscriminatorKey extends string, TMapping extends Record<string, AObjectSchema<any>>, TJoinedMapping extends JoinedDiscriminator<TDiscriminatorKey, TMapping>> = ResolveObject<TJoinedMapping[keyof TJoinedMapping]>;
|
|
60
|
+
|
|
61
|
+
declare const stringEnum: typeof enumerator;
|
|
62
|
+
/**
|
|
63
|
+
* An enumeration of string values
|
|
64
|
+
*
|
|
65
|
+
* This is an implementation of:
|
|
66
|
+
* https://jsontypedef.com/docs/jtd-in-5-minutes/#enum-schemas
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* const Schema = a.enumerator(["A", "B"])
|
|
70
|
+
* a.validate(Schema, "A") // true
|
|
71
|
+
* a.validate(Schema, "B") // true
|
|
72
|
+
* a.validate(Schema, "C") // false
|
|
73
|
+
*/
|
|
74
|
+
declare function enumerator<TKeys extends string, TValues extends TKeys[]>(values: TValues, opts?: ASchemaOptions): AStringEnumSchema<TValues>;
|
|
75
|
+
/**
|
|
76
|
+
* An enumeration of string values
|
|
77
|
+
*
|
|
78
|
+
* This is an implementation of:
|
|
79
|
+
* https://jsontypedef.com/docs/jtd-in-5-minutes/#enum-schemas
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* const Schema = a.enumerator("Schema", ["A", "B"])
|
|
83
|
+
* a.validate(Schema, "A") // true
|
|
84
|
+
* a.validate(Schema, "B") // true
|
|
85
|
+
* a.validate(Schema, "C") // false
|
|
86
|
+
*/
|
|
87
|
+
declare function enumerator<TKeys extends string, TValues extends TKeys[]>(id: string, values: TValues): AStringEnumSchema<TValues>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Transforms a schema into a nullable type
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* const NullableString = a.nullable(a.string())
|
|
94
|
+
* const NullableObject = a.nullable(
|
|
95
|
+
* a.object({
|
|
96
|
+
* id: a.string(),
|
|
97
|
+
* description: a.nullable(a.string())
|
|
98
|
+
* })
|
|
99
|
+
* )
|
|
100
|
+
*/
|
|
101
|
+
declare function nullable<T>(schema: ASchema<T>, opts?: ASchemaOptions): ASchema<T | null>;
|
|
102
|
+
/**
|
|
103
|
+
* Make an object field optional
|
|
104
|
+
*
|
|
105
|
+
* This makes use of the "optionalProperties" property in JTD. See: https://jsontypedef.com/docs/jtd-in-5-minutes/#optional-properties
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* const User = a.object({
|
|
109
|
+
* id: a.string(),
|
|
110
|
+
* // make the email field optional
|
|
111
|
+
* email: a.optional(a.string())
|
|
112
|
+
* })
|
|
113
|
+
*/
|
|
114
|
+
declare function optional<T>(input: ASchema<T>, opts?: ASchemaOptions): ASchema<T | undefined>;
|
|
115
|
+
declare function clone<T>(input: ASchema<T>, opts?: ASchemaOptions): ASchema<T>;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Alias for float64 as that is the only number type that Javascript uses
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* const Schema = a.number()
|
|
122
|
+
* a.validate(Schema, 1.5) // true
|
|
123
|
+
*/
|
|
124
|
+
declare function number(opts?: ASchemaOptions): AScalarSchema<"float64", number>;
|
|
125
|
+
declare function float32(opts?: ASchemaOptions): AScalarSchema<"float32", number>;
|
|
126
|
+
declare function float64(opts?: ASchemaOptions): AScalarSchema<"float64", number>;
|
|
127
|
+
declare function int8(opts?: ASchemaOptions): AScalarSchema<"int8", number>;
|
|
128
|
+
declare function uint8(opts?: ASchemaOptions): AScalarSchema<"uint8", number>;
|
|
129
|
+
declare function int16(opts?: ASchemaOptions): AScalarSchema<"int16", number>;
|
|
130
|
+
declare function uint16(opts?: ASchemaOptions): AScalarSchema<"uint16", number>;
|
|
131
|
+
declare function int32(opts?: ASchemaOptions): AScalarSchema<"int32", number>;
|
|
132
|
+
declare function uint32(opts?: ASchemaOptions): AScalarSchema<"uint32", number>;
|
|
133
|
+
declare function int64(opts?: ASchemaOptions): AScalarSchema<"int64", bigint>;
|
|
134
|
+
declare function uint64(opts?: ASchemaOptions): AScalarSchema<"uint64", bigint>;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Create an object schema
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* const Schema = a.object('Schema', {
|
|
141
|
+
* foo: a.string(),
|
|
142
|
+
* bar: a.number()
|
|
143
|
+
* });
|
|
144
|
+
* a.validate(Schema, {foo: "", bar: 0}) // true
|
|
145
|
+
* a.validate(Schema, {foo: null, bar: 0}) // false
|
|
146
|
+
*/
|
|
147
|
+
declare function object<TInput extends Record<any, ASchema> = any, TAdditionalProps extends boolean = false>(input: TInput, opts?: AObjectSchemaOptions<TAdditionalProps>): AObjectSchema<InferObjectOutput<TInput, TAdditionalProps>, TAdditionalProps>;
|
|
148
|
+
declare function object<TInput extends Record<any, ASchema> = any, TAdditionalProps extends boolean = false>(id: string, input: TInput): AObjectSchema<InferObjectOutput<TInput, TAdditionalProps>, TAdditionalProps>;
|
|
149
|
+
declare function parseObjectSchema<T>(schema: AObjectSchema<T>, input: unknown, data: ValidationData, coerce?: boolean): T | undefined;
|
|
150
|
+
declare function validateObjectSchema(schema: AObjectSchema, input: unknown): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Create an object schema using a subset of keys from another object schema
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* const BaseObject = a.object({
|
|
156
|
+
* foo: a.string(),
|
|
157
|
+
* bar: a.string(),
|
|
158
|
+
* baz: a.string(),
|
|
159
|
+
* }) // { foo: string; bar: string; baz: string; }
|
|
160
|
+
*
|
|
161
|
+
* const SubObject = a.pick(User, ['foo']) // { foo: string; }
|
|
162
|
+
*/
|
|
163
|
+
declare function pick<TSchema extends AObjectSchema<any, any> = any, TKeys extends keyof InferType<TSchema> = any, TAdditionalProps extends boolean = false>(inputSchema: TSchema, keys: TKeys[], opts?: AObjectSchemaOptions<TAdditionalProps>): AObjectSchema<Pick<InferType<TSchema>, TKeys>, TAdditionalProps>;
|
|
164
|
+
/**
|
|
165
|
+
* Create an object schema by omitting keys from another object schema
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* const BaseObject = a.object({
|
|
169
|
+
* foo: a.string(),
|
|
170
|
+
* bar: a.string(),
|
|
171
|
+
* baz: a.string(),
|
|
172
|
+
* }); // { foo: string; bar: string; baz: string; }
|
|
173
|
+
*
|
|
174
|
+
* const SubObject = a.omit(BaseObject, ['foo']) // { bar: string; baz: string; }
|
|
175
|
+
*/
|
|
176
|
+
declare function omit<TSchema extends AObjectSchema<any, any> = any, TKeys extends keyof InferType<TSchema> = any, TAdditionalProps extends boolean = false>(inputSchema: TSchema, keys: TKeys[], opts?: AObjectSchemaOptions<TAdditionalProps>): AObjectSchema<Omit<InferType<TSchema>, TKeys>, TAdditionalProps>;
|
|
177
|
+
declare function serializeObject(schema: AObjectSchema, input: any, data: ValidationData): string;
|
|
178
|
+
declare function extend<TBaseSchema extends AObjectSchema<any, any> = any, TSchema extends AObjectSchema<any, any> = any, TAdditionalProps extends boolean = false>(baseSchema: TBaseSchema, inputSchema: TSchema, opts?: AObjectSchemaOptions<TAdditionalProps>): AObjectSchema<ResolveObject<InferType<TBaseSchema> & InferType<TSchema>>, TAdditionalProps>;
|
|
179
|
+
declare function partial<TSchema extends AObjectSchema<any, any> = any, TAdditionalProps extends boolean = false>(schema: TSchema, options?: AObjectSchemaOptions<TAdditionalProps>): AObjectSchema<Partial<InferType<TSchema>>, TAdditionalProps>;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Create a schema for a record with strings keys
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* const StringRecord = a.record(
|
|
186
|
+
* a.string(),
|
|
187
|
+
* );
|
|
188
|
+
* a.validate(StringRecord, {foo: "bar"}) // true
|
|
189
|
+
*
|
|
190
|
+
* const ObjectRecord = a.record(
|
|
191
|
+
* a.object({
|
|
192
|
+
* id: a.string(),
|
|
193
|
+
* date: a.timestamp(),
|
|
194
|
+
* })
|
|
195
|
+
* )
|
|
196
|
+
* a.validate(ObjectRecord, {foo: {id: "1", date: new Date()}}) // true
|
|
197
|
+
*/
|
|
198
|
+
declare function record<TInnerSchema extends ASchema<any>>(schema: TInnerSchema, opts?: ASchemaOptions): ARecordSchema<TInnerSchema>;
|
|
199
|
+
|
|
200
|
+
type RecursiveCallback<T> = (self: ARefSchema<T>) => AObjectSchema<T> | ADiscriminatorSchema<T>;
|
|
201
|
+
/**
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* type BinaryTree = {
|
|
205
|
+
* left: BinaryTree | null;
|
|
206
|
+
* right: BinaryTree | null;
|
|
207
|
+
* }
|
|
208
|
+
*
|
|
209
|
+
* const BinaryTree = a.recursive<BinaryTree>(
|
|
210
|
+
* (self) => a.object({
|
|
211
|
+
* left: a.nullable(self),
|
|
212
|
+
* right: a.nullable(self),
|
|
213
|
+
* })
|
|
214
|
+
* );
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
217
|
+
declare function recursive<T = any>(callback: RecursiveCallback<T>, metadata?: ASchemaOptions): AObjectSchema<T> | ADiscriminatorSchema<T>;
|
|
218
|
+
/**
|
|
219
|
+
* Recursive ID Shorthand
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```ts
|
|
223
|
+
* type BinaryTree = {
|
|
224
|
+
* left: BinaryTree | null;
|
|
225
|
+
* right: BinaryTree | null;
|
|
226
|
+
* }
|
|
227
|
+
*
|
|
228
|
+
* const BinaryTree = a.recursive<BinaryTree>(
|
|
229
|
+
* "BinaryTree",
|
|
230
|
+
* (self) => a.object({
|
|
231
|
+
* left: a.nullable(self),
|
|
232
|
+
* right: a.nullable(self),
|
|
233
|
+
* })
|
|
234
|
+
* );
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
declare function recursive<T = any>(id: string, callback: RecursiveCallback<T>): AObjectSchema<T> | ADiscriminatorSchema<T>;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @example
|
|
241
|
+
* const StringSchema = a.string();
|
|
242
|
+
* a.validate(StringSchema, "hello world") // true
|
|
243
|
+
* a.validate(StringSchema, 10) // false
|
|
244
|
+
*/
|
|
245
|
+
declare function string(opts?: ASchemaOptions): AScalarSchema<"string", string>;
|
|
246
|
+
declare function serializeSmallString(input: string): string;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Create a Date schema
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* const Schema = a.timestamp();
|
|
253
|
+
* a.validate(Schema, new Date()) // true
|
|
254
|
+
*/
|
|
255
|
+
declare function timestamp(opts?: ASchemaOptions): AScalarSchema<"timestamp", Date>;
|
|
256
|
+
|
|
257
|
+
declare function createParsingTemplate(input: string, schema: Schema): string;
|
|
258
|
+
|
|
259
|
+
declare function createSerializationV2Template(inputName: string, schema: Schema): string;
|
|
260
|
+
|
|
261
|
+
declare function createValidationTemplate(inputName: string, schema: ASchema<any>): string;
|
|
262
|
+
|
|
263
|
+
interface CompiledValidator<TSchema extends ASchema<any>> {
|
|
264
|
+
/**
|
|
265
|
+
* Determine if a type matches a schema. This is a type guard.
|
|
266
|
+
*/
|
|
267
|
+
validate: (input: unknown) => input is InferType<TSchema>;
|
|
268
|
+
/**
|
|
269
|
+
* Parse a JSON string or the result of JSON.parse(). Throws an error if parsing fails.
|
|
270
|
+
*/
|
|
271
|
+
parse: (input: unknown) => InferType<TSchema>;
|
|
272
|
+
/**
|
|
273
|
+
* Parse a JSON string or the result of JSON.parse() without throwing an error
|
|
274
|
+
*/
|
|
275
|
+
safeParse: (input: unknown) => SafeResult<InferType<TSchema>>;
|
|
276
|
+
/**
|
|
277
|
+
* Serialize to JSON
|
|
278
|
+
*/
|
|
279
|
+
serialize: (input: InferType<TSchema>) => string;
|
|
280
|
+
compiledCode: {
|
|
281
|
+
serialize: string;
|
|
282
|
+
parse: string;
|
|
283
|
+
validate: string;
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Create compiled versions of the `parse()`, `validate()`, and `serialize()` functions
|
|
288
|
+
*/
|
|
289
|
+
declare function compile<TSchema extends ASchema<any>>(schema: TSchema): CompiledValidator<TSchema>;
|
|
290
|
+
type CompiledParser<TSchema extends ASchema<any>> = CompiledValidator<TSchema>["parse"];
|
|
291
|
+
declare function getCompiledParser<TSchema extends ASchema<any>>(input: string, schema: TSchema): {
|
|
292
|
+
fn: CompiledParser<TSchema>;
|
|
293
|
+
code: string;
|
|
294
|
+
};
|
|
295
|
+
declare function getCompiledSerializer<TSchema extends ASchema>(schema: TSchema): {
|
|
296
|
+
fn: (input: InferType<TSchema>) => string;
|
|
297
|
+
code: string;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
declare const _namespace_any: typeof any;
|
|
301
|
+
declare const _namespace_array: typeof array;
|
|
302
|
+
declare const _namespace_boolean: typeof boolean;
|
|
303
|
+
declare const _namespace_clone: typeof clone;
|
|
304
|
+
declare const _namespace_coerce: typeof coerce;
|
|
305
|
+
declare const _namespace_compile: typeof compile;
|
|
306
|
+
declare const _namespace_discriminator: typeof discriminator;
|
|
307
|
+
declare const _namespace_enumerator: typeof enumerator;
|
|
308
|
+
declare const _namespace_errors: typeof errors;
|
|
309
|
+
declare const _namespace_extend: typeof extend;
|
|
310
|
+
declare const _namespace_float32: typeof float32;
|
|
311
|
+
declare const _namespace_float64: typeof float64;
|
|
312
|
+
declare const _namespace_int16: typeof int16;
|
|
313
|
+
declare const _namespace_int32: typeof int32;
|
|
314
|
+
declare const _namespace_int64: typeof int64;
|
|
315
|
+
declare const _namespace_int8: typeof int8;
|
|
316
|
+
declare const _namespace_nullable: typeof nullable;
|
|
317
|
+
declare const _namespace_number: typeof number;
|
|
318
|
+
declare const _namespace_object: typeof object;
|
|
319
|
+
declare const _namespace_omit: typeof omit;
|
|
320
|
+
declare const _namespace_optional: typeof optional;
|
|
321
|
+
declare const _namespace_parse: typeof parse;
|
|
322
|
+
declare const _namespace_partial: typeof partial;
|
|
323
|
+
declare const _namespace_pick: typeof pick;
|
|
324
|
+
declare const _namespace_record: typeof record;
|
|
325
|
+
declare const _namespace_recursive: typeof recursive;
|
|
326
|
+
declare const _namespace_safeCoerce: typeof safeCoerce;
|
|
327
|
+
declare const _namespace_safeParse: typeof safeParse;
|
|
328
|
+
declare const _namespace_serialize: typeof serialize;
|
|
329
|
+
declare const _namespace_string: typeof string;
|
|
330
|
+
declare const _namespace_stringEnum: typeof stringEnum;
|
|
331
|
+
declare const _namespace_timestamp: typeof timestamp;
|
|
332
|
+
declare const _namespace_uint16: typeof uint16;
|
|
333
|
+
declare const _namespace_uint32: typeof uint32;
|
|
334
|
+
declare const _namespace_uint64: typeof uint64;
|
|
335
|
+
declare const _namespace_uint8: typeof uint8;
|
|
336
|
+
declare const _namespace_validate: typeof validate;
|
|
337
|
+
declare namespace _namespace {
|
|
338
|
+
export { _namespace_any as any, _namespace_array as array, _namespace_boolean as boolean, _namespace_clone as clone, _namespace_coerce as coerce, _namespace_compile as compile, _namespace_discriminator as discriminator, _namespace_enumerator as enumerator, _namespace_errors as errors, _namespace_extend as extend, _namespace_float32 as float32, _namespace_float64 as float64, InferType as infer, InferSubType as inferSubType, _namespace_int16 as int16, _namespace_int32 as int32, _namespace_int64 as int64, _namespace_int8 as int8, _namespace_nullable as nullable, _namespace_number as number, _namespace_object as object, _namespace_omit as omit, _namespace_optional as optional, _namespace_parse as parse, _namespace_partial as partial, _namespace_pick as pick, _namespace_record as record, _namespace_recursive as recursive, _namespace_safeCoerce as safeCoerce, _namespace_safeParse as safeParse, _namespace_serialize as serialize, _namespace_string as string, _namespace_stringEnum as stringEnum, _namespace_timestamp as timestamp, _namespace_uint16 as uint16, _namespace_uint32 as uint32, _namespace_uint64 as uint64, _namespace_uint8 as uint8, _namespace_validate as validate };
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
declare const int8Min = -128;
|
|
342
|
+
declare const int8Max = 127;
|
|
343
|
+
declare const uint8Min = 0;
|
|
344
|
+
declare const uint8Max = 255;
|
|
345
|
+
declare const int16Min = -32768;
|
|
346
|
+
declare const int16Max = 32767;
|
|
347
|
+
declare const uint16Min = 0;
|
|
348
|
+
declare const uint16Max = 65535;
|
|
349
|
+
declare const int32Min = -2147483648;
|
|
350
|
+
declare const int32Max = 2147483647;
|
|
351
|
+
declare const uint32Min = 0;
|
|
352
|
+
declare const uint32Max = 4294967295;
|
|
353
|
+
declare const int64Min: bigint;
|
|
354
|
+
declare const int64Max: bigint;
|
|
355
|
+
declare const uint64Min: bigint;
|
|
356
|
+
declare const uint64Max: bigint;
|
|
357
|
+
|
|
358
|
+
interface AAdaptedSchemaValidator<T> extends SchemaValidator<T> {
|
|
359
|
+
_isAdaptedSchema: true;
|
|
360
|
+
}
|
|
361
|
+
interface AAdaptedSchemaMetadata<T> extends SchemaMetadata<T> {
|
|
362
|
+
[SCHEMA_METADATA]: AAdaptedSchemaValidator<T>;
|
|
363
|
+
}
|
|
364
|
+
interface AAdaptedSchema<T> extends ASchema<T> {
|
|
365
|
+
metadata: AAdaptedSchemaMetadata<T>;
|
|
366
|
+
}
|
|
367
|
+
interface AAdaptedObjectSchema<T> extends AObjectSchema<T> {
|
|
368
|
+
metadata: AAdaptedSchemaMetadata<T>;
|
|
369
|
+
}
|
|
370
|
+
interface AAdaptedRecordSchema<T> extends ARecordSchema<ASchema<T>> {
|
|
371
|
+
metadata: AAdaptedSchemaMetadata<Record<string, T>>;
|
|
372
|
+
}
|
|
373
|
+
interface AAdaptedDiscriminatorSchema<T> extends ADiscriminatorSchema<T> {
|
|
374
|
+
metadata: AAdaptedSchemaMetadata<T>;
|
|
375
|
+
}
|
|
376
|
+
declare function isAAdaptedSchema<T = any>(input: unknown): input is AAdaptedSchema<T>;
|
|
377
|
+
type ValidationAdapter = <T>(input: any) => AAdaptedSchema<T>;
|
|
378
|
+
|
|
379
|
+
export { type AAdaptedDiscriminatorSchema, type AAdaptedObjectSchema, type AAdaptedRecordSchema, type AAdaptedSchema, type AAdaptedSchemaMetadata, type AAdaptedSchemaValidator, AArraySchema, ADiscriminatorSchema, AObjectSchema, AObjectSchemaOptions, ARecordSchema, ARefSchema, AScalarSchema, ASchema, ASchemaOptions, AStringEnumSchema, type CompiledValidator, InferObjectOutput, InferSubType, InferType, ResolveObject, SCHEMA_METADATA, SafeResult, SchemaMetadata, SchemaValidator, type ValidationAdapter, ValidationData, _namespace as a, any, array, boolean, clone, coerce, compile, discriminator, enumerator, errors, extend, float32, float64, getCompiledParser, getCompiledSerializer, createParsingTemplate as getSchemaParsingCode, createSerializationV2Template as getSchemaSerializationCode, createValidationTemplate as getSchemaValidationCode, int16, int16Max, int16Min, int32, int32Max, int32Min, int64, int64Max, int64Min, int8, int8Max, int8Min, isAAdaptedSchema, nullable, number, object, omit, optional, parse, parseObjectSchema, partial, pick, record, recursive, safeCoerce, safeParse, serialize, serializeObject, serializeSmallString, string, stringEnum, timestamp, uint16, uint16Max, uint16Min, uint32, uint32Max, uint32Min, uint64, uint64Max, uint64Min, uint8, uint8Max, uint8Min, validate, validateObjectSchema };
|