@forklaunch/validator 0.10.16 → 0.10.18
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/src/typebox/index.js +10 -1
- package/lib/src/typebox/index.mjs +12 -2
- package/package.json +6 -6
package/lib/src/typebox/index.js
CHANGED
|
@@ -66,6 +66,12 @@ var import_compiler = require("@sinclair/typebox/compiler");
|
|
|
66
66
|
var import_errors = require("@sinclair/typebox/errors");
|
|
67
67
|
var import_value = require("@sinclair/typebox/value");
|
|
68
68
|
import_typebox.FormatRegistry.Set("binary", (value) => typeof value === "string");
|
|
69
|
+
import_typebox.TypeRegistry.Set("Blob", (_schema, value) => value instanceof Blob);
|
|
70
|
+
import_typebox.TypeRegistry.Set(
|
|
71
|
+
"ArrayBuffer",
|
|
72
|
+
(_schema, value) => value instanceof ArrayBuffer
|
|
73
|
+
);
|
|
74
|
+
import_typebox.TypeRegistry.Set("Buffer", (_schema, value) => value instanceof Buffer);
|
|
69
75
|
(0, import_errors.SetErrorFunction)((params) => {
|
|
70
76
|
switch (params.errorType) {
|
|
71
77
|
case import_errors.ValueErrorType.Union:
|
|
@@ -259,18 +265,21 @@ var TypeboxSchemaValidator = class {
|
|
|
259
265
|
file = import_typebox.Type.Transform(
|
|
260
266
|
import_typebox.Type.Union([
|
|
261
267
|
import_typebox.Type.Unsafe({
|
|
268
|
+
[import_typebox.Kind]: "Buffer",
|
|
262
269
|
errorType: "binary",
|
|
263
270
|
format: "binary",
|
|
264
271
|
example: "a raw buffer or file stream",
|
|
265
272
|
title: "File"
|
|
266
273
|
}),
|
|
267
274
|
import_typebox.Type.Unsafe({
|
|
275
|
+
[import_typebox.Kind]: "ArrayBuffer",
|
|
268
276
|
errorType: "binary",
|
|
269
277
|
format: "binary",
|
|
270
278
|
example: "an array buffer",
|
|
271
279
|
title: "File"
|
|
272
280
|
}),
|
|
273
281
|
import_typebox.Type.Unsafe({
|
|
282
|
+
[import_typebox.Kind]: "Blob",
|
|
274
283
|
errorType: "binary",
|
|
275
284
|
format: "binary",
|
|
276
285
|
example: "a blob object",
|
|
@@ -526,7 +535,7 @@ var TypeboxSchemaValidator = class {
|
|
|
526
535
|
} : {
|
|
527
536
|
ok: false,
|
|
528
537
|
errors: errors.flatMap((error) => {
|
|
529
|
-
if (error.type === import_errors.ValueErrorType.Union && error.schema.errorType
|
|
538
|
+
if (error.type === import_errors.ValueErrorType.Union && error.schema.errorType?.includes("any of")) {
|
|
530
539
|
return error.errors.flatMap(
|
|
531
540
|
(e, idx) => Array.from(e).map((e2) => ({
|
|
532
541
|
path: [
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
FormatRegistry,
|
|
8
8
|
Kind,
|
|
9
9
|
KindGuard,
|
|
10
|
-
Type
|
|
10
|
+
Type,
|
|
11
|
+
TypeRegistry
|
|
11
12
|
} from "@sinclair/typebox";
|
|
12
13
|
import { TypeCheck, TypeCompiler } from "@sinclair/typebox/compiler";
|
|
13
14
|
import {
|
|
@@ -17,6 +18,12 @@ import {
|
|
|
17
18
|
} from "@sinclair/typebox/errors";
|
|
18
19
|
import { Value } from "@sinclair/typebox/value";
|
|
19
20
|
FormatRegistry.Set("binary", (value) => typeof value === "string");
|
|
21
|
+
TypeRegistry.Set("Blob", (_schema, value) => value instanceof Blob);
|
|
22
|
+
TypeRegistry.Set(
|
|
23
|
+
"ArrayBuffer",
|
|
24
|
+
(_schema, value) => value instanceof ArrayBuffer
|
|
25
|
+
);
|
|
26
|
+
TypeRegistry.Set("Buffer", (_schema, value) => value instanceof Buffer);
|
|
20
27
|
SetErrorFunction((params) => {
|
|
21
28
|
switch (params.errorType) {
|
|
22
29
|
case ValueErrorType.Union:
|
|
@@ -210,18 +217,21 @@ var TypeboxSchemaValidator = class {
|
|
|
210
217
|
file = Type.Transform(
|
|
211
218
|
Type.Union([
|
|
212
219
|
Type.Unsafe({
|
|
220
|
+
[Kind]: "Buffer",
|
|
213
221
|
errorType: "binary",
|
|
214
222
|
format: "binary",
|
|
215
223
|
example: "a raw buffer or file stream",
|
|
216
224
|
title: "File"
|
|
217
225
|
}),
|
|
218
226
|
Type.Unsafe({
|
|
227
|
+
[Kind]: "ArrayBuffer",
|
|
219
228
|
errorType: "binary",
|
|
220
229
|
format: "binary",
|
|
221
230
|
example: "an array buffer",
|
|
222
231
|
title: "File"
|
|
223
232
|
}),
|
|
224
233
|
Type.Unsafe({
|
|
234
|
+
[Kind]: "Blob",
|
|
225
235
|
errorType: "binary",
|
|
226
236
|
format: "binary",
|
|
227
237
|
example: "a blob object",
|
|
@@ -477,7 +487,7 @@ var TypeboxSchemaValidator = class {
|
|
|
477
487
|
} : {
|
|
478
488
|
ok: false,
|
|
479
489
|
errors: errors.flatMap((error) => {
|
|
480
|
-
if (error.type === ValueErrorType.Union && error.schema.errorType
|
|
490
|
+
if (error.type === ValueErrorType.Union && error.schema.errorType?.includes("any of")) {
|
|
481
491
|
return error.errors.flatMap(
|
|
482
492
|
(e, idx) => Array.from(e).map((e2) => ({
|
|
483
493
|
path: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/validator",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.18",
|
|
4
4
|
"description": "Schema validator for ForkLaunch components.",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -60,14 +60,14 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@sinclair/typebox": "^0.34.41",
|
|
62
62
|
"ts-deepmerge": "^7.0.3",
|
|
63
|
-
"zod": "^4.1.
|
|
64
|
-
"@forklaunch/common": "0.6.
|
|
63
|
+
"zod": "^4.1.12",
|
|
64
|
+
"@forklaunch/common": "0.6.18"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@eslint/js": "^9.37.0",
|
|
68
68
|
"@types/jest": "^30.0.0",
|
|
69
|
-
"@types/node": "^24.
|
|
70
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
69
|
+
"@types/node": "^24.7.0",
|
|
70
|
+
"@typescript/native-preview": "7.0.0-dev.20251008.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",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"ts-node": "^10.9.2",
|
|
79
79
|
"tsup": "^8.5.0",
|
|
80
80
|
"typedoc": "^0.28.13",
|
|
81
|
-
"typescript-eslint": "^8.
|
|
81
|
+
"typescript-eslint": "^8.46.0"
|
|
82
82
|
},
|
|
83
83
|
"scripts": {
|
|
84
84
|
"build": "tsgo --noEmit && tsup index.ts src/typebox/index.ts src/zod/index.ts __test__/utils/mockSchemaValidator.ts shims/zod-v3-openapi/zod-extensions.ts --format cjs,esm --no-splitting --tsconfig tsconfig.json --outDir lib --dts --clean",
|