stable

devtools

Framework-agnostic read-only inspector — createInspector(db) turns a live noy-db into serializable views for a CLI or browser panel.

@noy-db/in-devtools · pnpm add @noy-db/hub @noy-db/in-devtools Read-only inspector core for noy-db.

What it does

createInspector(db, { meter? }) returns an Inspector facade: listVaults() lists accessible vaults; snapshot(vault) returns collections with fields / indexes / refs / stats; records(vault, name, { limit?, offset? }) pages through decrypted rows (limit defaults to 50, hard ceiling 500); subscribe(handler) / subscribeConflicts(handler) fire on writes and conflicts; pendingWrites() reports write-queue state; meterSnapshot() needs a @noy-db/to-meter handle passed as meter (otherwise null). It's a pure consumer of public hub APIs — read-only and zero-knowledge-respecting: it never holds secrets and shows only what the caller's unlocked session can already decrypt. listVaults() requires a store that implements the optional listVaults capability; records() targets eager (non-lazy) collections.

Usage

import { createInspector } from '@noy-db/in-devtools'

const inspector = createInspector(db)
await inspector.listVaults()                          // → [{ id: 'acme', role: 'owner' }]
await inspector.snapshot(vault)                         // → { vault, collections: [...] }
await inspector.records(vault, 'invoices', { limit: 50 })

See also