// Where the document meets the core and the file format: both through the // project it holds, so that the core never sees Yjs and the document never // the core's snapshot (plan ยง5.2). import type * as Y from 'yjs'; import type { TopologySnapshot } from '@mdg-filius/core'; import { projectSnapshot, saveProjectArchive } from '@mdg-filius/fls'; import { readProject } from './projectDoc.js'; /** The core's snapshot of the document, to start a simulation with. */ export function docSnapshot(doc: Y.Doc): TopologySnapshot { return projectSnapshot(readProject(doc)); } /** The document as a .fls file, and what the export had to leave out. */ export function docArchive(doc: Y.Doc): { readonly archive: Uint8Array; readonly warnings: string[] } { return saveProjectArchive(readProject(doc)); }