Repository navigation
v0.5.0
Syncable(Base) mixin — cohost sync on any Durable Object base (ADR-0015) — plus optional Standard Schema validation (ADR-0014) and uniform rejection reasons for mutations and commands.
Added
Syncable(Base)mixin — cohost sync on any Durable Object base (ADR-0015). The sync machinery is now a curried mixin factory,Syncable<Env, TUser>()(Base), so one DO can be both its framework's host (the Agents SDKAgent,@cloudflare/think'sThink, a bareDurableObject) and a tddc sync source — no dedicated sync DO, no mirror write. Exposed from the root and a./server/mixinsubpath. Sync sockets carry a reserved tag and a plain attachment and claim only the/_syncpath; all other traffic delegates to the host base, so the two protocols never cross (proof: partyserver's__pkfiltering).Actor(@cloudflare/actors) is documented as unsupported because itsSocketshelper adopts foreign sockets on wake. See the README "Cohosting" section.- Optional Standard Schema validation (ADR-0014). A collection's
insert.schema(the row schema, which also infers the collection's Row) andupdate.schema(a partial patch schema), and a command's schema, are checked at runtime and rejected loudly on failure. Any~standardlibrary works (zod, valibot, arktype) and the framework adds no validator dependency. It is a gate, not a parser: the original value flows to handlers, so schemas must not rely on transforms, defaults, or coercion. Seerecipes/zod-standard-schema-collections.md.
Changed
SyncDurableObjectis nowSyncable()(DurableObject)— zero API change. All existingextends SyncDurableObject<Env, Claims>code, includingthis.sql,this.registerSync,this.runSyncedWrite, and an overridableparseAttachment, keeps compiling and behaving identically to 0.4.0 (the two DO-global side effects —ping/pongauto-response andPRAGMA case_sensitive_like = ON— stay ON for this base; they default OFF over any other base, opt in withthis.sync.configure). The internalsqlgetter was removed from the mixin because it shadowed the host'ssqltagged-template method; reachthis.ctx.storage.sqldirectly on a non-DurableObjectbase.- Rejection reasons are surfaced uniformly for mutations and commands (revises ADR-0012 D3). An
authorizethrow or a schema validation failure now reaches the client with its reason (validation failures carry aVALIDATIONcode); onlyexecuteerrors stay sanitized. Previously a command'sauthorizeerror was sanitized like itsexecute, unlike a mutation's.
Full Changelog: v0.4.0...v0.5.0