hayson-binding-shared 0.17.0

Shared error mapping, JSON shapes, options and predicate parsing for hayson's NAPI and WASM language bindings
Documentation
# hayson-binding-shared

Everything a hayson language binding needs that is not about the foreign boundary itself. This
crate holds the parts that would otherwise be duplicated between
[`hayson-napi`](https://gl.theritual.eu/ritual/hayson/-/tree/main/crates/hayson-napi) (Node native
addon) and [`hayson-wasm`](https://gl.theritual.eu/ritual/hayson/-/tree/main/crates/hayson-wasm)
(`wasm32-wasip1`):

- `errors` — maps every `hayson-engine` `DatabaseError`/`TableError` variant onto a stable,
  machine-readable envelope (`{ code, message, ...fields }`) that a TS shim can switch on to
  re-throw the matching typed error.
- `json` — converts the engine's result types (`HaysonRecord`, `TableStats`, `IntegrityReport`,
  `CompactionResult`, query-plan summaries, …) into the `serde_json::Value` shapes the bindings
  hand back across the boundary.
- `options` — parses the JSON document a binding's `open()` call receives into the engine's native
  `OpenOptions` (layout, locking, compaction, cipher settings), rejecting malformed input before
  the engine is ever touched.
- `predicate` — parses the JSON predicate/query document `Table::query` takes, including the
  operator aliases `hayson-server`'s own `predicate_json` accepts, so a caller already speaking to
  the gRPC server can send the same document to an embedded binding.

Nothing in this crate knows what it is bound to — no NAPI types, no `wasm-bindgen`. The bindings
that do own their own handle bookkeeping and their own way of raising an error, and both depend on
the whole of this crate to avoid drifting apart on error shapes, option parsing or predicate
semantics.

## Installation

```sh
cargo add hayson-binding-shared
```

## Usage

```rust
use hayson_binding_shared::{errors, options, predicate};

// Turn an `open()` options JSON document into the engine's native `OpenOptions`.
let open_options = options::parse_open_options(&options_json).unwrap();

// Turn a query predicate JSON document into the engine's `QuerySpec`.
let query_spec = predicate::parse_predicate(&predicate_json).unwrap();

// Map an engine error onto the stable envelope a binding throws across the FFI boundary.
let envelope = errors::describe_database_error(&err);
```

See each module's doc comments for the exact function signatures and JSON shapes.