ata-validator 0.21.0 → 0.22.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/CHANGELOG.md +13 -0
- package/build.d.ts +1 -1
- package/index.d.ts +5 -1
- package/index.js +17 -0
- package/lib/aot-build.js +1 -1
- package/lib/version.js +1 -1
- package/package.json +4 -4
- package/prebuilds/ata-darwin-arm64/node-napi-v10.node +0 -0
- package/prebuilds/ata-linux-arm64/node-napi-v10.node +0 -0
- package/prebuilds/ata-linux-arm64-musl/node-napi-v10.node +0 -0
- package/prebuilds/ata-linux-x64/node-napi-v10.node +0 -0
- package/prebuilds/ata-linux-x64-musl/node-napi-v10.node +0 -0
- package/prebuilds/ata-win32-x64/node-napi-v10.node +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to ata-validator are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/), and this project adheres to semantic versioning.
|
|
4
4
|
|
|
5
|
+
## 0.22.0 - 2026-07-14
|
|
6
|
+
|
|
7
|
+
### Deprecated
|
|
8
|
+
|
|
9
|
+
- `Validator.prototype.toStandalone()` and `Validator.prototype.toStandaloneModule()` now emit a one-time DeprecationWarning. Both will be removed in 1.0. The replacements have been stable since 0.19: `toStandaloneModule()`/`bundleStandalone()`/`bundleCompact()` from `ata-validator/build`, and the `Validator.bundle*()` statics.
|
|
10
|
+
|
|
11
|
+
## 0.21.0 - 2026-06-01
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- `errorMessage` keyword for custom error messages. A string on a subschema replaces the message for any failing keyword there; an object overrides per keyword, with `required` keyed by missing property name and `_` as fallback. `code`, `keyword`, and `path` fields are untouched. Schemas without `errorMessage` pay nothing; the override pass is only installed when one is present.
|
|
16
|
+
- Async refinement: `t.refine(schema, fn, { message, path })` attaches an async (or sync) check that runs through `validateAsync`/`parseAsync` after structural validation passes. `new Validator(schema)` ignores the refinement marker, so plain structural validation is unchanged. Failing refinements surface as errors with `keyword: 'refine'`.
|
|
17
|
+
|
|
5
18
|
## 0.20.1 - 2026-05-27
|
|
6
19
|
|
|
7
20
|
### Fixed
|
package/build.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export function watch(opts: BuildOptions, onReport?: (r: BuildReport) => void):
|
|
|
75
75
|
|
|
76
76
|
export interface BundleStandaloneOptions {
|
|
77
77
|
format?: 'cjs' | 'esm';
|
|
78
|
-
formats?: Record<string, (value:
|
|
78
|
+
formats?: Record<string, (value: string) => boolean>;
|
|
79
79
|
verbose?: boolean;
|
|
80
80
|
}
|
|
81
81
|
|
package/index.d.ts
CHANGED
|
@@ -411,12 +411,16 @@ export interface Validator<T = unknown> {
|
|
|
411
411
|
/** Single-thread NDJSON batch validation. Requires native addon. */
|
|
412
412
|
isValidNDJSON(ndjsonBuffer: Buffer): boolean[];
|
|
413
413
|
|
|
414
|
-
/**
|
|
414
|
+
/**
|
|
415
|
+
* Generate a standalone JS module string for zero-compile loading. Returns null if schema can't be standalone-compiled.
|
|
416
|
+
* @deprecated Removed in 1.0. Use `toStandaloneModule()` from `ata-validator/build` instead.
|
|
417
|
+
*/
|
|
415
418
|
toStandalone(): string | null;
|
|
416
419
|
|
|
417
420
|
/**
|
|
418
421
|
* Generate a self-contained module string with `validate`/`isValid` exports.
|
|
419
422
|
* The output has zero runtime dependency on ata-validator.
|
|
423
|
+
* @deprecated Removed in 1.0. Use `toStandaloneModule()` from `ata-validator/build` instead.
|
|
420
424
|
*/
|
|
421
425
|
toStandaloneModule(options?: { format?: 'esm' | 'cjs'; abortEarly?: boolean }): string | null;
|
|
422
426
|
|
package/index.js
CHANGED
|
@@ -446,6 +446,21 @@ function resolveSchemaForPreprocess(schema, schemaMap) {
|
|
|
446
446
|
return cloned || s
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
+
// Deprecated-method warning: once per method name per process. Guarded so the
|
|
450
|
+
// browser entry (no `process`) never touches it.
|
|
451
|
+
const deprecationWarned = new Set();
|
|
452
|
+
function warnDeprecated(method) {
|
|
453
|
+
if (deprecationWarned.has(method)) return;
|
|
454
|
+
deprecationWarned.add(method);
|
|
455
|
+
if (typeof process !== 'undefined' && typeof process.emitWarning === 'function') {
|
|
456
|
+
process.emitWarning(
|
|
457
|
+
`Validator.prototype.${method}() is deprecated and will be removed in ata-validator 1.0. ` +
|
|
458
|
+
`Use toStandaloneModule()/bundleStandalone() from 'ata-validator/build' instead.`,
|
|
459
|
+
'DeprecationWarning',
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
449
464
|
class Validator {
|
|
450
465
|
constructor(schema, opts) {
|
|
451
466
|
const options = opts || {};
|
|
@@ -1172,10 +1187,12 @@ class Validator {
|
|
|
1172
1187
|
// bundlers swap `lib/aot.js` with `lib/aot.browser.js`, which throws a
|
|
1173
1188
|
// pointed error instead of attempting to read source from disk.
|
|
1174
1189
|
toStandalone() {
|
|
1190
|
+
warnDeprecated('toStandalone');
|
|
1175
1191
|
return require('./lib/aot').toStandalone(this);
|
|
1176
1192
|
}
|
|
1177
1193
|
|
|
1178
1194
|
toStandaloneModule(opts) {
|
|
1195
|
+
warnDeprecated('toStandaloneModule');
|
|
1179
1196
|
return require('./lib/aot').toStandaloneModule(this, opts);
|
|
1180
1197
|
}
|
|
1181
1198
|
|
package/lib/aot-build.js
CHANGED
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ata-validator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "JSON Schema validation with first-class TypeScript and zero runtime cost. AOT compile to per-schema ESM modules with zero validator dependency. Generic Validator<T> for TypeBox/Zod/Valibot composition. Optional runtime API. Standard Schema V1 compatible.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"rebuild": "cmake-js rebuild --target ata",
|
|
49
49
|
"prebuild": "pkg-prebuilds-copy --baseDir build/Release --source ata.node --name=ata --strip --napi_version=10",
|
|
50
50
|
"prebuild-all": "npm run prebuild -- --arch x64 && npm run prebuild -- --arch arm64",
|
|
51
|
-
"test": "node test.js && node tests/test_no_native.js && node tests/test_browser_nofs.js && node tests/test_browser_imports_guard.js && node tests/test_version_sync.js && node tests/test_safe_regex_source_sync.js && node tests/test_t_builder.js && node tests/test_async_refine.js && node tests/test_safe_regex.js && node tests/test_safe_regex_integration.js && node tests/test_aot_build.js && node tests/test_aot_differential.js && node tests/test_aot_cli_build.js && node tests/test_aot_cli_smoke.js && node tests/test_bundle_standalone.js && node tests/test_standalone_anyof.js && node tests/test_standalone_formats.js && node tests/test_aot_additional_props_errors.js && node tests/test_id_anchor_refs.js && node tests/test_typed_validator_runner.js && node tests/test_define_schema.js && node tests/test_error_codes_lock.js && node tests/test_nullable.js && node tests/test_validate_and_parse.js && node tests/test_validate_data.js && node tests/test_enrich_error.js && node tests/test_rich_errors_optout.js && node tests/test_error_messages.js && node tests/test_source_positions.js && node tests/fuzz_positions.js && node tests/test_data_positions.js && node tests/test_render_shared.js && node tests/test_renderers.js && node tests/test_runtime_error_dx.js && node tests/test_aot_error_dx.js && node tests/test_abort_early.js && node tests/test_branch_collapse.js && node tests/test_suggestions.js && node tests/test_cli_validate.js && node tests/test_cli_version.js && node benchmark/bench_aot_size.mjs",
|
|
51
|
+
"test": "node test.js && node tests/test_deprecation_warnings.js && node tests/test_no_native.js && node tests/test_browser_nofs.js && node tests/test_browser_imports_guard.js && node tests/test_version_sync.js && node tests/test_safe_regex_source_sync.js && node tests/test_t_builder.js && node tests/test_async_refine.js && node tests/test_safe_regex.js && node tests/test_safe_regex_integration.js && node tests/test_aot_build.js && node tests/test_aot_differential.js && node tests/test_aot_cli_build.js && node tests/test_aot_cli_smoke.js && node tests/test_bundle_standalone.js && node tests/test_standalone_anyof.js && node tests/test_standalone_formats.js && node tests/test_aot_additional_props_errors.js && node tests/test_id_anchor_refs.js && node tests/test_typed_validator_runner.js && node tests/test_define_schema.js && node tests/test_error_codes_lock.js && node tests/test_nullable.js && node tests/test_validate_and_parse.js && node tests/test_validate_data.js && node tests/test_enrich_error.js && node tests/test_rich_errors_optout.js && node tests/test_error_messages.js && node tests/test_source_positions.js && node tests/fuzz_positions.js && node tests/test_data_positions.js && node tests/test_render_shared.js && node tests/test_renderers.js && node tests/test_runtime_error_dx.js && node tests/test_aot_error_dx.js && node tests/test_abort_early.js && node tests/test_branch_collapse.js && node tests/test_suggestions.js && node tests/test_cli_validate.js && node tests/test_cli_version.js && node benchmark/bench_aot_size.mjs",
|
|
52
52
|
"bench:size": "node benchmark/bench_aot_size.mjs",
|
|
53
53
|
"test:suite": "node tests/run_suite.js",
|
|
54
54
|
"test:compat": "node tests/test_compat.js",
|
|
@@ -86,10 +86,10 @@
|
|
|
86
86
|
"license": "MIT",
|
|
87
87
|
"repository": {
|
|
88
88
|
"type": "git",
|
|
89
|
-
"url": "git+https://github.com/
|
|
89
|
+
"url": "git+https://github.com/ata-core/ata-validator.git"
|
|
90
90
|
},
|
|
91
91
|
"bugs": {
|
|
92
|
-
"url": "https://github.com/
|
|
92
|
+
"url": "https://github.com/ata-core/ata-validator/issues"
|
|
93
93
|
},
|
|
94
94
|
"homepage": "https://ata-validator.com",
|
|
95
95
|
"engines": {
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|