Persist staged image uploads alongside document operations

This commit is contained in:
2026-11-07 23:24:00 +08:00
parent 8a19909716
commit 8a76e53a9f
20 changed files with 659 additions and 52 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ import type { LedgerSnapshot } from './ledger.ts';
/** The footprint follows ownership; geometry does not decide which canvas owns an object. */
export function operationCanvases(intent: OperationIntent, document: Document): readonly Id[] {
if(intent.operationType==='asset.upload')return[];
if (intent.canvasIds?.length) return intent.canvasIds;
const ids = new Set<Id>();
for (const change of intent.changes) {
@@ -29,7 +30,7 @@ export function operationCanvases(intent: OperationIntent, document: Document):
export function replayPending(base: Document, ledger: LedgerSnapshot, registry: Registry): Document {
let document = base;
for (const record of [...ledger.operations.values()].sort((a, b) => a.intent.sequence - b.intent.sequence)) {
if (record.phase === 'resolved') continue;
if (record.phase === 'resolved' || record.intent.operationType!=='document.change') continue;
for (const change of record.intent.changes) {
if (satisfied(document, change)) continue;
document = applyChanges(document, [change]);