@forklaunch/validator 0.6.3 → 0.6.4
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/__test__/utils/mockSchemaValidator.d.mts +1 -1
- package/lib/__test__/utils/mockSchemaValidator.d.ts +1 -1
- package/lib/index.d.mts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/{schema.types-MvSNOCj2.d.mts → schema.types-Df9EB_Ke.d.mts} +29 -23
- package/lib/{schema.types-MvSNOCj2.d.ts → schema.types-Df9EB_Ke.d.ts} +29 -23
- package/lib/src/typebox/index.d.mts +39 -38
- package/lib/src/typebox/index.d.ts +39 -38
- package/lib/src/typebox/index.js +27 -34
- package/lib/src/typebox/index.mjs +27 -34
- package/lib/src/zod/index.d.mts +38 -37
- package/lib/src/zod/index.d.ts +38 -37
- package/lib/src/zod/index.js +11 -28
- package/lib/src/zod/index.mjs +11 -28
- package/package.json +3 -2
package/lib/src/typebox/index.js
CHANGED
|
@@ -200,12 +200,15 @@ var TypeboxSchemaValidator = class {
|
|
|
200
200
|
symbol = import_typebox.Type.Symbol({
|
|
201
201
|
title: "Symbol"
|
|
202
202
|
});
|
|
203
|
-
nullish = import_typebox.Type.Union(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
203
|
+
nullish = import_typebox.Type.Union(
|
|
204
|
+
[import_typebox.Type.Void(), import_typebox.Type.Null(), import_typebox.Type.Undefined()],
|
|
205
|
+
{
|
|
206
|
+
errorType: "nullish",
|
|
207
|
+
type: "null",
|
|
208
|
+
example: "null",
|
|
209
|
+
title: "Nullish"
|
|
210
|
+
}
|
|
211
|
+
);
|
|
209
212
|
void = import_typebox.Type.Void({
|
|
210
213
|
type: "null",
|
|
211
214
|
example: "void",
|
|
@@ -243,16 +246,22 @@ var TypeboxSchemaValidator = class {
|
|
|
243
246
|
example: "a utf-8 encodable string",
|
|
244
247
|
title: "Binary"
|
|
245
248
|
})
|
|
246
|
-
).Decode(
|
|
247
|
-
|
|
249
|
+
).Decode((value) => new TextEncoder().encode(value)).Encode((value) => {
|
|
250
|
+
if (value instanceof ArrayBuffer) {
|
|
251
|
+
return String.fromCharCode(...new Uint8Array(value));
|
|
252
|
+
}
|
|
253
|
+
return "";
|
|
254
|
+
});
|
|
255
|
+
file = import_typebox.Type.Transform(
|
|
248
256
|
import_typebox.Type.String({
|
|
249
257
|
errorType: "binary",
|
|
250
258
|
format: "binary",
|
|
251
|
-
contentMediaType: type,
|
|
252
259
|
example: "a utf-8 encodable string",
|
|
253
260
|
title: "File"
|
|
254
261
|
})
|
|
255
|
-
).Decode(
|
|
262
|
+
).Decode(
|
|
263
|
+
(value) => (name, type) => new import_common.InMemoryFile(value, name, { type })
|
|
264
|
+
).Encode((value) => value("name", "type").content);
|
|
256
265
|
/**
|
|
257
266
|
* Extracts the error type of a schema for error messages.
|
|
258
267
|
*
|
|
@@ -535,35 +544,19 @@ var unknown = StaticSchemaValidator.unknown;
|
|
|
535
544
|
var never = StaticSchemaValidator.never;
|
|
536
545
|
var binary = StaticSchemaValidator.binary;
|
|
537
546
|
var file = StaticSchemaValidator.file;
|
|
538
|
-
var schemify = StaticSchemaValidator.schemify.bind(
|
|
539
|
-
|
|
540
|
-
);
|
|
541
|
-
var optional = StaticSchemaValidator.optional.bind(
|
|
542
|
-
StaticSchemaValidator
|
|
543
|
-
);
|
|
547
|
+
var schemify = StaticSchemaValidator.schemify.bind(StaticSchemaValidator);
|
|
548
|
+
var optional = StaticSchemaValidator.optional.bind(StaticSchemaValidator);
|
|
544
549
|
var array = StaticSchemaValidator.array.bind(StaticSchemaValidator);
|
|
545
550
|
var union = StaticSchemaValidator.union.bind(StaticSchemaValidator);
|
|
546
|
-
var literal = StaticSchemaValidator.literal.bind(
|
|
547
|
-
StaticSchemaValidator
|
|
548
|
-
);
|
|
551
|
+
var literal = StaticSchemaValidator.literal.bind(StaticSchemaValidator);
|
|
549
552
|
var enum_ = StaticSchemaValidator.enum_.bind(StaticSchemaValidator);
|
|
550
|
-
var function_ = StaticSchemaValidator.function_.bind(
|
|
551
|
-
StaticSchemaValidator
|
|
552
|
-
);
|
|
553
|
+
var function_ = StaticSchemaValidator.function_.bind(StaticSchemaValidator);
|
|
553
554
|
var record = StaticSchemaValidator.record.bind(StaticSchemaValidator);
|
|
554
|
-
var promise = StaticSchemaValidator.promise.bind(
|
|
555
|
-
|
|
556
|
-
);
|
|
557
|
-
var isSchema = StaticSchemaValidator.isSchema.bind(
|
|
558
|
-
StaticSchemaValidator
|
|
559
|
-
);
|
|
560
|
-
var validate = StaticSchemaValidator.validate.bind(
|
|
561
|
-
StaticSchemaValidator
|
|
562
|
-
);
|
|
555
|
+
var promise = StaticSchemaValidator.promise.bind(StaticSchemaValidator);
|
|
556
|
+
var isSchema = StaticSchemaValidator.isSchema.bind(StaticSchemaValidator);
|
|
557
|
+
var validate = StaticSchemaValidator.validate.bind(StaticSchemaValidator);
|
|
563
558
|
var parse = StaticSchemaValidator.parse.bind(StaticSchemaValidator);
|
|
564
|
-
var openapi = StaticSchemaValidator.openapi.bind(
|
|
565
|
-
StaticSchemaValidator
|
|
566
|
-
);
|
|
559
|
+
var openapi = StaticSchemaValidator.openapi.bind(StaticSchemaValidator);
|
|
567
560
|
// Annotate the CommonJS export names for ESM import in node:
|
|
568
561
|
0 && (module.exports = {
|
|
569
562
|
SchemaValidator,
|
|
@@ -152,12 +152,15 @@ var TypeboxSchemaValidator = class {
|
|
|
152
152
|
symbol = Type.Symbol({
|
|
153
153
|
title: "Symbol"
|
|
154
154
|
});
|
|
155
|
-
nullish = Type.Union(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
155
|
+
nullish = Type.Union(
|
|
156
|
+
[Type.Void(), Type.Null(), Type.Undefined()],
|
|
157
|
+
{
|
|
158
|
+
errorType: "nullish",
|
|
159
|
+
type: "null",
|
|
160
|
+
example: "null",
|
|
161
|
+
title: "Nullish"
|
|
162
|
+
}
|
|
163
|
+
);
|
|
161
164
|
void = Type.Void({
|
|
162
165
|
type: "null",
|
|
163
166
|
example: "void",
|
|
@@ -195,16 +198,22 @@ var TypeboxSchemaValidator = class {
|
|
|
195
198
|
example: "a utf-8 encodable string",
|
|
196
199
|
title: "Binary"
|
|
197
200
|
})
|
|
198
|
-
).Decode(
|
|
199
|
-
|
|
201
|
+
).Decode((value) => new TextEncoder().encode(value)).Encode((value) => {
|
|
202
|
+
if (value instanceof ArrayBuffer) {
|
|
203
|
+
return String.fromCharCode(...new Uint8Array(value));
|
|
204
|
+
}
|
|
205
|
+
return "";
|
|
206
|
+
});
|
|
207
|
+
file = Type.Transform(
|
|
200
208
|
Type.String({
|
|
201
209
|
errorType: "binary",
|
|
202
210
|
format: "binary",
|
|
203
|
-
contentMediaType: type,
|
|
204
211
|
example: "a utf-8 encodable string",
|
|
205
212
|
title: "File"
|
|
206
213
|
})
|
|
207
|
-
).Decode(
|
|
214
|
+
).Decode(
|
|
215
|
+
(value) => (name, type) => new InMemoryFile(value, name, { type })
|
|
216
|
+
).Encode((value) => value("name", "type").content);
|
|
208
217
|
/**
|
|
209
218
|
* Extracts the error type of a schema for error messages.
|
|
210
219
|
*
|
|
@@ -487,35 +496,19 @@ var unknown = StaticSchemaValidator.unknown;
|
|
|
487
496
|
var never = StaticSchemaValidator.never;
|
|
488
497
|
var binary = StaticSchemaValidator.binary;
|
|
489
498
|
var file = StaticSchemaValidator.file;
|
|
490
|
-
var schemify = StaticSchemaValidator.schemify.bind(
|
|
491
|
-
|
|
492
|
-
);
|
|
493
|
-
var optional = StaticSchemaValidator.optional.bind(
|
|
494
|
-
StaticSchemaValidator
|
|
495
|
-
);
|
|
499
|
+
var schemify = StaticSchemaValidator.schemify.bind(StaticSchemaValidator);
|
|
500
|
+
var optional = StaticSchemaValidator.optional.bind(StaticSchemaValidator);
|
|
496
501
|
var array = StaticSchemaValidator.array.bind(StaticSchemaValidator);
|
|
497
502
|
var union = StaticSchemaValidator.union.bind(StaticSchemaValidator);
|
|
498
|
-
var literal = StaticSchemaValidator.literal.bind(
|
|
499
|
-
StaticSchemaValidator
|
|
500
|
-
);
|
|
503
|
+
var literal = StaticSchemaValidator.literal.bind(StaticSchemaValidator);
|
|
501
504
|
var enum_ = StaticSchemaValidator.enum_.bind(StaticSchemaValidator);
|
|
502
|
-
var function_ = StaticSchemaValidator.function_.bind(
|
|
503
|
-
StaticSchemaValidator
|
|
504
|
-
);
|
|
505
|
+
var function_ = StaticSchemaValidator.function_.bind(StaticSchemaValidator);
|
|
505
506
|
var record = StaticSchemaValidator.record.bind(StaticSchemaValidator);
|
|
506
|
-
var promise = StaticSchemaValidator.promise.bind(
|
|
507
|
-
|
|
508
|
-
);
|
|
509
|
-
var isSchema = StaticSchemaValidator.isSchema.bind(
|
|
510
|
-
StaticSchemaValidator
|
|
511
|
-
);
|
|
512
|
-
var validate = StaticSchemaValidator.validate.bind(
|
|
513
|
-
StaticSchemaValidator
|
|
514
|
-
);
|
|
507
|
+
var promise = StaticSchemaValidator.promise.bind(StaticSchemaValidator);
|
|
508
|
+
var isSchema = StaticSchemaValidator.isSchema.bind(StaticSchemaValidator);
|
|
509
|
+
var validate = StaticSchemaValidator.validate.bind(StaticSchemaValidator);
|
|
515
510
|
var parse = StaticSchemaValidator.parse.bind(StaticSchemaValidator);
|
|
516
|
-
var openapi = StaticSchemaValidator.openapi.bind(
|
|
517
|
-
StaticSchemaValidator
|
|
518
|
-
);
|
|
511
|
+
var openapi = StaticSchemaValidator.openapi.bind(StaticSchemaValidator);
|
|
519
512
|
export {
|
|
520
513
|
SchemaValidator,
|
|
521
514
|
any,
|
package/lib/src/zod/index.d.mts
CHANGED
|
@@ -1,139 +1,140 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import * as zod from 'zod';
|
|
1
|
+
import { Z as ZodSchemaValidator } from '../../schema.types-Df9EB_Ke.mjs';
|
|
2
|
+
export { x as TupleZodResolve, u as UnboxedZodObjectSchema, z as UnionZodResolve, p as ZodCatchall, v as ZodIdiomaticSchema, s as ZodObject, r as ZodObjectShape, q as ZodOuterArray, C as ZodRecordKey, B as ZodResolve, t as ZodSchemaTranslate, w as ZodTupleContainer, y as ZodUnionContainer } from '../../schema.types-Df9EB_Ke.mjs';
|
|
3
|
+
import '@forklaunch/common';
|
|
4
|
+
import 'openapi3-ts/oas31';
|
|
6
5
|
import '@sinclair/typebox';
|
|
7
6
|
import '@sinclair/typebox/compiler';
|
|
7
|
+
import 'zod';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Factory function for creating a ZodSchemaValidator instance.
|
|
11
11
|
* @returns {ZodSchemaValidator} The ZodSchemaValidator instance.
|
|
12
12
|
*/
|
|
13
13
|
declare const SchemaValidator: () => ZodSchemaValidator;
|
|
14
|
+
declare const StaticSchemaValidator: ZodSchemaValidator;
|
|
14
15
|
/**
|
|
15
16
|
* Zod schema definition for string type.
|
|
16
17
|
*/
|
|
17
|
-
declare const string:
|
|
18
|
+
declare const string: typeof StaticSchemaValidator.string;
|
|
18
19
|
/**
|
|
19
20
|
* Zod schema definition for UUID type.
|
|
20
21
|
*/
|
|
21
|
-
declare const uuid:
|
|
22
|
+
declare const uuid: typeof StaticSchemaValidator.uuid;
|
|
22
23
|
/**
|
|
23
24
|
* Zod schema definition for email type.
|
|
24
25
|
*/
|
|
25
|
-
declare const email:
|
|
26
|
+
declare const email: typeof StaticSchemaValidator.email;
|
|
26
27
|
/**
|
|
27
28
|
* Zod schema definition for URI type.
|
|
28
29
|
*/
|
|
29
|
-
declare const uri:
|
|
30
|
+
declare const uri: typeof StaticSchemaValidator.uri;
|
|
30
31
|
/**
|
|
31
32
|
* Zod schema definition for number type.
|
|
32
33
|
*/
|
|
33
|
-
declare const number:
|
|
34
|
+
declare const number: typeof StaticSchemaValidator.number;
|
|
34
35
|
/**
|
|
35
36
|
* Zod schema definition for bigint type.
|
|
36
37
|
*/
|
|
37
|
-
declare const bigint:
|
|
38
|
+
declare const bigint: typeof StaticSchemaValidator.bigint;
|
|
38
39
|
/**
|
|
39
40
|
* Zod schema definition for boolean type.
|
|
40
41
|
*/
|
|
41
|
-
declare const boolean:
|
|
42
|
+
declare const boolean: typeof StaticSchemaValidator.boolean;
|
|
42
43
|
/**
|
|
43
44
|
* Zod schema definition for date type.
|
|
44
45
|
*/
|
|
45
|
-
declare const date:
|
|
46
|
+
declare const date: typeof StaticSchemaValidator.date;
|
|
46
47
|
/**
|
|
47
48
|
* Zod schema definition for symbol type.
|
|
48
49
|
*/
|
|
49
|
-
declare const symbol:
|
|
50
|
+
declare const symbol: typeof StaticSchemaValidator.symbol;
|
|
50
51
|
/**
|
|
51
52
|
* Zod schema definition for undefined, null, void types.
|
|
52
53
|
*/
|
|
53
|
-
declare const nullish:
|
|
54
|
+
declare const nullish: typeof StaticSchemaValidator.nullish;
|
|
54
55
|
/**
|
|
55
56
|
* Zod schema definition for void type.
|
|
56
57
|
*/
|
|
57
|
-
declare const void_:
|
|
58
|
+
declare const void_: typeof StaticSchemaValidator.void;
|
|
58
59
|
/**
|
|
59
60
|
* Zod schema definition for null type.
|
|
60
61
|
*/
|
|
61
|
-
declare const null_:
|
|
62
|
+
declare const null_: typeof StaticSchemaValidator.null;
|
|
62
63
|
/**
|
|
63
64
|
* Zod schema definition for undefined type.
|
|
64
65
|
*/
|
|
65
|
-
declare const undefined_:
|
|
66
|
+
declare const undefined_: typeof StaticSchemaValidator.undefined;
|
|
66
67
|
/**
|
|
67
68
|
* Zod schema definition for any type.
|
|
68
69
|
*/
|
|
69
|
-
declare const any:
|
|
70
|
+
declare const any: typeof StaticSchemaValidator.any;
|
|
70
71
|
/**
|
|
71
72
|
* Zod schema definition for unknown type.
|
|
72
73
|
*/
|
|
73
|
-
declare const unknown:
|
|
74
|
+
declare const unknown: typeof StaticSchemaValidator.unknown;
|
|
74
75
|
/**
|
|
75
76
|
* Zod schema definition for never type.
|
|
76
77
|
*/
|
|
77
|
-
declare const never:
|
|
78
|
+
declare const never: typeof StaticSchemaValidator.never;
|
|
78
79
|
/**
|
|
79
80
|
* Zod schema definition for blob type.
|
|
80
81
|
*/
|
|
81
|
-
declare const binary:
|
|
82
|
+
declare const binary: typeof StaticSchemaValidator.binary;
|
|
82
83
|
/**
|
|
83
84
|
* Zod schema definition for file type.
|
|
84
85
|
*/
|
|
85
|
-
declare const file:
|
|
86
|
+
declare const file: typeof StaticSchemaValidator.file;
|
|
86
87
|
/**
|
|
87
88
|
* Transforms valid schema into Zod schema.
|
|
88
89
|
*/
|
|
89
|
-
declare const schemify:
|
|
90
|
+
declare const schemify: typeof StaticSchemaValidator.schemify;
|
|
90
91
|
/**
|
|
91
92
|
* Makes a valid schema optional.
|
|
92
93
|
*/
|
|
93
|
-
declare const optional:
|
|
94
|
+
declare const optional: typeof StaticSchemaValidator.optional;
|
|
94
95
|
/**
|
|
95
96
|
* Defines an array for a valid schema.
|
|
96
97
|
*/
|
|
97
|
-
declare const array:
|
|
98
|
+
declare const array: typeof StaticSchemaValidator.array;
|
|
98
99
|
/**
|
|
99
100
|
* Defines a union for a valid schema.
|
|
100
101
|
*/
|
|
101
|
-
declare const union:
|
|
102
|
+
declare const union: typeof StaticSchemaValidator.union;
|
|
102
103
|
/**
|
|
103
104
|
* Defines a literal for a valid schema.
|
|
104
105
|
*/
|
|
105
|
-
declare const literal:
|
|
106
|
+
declare const literal: typeof StaticSchemaValidator.literal;
|
|
106
107
|
/**
|
|
107
108
|
* Defines an enum for a valid schema.
|
|
108
109
|
*/
|
|
109
|
-
declare const enum_:
|
|
110
|
+
declare const enum_: typeof StaticSchemaValidator.enum_;
|
|
110
111
|
/**
|
|
111
112
|
* Defines a function for a valid schema.
|
|
112
113
|
*/
|
|
113
|
-
declare const function_:
|
|
114
|
+
declare const function_: typeof StaticSchemaValidator.function_;
|
|
114
115
|
/**
|
|
115
116
|
* Defines a record for a valid schema.
|
|
116
117
|
*/
|
|
117
|
-
declare const record:
|
|
118
|
+
declare const record: typeof StaticSchemaValidator.record;
|
|
118
119
|
/**
|
|
119
120
|
* Defines a promise for a valid schema.
|
|
120
121
|
*/
|
|
121
|
-
declare const promise:
|
|
122
|
+
declare const promise: typeof StaticSchemaValidator.promise;
|
|
122
123
|
/**
|
|
123
124
|
* Checks if a value is a Zod schema.
|
|
124
125
|
*/
|
|
125
|
-
declare const isSchema:
|
|
126
|
+
declare const isSchema: typeof StaticSchemaValidator.isSchema;
|
|
126
127
|
/**
|
|
127
128
|
* Validates a value against a valid schema.
|
|
128
129
|
*/
|
|
129
|
-
declare const validate:
|
|
130
|
+
declare const validate: typeof StaticSchemaValidator.validate;
|
|
130
131
|
/**
|
|
131
132
|
* Parses a value to be conformant to a particular schema.
|
|
132
133
|
*/
|
|
133
|
-
declare const parse:
|
|
134
|
+
declare const parse: typeof StaticSchemaValidator.parse;
|
|
134
135
|
/**
|
|
135
136
|
* Generates an OpenAPI schema object from a valid schema.
|
|
136
137
|
*/
|
|
137
|
-
declare const openapi:
|
|
138
|
+
declare const openapi: typeof StaticSchemaValidator.openapi;
|
|
138
139
|
|
|
139
|
-
export { SchemaValidator,
|
|
140
|
+
export { SchemaValidator, ZodSchemaValidator, any, array, bigint, binary, boolean, date, email, enum_, file, function_, isSchema, literal, never, null_, nullish, number, openapi, optional, parse, promise, record, schemify, string, symbol, undefined_, union, unknown, uri, uuid, validate, void_ };
|
package/lib/src/zod/index.d.ts
CHANGED
|
@@ -1,139 +1,140 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import * as zod from 'zod';
|
|
1
|
+
import { Z as ZodSchemaValidator } from '../../schema.types-Df9EB_Ke.js';
|
|
2
|
+
export { x as TupleZodResolve, u as UnboxedZodObjectSchema, z as UnionZodResolve, p as ZodCatchall, v as ZodIdiomaticSchema, s as ZodObject, r as ZodObjectShape, q as ZodOuterArray, C as ZodRecordKey, B as ZodResolve, t as ZodSchemaTranslate, w as ZodTupleContainer, y as ZodUnionContainer } from '../../schema.types-Df9EB_Ke.js';
|
|
3
|
+
import '@forklaunch/common';
|
|
4
|
+
import 'openapi3-ts/oas31';
|
|
6
5
|
import '@sinclair/typebox';
|
|
7
6
|
import '@sinclair/typebox/compiler';
|
|
7
|
+
import 'zod';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Factory function for creating a ZodSchemaValidator instance.
|
|
11
11
|
* @returns {ZodSchemaValidator} The ZodSchemaValidator instance.
|
|
12
12
|
*/
|
|
13
13
|
declare const SchemaValidator: () => ZodSchemaValidator;
|
|
14
|
+
declare const StaticSchemaValidator: ZodSchemaValidator;
|
|
14
15
|
/**
|
|
15
16
|
* Zod schema definition for string type.
|
|
16
17
|
*/
|
|
17
|
-
declare const string:
|
|
18
|
+
declare const string: typeof StaticSchemaValidator.string;
|
|
18
19
|
/**
|
|
19
20
|
* Zod schema definition for UUID type.
|
|
20
21
|
*/
|
|
21
|
-
declare const uuid:
|
|
22
|
+
declare const uuid: typeof StaticSchemaValidator.uuid;
|
|
22
23
|
/**
|
|
23
24
|
* Zod schema definition for email type.
|
|
24
25
|
*/
|
|
25
|
-
declare const email:
|
|
26
|
+
declare const email: typeof StaticSchemaValidator.email;
|
|
26
27
|
/**
|
|
27
28
|
* Zod schema definition for URI type.
|
|
28
29
|
*/
|
|
29
|
-
declare const uri:
|
|
30
|
+
declare const uri: typeof StaticSchemaValidator.uri;
|
|
30
31
|
/**
|
|
31
32
|
* Zod schema definition for number type.
|
|
32
33
|
*/
|
|
33
|
-
declare const number:
|
|
34
|
+
declare const number: typeof StaticSchemaValidator.number;
|
|
34
35
|
/**
|
|
35
36
|
* Zod schema definition for bigint type.
|
|
36
37
|
*/
|
|
37
|
-
declare const bigint:
|
|
38
|
+
declare const bigint: typeof StaticSchemaValidator.bigint;
|
|
38
39
|
/**
|
|
39
40
|
* Zod schema definition for boolean type.
|
|
40
41
|
*/
|
|
41
|
-
declare const boolean:
|
|
42
|
+
declare const boolean: typeof StaticSchemaValidator.boolean;
|
|
42
43
|
/**
|
|
43
44
|
* Zod schema definition for date type.
|
|
44
45
|
*/
|
|
45
|
-
declare const date:
|
|
46
|
+
declare const date: typeof StaticSchemaValidator.date;
|
|
46
47
|
/**
|
|
47
48
|
* Zod schema definition for symbol type.
|
|
48
49
|
*/
|
|
49
|
-
declare const symbol:
|
|
50
|
+
declare const symbol: typeof StaticSchemaValidator.symbol;
|
|
50
51
|
/**
|
|
51
52
|
* Zod schema definition for undefined, null, void types.
|
|
52
53
|
*/
|
|
53
|
-
declare const nullish:
|
|
54
|
+
declare const nullish: typeof StaticSchemaValidator.nullish;
|
|
54
55
|
/**
|
|
55
56
|
* Zod schema definition for void type.
|
|
56
57
|
*/
|
|
57
|
-
declare const void_:
|
|
58
|
+
declare const void_: typeof StaticSchemaValidator.void;
|
|
58
59
|
/**
|
|
59
60
|
* Zod schema definition for null type.
|
|
60
61
|
*/
|
|
61
|
-
declare const null_:
|
|
62
|
+
declare const null_: typeof StaticSchemaValidator.null;
|
|
62
63
|
/**
|
|
63
64
|
* Zod schema definition for undefined type.
|
|
64
65
|
*/
|
|
65
|
-
declare const undefined_:
|
|
66
|
+
declare const undefined_: typeof StaticSchemaValidator.undefined;
|
|
66
67
|
/**
|
|
67
68
|
* Zod schema definition for any type.
|
|
68
69
|
*/
|
|
69
|
-
declare const any:
|
|
70
|
+
declare const any: typeof StaticSchemaValidator.any;
|
|
70
71
|
/**
|
|
71
72
|
* Zod schema definition for unknown type.
|
|
72
73
|
*/
|
|
73
|
-
declare const unknown:
|
|
74
|
+
declare const unknown: typeof StaticSchemaValidator.unknown;
|
|
74
75
|
/**
|
|
75
76
|
* Zod schema definition for never type.
|
|
76
77
|
*/
|
|
77
|
-
declare const never:
|
|
78
|
+
declare const never: typeof StaticSchemaValidator.never;
|
|
78
79
|
/**
|
|
79
80
|
* Zod schema definition for blob type.
|
|
80
81
|
*/
|
|
81
|
-
declare const binary:
|
|
82
|
+
declare const binary: typeof StaticSchemaValidator.binary;
|
|
82
83
|
/**
|
|
83
84
|
* Zod schema definition for file type.
|
|
84
85
|
*/
|
|
85
|
-
declare const file:
|
|
86
|
+
declare const file: typeof StaticSchemaValidator.file;
|
|
86
87
|
/**
|
|
87
88
|
* Transforms valid schema into Zod schema.
|
|
88
89
|
*/
|
|
89
|
-
declare const schemify:
|
|
90
|
+
declare const schemify: typeof StaticSchemaValidator.schemify;
|
|
90
91
|
/**
|
|
91
92
|
* Makes a valid schema optional.
|
|
92
93
|
*/
|
|
93
|
-
declare const optional:
|
|
94
|
+
declare const optional: typeof StaticSchemaValidator.optional;
|
|
94
95
|
/**
|
|
95
96
|
* Defines an array for a valid schema.
|
|
96
97
|
*/
|
|
97
|
-
declare const array:
|
|
98
|
+
declare const array: typeof StaticSchemaValidator.array;
|
|
98
99
|
/**
|
|
99
100
|
* Defines a union for a valid schema.
|
|
100
101
|
*/
|
|
101
|
-
declare const union:
|
|
102
|
+
declare const union: typeof StaticSchemaValidator.union;
|
|
102
103
|
/**
|
|
103
104
|
* Defines a literal for a valid schema.
|
|
104
105
|
*/
|
|
105
|
-
declare const literal:
|
|
106
|
+
declare const literal: typeof StaticSchemaValidator.literal;
|
|
106
107
|
/**
|
|
107
108
|
* Defines an enum for a valid schema.
|
|
108
109
|
*/
|
|
109
|
-
declare const enum_:
|
|
110
|
+
declare const enum_: typeof StaticSchemaValidator.enum_;
|
|
110
111
|
/**
|
|
111
112
|
* Defines a function for a valid schema.
|
|
112
113
|
*/
|
|
113
|
-
declare const function_:
|
|
114
|
+
declare const function_: typeof StaticSchemaValidator.function_;
|
|
114
115
|
/**
|
|
115
116
|
* Defines a record for a valid schema.
|
|
116
117
|
*/
|
|
117
|
-
declare const record:
|
|
118
|
+
declare const record: typeof StaticSchemaValidator.record;
|
|
118
119
|
/**
|
|
119
120
|
* Defines a promise for a valid schema.
|
|
120
121
|
*/
|
|
121
|
-
declare const promise:
|
|
122
|
+
declare const promise: typeof StaticSchemaValidator.promise;
|
|
122
123
|
/**
|
|
123
124
|
* Checks if a value is a Zod schema.
|
|
124
125
|
*/
|
|
125
|
-
declare const isSchema:
|
|
126
|
+
declare const isSchema: typeof StaticSchemaValidator.isSchema;
|
|
126
127
|
/**
|
|
127
128
|
* Validates a value against a valid schema.
|
|
128
129
|
*/
|
|
129
|
-
declare const validate:
|
|
130
|
+
declare const validate: typeof StaticSchemaValidator.validate;
|
|
130
131
|
/**
|
|
131
132
|
* Parses a value to be conformant to a particular schema.
|
|
132
133
|
*/
|
|
133
|
-
declare const parse:
|
|
134
|
+
declare const parse: typeof StaticSchemaValidator.parse;
|
|
134
135
|
/**
|
|
135
136
|
* Generates an OpenAPI schema object from a valid schema.
|
|
136
137
|
*/
|
|
137
|
-
declare const openapi:
|
|
138
|
+
declare const openapi: typeof StaticSchemaValidator.openapi;
|
|
138
139
|
|
|
139
|
-
export { SchemaValidator,
|
|
140
|
+
export { SchemaValidator, ZodSchemaValidator, any, array, bigint, binary, boolean, date, email, enum_, file, function_, isSchema, literal, never, null_, nullish, number, openapi, optional, parse, promise, record, schemify, string, symbol, undefined_, union, unknown, uri, uuid, validate, void_ };
|
package/lib/src/zod/index.js
CHANGED
|
@@ -186,14 +186,14 @@ var ZodSchemaValidator = class {
|
|
|
186
186
|
type: "null",
|
|
187
187
|
example: "never"
|
|
188
188
|
});
|
|
189
|
-
binary = import_zod.z.string().transform(
|
|
189
|
+
binary = import_zod.z.string().transform((v) => new TextEncoder().encode(v)).openapi({
|
|
190
190
|
title: "Binary",
|
|
191
191
|
type: "string",
|
|
192
192
|
format: "binary",
|
|
193
193
|
example: "a utf-8 encodable string"
|
|
194
194
|
});
|
|
195
|
-
file =
|
|
196
|
-
return new File([val], name, {
|
|
195
|
+
file = import_zod.z.string().transform((val) => {
|
|
196
|
+
return (name, type) => new File([val], name, {
|
|
197
197
|
type,
|
|
198
198
|
lastModified: Date.now()
|
|
199
199
|
});
|
|
@@ -201,7 +201,6 @@ var ZodSchemaValidator = class {
|
|
|
201
201
|
title: "File",
|
|
202
202
|
type: "string",
|
|
203
203
|
format: "binary",
|
|
204
|
-
contentMediaType: type,
|
|
205
204
|
example: "a utf-8 encodable string"
|
|
206
205
|
});
|
|
207
206
|
/**
|
|
@@ -406,35 +405,19 @@ var unknown = StaticSchemaValidator.unknown;
|
|
|
406
405
|
var never = StaticSchemaValidator.never;
|
|
407
406
|
var binary = StaticSchemaValidator.binary;
|
|
408
407
|
var file = StaticSchemaValidator.file;
|
|
409
|
-
var schemify = StaticSchemaValidator.schemify.bind(
|
|
410
|
-
|
|
411
|
-
);
|
|
412
|
-
var optional = StaticSchemaValidator.optional.bind(
|
|
413
|
-
StaticSchemaValidator
|
|
414
|
-
);
|
|
408
|
+
var schemify = StaticSchemaValidator.schemify.bind(StaticSchemaValidator);
|
|
409
|
+
var optional = StaticSchemaValidator.optional.bind(StaticSchemaValidator);
|
|
415
410
|
var array = StaticSchemaValidator.array.bind(StaticSchemaValidator);
|
|
416
411
|
var union = StaticSchemaValidator.union.bind(StaticSchemaValidator);
|
|
417
|
-
var literal = StaticSchemaValidator.literal.bind(
|
|
418
|
-
StaticSchemaValidator
|
|
419
|
-
);
|
|
412
|
+
var literal = StaticSchemaValidator.literal.bind(StaticSchemaValidator);
|
|
420
413
|
var enum_ = StaticSchemaValidator.enum_.bind(StaticSchemaValidator);
|
|
421
|
-
var function_ = StaticSchemaValidator.function_.bind(
|
|
422
|
-
StaticSchemaValidator
|
|
423
|
-
);
|
|
414
|
+
var function_ = StaticSchemaValidator.function_.bind(StaticSchemaValidator);
|
|
424
415
|
var record = StaticSchemaValidator.record.bind(StaticSchemaValidator);
|
|
425
|
-
var promise = StaticSchemaValidator.promise.bind(
|
|
426
|
-
|
|
427
|
-
);
|
|
428
|
-
var isSchema = StaticSchemaValidator.isSchema.bind(
|
|
429
|
-
StaticSchemaValidator
|
|
430
|
-
);
|
|
431
|
-
var validate = StaticSchemaValidator.validate.bind(
|
|
432
|
-
StaticSchemaValidator
|
|
433
|
-
);
|
|
416
|
+
var promise = StaticSchemaValidator.promise.bind(StaticSchemaValidator);
|
|
417
|
+
var isSchema = StaticSchemaValidator.isSchema.bind(StaticSchemaValidator);
|
|
418
|
+
var validate = StaticSchemaValidator.validate.bind(StaticSchemaValidator);
|
|
434
419
|
var parse = StaticSchemaValidator.parse.bind(StaticSchemaValidator);
|
|
435
|
-
var openapi = StaticSchemaValidator.openapi.bind(
|
|
436
|
-
StaticSchemaValidator
|
|
437
|
-
);
|
|
420
|
+
var openapi = StaticSchemaValidator.openapi.bind(StaticSchemaValidator);
|
|
438
421
|
// Annotate the CommonJS export names for ESM import in node:
|
|
439
422
|
0 && (module.exports = {
|
|
440
423
|
SchemaValidator,
|