DefinedSync.surface
property · packages/sync/src/make.ts:335
readonly surface: Surface<
AppModel,
Schema.Struct.Type<Fields>,
MsgOf<Ms>,
void
>Sync / foldkit-sync
interface · packages/sync/src/make.ts:322
interface DefinedSync<
AppModel,
Fields extends Schema.Struct.Fields,
Message,
Ms extends readonly unknown[],
Principal = unknown,
Authorized extends boolean = false,
SMs extends readonly unknown[] = [],
LawIds extends string = string,
> extends Sync<Message, Schema.Struct.Type<Fields>, MsgOf<Ms>> {
readonly surface: Surface<
AppModel,
Schema.Struct.Type<Fields>,
MsgOf<Ms>,
void
>
readonly projection: WritableProjection<AppModel, Fields>
readonly footprints?: Readonly<
Partial<Record<TagOf<Ms[number] | SMs[number]>, Footprint>>
>
readonly replay: (
shared: Schema.Struct.Type<Fields>,
message: Message,
) => Schema.Struct.Type<Fields>
readonly live: (model: AppModel, message: Message) => Option.Option<AppModel>
readonly messages: Ms
readonly serverOnlyMessages: SMs
readonly laws: {
readonly [Id in LawIds]: DeclaredLaw<Id>
}
readonly judge: (
before: Schema.Struct.Type<Fields>,
after: Schema.Struct.Type<Fields>,
) => Option.Option<DeclaredLaw<LawIds>>
readonly contract: Contract
readonly wiring: () => Wiring<AppModel, never>
readonly journalContract: () => Authorized extends true
? PolicyJournalContract<Operation, Schema.Struct.Type<Fields>, Principal> &
Required<
Pick<
PolicyJournalContract<
Operation,
Schema.Struct.Type<Fields>,
Principal
>,
'authorize'
>
>
: PolicyJournalContract<Operation, Schema.Struct.Type<Fields>, Principal>
}The value make returns: the low-level Sync protocol plus the writable
projection, the declared Messages, and a read-only Surface over the
projection. Exported so a consumer can name the type.
DefinedSync.surfaceproperty · packages/sync/src/make.ts:335
readonly surface: Surface<
AppModel,
Schema.Struct.Type<Fields>,
MsgOf<Ms>,
void
>DefinedSync.projectionproperty · packages/sync/src/make.ts:336
readonly projection: WritableProjection<AppModel, Fields>DefinedSync.footprintsproperty · packages/sync/src/make.ts:338
readonly footprints?: Readonly<
Partial<Record<TagOf<Ms[number] | SMs[number]>, Footprint>>
>Static paths of the transitions this document executes, keyed by durable or server-only tag.
DefinedSync.replayproperty · packages/sync/src/make.ts:340
readonly replay: (
shared: Schema.Struct.Type<Fields>,
message: Message,
) => Schema.Struct.Type<Fields>Replays a declared transition, falling back to the custom replay or the application's update.
DefinedSync.liveproperty · packages/sync/src/make.ts:345
readonly live: (model: AppModel, message: Message) => Option.Option<AppModel>DeclaredReplay's live: what the mount applies for a Message with a declared transition.
DefinedSync.messagesproperty · packages/sync/src/make.ts:347
readonly messages: MsThe durable constructors: what a replica submits.
DefinedSync.serverOnlyMessagesproperty · packages/sync/src/make.ts:349
readonly serverOnlyMessages: SMsThe server-only constructors: what only the server appends.
DefinedSync.lawsproperty · packages/sync/src/make.ts:351
readonly laws: {
readonly [Id in LawIds]: DeclaredLaw<Id>
}The declared laws, by id: what Sync.isInvalidBy matches a refusal against.
DefinedSync.judgeproperty · packages/sync/src/make.ts:357
readonly judge: (
before: Schema.Struct.Type<Fields>,
after: Schema.Struct.Type<Fields>,
) => Option.Option<DeclaredLaw<LawIds>>The first law the step from before to after breaks, or none: what the
journal and submit run. Run it over stored snapshots (judge(s, s)) to
audit them before deploying a new law.
DefinedSync.contractproperty · packages/sync/src/make.ts:362
readonly contract: ContractFor Module: this contract owns the shared projection's paths and records the durable and server-only tags.
DefinedSync.wiringproperty · packages/sync/src/make.ts:368
readonly wiring: () => Wiring<AppModel, never>How this contract joins an assembly: contract-only, so the Module sees it.
It routes nothing, runs nothing, and subscribes to nothing; Sync owns the
runtime through mount rather than joining it.
DefinedSync.journalContractproperty · packages/sync/src/make.ts:370
readonly journalContract: () => Authorized extends true
? PolicyJournalContract<Operation, Schema.Struct.Type<Fields>, Principal> &
Required<
Pick<
PolicyJournalContract<
Operation,
Schema.Struct.Type<Fields>,
Principal
>,
'authorize'
>
>
: PolicyJournalContract<Operation, Schema.Struct.Type<Fields>, Principal>The durable journal's codecs, reducer, and, when declared, authorization.