@alexify/metaschema 3.4.1 → 4.0.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 +162 -1
- package/README.md +22 -7
- package/SECURITY.md +5 -4
- package/index.d.ts +856 -460
- package/package.json +8 -6
- package/src/checks.js +72 -107
- package/src/codec.js +67 -58
- package/src/coerce/index.d.ts +31 -21
- package/src/coerce/index.js +64 -47
- package/src/compile/code.js +2 -2
- package/src/compile/emit.js +20 -31
- package/src/compile/index.d.ts +41 -25
- package/src/compile/index.js +45 -32
- package/src/context.js +10 -10
- package/src/definition/index.d.ts +10 -7
- package/src/definition/index.js +2 -1
- package/src/derive/index.d.ts +25 -17
- package/src/derive/index.js +14 -11
- package/src/errors.js +84 -59
- package/src/formats/index.d.ts +27 -21
- package/src/formats/index.js +15 -13
- package/src/generators/{fromjsonschema.js → from-json-schema.js} +170 -127
- package/src/generators/index.d.ts +23 -15
- package/src/generators/index.js +2 -2
- package/src/generators/{jsonschema.js → json-schema.js} +37 -43
- package/src/generators/typescript.js +9 -6
- package/src/index.js +2 -1
- package/src/issues.js +41 -42
- package/src/kinds.js +18 -16
- package/src/lint.js +15 -18
- package/src/locales/en.js +7 -7
- package/src/locales/uk.js +6 -6
- package/src/metadata.js +2 -2
- package/src/model/data.js +17 -20
- package/src/model/diff.js +29 -24
- package/src/model/index.d.ts +51 -35
- package/src/model/infer.js +69 -60
- package/src/model/merge.js +29 -18
- package/src/model/pattern.js +105 -102
- package/src/model/restore.js +24 -19
- package/src/model/sample.js +90 -100
- package/src/model.js +4 -2
- package/src/mongodb/bson.js +12 -12
- package/src/mongodb/document.js +7 -6
- package/src/mongodb/index.d.ts +54 -31
- package/src/mongodb/update.js +12 -9
- package/src/preprocessor.js +13 -13
- package/src/prototypes/abstract.js +8 -8
- package/src/prototypes/collections.js +7 -7
- package/src/prototypes/flags.js +1 -1
- package/src/prototypes/reference.js +3 -4
- package/src/prototypes/scalars.js +1 -1
- package/src/prototypes/schema.js +5 -6
- package/src/prototypes/tuple.js +6 -5
- package/src/prototypes/union.js +5 -4
- package/src/rules.js +23 -20
- package/src/runtime/browser.js +6 -1
- package/src/runtime/node.js +19 -2
- package/src/schema.js +15 -13
- package/src/snapshot.js +14 -12
- package/src/stream/index.d.ts +33 -21
- package/src/stream/index.js +37 -20
- package/src/struct.js +6 -6
- package/src/types.js +28 -22
- package/src/util.js +65 -64
- package/src/validation.js +10 -13
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,166 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [4.0.0] - 2026-11-27
|
|
11
|
+
|
|
12
|
+
4.0 brings the errors of the package to the rules of the Alexis libraries (alexiskills 1.1).
|
|
13
|
+
Every error code carries the `ALX_` prefix, and a wrong call throws a class of the package,
|
|
14
|
+
`SchemaUsageError`, where it threw a plain `TypeError` (or a `SchemaDefinitionError`, for a
|
|
15
|
+
wrong option of some calls). A program that matches on `error.code`, or on the `name` of the
|
|
16
|
+
error of a call, changes; one that checks `instanceof TypeError` does not. A hook no longer
|
|
17
|
+
fails the call it watches, and three defects of the async paths of 3.x are fixed. The schema
|
|
18
|
+
language, `check`, `parse`, the results and their issue codes are what they were.
|
|
19
|
+
|
|
20
|
+
### Upgrading from 3.x
|
|
21
|
+
|
|
22
|
+
The same guide with before-and-after examples is
|
|
23
|
+
[Migrating from 3.x](https://metaschema.vercel.app/guide/migrating-from-3).
|
|
24
|
+
|
|
25
|
+
- **Every code has the `ALX_` prefix**, and what follows it is the name it had:
|
|
26
|
+
`ERR_INVALID_RULE` is `ALX_ERR_INVALID_RULE`, `ERR_NOT_REGISTERED` is
|
|
27
|
+
`ALX_ERR_NOT_REGISTERED`, and so for the 31 codes of `SchemaDefinitionError` and the 5 of a
|
|
28
|
+
wrong call. A search for `'ERR_` finds every comparison to change; `DefinitionErrorCode` and
|
|
29
|
+
`RuntimeErrorCode` hold the new names.
|
|
30
|
+
- **A wrong call throws `SchemaUsageError`** (`ALX_ERR_ASYNC_VALIDATOR`,
|
|
31
|
+
`ALX_ERR_INVALID_TARGET`, `ALX_ERR_INVALID_OPTION`, `ALX_ERR_INVALID_RECORD`,
|
|
32
|
+
`ALX_ERR_NOT_REGISTERED`): `error.name` is `'SchemaUsageError'` where it was `'TypeError'`,
|
|
33
|
+
and `instanceof TypeError` holds as before.
|
|
34
|
+
- **`saveTypes` in a browser rejects with `ALX_ERR_UNSUPPORTED_RUNTIME`**, a
|
|
35
|
+
`SchemaUsageError`, where it rejected with a bare `Error`.
|
|
36
|
+
- **Every option of a call is `ALX_ERR_INVALID_OPTION` of `SchemaUsageError`.** The options of
|
|
37
|
+
`compile` and `register` of the compile subpath, `toJSONSchema`, `fromJSONSchema`, `fromJSON`,
|
|
38
|
+
`merge`, `sample`, `infer`, the `Model` constructor and `register` of the coerce subpath threw
|
|
39
|
+
`SchemaDefinitionError` with `ERR_INVALID_OPTIONS` (`ERR_INVALID_COERCION` for coerce);
|
|
40
|
+
`ALX_ERR_INVALID_OPTIONS` is the code of the metadata of a definition only.
|
|
41
|
+
- **The error classes take `(message, options = {})`**: a program that builds one writes
|
|
42
|
+
`new SchemaDefinitionError(message, { code })` where it wrote `(code, message)`. `error.cause`
|
|
43
|
+
is the standard one, not an own enumerable key (`JSON.stringify(error)` leaves it out).
|
|
44
|
+
|
|
45
|
+
### Changed (breaking)
|
|
46
|
+
|
|
47
|
+
- **Every error code is `ALX_ERR_*`**, as alexiskills 1.1 asks of the Alexis libraries (Fastify's
|
|
48
|
+
are `FST_ERR_*`): the codes of other packages and of Node pass through a program, and the
|
|
49
|
+
prefix tells the package's own apart. The names after it did not change.
|
|
50
|
+
- **`SchemaUsageError`, a `TypeError`, is the error of a wrong call**, beside
|
|
51
|
+
`SchemaDefinitionError` for a broken definition. The core entry and
|
|
52
|
+
`@alexify/metaschema/definition` export it, `index.d.ts` declares it with `code:
|
|
53
|
+
RuntimeErrorCode` and the fields the errors carried in 3.x (`index`, `record` and `result` on
|
|
54
|
+
`ALX_ERR_INVALID_RECORD`, `method` on the `ALX_ERR_NOT_REGISTERED` of the definition entry).
|
|
55
|
+
- **`saveTypes` of the browser build rejects with a code**, `ALX_ERR_UNSUPPORTED_RUNTIME`, new in
|
|
56
|
+
`RuntimeErrorCode`.
|
|
57
|
+
- **An option of a call is a `SchemaUsageError` with `ALX_ERR_INVALID_OPTION` everywhere**, as
|
|
58
|
+
alexiskills asks of a wrong call ("one class per failure the caller handles differently"):
|
|
59
|
+
the options of the compile subpath, of the generators, of `fromJSON`, `merge`, `sample` and
|
|
60
|
+
`infer`, of `Model` and of `register` of the coerce subpath were `SchemaDefinitionError` with
|
|
61
|
+
`ALX_ERR_INVALID_OPTIONS` (`ALX_ERR_INVALID_COERCION`). The metadata of a definition keeps
|
|
62
|
+
`ALX_ERR_INVALID_OPTIONS`.
|
|
63
|
+
- **The error classes take `(message, options = {})`, as `Error` does** (alexiskills 1.2):
|
|
64
|
+
`new SchemaDefinitionError(message, { code, cause, schema, field, index, seed })` and
|
|
65
|
+
`new SchemaUsageError(message, { code, cause, index, record, result, method })`, where
|
|
66
|
+
`SchemaDefinitionError` took `(code, reason)` in 3.x. `options` goes to `Error` whole, so `cause` is the standard one and set
|
|
67
|
+
only when given (the errors that wrapped another assigned it as an own enumerable key, and an
|
|
68
|
+
error of a snapshot that did not read lost the engine's error, which is its cause now). Every
|
|
69
|
+
field is set by the constructor, none afterwards. Without a code a `SchemaDefinitionError` is
|
|
70
|
+
`ALX_ERR_INVALID_DEFINITION` and a `SchemaUsageError` `ALX_ERR_INVALID_TARGET`; `code` is
|
|
71
|
+
`readonly` in the typings, and `DefinitionErrorOptions` and `UsageErrorOptions` type the
|
|
72
|
+
options.
|
|
73
|
+
|
|
74
|
+
### Changed
|
|
75
|
+
|
|
76
|
+
- **A hook never fails the call it watches.** `onFallback` of the compile subpath, `onError` of
|
|
77
|
+
the coerce subpath and `onUnsupported` of `fromJSONSchema` are observers (alexiskills,
|
|
78
|
+
library-errors): what one throws, or a promise of it that rejects, is dropped, where a
|
|
79
|
+
throwing `onFallback` made `new Schema` throw under `register()`. `onInvalid` of a stream
|
|
80
|
+
`transform` stays a step of the stream, and its throw ends it.
|
|
81
|
+
- **`saveTypes` replaces the file whole.** It writes a file of its own beside the target and
|
|
82
|
+
renames it into place, so a reader (`tsc --watch`, an editor) never sees half a declaration
|
|
83
|
+
file and a write that fails leaves the old file as it was; it wrote the target in place.
|
|
84
|
+
|
|
85
|
+
### Fixed
|
|
86
|
+
|
|
87
|
+
- **An async validator that rejects while settle awaits an earlier one no longer ends the
|
|
88
|
+
process.** `checkAsync` and `parseAsync` keep the promises of the validators they meet and
|
|
89
|
+
await them in field order after the walk; a promise that rejected while an earlier one was
|
|
90
|
+
still pending had no handler yet, so Node reported an unhandled rejection and exited (since
|
|
91
|
+
3.2, whose settle overlaps the waits). Every promise is now observed as soon as it is met, and
|
|
92
|
+
its rejection is the `exception` issue of its field, as it always was once awaited.
|
|
93
|
+
- **The `validate` of a merged field no longer leaves a rejecting promise behind.** When the
|
|
94
|
+
first of the two validators `merge` composes returned a promise and the second threw, the
|
|
95
|
+
first's promise rejected unhandled (since 3.1); it is observed before the second runs.
|
|
96
|
+
- **`checkEachAsync` and `parseEachAsync` read a record with a `then` of its own as the record.**
|
|
97
|
+
Over a sync source, `for await` adopted every thenable, so a record with a field named `then`
|
|
98
|
+
holding a function came out as what that function resolved to (since 3.2). The async pair now
|
|
99
|
+
awaits an element of a sync source only when it is a `Promise`, as documented, and a sync
|
|
100
|
+
generator it stops early is still closed.
|
|
101
|
+
|
|
102
|
+
### Documentation
|
|
103
|
+
|
|
104
|
+
- **Each error class has its table.** The API reference has a section for `SchemaUsageError`
|
|
105
|
+
beside the one of `SchemaDefinitionError`, with the fields and the six codes, and a test holds
|
|
106
|
+
the source, the two unions of `index.d.ts` and the two tables to one set of codes, throws every
|
|
107
|
+
code of a wrong call once to see its class, and fails on a code without the prefix.
|
|
108
|
+
- **Migrating from 3.x**, a page of the guide, and "From 3.x" in the README.
|
|
109
|
+
- **The public API is documented as JSDoc in the `.d.ts`**, which an editor shows on hover:
|
|
110
|
+
222 `//` comments over declarations became `/** */` blocks, and `Schema`, `Model`,
|
|
111
|
+
`ValidationResult`, `SchemaDefinitionError` and the options types got the ones they lacked.
|
|
112
|
+
- **"At a trust boundary"** in the guide to parse: the four defaults a boundary sets otherwise
|
|
113
|
+
(`maxErrors`, the async validators a walk starts, a pattern without `length.max`, the text of
|
|
114
|
+
an `exception` issue).
|
|
115
|
+
|
|
116
|
+
### Tooling
|
|
117
|
+
|
|
118
|
+
- **The agent skills are alexiskills.** `@alexify/metaskills` 1.2.0, a devDependency, links its
|
|
119
|
+
37 skills into `.claude/skills` from the `prepare` script (`alexiskills claude`) on every
|
|
120
|
+
`pnpm install`, and `.gitignore` leaves the link out. The seven skills of metarhia/metaskills
|
|
121
|
+
1.0.5 the repository kept there are gone; what two of them said of metaschema alone (the steps
|
|
122
|
+
of a release, the code style) is in CLAUDE.md. Nothing of it ships: the `files` of the package
|
|
123
|
+
are what they were.
|
|
124
|
+
- **The lint rules of alexiskills, and `src/` brought to them.**
|
|
125
|
+
- New rules: `func-style`, `no-nested-ternary`, `max-depth` and a strict `eqeqeq` (`null`
|
|
126
|
+
included) everywhere; in `src/` every array iteration method, the unicorn rules and
|
|
127
|
+
`max-lines-per-function`.
|
|
128
|
+
- The code changed for them: 31 loose comparisons with `null`, 16 nested ternaries,
|
|
129
|
+
3 `Object.entries`, 14 `let` without a value, three membership lists made Sets, three sorts
|
|
130
|
+
written as statements, three long functions split.
|
|
131
|
+
- No behaviour changed: the suites pass on both backends and without eval. The core measures
|
|
132
|
+
22298 bytes (21.8 KB, +74), and `check`, `parse` and the moltar rows are at parity or faster.
|
|
133
|
+
- **alexiskills 1.1.**
|
|
134
|
+
- The lint turns `no-void` off and reports unused disable directives as errors.
|
|
135
|
+
- `src/` follows it: 35 call-then-return pairs are `return void fn()`, 17 `String(value)` of
|
|
136
|
+
values that cannot be symbols are template literals (four stay, where a key or a value may
|
|
137
|
+
be one), and the last `Object.values` and array destructuring are gone.
|
|
138
|
+
- The 55 suites are `describe` and `it('should …')` with `node:assert/strict`: 590 tests,
|
|
139
|
+
the same as before, under new titles, and six more for the error codes.
|
|
140
|
+
- No behaviour changed. The core measures 22319 bytes (+21), and the bench is at parity.
|
|
141
|
+
- **CI tests Node 18.12.0**, the lowest version pnpm 10 runs on, where it tested the latest
|
|
142
|
+
18.x; `engines` stays `>=18.0.0`, and the suite passes on 18.12.0. alexiskills 1.1.1 asks for
|
|
143
|
+
exactly that.
|
|
144
|
+
- **alexiskills 1.1.2.** It allows `for...of` and `for...in` in library code, as `src/` was
|
|
145
|
+
written. It also asks a loop that replaced an array method to skip the holes of a caller's
|
|
146
|
+
array. No loop of these changes replaced one, and a list with holes (an `enum`, a tuple, a
|
|
147
|
+
union, `flags`, `aliases`, an index, an array value, the records of a stream, the keys of
|
|
148
|
+
`pick`, the changes of `compatibility`) gives what it gave in 3.4.1 on both backends.
|
|
149
|
+
- **alexiskills 1.2.0.** Every error class of a library takes `(message, options = {})`, and
|
|
150
|
+
metaschema's do (see Changed (breaking)); the skills describe metaschema 4.0.
|
|
151
|
+
- **The review against alexiskills 1.1.2** (no behaviour changed beyond what Fixed and Changed
|
|
152
|
+
say):
|
|
153
|
+
- `src/` keeps the order of a module (constants, functions, classes, exports in that order),
|
|
154
|
+
`concat` for a concatenation, `{ __proto__: null, ... }` for a fixed table, a `Set` for a
|
|
155
|
+
membership list, a `let` of one kind, named steps where an expression wrapped, tables for
|
|
156
|
+
two dispatchers, names with their units, and kebab-case files (`json-schema.js`,
|
|
157
|
+
`from-json-schema.js`). An A/B of the `check` and `parse` rows against the commit before is
|
|
158
|
+
at parity (median −0.8%); the `checkAsync` rows with promises pay the fix of settle (one
|
|
159
|
+
rejection handler per promise: −8% on four resolved promises, −15% on the JIT).
|
|
160
|
+
- The tests bound linearity relative to an input of an eighth of the size, not in
|
|
161
|
+
milliseconds, wait on `setImmediate` rather than timers, read the entries of
|
|
162
|
+
`export-parity` from the `exports` map and hold every subpath to a size row and a gate.
|
|
163
|
+
- `package.json` says `"type": "commonjs"`, leaves `CLAUDE.md` out of the tarball, and has no
|
|
164
|
+
`release` script: a release runs `pnpm publish`.
|
|
165
|
+
- The coerce subpath's gate is 3 KB: the observer guard took it to 2027 bytes, 21 under the
|
|
166
|
+
2 KB gate (2049 at the end of the review); the core measures 22402 bytes (21.9 KB).
|
|
167
|
+
- **The core gate is 23 KB.** The error classes of alexiskills 1.2 write every code as an
|
|
168
|
+
option, which took the core to 22508 bytes (22.0 KB), 20 under the 22 KB gate.
|
|
169
|
+
|
|
10
170
|
## [3.4.1] - 2026-11-24
|
|
11
171
|
|
|
12
172
|
3.4.1 settles what a capitalized key is. Until now the first key of an object was a kind
|
|
@@ -1642,7 +1802,8 @@ published.
|
|
|
1642
1802
|
|
|
1643
1803
|
### [metaschema 0.x][upstream-0.x] - First generation of metaschema
|
|
1644
1804
|
|
|
1645
|
-
[unreleased]: https://github.com/Alexis-Technologies/metaschema/compare/
|
|
1805
|
+
[unreleased]: https://github.com/Alexis-Technologies/metaschema/compare/v4.0.0...HEAD
|
|
1806
|
+
[4.0.0]: https://github.com/Alexis-Technologies/metaschema/compare/v3.4.1...v4.0.0
|
|
1646
1807
|
[3.4.1]: https://github.com/Alexis-Technologies/metaschema/compare/v3.4.0...v3.4.1
|
|
1647
1808
|
[3.4.0]: https://github.com/Alexis-Technologies/metaschema/compare/v3.3.0...v3.4.0
|
|
1648
1809
|
[3.3.0]: https://github.com/Alexis-Technologies/metaschema/compare/v3.2.0...v3.3.0
|
package/README.md
CHANGED
|
@@ -110,13 +110,13 @@ event.parse({ name: 'deploy', when: '2026-10-10T12:00:00.000Z' }).value;
|
|
|
110
110
|
schemas (`merge`) and infers a definition from the values that exist (`infer`); `aliases` and
|
|
111
111
|
`deprecated` let a model carry its history, and `fromJSONSchema` of the generators reads a
|
|
112
112
|
JSON Schema document back.
|
|
113
|
-
- **Zero dependencies,
|
|
114
|
-
one package for Node.js and browsers; the generators add 7.
|
|
115
|
-
model tools 12.
|
|
116
|
-
2.
|
|
113
|
+
- **Zero dependencies, 22.0 KB min+gzip.** CommonJS with ESM named imports, no build step,
|
|
114
|
+
one package for Node.js and browsers; the generators add 7.9 KB, the JIT backend 4.4 KB, the
|
|
115
|
+
model tools 12.9 KB, the record tools 1.1 KB, the string formats 3.8 KB, the derive tools
|
|
116
|
+
2.2 KB, the converters of coercion 2.0 KB and the MongoDB tools 3.6 KB (on top of the
|
|
117
117
|
converters, which they require) where they are imported. A program that reads schemas
|
|
118
118
|
without validating them (a client that encodes from their snapshots) imports
|
|
119
|
-
`@alexify/metaschema/definition`, the half of the core that builds them: 10.
|
|
119
|
+
`@alexify/metaschema/definition`, the half of the core that builds them: 10.7 KB.
|
|
120
120
|
|
|
121
121
|
## Benchmarks
|
|
122
122
|
|
|
@@ -621,7 +621,7 @@ const parsed = ReadableStream.from(rows).pipeThrough(
|
|
|
621
621
|
|
|
622
622
|
`checkEachAsync` and `parseEachAsync` take a sync or async source and keep `concurrency` records
|
|
623
623
|
in flight; `maxInvalid` ends an iteration after that many invalid records, and a `transform`
|
|
624
|
-
without `onInvalid` ends its stream with `
|
|
624
|
+
without `onInvalid` ends its stream with `ALX_ERR_INVALID_RECORD`. See
|
|
625
625
|
[Records and streams](https://metaschema.vercel.app/guide/streaming).
|
|
626
626
|
|
|
627
627
|
## Coercion
|
|
@@ -817,7 +817,7 @@ text. See [The JIT backend](https://metaschema.vercel.app/guide/compile).
|
|
|
817
817
|
```js
|
|
818
818
|
const {
|
|
819
819
|
KIND, KIND_STORED, KIND_MEMORY, SCOPE, STORE, ALLOW,
|
|
820
|
-
getKindMetadata, Schema, Model, SchemaDefinitionError, ValidationResult,
|
|
820
|
+
getKindMetadata, Schema, Model, SchemaDefinitionError, SchemaUsageError, ValidationResult,
|
|
821
821
|
} = require('@alexify/metaschema');
|
|
822
822
|
|
|
823
823
|
const { toJSONSchema, toTypeScript, saveTypes, fromJSONSchema, register } = require('@alexify/metaschema/generators');
|
|
@@ -846,6 +846,21 @@ and every exported type.
|
|
|
846
846
|
|
|
847
847
|
## Migrating
|
|
848
848
|
|
|
849
|
+
### From 3.x
|
|
850
|
+
|
|
851
|
+
4.0 changes the errors and the hooks that watch a call. Every code has the `ALX_` prefix of the Alexis
|
|
852
|
+
libraries (`ERR_INVALID_RULE` is `ALX_ERR_INVALID_RULE`, and so for every code), and a wrong
|
|
853
|
+
call (a target or an option a call does not take, a method before its `register()`, a promise
|
|
854
|
+
where the call is synchronous, an invalid record of a stream) throws `SchemaUsageError`, a
|
|
855
|
+
subclass of `TypeError`, where it threw a plain `TypeError`; the options of the compile
|
|
856
|
+
subpath, the generators, the model subpath, `Model` and coerce's `register`, which threw
|
|
857
|
+
`SchemaDefinitionError` with `ERR_INVALID_OPTIONS`, are among them (`ALX_ERR_INVALID_OPTION`).
|
|
858
|
+
`saveTypes` in a browser rejects with `ALX_ERR_UNSUPPORTED_RUNTIME` of that class, both
|
|
859
|
+
classes take the arguments of `Error` (`new SchemaDefinitionError(message, { code, cause })`),
|
|
860
|
+
and a hook (`onFallback`, `onError`, `onUnsupported`) no longer fails the
|
|
861
|
+
call it watches. The schema language, the results and their issue codes stay as they are. The before-and-after examples are in
|
|
862
|
+
[Migrating from 3.x](https://metaschema.vercel.app/guide/migrating-from-3).
|
|
863
|
+
|
|
849
864
|
### From 2.x
|
|
850
865
|
|
|
851
866
|
3.0 has two breaking changes. The generators left the core entry: `model.dts`,
|
package/SECURITY.md
CHANGED
|
@@ -6,7 +6,8 @@ Only the latest published version receives fixes.
|
|
|
6
6
|
|
|
7
7
|
| Version | Supported |
|
|
8
8
|
|---|---|
|
|
9
|
-
|
|
|
9
|
+
| 4.x | ✅ |
|
|
10
|
+
| 3.x | ❌ (upgrade: [Migrating from 3.x](https://metaschema.vercel.app/guide/migrating-from-3)) |
|
|
10
11
|
| 2.x | ❌ (upgrade: the CHANGELOG has the notes) |
|
|
11
12
|
| 1.x | ❌ |
|
|
12
13
|
| `metaschema` (metarhia) 2.x | ❌ (report upstream) |
|
|
@@ -79,7 +80,7 @@ Some things work as intended and are not vulnerabilities:
|
|
|
79
80
|
a copy (the `custom` metadata of a kind, the indexes and the `database` metadata included):
|
|
80
81
|
no function, no object of the model, a function as `{ $function: true }`. Read back by
|
|
81
82
|
`fromJSON`, a snapshot is untrusted input: its tags (`$date`, `$bigint`, `$bytes`, `$map`,
|
|
82
|
-
`$set`) are read into values and a tag that does not read is `
|
|
83
|
+
`$set`) are read into values and a tag that does not read is `ALX_ERR_INVALID_SNAPSHOT`; a value
|
|
83
84
|
shaped like a `Date` or a `RegExp` (`{ "constructor": { "name": "Date" } }`) is data; its
|
|
84
85
|
`root` names one of its entities; a field key `root` is refused like the methods of a field;
|
|
85
86
|
the walks are bounded (128 levels, and a chain of entities of any length orders without
|
|
@@ -92,7 +93,7 @@ Some things work as intended and are not vulnerabilities:
|
|
|
92
93
|
`length.max` holds one. `fromDocument` of `./mongodb` reads a generic Binary (subtype 0 or
|
|
93
94
|
2) into a copy of its bytes and leaves any other subtype to the check.
|
|
94
95
|
- **The definition entry does not validate.** A schema built through
|
|
95
|
-
`@alexify/metaschema/definition` throws `
|
|
96
|
+
`@alexify/metaschema/definition` throws `ALX_ERR_NOT_REGISTERED` from every way to validate until
|
|
96
97
|
the core entry of the same copy of the package is loaded, and has no `~standard`, so a
|
|
97
98
|
consumer of Standard Schema never takes it for a validator. A schema of another copy (two
|
|
98
99
|
versions of the package installed) does not validate with this copy's core and says so.
|
|
@@ -101,7 +102,7 @@ Some things work as intended and are not vulnerabilities:
|
|
|
101
102
|
keys of the definition, written as own properties), and checks the definition it built
|
|
102
103
|
against every sample before it returns it. A key of a sample that reaches an error message
|
|
103
104
|
is truncated to 100 characters, as a key of a value under check is.
|
|
104
|
-
- **The error a stream ends with carries the record.** `
|
|
105
|
+
- **The error a stream ends with carries the record.** `ALX_ERR_INVALID_RECORD` of the stream
|
|
105
106
|
subpath has `record` and `result` on it, since the stream carries them no further; a logger
|
|
106
107
|
that serializes error objects writes the record.
|
|
107
108
|
- **Validation errors are data.** `check` collects problems as issues (a code, a path and params,
|