chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase
This commit is contained in:
parent
970e08c466
commit
1f7e365a4e
237 changed files with 1951 additions and 49413 deletions
29
RELEASES.md
29
RELEASES.md
|
|
@ -106,6 +106,12 @@ Hard renames, no aliases. Every pair below is verified against the 8.0 source.
|
|||
|
||||
| Brainy 7.x | Brainy 8.0 |
|
||||
|---|---|
|
||||
| `brain.delete(id)` | `brain.remove(id)` — matches the transact op vocabulary (`add` / `update` / `remove` / `relate` / `unrelate`) |
|
||||
| `brain.deleteMany(params)` | `brain.removeMany(params)` |
|
||||
| `DeleteManyParams` (type) | `RemoveManyParams` |
|
||||
| `brain.getRelations(paramsOrId)` | `brain.related(paramsOrId)` — the same name a pinned `Db` exposes (`db.related()`) |
|
||||
| `GetRelationsParams` (type) | `RelatedParams` |
|
||||
| CLI `delete <id>` | CLI `remove <id>` (JSON output `{ id, removed: true }`, matching `unrelate`) |
|
||||
| `HnswProvider` (from `@soulcraft/brainy/plugin`) | `VectorIndexProvider` |
|
||||
| `HNSWIndex` (exported class) | `JsHnswVectorIndex` |
|
||||
| Provider keys `'hnsw'` and `'diskann'` | `'vector'` (the only key Brainy consults for the vector index) |
|
||||
|
|
@ -129,9 +135,17 @@ find . -name '*.ts' -not -path '*/node_modules/*' -print0 | xargs -0 sed -i \
|
|||
-e "s/registerProvider('hnsw'/registerProvider('vector'/g" \
|
||||
-e "s/registerProvider('diskann'/registerProvider('vector'/g" \
|
||||
-e "s/getProvider('hnsw'/getProvider('vector'/g" \
|
||||
-e "s/getProvider('diskann'/getProvider('vector'/g"
|
||||
-e "s/getProvider('diskann'/getProvider('vector'/g" \
|
||||
-e 's/\.getRelations(/.related(/g' \
|
||||
-e 's/\bGetRelationsParams\b/RelatedParams/g' \
|
||||
-e 's/\.deleteMany(/.removeMany(/g' \
|
||||
-e 's/\bDeleteManyParams\b/RemoveManyParams/g'
|
||||
```
|
||||
|
||||
`delete()` → `remove()` is deliberately **not** in the snippet: `.delete(` is
|
||||
too common (`Map`/`Set`/storage adapters) for a blind sed. Find your
|
||||
`brain.delete(...)` call sites and rename them by hand.
|
||||
|
||||
The config shape changes need a human (they are not 1:1 textual):
|
||||
|
||||
```ts
|
||||
|
|
@ -192,7 +206,7 @@ this rename; only the API surface moved.
|
|||
implements the BFS in the JS graph index and routes to a native provider
|
||||
when one is registered.
|
||||
- **Every write advances the generation clock; only `transact()` writes
|
||||
history.** Single-operation writes (`add` / `update` / `delete` / `relate`
|
||||
history.** Single-operation writes (`add` / `update` / `remove` / `relate`
|
||||
outside `transact()`) bump `brain.generation()` so watermarks and CAS stay
|
||||
sound, but they do not stage historical records — they remain visible
|
||||
through earlier pins and are not reported by `db.since()`. Writes you want
|
||||
|
|
@ -210,13 +224,20 @@ this rename; only the API surface moved.
|
|||
no-ops, closing a 7.x trap), system-managed fields drop with a one-shot
|
||||
warning naming the right path; (3) **split at read time** through one
|
||||
canonical helper, so `entity.metadata` / `relation.metadata` contain ONLY
|
||||
custom fields on every read path — `get`, `find`, `getRelations` (several
|
||||
custom fields on every read path — `get`, `find`, `related` (several
|
||||
paginated/by-source/by-target paths previously echoed the full stored
|
||||
record, including the `verb` type key, inside `metadata`), batch reads,
|
||||
and historical `asOf()` reads. `getRelations()` results now also surface
|
||||
and historical `asOf()` reads. `related()` results now also surface
|
||||
`confidence`/`updatedAt` top-level, and `updateRelation()` no longer
|
||||
erases a relationship's `service`/`createdBy`. See "Reserved fields" in
|
||||
`docs/concepts/consistency-model.md`.
|
||||
- **Named errors for not-found contract failures.** `update()`, `relate()`,
|
||||
`updateRelation()`, `similar({ to: id })`, `transact()` planning, and
|
||||
speculative `db.with()` planning now throw `EntityNotFoundError` /
|
||||
`RelationNotFoundError` (both exported from the package root, both carrying
|
||||
the missing `id` as a field) instead of a generic `Error`. Message texts are
|
||||
unchanged, so existing `/not found/` matching keeps working — `instanceof`
|
||||
is now the supported way to branch.
|
||||
- **Unchanged from 7.31:** per-entity `_rev`, `update({ ifRev })`
|
||||
(`RevisionConflictError`), and `add({ ifAbsent })` work exactly as before,
|
||||
and `ifRev` is also accepted on `transact()` update operations (a conflict
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue