Skip to content

Latest commit

 

History

History
60 lines (53 loc) · 4.15 KB

core-api-overview.md

File metadata and controls

60 lines (53 loc) · 4.15 KB

Core API Reference

This reference is generated from the documentation-only catalog in packages/core/api-docs.ts. The catalog combines symbols from the root entry and the public subpaths; it does not imply that every listed symbol is exported from coaction.

Import Map

Import path Intended use
coaction Transport-free local stores and local signal/lifecycle helpers.
coaction/shared Shared authority/client stores, the JSON protocol, and reconnect behavior.
coaction/adapter External-store adapter contracts, snapshots, patch helpers, and reactive utilities.
coaction/derived Optional store-owned path reads, deep selectors, identity markers and disposal.

Primary Entry Points

  • {@link api-docs.create | shared create}: exported by coaction/shared; creates local stores, shared main stores, and shared clients.
  • {@link api-docs.createLocal | create from coaction}: documentation name for the transport-free implementation exported as create by coaction. createLocal is not a root-package export.
  • {@link api-docs.Store | Store} and {@link api-docs.MiddlewareStore | MiddlewareStore}: runtime store contracts.
  • {@link api-docs.StoreOptions | StoreOptions} and {@link api-docs.ClientStoreOptions | ClientStoreOptions}: creation options for main/local and client stores.
  • {@link api-docs.Slice | Slice} and {@link api-docs.Slices | Slices}: state-factory signatures.
  • {@link api-docs.Middleware | Middleware}: store enhancement contract.
  • {@link api-docs.onStoreCommit | onStoreCommit}, {@link api-docs.onStoreCommitValidate | onStoreCommitValidate}, and {@link api-docs.onStoreCommitPrepare | onStoreCommitPrepare}: exported by coaction/adapter; observe committed transitions, validate pending transitions, and request snapshot handling for object-valued transitions.
  • {@link api-docs.StoreCommit | StoreCommit} and {@link api-docs.StoreCommitSource | StoreCommitSource}: committed state and patch-pair metadata. {@link api-docs.replayStorePatches | replayStorePatches} replays a {@link api-docs.StorePatchTransition | StorePatchTransition} through the store's authoritative mutation pipeline.
  • {@link api-docs.defineExternalStoreAdapter | defineExternalStoreAdapter}: exported by coaction/adapter; third-party whole-store adapter helper. createBinder remains available there as the compatibility name.
  • {@link api-docs.createReactiveTracker | createReactiveTracker}: exported by coaction/adapter; low-level signal dependency tracker for framework adapters that need render/effect invalidation without selectors.
  • {@link api-docs.wrapStore | wrapStore}: exported by coaction and coaction/adapter; low-level helper used by framework bindings.
  • signal, computed, effect, effectScope, trigger, batching helpers, and introspection helpers: alien-signals primitives re-exported for advanced integrations.
  • {@link api-docs.derive | derive}, {@link api-docs.derivePath | derivePath}, and {@link api-docs.identity | identity}: exported only by coaction/derived; managed selectors and paths for native immutable stores. Deep value tracking is explicit; object-identity observations need markers in deep mode.

Semantics Worth Reading First

  • Prefer explicit sliceMode when passing an object whose enumerable values are all functions.
  • Native immutable store writes must happen inside set(); direct this.count += 1 writes outside that update boundary are rejected.
  • Client stores mirror shared state and their methods return promises because execution happens on the main store.
  • Methods destructured from getState() keep the correct this binding.
  • Getter accessors and get(deps, selector) computed values are cached through the built-in alien-signals runtime.
  • Binder-backed integrations are whole-store adapters; slices mode is not supported for them.
  • create() should not gain more ambiguous option combinations; prefer explicit helpers or variants for future expansion.