OptionalgetOptional: expose the raw CRDT document for a specific entity.
Yjs provider returns the Y.Doc; Loro returns the LoroDoc.
Return type is unknown to avoid forcing consumers to import the CRDT lib.
ReadonlynameHuman-readable name used in devtools and error messages.
Push a local graph write to connected peers. Called by the bridge after
upsertEntity / replaceEntity fires for a managed entity type.
Providers MUST be idempotent: they receive the same entity data they already wrote to the CRDT (the bridge does not diff), so a set() call on an already-set key is safe.
Entity type.
Entity id.
Current canonical fields from the graph (full snapshot or partial — see provider docs).
Connect to the sync fabric and start receiving peer changes for the listed entity types.
The set of entity type strings this provider is
responsible for (as registered with registerSyncProvider).
Callback the provider MUST invoke when peers send updates. May be batched; the bridge handles debouncing.
Tear down all network connections, subscriptions, and internal state.
After stop() the provider MUST NOT call onPeerChange again.
Every sync provider MUST implement this interface.
Lifecycle:
start(entityTypes, onPeerChange)— connect and begin syncing the given entity types. Subscribe to remote changes and callonPeerChangewhenever peers update entities.pushLocalChange(type, id, fields)— called by the graph bridge whenever the local graph upserts an entity that belongs to this provider. Providers push the delta to connected peers.stop()— disconnect and clean up all resources.Optional extras:
getDoc(type, id)— providers that expose raw CRDT documents (e.g. Yjs) may implement this for advanced consumers.