| @loro-extended/change | minor |
|---|---|
| @loro-extended/repo | minor |
Add schema-level mergeable configuration and document metadata
Shape.doc()now accepts an options parameter withmergeable?: boolean- Document metadata is stored in
_loro_extended_meta_root container - Metadata includes
mergeableflag for peer agreement toJSON()excludes all_loro_extended*prefixed keys from output- Reserved prefix
_loro_extendedfor future internal use loro(doc).mergeableexposes the effective mergeable value- Handle now exposes
isMergeablegetter (delegates to TypedDoc) - New
skipInitializeoption to defer metadata writing - New
doc.initialize()method for manual metadata initialization
Usage:
const schema = Shape.doc({
players: Shape.record(Shape.struct({ score: Shape.plain.number() })),
}, { mergeable: true })
// Auto-initialize (default) - writes metadata immediately
const doc = createTypedDoc(schema)
// Skip initialization for advanced use cases
const doc2 = createTypedDoc(schema, { skipInitialize: true })
// Later, when ready:
doc2.initialize()
// Access effective mergeable value
loro(doc).mergeable // true