Skip to content

Latest commit

 

History

History

README.md

@wcpos/query

Low-level reactive read and demand primitives for WCPOS.

The package no longer owns a fluent query model or replication state machine. Engine-backed screen reads are composed by packages/core/src/query/query-bindings.ts; local logs and receipt templates remain dedicated local-only paths.

Public surface

The package root exports:

  • QueryProvider and useQueryRuntime — provide and access the shared runtime dependencies { localDB, engine, locale }.
  • observeEngineQuery and observeEngineDatabases — direct engine-resident reads through the adapter execution path.
  • requirement declaration/reset-refill helpers used by core bindings.
  • legacy-document boundary functions used by core.
  • useLocalQuery and logs-storage recovery for the standalone logs collection.
  • awaitWriteOutcome for engine mutation acknowledgements.

All other engine-adapter modules are package-private.

Read ownership

  • Engine-backed collections are read from the current engine db$ resident database.
  • Search, targeted-record, and order-query demand is declared through engine requirement handles.
  • Coverage-aware totals are projected from engine coverage collections by core bindings.
  • Relational product search joins product and variation residents in the core binding layer.
  • Logs query only localDB.collections.logs; receipt templates query their dedicated local collection after useTemplatesSync performs its best-effort refresh.

Tests

cd packages/query
NODE_OPTIONS=--experimental-vm-modules ../../node_modules/.bin/jest --runInBand