API cheat sheet
Everything exported from pulsify-core that you will use day to day. The package README documents the rest, and the protocol spec covers the wire format.
Define
definePulse(kind, schema, options?) | Start a definition. Options: richTextPaths (constantPaths is deprecated). |
|---|
.migrateTo(schema, fn, options?) | Append a schema version with its transformation. |
|---|
.materialize<T>(fn?) | Finish the definition. fn receives { bind } and returns bindings. |
|---|
richText() | Collaborative text field marker inside a schema. |
|---|
constant(schema) | Value fixed at creation: never replaced or edited. |
|---|
frozen(schema) | Value replaced only as a whole; its contents are readonly. |
|---|
tree(schema) | Ordered movable tree of typed payloads. |
|---|
Use
createPulse(Def, data, options?) | New document. options: id, connectors, connect, scope, onError. |
|---|
loadPulse(Def, id, options?) | Existing document. options: connectors, waitFor, timeoutMs, signal. |
|---|
subscribePulse(pulse, fn) | Called now and after each commit. Returns unsubscribe. |
|---|
snapshotPulse(pulse) | Detached plain copy, materialized. |
|---|
arrayOperations(arr) | insert, delete, move, replaceAll. |
|---|
destroyPulse(pulse) | Close sessions and release the instance. |
|---|
Connect
connectPulse(pulse) | Returns { ready, connected, synced }. |
|---|
disconnectPulse(pulse) | Close transports, keep editing. |
|---|
createWebSocketConnector(url, factory?, { protocolVersion }) | Remote connector. |
|---|
createMemoryConnector(relay?, kind?) | Local connector over an in-process relay. |
|---|
createPulseScope() | Isolated identity map, one instance per document ID. |
|---|
getPulseMeta(pulse) | Status and last connection error. |
|---|
setDefaultPulseOptions(options) | Process-wide defaults. |
|---|
Server
new PulseRelay() | In-memory relay; open(send, { protocolVersion }) returns a peer. |
|---|
PostgresPatchStore / SqlitePatchStore | pulsify-core/storage: initialize, appendEncoded, missing, vector. |
|---|
exportPulseUpdates / applyPulseUpdates | Manual frame exchange between two pulses. |
|---|
Errors
PulseError | code: NOT_FOUND, CLOSED, TIMEOUT, LIMIT_EXCEEDED, … |
|---|
MigrationDriftError | code MIGRATION_DRIFT; incompatible schema chain, nothing written. |
|---|