refactor(workspace): materializer async-compat, transport origins, and API surface cleanup#1655
Open
refactor(workspace): materializer async-compat, transport origins, and API surface cleanup#1655
Conversation
…ializer With two materializers (markdown + SQLite), the generic name was ambiguous. Updated the barrel export and both playground consumers.
… both materializers - Add shared MaterializerExtension type (whenReady + dispose) both materializers satisfy - Replace stale markdownMaterializer example with createMarkdownMaterializer builder pattern - Replace 'honest note' (SQLite not exported) with full SQLite materializer section—it IS exported - Fix exports table to list both materializers as public
…ble<T> MirrorDatabase/MirrorStatement now return Awaitable<T> so both sync drivers (bun:sqlite) and async WASM drivers (@tursodatabase/database-wasm) satisfy the same interface. The materializer awaits every DB call—a no-op for sync returns, natural for async. Zero adapter needed for either driver. Also destructured ctx/config in the factory signature per project conventions and inlined the debounceMs default.
Remove resolveSchema, quoteIdentifier, and serializeValue from the barrel—no external consumers, and they leak implementation details. Fix module doc to show destructured signature instead of stale ctx param. Update README exports table to match.
Move BC_ORIGIN and SYNC_ORIGIN into extensions/sync/origins.ts as the single source of truth for transport origin sentinels. Documents the Symbol convention (all transports use Symbols; local edits use non-Symbol origins) in one place so new transports know where to register. broadcast-channel.ts re-exports BC_ORIGIN for backward compatibility. websocket.ts now imports both origins from origins.ts instead of defining SYNC_ORIGIN locally and importing BC_ORIGIN from broadcast-channel.ts.
…ch export The file exports createDocuments (plural) but was named create-document (singular). Every other file in workspace/ follows the convention: create-table.ts → createTable, create-tables.ts → createTables, create-workspace.ts → createWorkspace. Fix the only outlier.
DOCUMENTS_ORIGIN was re-exported from @epicenter/workspace but no app code ever imported it. It remains exported from create-documents.ts for internal test use but is no longer part of the public surface. Can always be re-added if consumers need it.
This was referenced Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Workspace internals cleanup across materializers, sync transport, and public API surface. No app-level behavior changes.
createMaterializer→createMarkdownMaterializer(was ambiguous now that SQLite materializer exists)Awaitable<T>in materializer callbacks so consumers can use async SQLite drivers without wrapper hacksSYNC_ORIGIN/BROADCAST_ORIGINconstants moved toorigins.tsinstead of being redefined in each sync providerDOCUMENTS_ORIGINwas exported but unused by any consumercreate-document.ts→create-documents.tsto match its plural export nameworkspace/index.tsthat duplicated subpath exportsWhy
The materializer naming was confusing after adding the SQLite materializer—both were "createMaterializer" with different signatures. The transport origins were copy-pasted across broadcast-channel and websocket providers. The barrel exports had accumulated dead re-exports that created false import paths.
Files changed
packages/workspace/only (+ playground e2e configs that import workspace)