mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-12-05 11:15:01 +03:00
Unifies the 3-crate native-playground workspace (ui, doc, playground) with: - crates/doc (#![forbid(unsafe_code)], y-octo 0.3.0, 53-bit JS-safe client IDs, full block & surface element schemas with 0-writeback defaults, blocks-scoped undo/redo with SelectionSnapshot, deterministic RoomAwareness with BlockSuite TextSelectionState, Sans-I/O binary room framing, Axum room hub / bs-relay with WS-only seed-claim FIFO waiter promotion & equal-clock awareness refcount hardening & permissive blob CORS, and bs_doc_driver). - @blocksuite/sync DocPeer finishPull listener ordering (preserving 0-writeback while capturing mid-handshake edits) and pendingIncomingUpdates subdoc buffer. - @blocksuite/playground RoomWebSocketClient (+2 awareness clock re-announce on reconnect, disconnect removal before detaching listener, socket-only detached offline fallback, in-place Proxy reuse for partial-seed recovery without destroying shared subdocs, winner flush & non-winner affine:page root wait, ?ws= relay origin forwarding to MockServerBlobSource) + live Rust-JS E2E convergence suite. - Real doc_1k_edits_ms and room_sync_1k_ops_ms benchmarks in bs-harness bench. - Updated check-invariants.sh (doc GUI isolation + forbid(unsafe_code)), AGENTS.md active invariants, and native-playground CI workflow (wasm32 doc check, macOS doc tests, and parallel js-room-coop job).
30 lines
774 B
TypeScript
30 lines
774 B
TypeScript
export interface DocSource {
|
|
/**
|
|
* for debug
|
|
*/
|
|
name: string;
|
|
|
|
pull(
|
|
docId: string,
|
|
state: Uint8Array
|
|
):
|
|
| Promise<{ data: Uint8Array; state?: Uint8Array } | null>
|
|
| { data: Uint8Array; state?: Uint8Array }
|
|
| null;
|
|
finishPull?(docId: string, diffToStorage: Uint8Array): Promise<void> | void;
|
|
push(docId: string, data: Uint8Array): Promise<void> | void;
|
|
|
|
/**
|
|
* Subscribe to updates from peer
|
|
*
|
|
* @param cb callback to handle updates
|
|
* @param disconnect callback to handle disconnect, reason can be something like 'network-error'
|
|
*
|
|
* @returns unsubscribe function
|
|
*/
|
|
subscribe(
|
|
cb: (docId: string, data: Uint8Array) => void,
|
|
disconnect: (reason: string) => void
|
|
): Promise<() => void> | (() => void);
|
|
}
|