@arki/schema
For @arki/[email protected] · source CHANGELOG.md
Unreleased
parse and parseAsync return canonical typed failures through the shared failure executor. SchemaError and validation-related SchemaRunError codes are removed; ARKI_SCHEMA_E003 remains for unsupported JSON Schema targets.
0.2.0
Minor Changes
- 6601242: Throwing channel next to
parse:is(value, schema)(guard),assert(value, schema, { at, message })(narrows to the schema's input type; never transforms) andensure(value, schema, options)(returns the schema's output, a throwingparse). A rejected value throwsAssertError(ARKI_SCHEMA_E004) with the sameissuesthatparsereports; the message lists them with paths and never contains the raw value. An async schema throwsARKI_SCHEMA_E005at once. Also adds the schemasrecordSchema(non-null, non-array object) andplainObjectSchema(prototype isObject.prototypeornull); use them asis(value, recordSchema).
Patch Changes
- 2000a7e: Fix:
is,assertandensurenow answer about a value that is itself a failure. Before,is(failureValue, recordSchema)returnedfalsefor an invalid-input failure and threw for any other failure, becauseparsereturns a failure-valued output and a rejection the same way.@arki/failure/schemanow exportsexecuteSchema, which runs a schema once without unwrapping ({ value }or a failure), and the throwing channel is built on it. - Updated dependencies [6601242]
- Updated dependencies [2000a7e]
- @arki/[email protected]
0.1.0
Minor Changes
-
232d3e8: Make failure the acyclic validation foundation. Schema parsing now returns exact typed validation failures, and failure revival returns typed protocol/validator defects instead of throwing. Add validated versioned JSON envelopes; retain legacy envelope reads while rejecting non-JSON data and changing output transforms. oRPC error maps validate output-only wire data.
Migrate consumers to check failures, propagate them through Journal event/write/replay and queue/mail operations, and use explicit exception bridges at foreign callbacks. Journal rejects invalid event entries before inserting them. See
@arki/failure/docs/upgrade-typed-validation.mdfor breaking API and stored-data migration details.
Patch Changes
-
f6a15d0: New package: Standard Schema helpers for every validator (Zod, Valibot, ArkType or a hand-written schema). Exports the spec types
StandardSchemaV1andStandardJSONSchemaV1(with their namespaces),SchemaInput,SchemaOutputandSchemaWithJson;parse(sync, returns the schema output) andparseAsync(always rejects, never throws);SchemaErrorfor bad data (with the schema'sissues) and the codedSchemaRunErrorfor a schema that cannot be run (ARKI_SCHEMA_E001async result inparse,ARKI_SCHEMA_E002validator threw, with the thrown value ascause,ARKI_SCHEMA_E003unsupported JSON Schema target), withSCHEMA_ERROR_CODES;pathOfandformatIssues, which read issue paths the same way for every validator;isStandardSchema(callable schemas included),hasJsonSchema, andwithJsonSchema, which gives any schema a draft-2020-12 JSON Schema. -
f43d509: Docs standard: AGENTS.md, CHANGELOG, a tested example, README sections in the standard order (
When not to use this,Limits,Failure behaviour), and@fix/@verifynotes on every error code.no demo impact: documentation and doc-example changes only, runtime behaviour unchanged
-
Updated dependencies [57313a4]
-
Updated dependencies [f43d509]
-
Updated dependencies [232d3e8]
-
Updated dependencies [3f6d39f]
-
Updated dependencies [7f9b4bb]
-
Updated dependencies [86efafc]
-
Updated dependencies [d541df1]
-
Updated dependencies [f6a15d0]
-
Updated dependencies [4913009]
-
Updated dependencies [232d3e8]
-
Updated dependencies [73ef41b]
-
Updated dependencies [f796e5a]
- @arki/[email protected]
0.0.0
Not published yet. The first release adds the Standard Schema types, parse, parseAsync, issue helpers and the JSON Schema bridge.