Sync / foldkit-sync/remote

RemoteEdits

namespace · packages/sync/src/remote.ts:239

const RemoteEdits = { make }

Its type

type RemoteEdits<AppModel, Edit extends AnyEdit> = ReturnType<
  typeof make<AppModel, Edit>
>

Members

RemoteEdits.make

function · packages/sync/src/remote.ts:78

make<AppModel, Edit extends AnyEdit>(
  data: RemoteOverlays<AppModel>,
  edits: EditsOf<Edit>,
): {
  reconcile: (
    model: AppModel,
    slice: ReadonlyArray<Edit>,
    replica: string,
  ) => Reconciled<AppModel, Edit>
  shown: (model: AppModel) => ReadonlyArray<ShownEdit<Edit>>
  clear: (model: AppModel) => AppModel
}

The bridge between a slice of EditableEntity edits and a Remote domain that reads the same Entity, with its revision.

ts
const Shown = RemoteEdits.make(Data, ProductEdits)
const { model: next } = Shown.reconcile(model, model.edits, model.replica)