Sel-Sync API

All information on this page is subject to frequent changes.

The Sel-Sync API provides the means for creating various Sel-Sync core entities, each having their own API.

Language Support

Sel-Sync API is currently only implemented for Typescript.

Dependencies

Libraries

code-extend

The Sel-Sync API makes use of the code-extend library. See Code-Extend for details.

data def

We use the Data Def framework to configure how versions interact with state. See Data Def for details.

tagspace

yjs

Utilities

  • clone
  • deepEqual
  • uuid

Responsibilities

  • Create runtimes
  • Create version managers
  • Create sync group managers
  • Create sync prop managers
  • Create sync props

Examples

const runtime = useSelSyncApi().createRuntime()
const syncGroupManager = useSelSyncApi().createSyncGroupManager()
const syncPropManager = useSelSyncApi().createSyncPropManager()
const versionManager = useSelSyncApi().createVersionManager()
const syncProp = useSelSyncApi().createSyncProp()

Runtime API

A runtime coordinates versions, sync groups, instances, and sync props on a host.

Responsibilities

  • Manage service state
  • Manage sync prop instances

Hooks

  • stateWillChange
  • stateChanged
  • instanceCreated
  • instanceDestroyed

Methods

Version API

Sel-Sync versions provide alternative values for stateful sync props.

Responsibilities

Entity

  • Filter versions
  • Create versions
  • Delete versions
  • Clone versions
  • Get metadata
  • Set metadata

State

  • Load version state
  • Save version state
  • Validate version state
  • Merge version states
  • Compare version states

Hooks

Version Manager

  • versionCreated
  • versionDeleted
  • versionModified
  • versionStateModified

Methods

Instance API

Responsibilities

  • Map versions
  • Maintain effective version
  • Version resolution
  • State observation
  • Installation lifecycle
  • Local value access

Hooks

Lifecycle

  • init
  • install
  • start
  • stop
  • uninstall

Version Register

  • versionMapped
  • effectiveVersionChanged

State

  • localValueChanged
  • remoteValueChanged

Methods

Sync Prop API

Persistence Models

None

The property is not persisted. This model is used for action type sync props, such as HostClick

Group

A single property state is shared between all hosts. This model is used for sync props such as AreasScrollPosition

Host

A state is stored per-host. This model is used for sync props such as HostSelection

Instance

A state is stored per-instance. This model is used for sync props such as tbd

Responsibilities

  • Sync Prop ID
  • Metadata
  • Data Block Definition
  • Publishing
  • Enumerating

Hooks

Methods

Sync Group API

Sync groups associate entities.

Entity Types

  • sync prop
  • user
  • constraint
  • resource
  • configuration

Responsibilities

  • Manage sync group lifecycle
  • Enumerate sync groups
  • Manage entities

    Hooks

  • start (deprecated)
  • stop (deprecated)
  • stateWillChange
  • stateChanged
  • entityAdded
  • entityRemoved
  • entityModified (new)

Methods