@forklaunch/validator 0.10.14 → 0.10.15
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-wl77iEsE.d.mts → schema.types-CR2kDA3N.d.mts} +2 -2
- package/lib/{schema.types-wl77iEsE.d.ts → schema.types-CR2kDA3N.d.ts} +2 -2
- package/lib/src/typebox/index.d.mts +2 -2
- package/lib/src/typebox/index.d.ts +2 -2
- package/lib/src/typebox/index.js +52 -15
- package/lib/src/typebox/index.mjs +52 -15
- package/lib/src/zod/index.d.mts +2 -2
- package/lib/src/zod/index.d.ts +2 -2
- package/lib/src/zod/index.js +21 -2
- package/lib/src/zod/index.mjs +21 -2
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
2
|
-
import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-
|
|
2
|
+
import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-CR2kDA3N.mjs';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import '@sinclair/typebox';
|
|
5
5
|
import '@sinclair/typebox/compiler';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
2
|
-
import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-
|
|
2
|
+
import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-CR2kDA3N.js';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import '@sinclair/typebox';
|
|
5
5
|
import '@sinclair/typebox/compiler';
|
package/lib/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ParseError } from './schema.types-
|
|
2
|
-
export { A as AnySchemaValidator, I as IdiomaticSchema, e as Increment, K as KeyTypes, L as LiteralSchema, a as ParseResult, d as Schema, b as SchemaResolve, c as SchemaTranslate, S as SchemaValidator, U as UnboxedObjectSchema } from './schema.types-
|
|
1
|
+
import { P as ParseError } from './schema.types-CR2kDA3N.mjs';
|
|
2
|
+
export { A as AnySchemaValidator, I as IdiomaticSchema, e as Increment, K as KeyTypes, L as LiteralSchema, a as ParseResult, d as Schema, b as SchemaResolve, c as SchemaTranslate, S as SchemaValidator, U as UnboxedObjectSchema } from './schema.types-CR2kDA3N.mjs';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import 'openapi3-ts/oas31';
|
|
5
5
|
import '@sinclair/typebox';
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ParseError } from './schema.types-
|
|
2
|
-
export { A as AnySchemaValidator, I as IdiomaticSchema, e as Increment, K as KeyTypes, L as LiteralSchema, a as ParseResult, d as Schema, b as SchemaResolve, c as SchemaTranslate, S as SchemaValidator, U as UnboxedObjectSchema } from './schema.types-
|
|
1
|
+
import { P as ParseError } from './schema.types-CR2kDA3N.js';
|
|
2
|
+
export { A as AnySchemaValidator, I as IdiomaticSchema, e as Increment, K as KeyTypes, L as LiteralSchema, a as ParseResult, d as Schema, b as SchemaResolve, c as SchemaTranslate, S as SchemaValidator, U as UnboxedObjectSchema } from './schema.types-CR2kDA3N.js';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import 'openapi3-ts/oas31';
|
|
5
5
|
import '@sinclair/typebox';
|
|
@@ -40,7 +40,7 @@ declare class TypeboxSchemaValidator implements SchemaValidator<(<T>() => TTrans
|
|
|
40
40
|
unknown: TUnknown;
|
|
41
41
|
never: TNever;
|
|
42
42
|
binary: TTransform<TString, Uint8Array<ArrayBuffer>>;
|
|
43
|
-
file: TTransform<TUnsafe<Buffer<ArrayBuffer
|
|
43
|
+
file: TTransform<TUnion<[TUnsafe<Buffer>, TUnsafe<ArrayBuffer>, TUnsafe<Blob>, TString]>, Blob>;
|
|
44
44
|
type: <T>() => TTransform<TAny, T>;
|
|
45
45
|
/**
|
|
46
46
|
* Extracts the error type of a schema for error messages.
|
|
@@ -251,7 +251,7 @@ declare class ZodSchemaValidator implements SchemaValidator<(<T>() => ZodType<T>
|
|
|
251
251
|
unknown: z.ZodUnknown;
|
|
252
252
|
never: z.ZodNever;
|
|
253
253
|
binary: z.ZodEffects<z.ZodString, Uint8Array<ArrayBuffer>, string>;
|
|
254
|
-
file: z.ZodEffects<z.ZodType<Buffer<
|
|
254
|
+
file: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Blob, z.ZodTypeDef, Blob>, z.ZodString]>, Blob, string | ArrayBuffer | Buffer<ArrayBufferLike> | Blob>, Blob, string | ArrayBuffer | Buffer<ArrayBufferLike> | Blob>;
|
|
255
255
|
type: <T>() => ZodType<T>;
|
|
256
256
|
/**
|
|
257
257
|
* Compiles schema if this exists, for optimal performance.
|
|
@@ -40,7 +40,7 @@ declare class TypeboxSchemaValidator implements SchemaValidator<(<T>() => TTrans
|
|
|
40
40
|
unknown: TUnknown;
|
|
41
41
|
never: TNever;
|
|
42
42
|
binary: TTransform<TString, Uint8Array<ArrayBuffer>>;
|
|
43
|
-
file: TTransform<TUnsafe<Buffer<ArrayBuffer
|
|
43
|
+
file: TTransform<TUnion<[TUnsafe<Buffer>, TUnsafe<ArrayBuffer>, TUnsafe<Blob>, TString]>, Blob>;
|
|
44
44
|
type: <T>() => TTransform<TAny, T>;
|
|
45
45
|
/**
|
|
46
46
|
* Extracts the error type of a schema for error messages.
|
|
@@ -251,7 +251,7 @@ declare class ZodSchemaValidator implements SchemaValidator<(<T>() => ZodType<T>
|
|
|
251
251
|
unknown: z.ZodUnknown;
|
|
252
252
|
never: z.ZodNever;
|
|
253
253
|
binary: z.ZodEffects<z.ZodString, Uint8Array<ArrayBuffer>, string>;
|
|
254
|
-
file: z.ZodEffects<z.ZodType<Buffer<
|
|
254
|
+
file: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Blob, z.ZodTypeDef, Blob>, z.ZodString]>, Blob, string | ArrayBuffer | Buffer<ArrayBufferLike> | Blob>, Blob, string | ArrayBuffer | Buffer<ArrayBufferLike> | Blob>;
|
|
255
255
|
type: <T>() => ZodType<T>;
|
|
256
256
|
/**
|
|
257
257
|
* Compiles schema if this exists, for optimal performance.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@sinclair/typebox';
|
|
2
|
-
import { T as TypeboxSchemaValidator } from '../../schema.types-
|
|
3
|
-
export { i as SafeTObject, f as TCatchall, l as TIdiomaticSchema, h as TObjectShape, g as TOuterArray, o as TResolve, j as TSchemaTranslate, m as TUnionTupleContainer, k as UnboxedTObjectSchema, n as UnionTupleTResolve } from '../../schema.types-
|
|
2
|
+
import { T as TypeboxSchemaValidator } from '../../schema.types-CR2kDA3N.mjs';
|
|
3
|
+
export { i as SafeTObject, f as TCatchall, l as TIdiomaticSchema, h as TObjectShape, g as TOuterArray, o as TResolve, j as TSchemaTranslate, m as TUnionTupleContainer, k as UnboxedTObjectSchema, n as UnionTupleTResolve } from '../../schema.types-CR2kDA3N.mjs';
|
|
4
4
|
import '@forklaunch/common';
|
|
5
5
|
import 'openapi3-ts/oas31';
|
|
6
6
|
import '@sinclair/typebox/compiler';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@sinclair/typebox';
|
|
2
|
-
import { T as TypeboxSchemaValidator } from '../../schema.types-
|
|
3
|
-
export { i as SafeTObject, f as TCatchall, l as TIdiomaticSchema, h as TObjectShape, g as TOuterArray, o as TResolve, j as TSchemaTranslate, m as TUnionTupleContainer, k as UnboxedTObjectSchema, n as UnionTupleTResolve } from '../../schema.types-
|
|
2
|
+
import { T as TypeboxSchemaValidator } from '../../schema.types-CR2kDA3N.js';
|
|
3
|
+
export { i as SafeTObject, f as TCatchall, l as TIdiomaticSchema, h as TObjectShape, g as TOuterArray, o as TResolve, j as TSchemaTranslate, m as TUnionTupleContainer, k as UnboxedTObjectSchema, n as UnionTupleTResolve } from '../../schema.types-CR2kDA3N.js';
|
|
4
4
|
import '@forklaunch/common';
|
|
5
5
|
import 'openapi3-ts/oas31';
|
|
6
6
|
import '@sinclair/typebox/compiler';
|
package/lib/src/typebox/index.js
CHANGED
|
@@ -257,14 +257,46 @@ var TypeboxSchemaValidator = class {
|
|
|
257
257
|
return "";
|
|
258
258
|
});
|
|
259
259
|
file = import_typebox.Type.Transform(
|
|
260
|
-
import_typebox.Type.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
260
|
+
import_typebox.Type.Union([
|
|
261
|
+
import_typebox.Type.Unsafe({
|
|
262
|
+
errorType: "binary",
|
|
263
|
+
format: "binary",
|
|
264
|
+
example: "a raw buffer or file stream",
|
|
265
|
+
title: "File"
|
|
266
|
+
}),
|
|
267
|
+
import_typebox.Type.Unsafe({
|
|
268
|
+
errorType: "binary",
|
|
269
|
+
format: "binary",
|
|
270
|
+
example: "an array buffer",
|
|
271
|
+
title: "File"
|
|
272
|
+
}),
|
|
273
|
+
import_typebox.Type.Unsafe({
|
|
274
|
+
errorType: "binary",
|
|
275
|
+
format: "binary",
|
|
276
|
+
example: "a blob object",
|
|
277
|
+
title: "File"
|
|
278
|
+
}),
|
|
279
|
+
import_typebox.Type.String({
|
|
280
|
+
errorType: "binary",
|
|
281
|
+
format: "binary",
|
|
282
|
+
example: "a string content",
|
|
283
|
+
title: "File"
|
|
284
|
+
})
|
|
285
|
+
])
|
|
266
286
|
).Decode((value) => {
|
|
267
|
-
|
|
287
|
+
if (value instanceof Buffer) {
|
|
288
|
+
return new import_common.InMemoryBlob(value);
|
|
289
|
+
}
|
|
290
|
+
if (value instanceof ArrayBuffer) {
|
|
291
|
+
return new import_common.InMemoryBlob(Buffer.from(value));
|
|
292
|
+
}
|
|
293
|
+
if (value instanceof Blob) {
|
|
294
|
+
return value;
|
|
295
|
+
}
|
|
296
|
+
if (typeof value === "string") {
|
|
297
|
+
return new import_common.InMemoryBlob(Buffer.from(value));
|
|
298
|
+
}
|
|
299
|
+
return new import_common.InMemoryBlob(Buffer.from(value));
|
|
268
300
|
}).Encode((value) => value.content);
|
|
269
301
|
type = () => this.any;
|
|
270
302
|
/**
|
|
@@ -304,7 +336,7 @@ var TypeboxSchemaValidator = class {
|
|
|
304
336
|
}
|
|
305
337
|
const newSchema = {};
|
|
306
338
|
Object.getOwnPropertyNames(schema).forEach((key) => {
|
|
307
|
-
if (import_typebox.KindGuard.IsSchema(schema[key])) {
|
|
339
|
+
if (import_typebox.KindGuard.IsSchema(schema[key]) || import_typebox.KindGuard.IsTransform(schema[key])) {
|
|
308
340
|
newSchema[key] = schema[key];
|
|
309
341
|
} else {
|
|
310
342
|
const schemified = this.schemify(schema[key]);
|
|
@@ -522,20 +554,25 @@ var TypeboxSchemaValidator = class {
|
|
|
522
554
|
* @returns {SchemaObject} The OpenAPI schema object.
|
|
523
555
|
*/
|
|
524
556
|
openapi(schema) {
|
|
525
|
-
|
|
557
|
+
const schemified = this.schemify(schema);
|
|
558
|
+
let processedSchema;
|
|
526
559
|
if (import_typebox.KindGuard.IsDate(schemified)) {
|
|
527
|
-
|
|
560
|
+
processedSchema = import_typebox.Type.String({
|
|
528
561
|
format: "date-time"
|
|
529
562
|
});
|
|
563
|
+
} else {
|
|
564
|
+
processedSchema = JSON.parse(JSON.stringify(schemified));
|
|
530
565
|
}
|
|
531
|
-
const newSchema = Object.assign({},
|
|
566
|
+
const newSchema = Object.assign({}, processedSchema);
|
|
532
567
|
if (Object.hasOwn(newSchema, "properties")) {
|
|
533
568
|
if (newSchema.properties) {
|
|
534
|
-
Object.entries({ ...
|
|
535
|
-
|
|
536
|
-
|
|
569
|
+
Object.entries({ ...processedSchema.properties }).forEach(
|
|
570
|
+
([key, value]) => {
|
|
571
|
+
if (import_typebox.KindGuard.IsSchema(value) && newSchema.properties) {
|
|
572
|
+
newSchema.properties[key] = this.openapi(value);
|
|
573
|
+
}
|
|
537
574
|
}
|
|
538
|
-
|
|
575
|
+
);
|
|
539
576
|
}
|
|
540
577
|
}
|
|
541
578
|
if (Object.hasOwn(newSchema, "items")) {
|
|
@@ -208,14 +208,46 @@ var TypeboxSchemaValidator = class {
|
|
|
208
208
|
return "";
|
|
209
209
|
});
|
|
210
210
|
file = Type.Transform(
|
|
211
|
-
Type.
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
211
|
+
Type.Union([
|
|
212
|
+
Type.Unsafe({
|
|
213
|
+
errorType: "binary",
|
|
214
|
+
format: "binary",
|
|
215
|
+
example: "a raw buffer or file stream",
|
|
216
|
+
title: "File"
|
|
217
|
+
}),
|
|
218
|
+
Type.Unsafe({
|
|
219
|
+
errorType: "binary",
|
|
220
|
+
format: "binary",
|
|
221
|
+
example: "an array buffer",
|
|
222
|
+
title: "File"
|
|
223
|
+
}),
|
|
224
|
+
Type.Unsafe({
|
|
225
|
+
errorType: "binary",
|
|
226
|
+
format: "binary",
|
|
227
|
+
example: "a blob object",
|
|
228
|
+
title: "File"
|
|
229
|
+
}),
|
|
230
|
+
Type.String({
|
|
231
|
+
errorType: "binary",
|
|
232
|
+
format: "binary",
|
|
233
|
+
example: "a string content",
|
|
234
|
+
title: "File"
|
|
235
|
+
})
|
|
236
|
+
])
|
|
217
237
|
).Decode((value) => {
|
|
218
|
-
|
|
238
|
+
if (value instanceof Buffer) {
|
|
239
|
+
return new InMemoryBlob(value);
|
|
240
|
+
}
|
|
241
|
+
if (value instanceof ArrayBuffer) {
|
|
242
|
+
return new InMemoryBlob(Buffer.from(value));
|
|
243
|
+
}
|
|
244
|
+
if (value instanceof Blob) {
|
|
245
|
+
return value;
|
|
246
|
+
}
|
|
247
|
+
if (typeof value === "string") {
|
|
248
|
+
return new InMemoryBlob(Buffer.from(value));
|
|
249
|
+
}
|
|
250
|
+
return new InMemoryBlob(Buffer.from(value));
|
|
219
251
|
}).Encode((value) => value.content);
|
|
220
252
|
type = () => this.any;
|
|
221
253
|
/**
|
|
@@ -255,7 +287,7 @@ var TypeboxSchemaValidator = class {
|
|
|
255
287
|
}
|
|
256
288
|
const newSchema = {};
|
|
257
289
|
Object.getOwnPropertyNames(schema).forEach((key) => {
|
|
258
|
-
if (KindGuard.IsSchema(schema[key])) {
|
|
290
|
+
if (KindGuard.IsSchema(schema[key]) || KindGuard.IsTransform(schema[key])) {
|
|
259
291
|
newSchema[key] = schema[key];
|
|
260
292
|
} else {
|
|
261
293
|
const schemified = this.schemify(schema[key]);
|
|
@@ -473,20 +505,25 @@ var TypeboxSchemaValidator = class {
|
|
|
473
505
|
* @returns {SchemaObject} The OpenAPI schema object.
|
|
474
506
|
*/
|
|
475
507
|
openapi(schema) {
|
|
476
|
-
|
|
508
|
+
const schemified = this.schemify(schema);
|
|
509
|
+
let processedSchema;
|
|
477
510
|
if (KindGuard.IsDate(schemified)) {
|
|
478
|
-
|
|
511
|
+
processedSchema = Type.String({
|
|
479
512
|
format: "date-time"
|
|
480
513
|
});
|
|
514
|
+
} else {
|
|
515
|
+
processedSchema = JSON.parse(JSON.stringify(schemified));
|
|
481
516
|
}
|
|
482
|
-
const newSchema = Object.assign({},
|
|
517
|
+
const newSchema = Object.assign({}, processedSchema);
|
|
483
518
|
if (Object.hasOwn(newSchema, "properties")) {
|
|
484
519
|
if (newSchema.properties) {
|
|
485
|
-
Object.entries({ ...
|
|
486
|
-
|
|
487
|
-
|
|
520
|
+
Object.entries({ ...processedSchema.properties }).forEach(
|
|
521
|
+
([key, value]) => {
|
|
522
|
+
if (KindGuard.IsSchema(value) && newSchema.properties) {
|
|
523
|
+
newSchema.properties[key] = this.openapi(value);
|
|
524
|
+
}
|
|
488
525
|
}
|
|
489
|
-
|
|
526
|
+
);
|
|
490
527
|
}
|
|
491
528
|
}
|
|
492
529
|
if (Object.hasOwn(newSchema, "items")) {
|
package/lib/src/zod/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodDate, ZodEffects, ZodEnum, ZodFunction, ZodLiteral, ZodNever, ZodNull, ZodNumber, ZodObject, ZodOptional, ZodPipeline, ZodPromise, ZodRawShape, ZodRecord, ZodString, ZodSymbol, ZodTuple, ZodType, ZodTypeAny, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid } from 'zod/v3';
|
|
2
|
-
import { Z as ZodSchemaValidator } from '../../schema.types-
|
|
3
|
-
export { w as TupleZodResolve, t as UnboxedZodObjectSchema, y as UnionZodResolve, p as ZodCatchall, u as ZodIdiomaticSchema, r as ZodObjectShape, q as ZodOuterArray, B as ZodRecordKey, z as ZodResolve, s as ZodSchemaTranslate, v as ZodTupleContainer, x as ZodUnionContainer } from '../../schema.types-
|
|
2
|
+
import { Z as ZodSchemaValidator } from '../../schema.types-CR2kDA3N.mjs';
|
|
3
|
+
export { w as TupleZodResolve, t as UnboxedZodObjectSchema, y as UnionZodResolve, p as ZodCatchall, u as ZodIdiomaticSchema, r as ZodObjectShape, q as ZodOuterArray, B as ZodRecordKey, z as ZodResolve, s as ZodSchemaTranslate, v as ZodTupleContainer, x as ZodUnionContainer } from '../../schema.types-CR2kDA3N.mjs';
|
|
4
4
|
import '@forklaunch/common';
|
|
5
5
|
import 'openapi3-ts/oas31';
|
|
6
6
|
import '@sinclair/typebox';
|
package/lib/src/zod/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodDate, ZodEffects, ZodEnum, ZodFunction, ZodLiteral, ZodNever, ZodNull, ZodNumber, ZodObject, ZodOptional, ZodPipeline, ZodPromise, ZodRawShape, ZodRecord, ZodString, ZodSymbol, ZodTuple, ZodType, ZodTypeAny, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid } from 'zod/v3';
|
|
2
|
-
import { Z as ZodSchemaValidator } from '../../schema.types-
|
|
3
|
-
export { w as TupleZodResolve, t as UnboxedZodObjectSchema, y as UnionZodResolve, p as ZodCatchall, u as ZodIdiomaticSchema, r as ZodObjectShape, q as ZodOuterArray, B as ZodRecordKey, z as ZodResolve, s as ZodSchemaTranslate, v as ZodTupleContainer, x as ZodUnionContainer } from '../../schema.types-
|
|
2
|
+
import { Z as ZodSchemaValidator } from '../../schema.types-CR2kDA3N.js';
|
|
3
|
+
export { w as TupleZodResolve, t as UnboxedZodObjectSchema, y as UnionZodResolve, p as ZodCatchall, u as ZodIdiomaticSchema, r as ZodObjectShape, q as ZodOuterArray, B as ZodRecordKey, z as ZodResolve, s as ZodSchemaTranslate, v as ZodTupleContainer, x as ZodUnionContainer } from '../../schema.types-CR2kDA3N.js';
|
|
4
4
|
import '@forklaunch/common';
|
|
5
5
|
import 'openapi3-ts/oas31';
|
|
6
6
|
import '@sinclair/typebox';
|
package/lib/src/zod/index.js
CHANGED
|
@@ -774,8 +774,27 @@ var ZodSchemaValidator = class {
|
|
|
774
774
|
format: "binary",
|
|
775
775
|
example: "a base-64 encodable string"
|
|
776
776
|
});
|
|
777
|
-
file = import_v32.z.
|
|
777
|
+
file = import_v32.z.union([
|
|
778
|
+
import_v32.z.instanceof(Buffer),
|
|
779
|
+
import_v32.z.instanceof(ArrayBuffer),
|
|
780
|
+
import_v32.z.instanceof(Blob),
|
|
781
|
+
import_v32.z.string()
|
|
782
|
+
]).transform((val) => {
|
|
783
|
+
if (val instanceof Buffer) {
|
|
784
|
+
return new Blob([val]);
|
|
785
|
+
}
|
|
786
|
+
if (val instanceof ArrayBuffer) {
|
|
787
|
+
return new Blob([val]);
|
|
788
|
+
}
|
|
789
|
+
if (val instanceof Blob) {
|
|
790
|
+
return val;
|
|
791
|
+
}
|
|
792
|
+
if (typeof val === "string") {
|
|
793
|
+
return new Blob([val]);
|
|
794
|
+
}
|
|
778
795
|
return new Blob([val]);
|
|
796
|
+
}).refine((val) => val instanceof Blob, {
|
|
797
|
+
message: "Invalid file type: expected Buffer, ArrayBuffer, Blob, or string"
|
|
779
798
|
}).openapi({
|
|
780
799
|
title: "File",
|
|
781
800
|
type: "string",
|
|
@@ -960,7 +979,7 @@ var ZodSchemaValidator = class {
|
|
|
960
979
|
* @returns {SchemaObject} The OpenAPI schema object.
|
|
961
980
|
*/
|
|
962
981
|
openapi(schema) {
|
|
963
|
-
return generateSchema(this.schemify(schema));
|
|
982
|
+
return generateSchema(JSON.parse(JSON.stringify(this.schemify(schema))));
|
|
964
983
|
}
|
|
965
984
|
};
|
|
966
985
|
|
package/lib/src/zod/index.mjs
CHANGED
|
@@ -718,8 +718,27 @@ var ZodSchemaValidator = class {
|
|
|
718
718
|
format: "binary",
|
|
719
719
|
example: "a base-64 encodable string"
|
|
720
720
|
});
|
|
721
|
-
file = z2.
|
|
721
|
+
file = z2.union([
|
|
722
|
+
z2.instanceof(Buffer),
|
|
723
|
+
z2.instanceof(ArrayBuffer),
|
|
724
|
+
z2.instanceof(Blob),
|
|
725
|
+
z2.string()
|
|
726
|
+
]).transform((val) => {
|
|
727
|
+
if (val instanceof Buffer) {
|
|
728
|
+
return new Blob([val]);
|
|
729
|
+
}
|
|
730
|
+
if (val instanceof ArrayBuffer) {
|
|
731
|
+
return new Blob([val]);
|
|
732
|
+
}
|
|
733
|
+
if (val instanceof Blob) {
|
|
734
|
+
return val;
|
|
735
|
+
}
|
|
736
|
+
if (typeof val === "string") {
|
|
737
|
+
return new Blob([val]);
|
|
738
|
+
}
|
|
722
739
|
return new Blob([val]);
|
|
740
|
+
}).refine((val) => val instanceof Blob, {
|
|
741
|
+
message: "Invalid file type: expected Buffer, ArrayBuffer, Blob, or string"
|
|
723
742
|
}).openapi({
|
|
724
743
|
title: "File",
|
|
725
744
|
type: "string",
|
|
@@ -904,7 +923,7 @@ var ZodSchemaValidator = class {
|
|
|
904
923
|
* @returns {SchemaObject} The OpenAPI schema object.
|
|
905
924
|
*/
|
|
906
925
|
openapi(schema) {
|
|
907
|
-
return generateSchema(this.schemify(schema));
|
|
926
|
+
return generateSchema(JSON.parse(JSON.stringify(this.schemify(schema))));
|
|
908
927
|
}
|
|
909
928
|
};
|
|
910
929
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/validator",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.15",
|
|
4
4
|
"description": "Schema validator for ForkLaunch components.",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
"@sinclair/typebox": "^0.34.41",
|
|
62
62
|
"ts-deepmerge": "^7.0.3",
|
|
63
63
|
"zod": "^4.1.11",
|
|
64
|
-
"@forklaunch/common": "0.6.
|
|
64
|
+
"@forklaunch/common": "0.6.15"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@eslint/js": "^9.
|
|
67
|
+
"@eslint/js": "^9.37.0",
|
|
68
68
|
"@types/jest": "^30.0.0",
|
|
69
|
-
"@types/node": "^24.6.
|
|
70
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
69
|
+
"@types/node": "^24.6.2",
|
|
70
|
+
"@typescript/native-preview": "7.0.0-dev.20251003.1",
|
|
71
71
|
"@vitest/coverage-v8": "^3.2.4",
|
|
72
72
|
"eslint-config-prettier": "^10.1.8",
|
|
73
73
|
"eslint-plugin-prettier": "^5.5.4",
|