ata-validator 1.28.0 → 1.29.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/README.md +3 -0
- package/build.d.ts +4 -2
- package/index.js +123 -69
- package/lib/aot-impl.js +15 -8
- package/lib/ts-gen.js +5 -2
- package/lib/version.js +1 -1
- package/package.json +9 -10
- package/CHANGELOG.md +0 -750
package/README.md
CHANGED
|
@@ -703,6 +703,9 @@ npm run test:suite
|
|
|
703
703
|
|
|
704
704
|
## Project
|
|
705
705
|
|
|
706
|
+
- [CHANGELOG.md](CHANGELOG.md) records every release. It is kept in the
|
|
707
|
+
repository and not shipped in the npm package, where its history had grown to
|
|
708
|
+
about 13% of the install.
|
|
706
709
|
- [CONTRIBUTING.md](CONTRIBUTING.md) explains how to build the project and what a
|
|
707
710
|
pull request needs before it can be merged.
|
|
708
711
|
- [GOVERNANCE.md](GOVERNANCE.md) says who decides what, which changes the project
|
package/build.d.ts
CHANGED
|
@@ -144,8 +144,10 @@ export function bundleCompact(schemas: unknown[], options?: BundleStandaloneOpti
|
|
|
144
144
|
* Stable content hash of a schema, 16 hex characters, over a canonical JSON
|
|
145
145
|
* form (keys sorted at every level). Every module from
|
|
146
146
|
* {@link toStandaloneModule} exports its own `schemaHash`; comparing that
|
|
147
|
-
* against `schemaHash(currentSchema)` tells a build the
|
|
148
|
-
*
|
|
147
|
+
* against `schemaHash(currentSchema)` tells a build the schema has changed.
|
|
148
|
+
* It does not tell the build that ata has changed, since an upgrade leaves
|
|
149
|
+
* the hash matching, so compare the module's `ataVersion` against the
|
|
150
|
+
* installed version as well. An integrity aid, not a security boundary.
|
|
149
151
|
*/
|
|
150
152
|
export function schemaHash(schema: unknown): string;
|
|
151
153
|
|
package/index.js
CHANGED
|
@@ -462,11 +462,18 @@ const { rankFor: schemaOrderRank, ordinalFor: schemaOrdinal } = require('./lib/s
|
|
|
462
462
|
// that carry only message and path, such as the Standard Schema bridge.
|
|
463
463
|
// Prototype accessors, not per-instance ones: see LazyRejection.
|
|
464
464
|
class RichRejection {
|
|
465
|
-
|
|
465
|
+
// `rawInput` is the JSON text validateJSON was given, or null for validate(data).
|
|
466
|
+
// The position map it implies is built in the `errors` getter, not here: it is
|
|
467
|
+
// a full walk of the document, it is only ever read through an error's
|
|
468
|
+
// dataFrame, and building it on every rejection cost a caller that reads
|
|
469
|
+
// `.valid` about 460 microseconds on a 50 KB document. Holding the text rather
|
|
470
|
+
// than reading `self._lastRawInput` later also keeps the result independent of
|
|
471
|
+
// what the instance does after this call returns.
|
|
472
|
+
constructor(result, data, rawInput, self, root, enrich) {
|
|
466
473
|
this.valid = false;
|
|
467
474
|
this._result = result;
|
|
468
475
|
this._data = data;
|
|
469
|
-
this.
|
|
476
|
+
this._rawInput = rawInput;
|
|
470
477
|
this._self = self;
|
|
471
478
|
this._root = root;
|
|
472
479
|
this._enrich = enrich;
|
|
@@ -490,11 +497,17 @@ Object.defineProperty(RichRejection.prototype, 'errors', {
|
|
|
490
497
|
const enrich = this._enrich;
|
|
491
498
|
let raw = this._result.errors || [];
|
|
492
499
|
if (raw.length > 1) raw = sortErrorsBySchemaOrder(this._root, raw);
|
|
500
|
+
// The position map, resolved now that an error is actually being read.
|
|
501
|
+
let positions = null;
|
|
502
|
+
if (enrich && raw.length && this._rawInput != null) {
|
|
503
|
+
positions = self._pos().get(this._rawInput);
|
|
504
|
+
if (positions) self._posCache.reset();
|
|
505
|
+
}
|
|
493
506
|
// One options object for the whole list, not one per error.
|
|
494
507
|
const opts = enrich && raw.length
|
|
495
508
|
? {
|
|
496
509
|
data: this._data,
|
|
497
|
-
positions
|
|
510
|
+
positions,
|
|
498
511
|
schemaPositions: self._schemaPositions,
|
|
499
512
|
schemaFile: self._source ? self._source.path : undefined,
|
|
500
513
|
}
|
|
@@ -518,6 +531,98 @@ Object.defineProperty(RichRejection.prototype, 'errors', {
|
|
|
518
531
|
},
|
|
519
532
|
});
|
|
520
533
|
|
|
534
|
+
// The rejection validateJSON returns. Everything the text path adds over
|
|
535
|
+
// validate(data), the value tree enrichment needs, the position map, the
|
|
536
|
+
// diagnostic payload, happens on first access to `.errors`. Reading `.valid`
|
|
537
|
+
// touches none of it. The JSON text is held here rather than read back off the
|
|
538
|
+
// validator, so the result does not depend on what the instance does next.
|
|
539
|
+
class LazyJsonRejection {
|
|
540
|
+
constructor(result, jsonStr, self, enrich) {
|
|
541
|
+
this.valid = false;
|
|
542
|
+
this._result = result;
|
|
543
|
+
this._jsonStr = jsonStr;
|
|
544
|
+
this._self = self;
|
|
545
|
+
this._enrich = enrich;
|
|
546
|
+
this._cached = null;
|
|
547
|
+
}
|
|
548
|
+
toJSON() {
|
|
549
|
+
return { valid: false, errors: this.errors };
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
Object.defineProperty(LazyJsonRejection.prototype, 'errors', {
|
|
553
|
+
enumerable: true,
|
|
554
|
+
configurable: true,
|
|
555
|
+
get() {
|
|
556
|
+
if (this._cached !== null) return this._cached;
|
|
557
|
+
const self = this._self;
|
|
558
|
+
const enrich = this._enrich;
|
|
559
|
+
const jsonStr = this._jsonStr;
|
|
560
|
+
// Reading the inner errors realizes the inner lazy layer, if there was one.
|
|
561
|
+
const raw = this._result.errors || [];
|
|
562
|
+
if (!raw.length) { this._cached = raw; return raw; }
|
|
563
|
+
|
|
564
|
+
// The enrich pass plucks `received` from the value tree and the suggestion
|
|
565
|
+
// engine (required-typo, format hints, coercion nudges) walks it too.
|
|
566
|
+
let parsedData;
|
|
567
|
+
try { parsedData = JSON.parse(jsonStr); } catch { parsedData = undefined; }
|
|
568
|
+
|
|
569
|
+
// Errors the inner path already enriched carry a docUrl: only enrich() sets
|
|
570
|
+
// one. `code` is not a safe signal, because branch-collapse attaches codes
|
|
571
|
+
// to raw errors, and detecting on it left every collapsed oneOf/anyOf error
|
|
572
|
+
// unenriched on the text path.
|
|
573
|
+
if (!raw[0] || !raw[0].docUrl) {
|
|
574
|
+
const positions = self._pos().get(jsonStr);
|
|
575
|
+
// Declaration order, as validate() applies it; the text path used to
|
|
576
|
+
// enrich in emission order.
|
|
577
|
+
const ordered = raw.length > 1 ? sortErrorsBySchemaOrder(self._schemaObj, raw) : raw;
|
|
578
|
+
const enrichOpts = {
|
|
579
|
+
data: parsedData,
|
|
580
|
+
positions,
|
|
581
|
+
schemaPositions: self._schemaPositions,
|
|
582
|
+
schemaFile: self._source ? self._source.path : undefined,
|
|
583
|
+
};
|
|
584
|
+
const enriched = ordered.map((e) => enrich(e, enrichOpts));
|
|
585
|
+
if (enriched.length > 1) attachRelated(enriched);
|
|
586
|
+
attachDiagnosticSource(enriched, {
|
|
587
|
+
data: parsedData,
|
|
588
|
+
text: jsonStr,
|
|
589
|
+
positions,
|
|
590
|
+
schema: self._schemaObj,
|
|
591
|
+
mutatesInput: self._mutatesInput === true,
|
|
592
|
+
});
|
|
593
|
+
if (positions) self._posCache.reset();
|
|
594
|
+
this._cached = enriched;
|
|
595
|
+
return enriched;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// Already enriched, so the frames are usually attached too. Only a gap in
|
|
599
|
+
// them is worth another walk of the document: resolving the map to discover
|
|
600
|
+
// there was nothing to fill cost a second full walk on every rejection.
|
|
601
|
+
if (raw.some((e) => e && !e.dataFrame)) {
|
|
602
|
+
const positions = self._pos().get(jsonStr);
|
|
603
|
+
if (positions) {
|
|
604
|
+
for (const e of raw) {
|
|
605
|
+
if (e && !e.dataFrame) {
|
|
606
|
+
const path = e.path != null ? e.path : (e.instancePath || '');
|
|
607
|
+
const p = positions[path];
|
|
608
|
+
if (p) e.dataFrame = { byteOffset: p.byteOffset, length: p.length, line: p.line, col: p.col, text: p.text };
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
self._posCache.reset();
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
if (raw.length > 1) attachRelated(raw);
|
|
615
|
+
attachDiagnosticSource(raw, {
|
|
616
|
+
data: parsedData,
|
|
617
|
+
text: jsonStr,
|
|
618
|
+
schema: self._schemaObj,
|
|
619
|
+
mutatesInput: self._mutatesInput === true,
|
|
620
|
+
});
|
|
621
|
+
this._cached = raw;
|
|
622
|
+
return raw;
|
|
623
|
+
},
|
|
624
|
+
});
|
|
625
|
+
|
|
521
626
|
// A raw error without the `_o` ordering key, for the legacy error shape.
|
|
522
627
|
function stripOrdinal(e) {
|
|
523
628
|
if (e === null || typeof e !== 'object' || e._o === undefined) return e;
|
|
@@ -1681,15 +1786,15 @@ class Validator {
|
|
|
1681
1786
|
// abortEarly returns the shared ATA9000 stub; preserve it as-is so the
|
|
1682
1787
|
// perf fast path stays allocation-free and the documented code stays stable.
|
|
1683
1788
|
if (result && result.valid === false && result !== ABORT_EARLY_RESULT) {
|
|
1684
|
-
//
|
|
1685
|
-
//
|
|
1686
|
-
|
|
1687
|
-
|
|
1789
|
+
// The raw input travels with the rejection when validateJSON set one.
|
|
1790
|
+
// The map it implies is built on first access to `.errors`, so a
|
|
1791
|
+
// caller reading only `.valid` does not pay for a document walk.
|
|
1792
|
+
const rawInput = enrich ? self._lastRawInput : null;
|
|
1688
1793
|
// One instance of a class with prototype accessors. An object
|
|
1689
1794
|
// literal with a getter here cost a closure plus an accessor
|
|
1690
1795
|
// definition on every rejection, several hundred nanoseconds
|
|
1691
1796
|
// before any error was read.
|
|
1692
|
-
return new RichRejection(result, data,
|
|
1797
|
+
return new RichRejection(result, data, rawInput, self, root, enrich);
|
|
1693
1798
|
}
|
|
1694
1799
|
return result;
|
|
1695
1800
|
};
|
|
@@ -1700,74 +1805,23 @@ class Validator {
|
|
|
1700
1805
|
if (this._richErrors && this.validateJSON) {
|
|
1701
1806
|
const innerJson = this.validateJSON;
|
|
1702
1807
|
this.validateJSON = (jsonStr) => {
|
|
1808
|
+
// The inner path reads _lastRawInput to hand the raw text to the
|
|
1809
|
+
// rejection it builds. Cleared as soon as it returns: the rejection
|
|
1810
|
+
// carries the text itself, so nothing outlives the call.
|
|
1703
1811
|
this._lastRawInput = jsonStr;
|
|
1704
1812
|
let result;
|
|
1705
1813
|
try {
|
|
1706
1814
|
result = innerJson(jsonStr);
|
|
1707
1815
|
} finally {
|
|
1708
|
-
|
|
1709
|
-
// clear after enrich, or in the early-return path.
|
|
1816
|
+
this._lastRawInput = null;
|
|
1710
1817
|
}
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
// it left every collapsed oneOf/anyOf error unenriched on the
|
|
1718
|
-
// text path.
|
|
1719
|
-
const first = result.errors[0];
|
|
1720
|
-
// Re-parse the input once so the enrich pass can pluck `received`
|
|
1721
|
-
// and feed the suggestion engine (required-typo, format hints,
|
|
1722
|
-
// coercion nudges all need the live value tree), and so the
|
|
1723
|
-
// diagnostic payload carries the data on both paths below.
|
|
1724
|
-
let parsedData;
|
|
1725
|
-
try { parsedData = JSON.parse(jsonStr); } catch { parsedData = undefined; }
|
|
1726
|
-
if (!first || !first.docUrl) {
|
|
1727
|
-
const positions = (this._lastRawInput != null) ? this._pos().get(this._lastRawInput) : null;
|
|
1728
|
-
// Declaration order, as validate() applies it; the text path
|
|
1729
|
-
// used to enrich in emission order.
|
|
1730
|
-
const ordered = result.errors.length > 1 ? sortErrorsBySchemaOrder(this._schemaObj, result.errors) : result.errors;
|
|
1731
|
-
const enrichOpts = {
|
|
1732
|
-
data: parsedData,
|
|
1733
|
-
positions,
|
|
1734
|
-
schemaPositions: this._schemaPositions,
|
|
1735
|
-
schemaFile: this._source ? this._source.path : undefined,
|
|
1736
|
-
};
|
|
1737
|
-
const enriched = ordered.map((e) => enrich(e, enrichOpts));
|
|
1738
|
-
if (enriched.length > 1) attachRelated(enriched);
|
|
1739
|
-
attachDiagnosticSource(enriched, {
|
|
1740
|
-
data: parsedData,
|
|
1741
|
-
text: jsonStr,
|
|
1742
|
-
positions,
|
|
1743
|
-
schema: this._schemaObj,
|
|
1744
|
-
mutatesInput: this._mutatesInput === true,
|
|
1745
|
-
});
|
|
1746
|
-
if (positions) this._posCache.reset();
|
|
1747
|
-
this._lastRawInput = null;
|
|
1748
|
-
return { valid: false, errors: enriched };
|
|
1749
|
-
}
|
|
1750
|
-
// Already-enriched path: still attach dataFrame if missing.
|
|
1751
|
-
const positions = (this._lastRawInput != null) ? this._pos().get(this._lastRawInput) : null;
|
|
1752
|
-
if (positions) {
|
|
1753
|
-
for (const e of result.errors) {
|
|
1754
|
-
if (e && !e.dataFrame) {
|
|
1755
|
-
const path = e.path != null ? e.path : (e.instancePath || '');
|
|
1756
|
-
const p = positions[path];
|
|
1757
|
-
if (p) e.dataFrame = { byteOffset: p.byteOffset, length: p.length, line: p.line, col: p.col, text: p.text };
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
|
-
this._posCache.reset();
|
|
1761
|
-
}
|
|
1762
|
-
if (result.errors.length > 1) attachRelated(result.errors);
|
|
1763
|
-
attachDiagnosticSource(result.errors, {
|
|
1764
|
-
data: parsedData,
|
|
1765
|
-
text: jsonStr,
|
|
1766
|
-
schema: this._schemaObj,
|
|
1767
|
-
mutatesInput: this._mutatesInput === true,
|
|
1768
|
-
});
|
|
1818
|
+
// Every diagnostic the text path adds is deferred. Deciding here
|
|
1819
|
+
// whether there is anything to add would mean reading `result.errors`,
|
|
1820
|
+
// and on the codegen path that realizes the inner lazy layer, which is
|
|
1821
|
+
// the document walk this exists to avoid.
|
|
1822
|
+
if (result && result.valid === false) {
|
|
1823
|
+
return new LazyJsonRejection(result, jsonStr, this, enrich);
|
|
1769
1824
|
}
|
|
1770
|
-
this._lastRawInput = null;
|
|
1771
1825
|
return result;
|
|
1772
1826
|
};
|
|
1773
1827
|
}
|
package/lib/aot-impl.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
const { compileToJSCodegenWithErrors, compileToJSCodegen, unevalContributions } = require('./js-compiler');
|
|
17
17
|
const { buildDataPositionMap } = require('./data-positions');
|
|
18
18
|
const { schemaHash } = require('./schema-hash');
|
|
19
|
+
const ATA_VERSION = require('./version');
|
|
19
20
|
const SAFE_REGEX_SOURCE = require('./safe-regex-source');
|
|
20
21
|
|
|
21
22
|
// Embedded verbatim in standalone modules so the output file has no runtime
|
|
@@ -119,7 +120,7 @@ function toStandalone(validator) {
|
|
|
119
120
|
const errSrc = jsErrFn && jsErrFn._errSource ? jsErrFn._errSource : '';
|
|
120
121
|
|
|
121
122
|
const closureSrc = closureDeclLines(jsFn).join('\n');
|
|
122
|
-
return `// Auto-generated by ata-validator
|
|
123
|
+
return `// Auto-generated by ata-validator ${ATA_VERSION}, do not edit
|
|
123
124
|
'use strict';
|
|
124
125
|
${_CP_LEN_SOURCE}
|
|
125
126
|
${safeRePrelude(jsFn, jsErrFn)}${preambleSrc}
|
|
@@ -627,10 +628,15 @@ function validateJSON(text) {
|
|
|
627
628
|
// can compare it against schemaHash(currentSchema) and know the module is
|
|
628
629
|
// stale without embedding its own fingerprint.
|
|
629
630
|
const hashSrc = schemaHash(validator._rawSchema !== undefined ? validator._rawSchema : validator._schemaObj);
|
|
630
|
-
|
|
631
|
+
// The schema hash answers "is this module built from a different schema" and
|
|
632
|
+
// nothing else. Upgrading ata and not re-running the generate step leaves the
|
|
633
|
+
// hash matching, so the stale module reads as current. The module cannot ask
|
|
634
|
+
// the installed ata itself, since it imports nothing, so it carries the
|
|
635
|
+
// version that wrote it and a build compares that too.
|
|
636
|
+
const hashDecl = `const schemaHash = ${JSON.stringify(hashSrc)};\nconst ataVersion = ${JSON.stringify(ATA_VERSION)};\n`;
|
|
631
637
|
|
|
632
638
|
let names = fmt.exportsSetFormats ? baseNames + ', setFormats' : baseNames;
|
|
633
|
-
names += ', schemaHash';
|
|
639
|
+
names += ', schemaHash, ataVersion';
|
|
634
640
|
if (positionsCore) names += ', validateJSON';
|
|
635
641
|
const parseAlias = cloneExpr ? ', _ataParse as parse' : '';
|
|
636
642
|
const parseProp = cloneExpr ? ', parse: _ataParse' : '';
|
|
@@ -644,8 +650,9 @@ function validateJSON(text) {
|
|
|
644
650
|
if (opts && opts.parse && !cloneExpr) {
|
|
645
651
|
degradedNote += '// NOTE: parse() was requested but could not be generated for this schema;\n// the module has no parse export. Validate and strip with the runtime Validator.\n';
|
|
646
652
|
}
|
|
647
|
-
return `// Auto-generated by ata-validator
|
|
653
|
+
return `// Auto-generated by ata-validator ${ATA_VERSION}, do not edit.
|
|
648
654
|
// Schema is embedded; runtime has zero dependency on ata-validator.
|
|
655
|
+
// Re-run the build after upgrading ata: the version above is what wrote this.
|
|
649
656
|
${degradedNote}'use strict';
|
|
650
657
|
${_CP_LEN_SOURCE}
|
|
651
658
|
${safeRePrelude(jsFn, jsErrFn)}${schemaSourceConst}const VALID = Object.freeze({ valid: true, errors: Object.freeze([]) });
|
|
@@ -786,10 +793,10 @@ function bundleStandalone(Validator, schemas, opts) {
|
|
|
786
793
|
: '';
|
|
787
794
|
if (format === 'esm') {
|
|
788
795
|
const extra = bundleInjects ? 'export { validators, setFormats };' : 'export { validators };';
|
|
789
|
-
return `// Auto-generated by ata-validator
|
|
796
|
+
return `// Auto-generated by ata-validator ${ATA_VERSION}, do not edit\n${safeEmbed}${registry}const R=${R};\nconst validators=${arr};\nexport default validators;\n${extra}\n`;
|
|
790
797
|
}
|
|
791
798
|
const attach = bundleInjects ? 'module.exports.setFormats=setFormats;\n' : '';
|
|
792
|
-
return
|
|
799
|
+
return `// Auto-generated by ata-validator ${ATA_VERSION}, do not edit\n'use strict';\n${safeEmbed}${registry}var R=${R};\nmodule.exports=[${fns.join(',')}];\n${attach}`;
|
|
793
800
|
}
|
|
794
801
|
|
|
795
802
|
// Compact bundle: deduplicated code. Shared template functions + per-schema params.
|
|
@@ -898,8 +905,8 @@ function bundleCompact(Validator, schemas, opts) {
|
|
|
898
905
|
// Generate compact bundle
|
|
899
906
|
const isEsm = format === 'esm';
|
|
900
907
|
let out = isEsm
|
|
901
|
-
?
|
|
902
|
-
:
|
|
908
|
+
? `// Auto-generated by ata-validator ${ATA_VERSION}, do not edit\n`
|
|
909
|
+
: `// Auto-generated by ata-validator ${ATA_VERSION}, do not edit\n'use strict';\n`;
|
|
903
910
|
if (bundleUsesSafeRe) out += getSafeRegexEmbed() + '\n';
|
|
904
911
|
if (sharedDecls.length) out += sharedDecls.join('\n') + '\n';
|
|
905
912
|
const declKW = isEsm ? 'const' : 'var';
|
package/lib/ts-gen.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const ATA_VERSION = require('./version');
|
|
4
|
+
|
|
3
5
|
// Schema -> TypeScript type declaration.
|
|
4
6
|
// Emits an interface or type alias for each top-level schema, plus
|
|
5
7
|
// `isValid` (type predicate) and `validate` signatures.
|
|
@@ -215,7 +217,7 @@ function toTypeScript(schema, opts) {
|
|
|
215
217
|
? `${rootDoc}export interface ${rootName} ${rootType}`
|
|
216
218
|
: `${rootDoc}export type ${rootName} = ${rootType};`;
|
|
217
219
|
|
|
218
|
-
return `// Auto-generated by ata-validator
|
|
220
|
+
return `// Auto-generated by ata-validator ${ATA_VERSION}, do not edit.
|
|
219
221
|
${defLines.length ? defLines.join('\n\n') + '\n\n' : ''}${rootDecl}
|
|
220
222
|
|
|
221
223
|
export interface ValidationError {
|
|
@@ -239,7 +241,8 @@ export type Result = ValidResult | InvalidResult;
|
|
|
239
241
|
export declare function isValid(data: unknown): data is ${rootName};
|
|
240
242
|
export declare function validate(data: unknown): Result;
|
|
241
243
|
export declare const schemaHash: string;
|
|
242
|
-
declare const
|
|
244
|
+
export declare const ataVersion: string;
|
|
245
|
+
declare const _default: { validate: typeof validate; isValid: typeof isValid; schemaHash: typeof schemaHash; ataVersion: typeof ataVersion };
|
|
243
246
|
export default _default;
|
|
244
247
|
`;
|
|
245
248
|
}
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ata-validator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"description": "JSON Schema validation that compiles for speed and still runs where code generation is blocked. Compiled and interpreted engines answer identically at 100% of the official suite. TypeScript inference, Standard Schema V1, and a build step that emits dependency-free modules.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"release:check": "node scripts/regen-safe-regex-source.js && node tests/test_pack_purity.js && node scripts/check-doc-coverage.js && node tests/test_error_codes_lock.js && node tests/test_safe_regex_source_sync.js && node tests/test_version_sync.js",
|
|
52
52
|
"build": "cmake-js build --target ata",
|
|
53
53
|
"rebuild": "cmake-js rebuild --target ata",
|
|
54
|
-
"test": "node test.js && node tests/test_removed_aot_methods.js && node tests/test_no_native.js && node tests/test_no_eval.js && node tests/test_property_dependencies.js && node tests/test_v1_dialect.js && node tests/test_buffer_path_parity.js && node tests/test_buffer_gate.js && node tests/test_scanner_differential.js && node tests/test_buffer_reject_cost.js && node tests/test_nan_verdict.js && node tests/test_remove_additional_nested.js && node tests/test_exclusive_bounds.js && node tests/test_engine_differential.js && node tests/test_error_shape_differential.js && node tests/test_output_format.js && node tests/test_retry_message.js && node tests/test_describe_schema.js && node tests/test_aot_parse.js && node tests/test_draft7_semantics.js && node tests/test_metaschema_ref.js && node tests/test_pure_js_unsupported.js && node tests/test_native_load_order.js && node tests/test_pack_purity.js && node tests/test_make_native_package.js && node tests/test_browser_nofs.js && node tests/test_browser_imports_guard.js && node tests/test_version_sync.js && node tests/test_native_loaded.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_format_mode.js && node tests/test_aot_additional_props_errors.js && node tests/test_id_anchor_refs.js && node tests/test_engine_routing.js && node tests/test_engine_option.js && node tests/test_compile_cache_order.js && node tests/test_engine_diagnostic.js && node tests/test_format_engine_parity.js && node tests/test_uri_helper_parity.js && node tests/test_formats_single_pass.js && node tests/test_format_single_error.js && node tests/test_defs_pointer_alias.js && node tests/test_cross_doc_root_ref.js && node tests/test_codegen_entrypoint_agreement.js && node tests/test_hybrid_agreement.js && node tests/test_codegen_edge_shapes.js && node tests/test_ajv_errors.js && node tests/test_custom_keywords.js && node tests/test_strict_schema.js && node tests/test_aot_external_checks.js && node tests/test_ajv_parity.js && node tests/test_user_format_error_path.js && node tests/test_unevaluated_error_path.js && node tests/test_unevaluated_error_shape.js && node tests/test_pattern_properties_errors.js && node tests/test_additional_properties_scaling.js && node tests/test_no_input_mutation.js && node tests/test_typed_validator_runner.js && node tests/test_define_schema.js && node tests/test_error_codes_lock.js && node tests/test_error_code_lookup.js && node tests/test_error_order.js && node tests/test_error_order_ordinal.js && node tests/test_rejection_shape.js && node tests/test_lazy_normalization.js && node tests/test_value_equality.js && node tests/test_vocabulary.js && node tests/test_schema_scan.js && node tests/test_lazy_errors.js && node tests/test_lazy_instance.js && node tests/test_cyclic_input.js && node tests/test_native_error_codes.js && node tests/test_verdict_preprocess.js && node tests/test_defaults_own_keys.js && node tests/test_plan_compiler.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_enrich_received.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_malformed_json_termination.js && node tests/test_data_positions.js && node tests/test_position_map_cost.js && node tests/test_file_positions.js && node tests/test_schema_hash.js && node tests/test_render_shared.js && node tests/test_renderers.js && node tests/test_additive_fields.js && node tests/test_diagnostic_source.js && node tests/test_diagnose.js && node tests/test_correlate.js && node tests/test_diagnostics_score.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",
|
|
54
|
+
"test": "node test.js && node tests/test_removed_aot_methods.js && node tests/test_no_native.js && node tests/test_no_eval.js && node tests/test_property_dependencies.js && node tests/test_v1_dialect.js && node tests/test_buffer_path_parity.js && node tests/test_buffer_gate.js && node tests/test_scanner_differential.js && node tests/test_buffer_reject_cost.js && node tests/test_nan_verdict.js && node tests/test_remove_additional_nested.js && node tests/test_exclusive_bounds.js && node tests/test_engine_differential.js && node tests/test_error_shape_differential.js && node tests/test_output_format.js && node tests/test_retry_message.js && node tests/test_describe_schema.js && node tests/test_aot_parse.js && node tests/test_draft7_semantics.js && node tests/test_metaschema_ref.js && node tests/test_pure_js_unsupported.js && node tests/test_native_load_order.js && node tests/test_pack_purity.js && node tests/test_make_native_package.js && node tests/test_browser_nofs.js && node tests/test_browser_imports_guard.js && node tests/test_version_sync.js && node tests/test_native_loaded.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_format_mode.js && node tests/test_aot_additional_props_errors.js && node tests/test_id_anchor_refs.js && node tests/test_engine_routing.js && node tests/test_engine_option.js && node tests/test_compile_cache_order.js && node tests/test_engine_diagnostic.js && node tests/test_format_engine_parity.js && node tests/test_uri_helper_parity.js && node tests/test_formats_single_pass.js && node tests/test_format_single_error.js && node tests/test_defs_pointer_alias.js && node tests/test_cross_doc_root_ref.js && node tests/test_codegen_entrypoint_agreement.js && node tests/test_hybrid_agreement.js && node tests/test_codegen_edge_shapes.js && node tests/test_ajv_errors.js && node tests/test_custom_keywords.js && node tests/test_strict_schema.js && node tests/test_aot_external_checks.js && node tests/test_ajv_parity.js && node tests/test_user_format_error_path.js && node tests/test_unevaluated_error_path.js && node tests/test_unevaluated_error_shape.js && node tests/test_pattern_properties_errors.js && node tests/test_additional_properties_scaling.js && node tests/test_no_input_mutation.js && node tests/test_typed_validator_runner.js && node tests/test_define_schema.js && node tests/test_error_codes_lock.js && node tests/test_error_code_lookup.js && node tests/test_error_order.js && node tests/test_error_order_ordinal.js && node tests/test_rejection_shape.js && node tests/test_lazy_normalization.js && node tests/test_value_equality.js && node tests/test_vocabulary.js && node tests/test_schema_scan.js && node tests/test_lazy_errors.js && node tests/test_lazy_json_errors.js && node tests/test_lazy_instance.js && node tests/test_cyclic_input.js && node tests/test_native_error_codes.js && node tests/test_verdict_preprocess.js && node tests/test_defaults_own_keys.js && node tests/test_plan_compiler.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_enrich_received.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_malformed_json_termination.js && node tests/test_data_positions.js && node tests/test_position_map_cost.js && node tests/test_aot_staleness.js && node tests/test_file_positions.js && node tests/test_schema_hash.js && node tests/test_render_shared.js && node tests/test_renderers.js && node tests/test_additive_fields.js && node tests/test_diagnostic_source.js && node tests/test_diagnose.js && node tests/test_correlate.js && node tests/test_diagnostics_score.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",
|
|
55
55
|
"bench:size": "node benchmark/bench_aot_size.mjs",
|
|
56
56
|
"test:suite": "node tests/run_suite.js && node tests/run_suite.js draft7 && node tests/run_suite.js v1",
|
|
57
57
|
"test:compat": "node tests/test_compat.js",
|
|
@@ -118,17 +118,16 @@
|
|
|
118
118
|
"t.d.ts",
|
|
119
119
|
"bin/",
|
|
120
120
|
"README.md",
|
|
121
|
-
"CHANGELOG.md",
|
|
122
121
|
"LICENSE"
|
|
123
122
|
],
|
|
124
123
|
"optionalDependencies": {
|
|
125
|
-
"@ata-validator/native-darwin-arm64": "1.
|
|
126
|
-
"@ata-validator/native-darwin-x64": "1.
|
|
127
|
-
"@ata-validator/native-linux-arm64-gnu": "1.
|
|
128
|
-
"@ata-validator/native-linux-arm64-musl": "1.
|
|
129
|
-
"@ata-validator/native-linux-x64-gnu": "1.
|
|
130
|
-
"@ata-validator/native-linux-x64-musl": "1.
|
|
131
|
-
"@ata-validator/native-win32-x64": "1.
|
|
124
|
+
"@ata-validator/native-darwin-arm64": "1.29.0",
|
|
125
|
+
"@ata-validator/native-darwin-x64": "1.29.0",
|
|
126
|
+
"@ata-validator/native-linux-arm64-gnu": "1.29.0",
|
|
127
|
+
"@ata-validator/native-linux-arm64-musl": "1.29.0",
|
|
128
|
+
"@ata-validator/native-linux-x64-gnu": "1.29.0",
|
|
129
|
+
"@ata-validator/native-linux-x64-musl": "1.29.0",
|
|
130
|
+
"@ata-validator/native-win32-x64": "1.29.0"
|
|
132
131
|
},
|
|
133
132
|
"peerDependencies": {
|
|
134
133
|
"yaml": "^2.0.0"
|