oatschema 0.0.1 → 0.1.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/AUTHORS +4 -0
- package/CHANGELOG.md +17 -0
- package/README.md +113 -13
- package/THIRD-PARTY-NOTICES +28 -0
- package/dist/ajv.d.ts +21 -0
- package/dist/ajv.js +28 -0
- package/dist/compiled/0.8.0/audio-transcription.js +4 -0
- package/dist/compiled/0.8.0/classification.js +4 -0
- package/dist/compiled/0.8.0/document-extraction.js +4 -0
- package/dist/compiled/0.8.0/embedding.js +4 -0
- package/dist/compiled/0.8.0/entity-extraction.js +4 -0
- package/dist/compiled/0.8.0/generic.js +4 -0
- package/dist/compiled/0.8.0/geolocation.js +4 -0
- package/dist/compiled/0.8.0/llm-output.js +4 -0
- package/dist/compiled/0.8.0/object-detection.js +4 -0
- package/dist/compiled/0.8.0/ranking.js +4 -0
- package/dist/compiled/0.8.0/regression.js +4 -0
- package/dist/compiled/0.8.0/temporal-segmentation.js +4 -0
- package/dist/compiled/index.js +30 -0
- package/dist/errors.d.ts +27 -0
- package/dist/errors.js +63 -0
- package/dist/formats.d.ts +13 -0
- package/dist/formats.js +106 -0
- package/dist/index.d.ts +6 -45
- package/dist/index.js +10 -56
- package/dist/names.d.ts +33 -0
- package/dist/names.js +33 -0
- package/dist/validate/audio-transcription.d.ts +27 -0
- package/dist/validate/audio-transcription.js +14 -0
- package/dist/validate/classification.d.ts +27 -0
- package/dist/validate/classification.js +14 -0
- package/dist/validate/document-extraction.d.ts +27 -0
- package/dist/validate/document-extraction.js +14 -0
- package/dist/validate/embedding.d.ts +27 -0
- package/dist/validate/embedding.js +14 -0
- package/dist/validate/entity-extraction.d.ts +27 -0
- package/dist/validate/entity-extraction.js +14 -0
- package/dist/validate/generic.d.ts +27 -0
- package/dist/validate/generic.js +14 -0
- package/dist/validate/geolocation.d.ts +27 -0
- package/dist/validate/geolocation.js +14 -0
- package/dist/validate/llm-output.d.ts +27 -0
- package/dist/validate/llm-output.js +14 -0
- package/dist/validate/object-detection.d.ts +27 -0
- package/dist/validate/object-detection.js +14 -0
- package/dist/validate/ranking.d.ts +27 -0
- package/dist/validate/ranking.js +14 -0
- package/dist/validate/regression.d.ts +27 -0
- package/dist/validate/regression.js +14 -0
- package/dist/validate/temporal-segmentation.d.ts +27 -0
- package/dist/validate/temporal-segmentation.js +14 -0
- package/dist/validate.d.ts +40 -0
- package/dist/validate.js +59 -0
- package/dist/validation.d.ts +74 -0
- package/dist/validation.js +328 -0
- package/package.json +24 -6
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 The OATS Authors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { describe, missingFromVersion, shorten, UnknownSchemaError, unbundledVersion } from "./errors.js";
|
|
4
|
+
import { withFormats } from "./formats.js";
|
|
5
|
+
import { isSchemaVersion, SCHEMA_VERSION } from "./names.js";
|
|
6
|
+
const PATH_PART_LIMIT = 100;
|
|
7
|
+
const MESSAGE_LIMIT = 1000;
|
|
8
|
+
const VALUE = "…";
|
|
9
|
+
const ARRAY_KEYWORDS = new Set(["allOf", "anyOf", "oneOf", "prefixItems"]);
|
|
10
|
+
const DROPPED_KEYWORDS = new Set(["if", "propertyNames"]);
|
|
11
|
+
/**
|
|
12
|
+
* A record that does not conform to its schema.
|
|
13
|
+
*
|
|
14
|
+
* `path` locates the failing value within the record, `schemaPath` the schema location that rejected it,
|
|
15
|
+
* and `keyword` the JSON Schema keyword at the end of `schemaPath` (`"maxLength"`, `"required"`, …).
|
|
16
|
+
*
|
|
17
|
+
* `reason` shows each value from the record as `…`, quoting only property names, and is at most 1,000 characters.
|
|
18
|
+
* `message` adds the schema and the location, as in `classification 0.8.0 at /labels/0/score: … is greater than the
|
|
19
|
+
* maximum of 1`. Each string in `path` is at most 100 characters, and the location in `message` at most 1,000.
|
|
20
|
+
* The underlying validator's error is not kept.
|
|
21
|
+
*/
|
|
22
|
+
export class ValidationError extends Error {
|
|
23
|
+
/** Why the value was rejected, without the schema or the location. */
|
|
24
|
+
reason;
|
|
25
|
+
/** The schema's name. */
|
|
26
|
+
schemaName;
|
|
27
|
+
/** The exact schema version. */
|
|
28
|
+
schemaVersion;
|
|
29
|
+
/** The location of the failing value within the record. Array indices are numbers. */
|
|
30
|
+
path;
|
|
31
|
+
/** The location within the schema of the keyword that rejected the value. */
|
|
32
|
+
schemaPath;
|
|
33
|
+
/** The JSON Schema keyword that rejected the value. */
|
|
34
|
+
keyword;
|
|
35
|
+
constructor(reason, details) {
|
|
36
|
+
const bounded = shorten(String(reason), MESSAGE_LIMIT);
|
|
37
|
+
const path = Object.freeze(boundPath(details.path ?? []));
|
|
38
|
+
const schemaPath = Object.freeze(boundPath(details.schemaPath ?? []));
|
|
39
|
+
const name = shorten(String(details.schemaName), PATH_PART_LIMIT);
|
|
40
|
+
const version = shorten(String(details.schemaVersion), PATH_PART_LIMIT);
|
|
41
|
+
const location = shorten(path.join("/"), MESSAGE_LIMIT);
|
|
42
|
+
super(`${name} ${version} at /${location}: ${bounded}`);
|
|
43
|
+
this.reason = bounded;
|
|
44
|
+
this.schemaName = name;
|
|
45
|
+
this.schemaVersion = version;
|
|
46
|
+
this.path = path;
|
|
47
|
+
this.schemaPath = schemaPath;
|
|
48
|
+
this.keyword = shorten(String(details.keyword ?? lastKeyword(schemaPath)), PATH_PART_LIMIT);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
Object.defineProperty(ValidationError.prototype, "name", {
|
|
52
|
+
value: "ValidationError",
|
|
53
|
+
writable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
enumerable: false,
|
|
56
|
+
});
|
|
57
|
+
function boundPath(path) {
|
|
58
|
+
return [...path].map((part) => (typeof part === "number" ? part : shorten(String(part), PATH_PART_LIMIT)));
|
|
59
|
+
}
|
|
60
|
+
function lastKeyword(schemaPath) {
|
|
61
|
+
for (let index = schemaPath.length - 1; index >= 0; index--) {
|
|
62
|
+
const part = schemaPath[index];
|
|
63
|
+
if (typeof part === "string") {
|
|
64
|
+
return part;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return "";
|
|
68
|
+
}
|
|
69
|
+
function unescapePointer(part) {
|
|
70
|
+
return part.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
71
|
+
}
|
|
72
|
+
function recordPath(pointer, record) {
|
|
73
|
+
if (pointer === "") {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
const path = [];
|
|
77
|
+
let node = record;
|
|
78
|
+
for (const encoded of pointer.slice(1).split("/")) {
|
|
79
|
+
const part = unescapePointer(encoded);
|
|
80
|
+
if (Array.isArray(node) && /^(?:0|[1-9][0-9]*)$/.test(part)) {
|
|
81
|
+
const index = Number(part);
|
|
82
|
+
path.push(index);
|
|
83
|
+
node = node[index];
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
path.push(shorten(part, PATH_PART_LIMIT));
|
|
87
|
+
node =
|
|
88
|
+
node !== null && typeof node === "object" && Object.hasOwn(node, part)
|
|
89
|
+
? node[part]
|
|
90
|
+
: undefined;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return path;
|
|
94
|
+
}
|
|
95
|
+
function schemaLocation(pointer) {
|
|
96
|
+
const parts = pointer.replace(/^#/, "").split("/").slice(1).map(unescapePointer);
|
|
97
|
+
return parts.map((part, index) => index > 0 && ARRAY_KEYWORDS.has(parts[index - 1] ?? "") && /^(?:0|[1-9][0-9]*)$/.test(part) ? Number(part) : part);
|
|
98
|
+
}
|
|
99
|
+
function plural(count, singular, many) {
|
|
100
|
+
return `${String(count)} ${count === 1 ? singular : many}`;
|
|
101
|
+
}
|
|
102
|
+
function json(value) {
|
|
103
|
+
const text = JSON.stringify(value);
|
|
104
|
+
return text === undefined ? String(value) : text;
|
|
105
|
+
}
|
|
106
|
+
function quoteName(name) {
|
|
107
|
+
return JSON.stringify(shorten(String(name), PATH_PART_LIMIT));
|
|
108
|
+
}
|
|
109
|
+
function candidates(values) {
|
|
110
|
+
const list = Array.isArray(values) ? values.map(json) : [json(values)];
|
|
111
|
+
if (list.length <= 1) {
|
|
112
|
+
return list.join("");
|
|
113
|
+
}
|
|
114
|
+
if (list.length <= 3) {
|
|
115
|
+
return `${list.slice(0, -1).join(", ")} or ${list.at(-1)}`;
|
|
116
|
+
}
|
|
117
|
+
return `${list.slice(0, 2).join(", ")} or ${list.length - 2} other candidates`;
|
|
118
|
+
}
|
|
119
|
+
function reason({ raw, names }) {
|
|
120
|
+
const { keyword, params } = raw;
|
|
121
|
+
const value = raw.propertyName === undefined ? VALUE : quoteName(raw.propertyName);
|
|
122
|
+
switch (keyword) {
|
|
123
|
+
case "type": {
|
|
124
|
+
const types = String(params.type).split(",");
|
|
125
|
+
return types.length === 1
|
|
126
|
+
? `${value} is not of type "${types[0]}"`
|
|
127
|
+
: `${value} is not of types ${types
|
|
128
|
+
.sort()
|
|
129
|
+
.map((type) => `"${type}"`)
|
|
130
|
+
.join(", ")}`;
|
|
131
|
+
}
|
|
132
|
+
case "required":
|
|
133
|
+
case "dependentRequired":
|
|
134
|
+
return `${quoteName(params.missingProperty)} is a required property`;
|
|
135
|
+
case "additionalProperties":
|
|
136
|
+
case "unevaluatedProperties": {
|
|
137
|
+
const list = (names ?? []).map((name) => `'${shorten(String(name), PATH_PART_LIMIT)}'`);
|
|
138
|
+
const kind = keyword === "additionalProperties" ? "Additional" : "Unevaluated";
|
|
139
|
+
return `${kind} properties are not allowed (${list.join(", ")} ${list.length === 1 ? "was" : "were"} unexpected)`;
|
|
140
|
+
}
|
|
141
|
+
case "maxLength":
|
|
142
|
+
return `${value} is longer than ${plural(params.limit, "character", "characters")}`;
|
|
143
|
+
case "minLength":
|
|
144
|
+
return `${value} is shorter than ${plural(params.limit, "character", "characters")}`;
|
|
145
|
+
case "maxItems":
|
|
146
|
+
case "items":
|
|
147
|
+
case "unevaluatedItems":
|
|
148
|
+
return `${value} has more than ${plural(params.limit, "item", "items")}`;
|
|
149
|
+
case "minItems":
|
|
150
|
+
return `${value} has less than ${plural(params.limit, "item", "items")}`;
|
|
151
|
+
case "maxProperties":
|
|
152
|
+
return `${value} has more than ${plural(params.limit, "property", "properties")}`;
|
|
153
|
+
case "minProperties":
|
|
154
|
+
return `${value} has less than ${plural(params.limit, "property", "properties")}`;
|
|
155
|
+
case "minimum":
|
|
156
|
+
return `${value} is less than the minimum of ${String(params.limit)}`;
|
|
157
|
+
case "maximum":
|
|
158
|
+
return `${value} is greater than the maximum of ${String(params.limit)}`;
|
|
159
|
+
case "exclusiveMinimum":
|
|
160
|
+
return `${value} is less than or equal to the minimum of ${String(params.limit)}`;
|
|
161
|
+
case "exclusiveMaximum":
|
|
162
|
+
return `${value} is greater than or equal to the maximum of ${String(params.limit)}`;
|
|
163
|
+
case "multipleOf":
|
|
164
|
+
return `${value} is not a multiple of ${String(params.multipleOf)}`;
|
|
165
|
+
case "enum":
|
|
166
|
+
return `${value} is not one of ${candidates(params.allowedValues)}`;
|
|
167
|
+
case "const":
|
|
168
|
+
return `${json(params.allowedValue)} was expected`;
|
|
169
|
+
case "pattern":
|
|
170
|
+
return `${value} does not match ${json(params.pattern)}`;
|
|
171
|
+
case "format":
|
|
172
|
+
return `${value} is not a ${json(params.format)}`;
|
|
173
|
+
case "uniqueItems":
|
|
174
|
+
return `${value} has non-unique elements`;
|
|
175
|
+
case "anyOf":
|
|
176
|
+
return `${value} is not valid under any of the schemas listed in the 'anyOf' keyword`;
|
|
177
|
+
case "oneOf":
|
|
178
|
+
return Array.isArray(params.passingSchemas)
|
|
179
|
+
? `${value} is valid under more than one of the schemas listed in the 'oneOf' keyword`
|
|
180
|
+
: `${value} is not valid under any of the schemas listed in the 'oneOf' keyword`;
|
|
181
|
+
case "contains":
|
|
182
|
+
return `None of ${value} are valid under the given schema`;
|
|
183
|
+
case "not":
|
|
184
|
+
return `${value} is not allowed by the 'not' keyword`;
|
|
185
|
+
case "false schema":
|
|
186
|
+
return `False schema does not allow ${value}`;
|
|
187
|
+
default:
|
|
188
|
+
return `${value} is not valid under the ${json(keyword)} keyword`;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function asRawErrors(errors) {
|
|
192
|
+
return Array.isArray(errors) ? errors : [];
|
|
193
|
+
}
|
|
194
|
+
function fold(errors) {
|
|
195
|
+
const kept = [];
|
|
196
|
+
errors.forEach((raw, index) => {
|
|
197
|
+
const branches = raw.params.branchErrors;
|
|
198
|
+
if (typeof branches === "number" && branches > 0) {
|
|
199
|
+
while ((kept.at(-1)?.index ?? -1) >= index - branches) {
|
|
200
|
+
kept.pop();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (!DROPPED_KEYWORDS.has(raw.keyword)) {
|
|
204
|
+
kept.push({ index, raw });
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
const folded = [];
|
|
208
|
+
for (const { raw } of kept) {
|
|
209
|
+
if (raw.keyword === "additionalProperties" || raw.keyword === "unevaluatedProperties") {
|
|
210
|
+
const name = raw.params.additionalProperty ?? raw.params.unevaluatedProperty;
|
|
211
|
+
const previous = folded.at(-1);
|
|
212
|
+
if (previous?.names !== undefined &&
|
|
213
|
+
previous.raw.keyword === raw.keyword &&
|
|
214
|
+
previous.raw.instancePath === raw.instancePath &&
|
|
215
|
+
previous.raw.schemaPath === raw.schemaPath) {
|
|
216
|
+
if (previous.names.length < MESSAGE_LIMIT) {
|
|
217
|
+
previous.names.push(name);
|
|
218
|
+
}
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
folded.push({ raw, names: [name] });
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
folded.push({ raw });
|
|
225
|
+
}
|
|
226
|
+
if (folded.length === 0) {
|
|
227
|
+
const last = errors.at(-1);
|
|
228
|
+
if (last !== undefined) {
|
|
229
|
+
folded.push({ raw: last });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return folded;
|
|
233
|
+
}
|
|
234
|
+
class CompiledSchemaValidator {
|
|
235
|
+
schemaName;
|
|
236
|
+
schemaVersion;
|
|
237
|
+
checkFormats;
|
|
238
|
+
#compiled;
|
|
239
|
+
constructor(name, version, checkFormats, compiled) {
|
|
240
|
+
this.schemaName = name;
|
|
241
|
+
this.schemaVersion = version;
|
|
242
|
+
this.checkFormats = checkFormats;
|
|
243
|
+
this.#compiled = compiled;
|
|
244
|
+
Object.freeze(this);
|
|
245
|
+
}
|
|
246
|
+
isValid(record) {
|
|
247
|
+
return withFormats(this.checkFormats, () => this.#compiled(record));
|
|
248
|
+
}
|
|
249
|
+
validate(record) {
|
|
250
|
+
const errors = this.#run(record);
|
|
251
|
+
const first = errors[0];
|
|
252
|
+
if (first !== undefined) {
|
|
253
|
+
throw this.#convert(first, record);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
*iterErrors(record) {
|
|
257
|
+
for (const error of this.#run(record)) {
|
|
258
|
+
yield this.#convert(error, record);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
#run(record) {
|
|
262
|
+
const compiled = this.#compiled;
|
|
263
|
+
return withFormats(this.checkFormats, () => (compiled(record) ? [] : fold(asRawErrors(compiled.errors))));
|
|
264
|
+
}
|
|
265
|
+
#convert(error, record) {
|
|
266
|
+
const schemaPath = schemaLocation(error.raw.schemaPath);
|
|
267
|
+
return new ValidationError(reason(error), {
|
|
268
|
+
schemaName: this.schemaName,
|
|
269
|
+
schemaVersion: this.schemaVersion,
|
|
270
|
+
path: recordPath(error.raw.instancePath, record),
|
|
271
|
+
schemaPath,
|
|
272
|
+
keyword: lastKeyword(schemaPath),
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
get [Symbol.toStringTag]() {
|
|
276
|
+
return `Validator ${this.schemaName} ${this.schemaVersion}${this.checkFormats ? "" : " checkFormats=false"}`;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const CACHE = new Map();
|
|
280
|
+
function checkFormatsOption(options) {
|
|
281
|
+
if (options === undefined) {
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
if (options === null || typeof options !== "object" || Array.isArray(options)) {
|
|
285
|
+
throw new TypeError(`options must be an object, not ${describe(options)}`);
|
|
286
|
+
}
|
|
287
|
+
for (const key of Object.keys(options)) {
|
|
288
|
+
if (key !== "checkFormats") {
|
|
289
|
+
throw new TypeError(`unknown option ${describe(key)}; the only option is "checkFormats"`);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const check = options.checkFormats;
|
|
293
|
+
if (check === undefined) {
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
if (typeof check !== "boolean") {
|
|
297
|
+
throw new TypeError(`checkFormats must be true or false, not ${describe(check)}`);
|
|
298
|
+
}
|
|
299
|
+
return check;
|
|
300
|
+
}
|
|
301
|
+
/** @internal */
|
|
302
|
+
export function versionValidator(name, versions, version, options) {
|
|
303
|
+
const check = checkFormatsOption(options);
|
|
304
|
+
const resolved = version === undefined ? SCHEMA_VERSION : version;
|
|
305
|
+
if (!isSchemaVersion(resolved)) {
|
|
306
|
+
throw unbundledVersion(name, resolved);
|
|
307
|
+
}
|
|
308
|
+
const compiled = versions.get(resolved);
|
|
309
|
+
if (compiled === undefined) {
|
|
310
|
+
throw missingFromVersion(name, resolved);
|
|
311
|
+
}
|
|
312
|
+
const key = `${name} ${resolved} ${check}`;
|
|
313
|
+
let validator = CACHE.get(key);
|
|
314
|
+
if (validator === undefined) {
|
|
315
|
+
validator = new CompiledSchemaValidator(name, resolved, check, compiled);
|
|
316
|
+
CACHE.set(key, validator);
|
|
317
|
+
}
|
|
318
|
+
return validator;
|
|
319
|
+
}
|
|
320
|
+
/** @internal */
|
|
321
|
+
export function tableValidator(table, name, version, options) {
|
|
322
|
+
const versions = typeof name === "string" ? table.get(name) : undefined;
|
|
323
|
+
if (versions === undefined) {
|
|
324
|
+
checkFormatsOption(options);
|
|
325
|
+
throw new UnknownSchemaError(name);
|
|
326
|
+
}
|
|
327
|
+
return versionValidator(name, versions, version, options);
|
|
328
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oatschema",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "OATS (Open Annotation Task Schemas) JSON schemas
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OATS (Open Annotation Task Schemas) JSON schemas and precompiled validators for JavaScript and TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oats",
|
|
7
7
|
"json-schema",
|
|
8
8
|
"annotation",
|
|
9
9
|
"schema",
|
|
10
|
+
"validation",
|
|
10
11
|
"machine-learning"
|
|
11
12
|
],
|
|
12
13
|
"homepage": "https://oatschema.org",
|
|
@@ -26,31 +27,48 @@
|
|
|
26
27
|
"types": "./dist/index.d.ts",
|
|
27
28
|
"default": "./dist/index.js"
|
|
28
29
|
},
|
|
30
|
+
"./validate": {
|
|
31
|
+
"types": "./dist/validate.d.ts",
|
|
32
|
+
"default": "./dist/validate.js"
|
|
33
|
+
},
|
|
34
|
+
"./validate/*": {
|
|
35
|
+
"types": "./dist/validate/*.d.ts",
|
|
36
|
+
"default": "./dist/validate/*.js"
|
|
37
|
+
},
|
|
38
|
+
"./ajv": {
|
|
39
|
+
"types": "./dist/ajv.d.ts",
|
|
40
|
+
"default": "./dist/ajv.js"
|
|
41
|
+
},
|
|
29
42
|
"./package.json": "./package.json"
|
|
30
43
|
},
|
|
31
44
|
"types": "./dist/index.d.ts",
|
|
32
45
|
"files": [
|
|
33
46
|
"dist/",
|
|
34
|
-
"
|
|
47
|
+
"AUTHORS",
|
|
48
|
+
"CHANGELOG.md",
|
|
49
|
+
"THIRD-PARTY-NOTICES"
|
|
35
50
|
],
|
|
36
51
|
"sideEffects": false,
|
|
37
52
|
"engines": {
|
|
38
53
|
"node": ">=22"
|
|
39
54
|
},
|
|
40
55
|
"scripts": {
|
|
41
|
-
"build": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json",
|
|
42
|
-
"typecheck": "
|
|
56
|
+
"build": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json && node --disable-warning=ExperimentalWarning scripts/build-validators.ts",
|
|
57
|
+
"typecheck": "npm run build && tsc --noEmit",
|
|
43
58
|
"lint": "biome check .",
|
|
44
59
|
"format": "biome check --write .",
|
|
45
60
|
"test": "npm run build && node --disable-warning=ExperimentalWarning --test 'test/**/*.test.ts'",
|
|
46
61
|
"check": "npm run lint && npm run typecheck && npm test",
|
|
47
62
|
"sync": "node --disable-warning=ExperimentalWarning scripts/sync-schemas.ts",
|
|
48
63
|
"generate": "node --disable-warning=ExperimentalWarning scripts/generate.ts",
|
|
49
|
-
"prepack": "npm run build"
|
|
64
|
+
"prepack": "npm run build",
|
|
65
|
+
"corpus": "node --disable-warning=ExperimentalWarning scripts/corpus.ts"
|
|
50
66
|
},
|
|
51
67
|
"devDependencies": {
|
|
52
68
|
"@biomejs/biome": "2.5.15",
|
|
53
69
|
"@types/node": "^22.20.5",
|
|
70
|
+
"ajv": "8.20.0",
|
|
71
|
+
"esbuild": "0.28.2",
|
|
54
72
|
"typescript": "^7.0.2"
|
|
55
73
|
}
|
|
56
74
|
}
|