@fluidframework/tree 2.91.0 → 2.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (866) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/api-report/tree.alpha.api.md +60 -22
  3. package/dist/api.d.ts +6 -1
  4. package/dist/api.d.ts.map +1 -1
  5. package/dist/api.js.map +1 -1
  6. package/dist/codec/codec.d.ts +28 -2
  7. package/dist/codec/codec.d.ts.map +1 -1
  8. package/dist/codec/codec.js +1 -0
  9. package/dist/codec/codec.js.map +1 -1
  10. package/dist/codec/index.d.ts +2 -2
  11. package/dist/codec/index.d.ts.map +1 -1
  12. package/dist/codec/index.js +2 -4
  13. package/dist/codec/index.js.map +1 -1
  14. package/dist/codec/versioned/codec.d.ts +18 -36
  15. package/dist/codec/versioned/codec.d.ts.map +1 -1
  16. package/dist/codec/versioned/codec.js +46 -59
  17. package/dist/codec/versioned/codec.js.map +1 -1
  18. package/dist/codec/versioned/index.d.ts +1 -1
  19. package/dist/codec/versioned/index.d.ts.map +1 -1
  20. package/dist/codec/versioned/index.js +2 -4
  21. package/dist/codec/versioned/index.js.map +1 -1
  22. package/dist/core/forest/forest.d.ts +5 -2
  23. package/dist/core/forest/forest.d.ts.map +1 -1
  24. package/dist/core/forest/forest.js.map +1 -1
  25. package/dist/core/index.d.ts +1 -1
  26. package/dist/core/index.d.ts.map +1 -1
  27. package/dist/core/index.js +6 -2
  28. package/dist/core/index.js.map +1 -1
  29. package/dist/core/rebase/changeRebaser.d.ts +8 -1
  30. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  31. package/dist/core/rebase/changeRebaser.js.map +1 -1
  32. package/dist/core/rebase/revisionTagCodec.d.ts +4 -3
  33. package/dist/core/rebase/revisionTagCodec.d.ts.map +1 -1
  34. package/dist/core/rebase/revisionTagCodec.js +2 -0
  35. package/dist/core/rebase/revisionTagCodec.js.map +1 -1
  36. package/dist/core/rebase/utils.d.ts +2 -2
  37. package/dist/core/rebase/utils.d.ts.map +1 -1
  38. package/dist/core/rebase/utils.js +4 -4
  39. package/dist/core/rebase/utils.js.map +1 -1
  40. package/dist/core/schema-stored/formatV2.d.ts +1 -1
  41. package/dist/core/schema-stored/formatV2.js +1 -1
  42. package/dist/core/schema-stored/formatV2.js.map +1 -1
  43. package/dist/core/tree/anchorSet.d.ts +8 -0
  44. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  45. package/dist/core/tree/anchorSet.js +42 -7
  46. package/dist/core/tree/anchorSet.js.map +1 -1
  47. package/dist/core/tree/cursor.d.ts +25 -1
  48. package/dist/core/tree/cursor.d.ts.map +1 -1
  49. package/dist/core/tree/cursor.js +45 -1
  50. package/dist/core/tree/cursor.js.map +1 -1
  51. package/dist/core/tree/deltaUtil.d.ts +13 -1
  52. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  53. package/dist/core/tree/deltaUtil.js +34 -1
  54. package/dist/core/tree/deltaUtil.js.map +1 -1
  55. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +5 -5
  56. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  57. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  58. package/dist/core/tree/index.d.ts +2 -2
  59. package/dist/core/tree/index.d.ts.map +1 -1
  60. package/dist/core/tree/index.js +6 -2
  61. package/dist/core/tree/index.js.map +1 -1
  62. package/dist/core/tree/visitDelta.d.ts +11 -0
  63. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  64. package/dist/core/tree/visitDelta.js +1 -1
  65. package/dist/core/tree/visitDelta.js.map +1 -1
  66. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  67. package/dist/core/tree/visitorUtils.js +5 -0
  68. package/dist/core/tree/visitorUtils.js.map +1 -1
  69. package/dist/entrypoints/alpha.d.ts +1 -1
  70. package/dist/entrypoints/alpha.d.ts.map +1 -1
  71. package/dist/entrypoints/alpha.js +2 -3
  72. package/dist/entrypoints/alpha.js.map +1 -1
  73. package/dist/entrypoints/beta.js +1 -1
  74. package/dist/entrypoints/beta.js.map +1 -1
  75. package/dist/entrypoints/legacy.d.ts +1 -1
  76. package/dist/entrypoints/legacy.d.ts.map +1 -1
  77. package/dist/entrypoints/legacy.js +1 -1
  78. package/dist/entrypoints/legacy.js.map +1 -1
  79. package/dist/entrypoints/public.js +1 -1
  80. package/dist/entrypoints/public.js.map +1 -1
  81. package/dist/feature-libraries/changeAtomIdCodec.d.ts +4 -3
  82. package/dist/feature-libraries/changeAtomIdCodec.d.ts.map +1 -1
  83. package/dist/feature-libraries/changeAtomIdCodec.js +2 -0
  84. package/dist/feature-libraries/changeAtomIdCodec.js.map +1 -1
  85. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +2 -1
  86. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  87. package/dist/feature-libraries/chunked-forest/chunkedForest.js +2 -2
  88. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  89. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +4 -4
  90. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  91. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +6 -6
  92. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  93. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  94. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  95. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  96. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -2
  97. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  98. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  99. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -4
  100. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  101. package/dist/feature-libraries/chunked-forest/codec/codecs.js +6 -6
  102. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  103. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +12 -12
  104. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  105. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
  106. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  107. package/dist/feature-libraries/chunked-forest/codec/{formatGeneric.d.ts → format/formatGeneric.d.ts} +1 -1
  108. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -0
  109. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -0
  110. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +187 -0
  111. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -0
  112. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js +115 -0
  113. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -0
  114. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +33 -0
  115. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -0
  116. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js +16 -0
  117. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -0
  118. package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts +10 -0
  119. package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -0
  120. package/dist/feature-libraries/chunked-forest/codec/format/index.js +18 -0
  121. package/dist/feature-libraries/chunked-forest/codec/format/index.js.map +1 -0
  122. package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts +93 -0
  123. package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -0
  124. package/dist/feature-libraries/chunked-forest/codec/format/versions.js +29 -0
  125. package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -0
  126. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  127. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  128. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -2
  129. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  130. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
  131. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  132. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  133. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  134. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  135. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +6 -4
  136. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  137. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +1 -1
  138. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  139. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +3 -3
  140. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  141. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  142. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  143. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  144. package/dist/feature-libraries/cursorComparator.d.ts +23 -0
  145. package/dist/feature-libraries/cursorComparator.d.ts.map +1 -0
  146. package/dist/feature-libraries/cursorComparator.js +65 -0
  147. package/dist/feature-libraries/cursorComparator.js.map +1 -0
  148. package/dist/feature-libraries/forest-summary/codec.d.ts +1 -1
  149. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +3 -3
  150. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  151. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  152. package/dist/feature-libraries/index.d.ts +3 -2
  153. package/dist/feature-libraries/index.d.ts.map +1 -1
  154. package/dist/feature-libraries/index.js +5 -5
  155. package/dist/feature-libraries/index.js.map +1 -1
  156. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -0
  157. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  158. package/dist/feature-libraries/indexing/anchorTreeIndex.js +12 -7
  159. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  160. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  161. package/dist/feature-libraries/mitigatedChangeFamily.js +2 -2
  162. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  163. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +3 -3
  164. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  165. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  166. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  167. package/dist/feature-libraries/modular-schema/genericFieldKind.js +0 -1
  168. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  169. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +10 -10
  170. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  171. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +2 -4
  172. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  173. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +3 -3
  174. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
  175. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  176. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +3 -3
  177. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  178. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  179. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -1
  180. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  181. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +4 -3
  182. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  183. package/dist/feature-libraries/object-forest/objectForest.d.ts +1 -1
  184. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  185. package/dist/feature-libraries/object-forest/objectForest.js +2 -2
  186. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  187. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +4 -4
  188. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  189. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  190. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts +3 -3
  191. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  192. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  193. package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
  194. package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
  195. package/dist/feature-libraries/schema-edits/index.js +2 -3
  196. package/dist/feature-libraries/schema-edits/index.js.map +1 -1
  197. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -15
  198. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  199. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -54
  200. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  201. package/dist/feature-libraries/schema-index/codec.d.ts +3 -16
  202. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  203. package/dist/feature-libraries/schema-index/codec.js +1 -21
  204. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  205. package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -1
  206. package/dist/feature-libraries/schema-index/formatV2.js +1 -1
  207. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
  208. package/dist/feature-libraries/schema-index/index.d.ts +1 -1
  209. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  210. package/dist/feature-libraries/schema-index/index.js +1 -2
  211. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  212. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -4
  213. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  214. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  215. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +3 -3
  216. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  217. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  218. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +3 -3
  219. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  220. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  221. package/dist/index.d.ts +2 -2
  222. package/dist/index.d.ts.map +1 -1
  223. package/dist/index.js +2 -3
  224. package/dist/index.js.map +1 -1
  225. package/dist/packageVersion.d.ts +1 -1
  226. package/dist/packageVersion.js +1 -1
  227. package/dist/packageVersion.js.map +1 -1
  228. package/dist/shared-tree/independentView.d.ts +1 -1
  229. package/dist/shared-tree/independentView.d.ts.map +1 -1
  230. package/dist/shared-tree/independentView.js +14 -21
  231. package/dist/shared-tree/independentView.js.map +1 -1
  232. package/dist/shared-tree/index.d.ts +2 -2
  233. package/dist/shared-tree/index.d.ts.map +1 -1
  234. package/dist/shared-tree/index.js +1 -2
  235. package/dist/shared-tree/index.js.map +1 -1
  236. package/dist/shared-tree/schematizingTreeView.d.ts +2 -36
  237. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  238. package/dist/shared-tree/schematizingTreeView.js +15 -117
  239. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  240. package/dist/shared-tree/sharedTree.d.ts +3 -22
  241. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  242. package/dist/shared-tree/sharedTree.js +10 -27
  243. package/dist/shared-tree/sharedTree.js.map +1 -1
  244. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +3 -2
  245. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  246. package/dist/shared-tree/sharedTreeChangeCodecs.js +23 -16
  247. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  248. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  249. package/dist/shared-tree/sharedTreeChangeEnricher.js +1 -1
  250. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  251. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
  252. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  253. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  254. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  255. package/dist/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
  256. package/dist/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
  257. package/dist/shared-tree/sharedTreeChangeFormat.js +13 -5
  258. package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
  259. package/dist/shared-tree/tree.d.ts.map +1 -1
  260. package/dist/shared-tree/tree.js +2 -1
  261. package/dist/shared-tree/tree.js.map +1 -1
  262. package/dist/shared-tree/treeAlpha.d.ts +13 -1
  263. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  264. package/dist/shared-tree/treeAlpha.js +3 -0
  265. package/dist/shared-tree/treeAlpha.js.map +1 -1
  266. package/dist/shared-tree/treeCheckout.d.ts +34 -69
  267. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  268. package/dist/shared-tree/treeCheckout.js +885 -678
  269. package/dist/shared-tree/treeCheckout.js.map +1 -1
  270. package/dist/shared-tree/unhydratedTreeContext.js +3 -3
  271. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
  272. package/dist/shared-tree-core/editManagerCodecs.d.ts +23 -12
  273. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  274. package/dist/shared-tree-core/editManagerCodecs.js +40 -67
  275. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  276. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  277. package/dist/shared-tree-core/editManagerCodecsCommons.js +0 -1
  278. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  279. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +10 -2
  280. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  281. package/dist/shared-tree-core/editManagerCodecsV1toV4.js +18 -13
  282. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  283. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
  284. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  285. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +6 -9
  286. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  287. package/dist/shared-tree-core/index.d.ts +3 -3
  288. package/dist/shared-tree-core/index.d.ts.map +1 -1
  289. package/dist/shared-tree-core/index.js +5 -8
  290. package/dist/shared-tree-core/index.js.map +1 -1
  291. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -3
  292. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  293. package/dist/shared-tree-core/messageCodecV1ToV4.js +8 -8
  294. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  295. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts +2 -3
  296. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  297. package/dist/shared-tree-core/messageCodecVSharedBranches.js +5 -4
  298. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  299. package/dist/shared-tree-core/messageCodecs.d.ts +15 -14
  300. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  301. package/dist/shared-tree-core/messageCodecs.js +38 -74
  302. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  303. package/dist/shared-tree-core/messageFormat.d.ts +0 -1
  304. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  305. package/dist/shared-tree-core/messageFormat.js +1 -2
  306. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  307. package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -3
  308. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  309. package/dist/shared-tree-core/sharedTreeCore.js +12 -2
  310. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  311. package/dist/sharedTreeAttributes.d.ts.map +1 -1
  312. package/dist/sharedTreeAttributes.js +3 -0
  313. package/dist/sharedTreeAttributes.js.map +1 -1
  314. package/dist/simple-tree/api/index.d.ts +1 -0
  315. package/dist/simple-tree/api/index.d.ts.map +1 -1
  316. package/dist/simple-tree/api/index.js.map +1 -1
  317. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  318. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  319. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +2 -2
  320. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  321. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  322. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  323. package/dist/simple-tree/api/storedSchema.js +6 -6
  324. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  325. package/dist/simple-tree/api/tree.d.ts +7 -19
  326. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  327. package/dist/simple-tree/api/tree.js.map +1 -1
  328. package/dist/simple-tree/api/treeAlpha.d.ts +69 -0
  329. package/dist/simple-tree/api/treeAlpha.d.ts.map +1 -0
  330. package/dist/simple-tree/api/treeAlpha.js +7 -0
  331. package/dist/simple-tree/api/treeAlpha.js.map +1 -0
  332. package/dist/simple-tree/api/treeBeta.d.ts +1 -1
  333. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  334. package/dist/simple-tree/api/treeChangeEvents.d.ts +3 -0
  335. package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  336. package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
  337. package/dist/simple-tree/api/treeNodeApi.d.ts +49 -0
  338. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  339. package/dist/simple-tree/api/treeNodeApi.js +41 -2
  340. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  341. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  342. package/dist/simple-tree/core/treeNodeKernel.js +45 -8
  343. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  344. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  345. package/dist/simple-tree/core/unhydratedFlexTree.js +5 -1
  346. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  347. package/dist/simple-tree/index.d.ts +2 -2
  348. package/dist/simple-tree/index.d.ts.map +1 -1
  349. package/dist/simple-tree/index.js.map +1 -1
  350. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +16 -0
  351. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  352. package/dist/simple-tree/node-kinds/array/arrayNode.js +23 -0
  353. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  354. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +10 -1
  355. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  356. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  357. package/dist/simple-tree/node-kinds/array/index.d.ts +2 -2
  358. package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -1
  359. package/dist/simple-tree/node-kinds/array/index.js.map +1 -1
  360. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  361. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  362. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  363. package/dist/text/textDomainFormatted.d.ts +319 -9
  364. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  365. package/dist/text/textDomainFormatted.js +100 -25
  366. package/dist/text/textDomainFormatted.js.map +1 -1
  367. package/dist/treeFactory.d.ts.map +1 -1
  368. package/dist/treeFactory.js +5 -2
  369. package/dist/treeFactory.js.map +1 -1
  370. package/dist/util/referenceCounting.d.ts.map +1 -1
  371. package/dist/util/referenceCounting.js +0 -1
  372. package/dist/util/referenceCounting.js.map +1 -1
  373. package/legacy.d.ts +2 -3
  374. package/lib/api.d.ts +6 -1
  375. package/lib/api.d.ts.map +1 -1
  376. package/lib/api.js.map +1 -1
  377. package/lib/codec/codec.d.ts +28 -2
  378. package/lib/codec/codec.d.ts.map +1 -1
  379. package/lib/codec/codec.js +1 -0
  380. package/lib/codec/codec.js.map +1 -1
  381. package/lib/codec/index.d.ts +2 -2
  382. package/lib/codec/index.d.ts.map +1 -1
  383. package/lib/codec/index.js +1 -1
  384. package/lib/codec/index.js.map +1 -1
  385. package/lib/codec/versioned/codec.d.ts +18 -36
  386. package/lib/codec/versioned/codec.d.ts.map +1 -1
  387. package/lib/codec/versioned/codec.js +45 -56
  388. package/lib/codec/versioned/codec.js.map +1 -1
  389. package/lib/codec/versioned/index.d.ts +1 -1
  390. package/lib/codec/versioned/index.d.ts.map +1 -1
  391. package/lib/codec/versioned/index.js +1 -1
  392. package/lib/codec/versioned/index.js.map +1 -1
  393. package/lib/core/forest/forest.d.ts +5 -2
  394. package/lib/core/forest/forest.d.ts.map +1 -1
  395. package/lib/core/forest/forest.js.map +1 -1
  396. package/lib/core/index.d.ts +1 -1
  397. package/lib/core/index.d.ts.map +1 -1
  398. package/lib/core/index.js +1 -1
  399. package/lib/core/index.js.map +1 -1
  400. package/lib/core/rebase/changeRebaser.d.ts +8 -1
  401. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  402. package/lib/core/rebase/changeRebaser.js.map +1 -1
  403. package/lib/core/rebase/revisionTagCodec.d.ts +4 -3
  404. package/lib/core/rebase/revisionTagCodec.d.ts.map +1 -1
  405. package/lib/core/rebase/revisionTagCodec.js +2 -0
  406. package/lib/core/rebase/revisionTagCodec.js.map +1 -1
  407. package/lib/core/rebase/utils.d.ts +2 -2
  408. package/lib/core/rebase/utils.d.ts.map +1 -1
  409. package/lib/core/rebase/utils.js +4 -4
  410. package/lib/core/rebase/utils.js.map +1 -1
  411. package/lib/core/schema-stored/formatV2.d.ts +1 -1
  412. package/lib/core/schema-stored/formatV2.js +1 -1
  413. package/lib/core/schema-stored/formatV2.js.map +1 -1
  414. package/lib/core/tree/anchorSet.d.ts +8 -0
  415. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  416. package/lib/core/tree/anchorSet.js +42 -7
  417. package/lib/core/tree/anchorSet.js.map +1 -1
  418. package/lib/core/tree/cursor.d.ts +25 -1
  419. package/lib/core/tree/cursor.d.ts.map +1 -1
  420. package/lib/core/tree/cursor.js +43 -0
  421. package/lib/core/tree/cursor.js.map +1 -1
  422. package/lib/core/tree/deltaUtil.d.ts +13 -1
  423. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  424. package/lib/core/tree/deltaUtil.js +31 -0
  425. package/lib/core/tree/deltaUtil.js.map +1 -1
  426. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +5 -5
  427. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  428. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  429. package/lib/core/tree/index.d.ts +2 -2
  430. package/lib/core/tree/index.d.ts.map +1 -1
  431. package/lib/core/tree/index.js +2 -2
  432. package/lib/core/tree/index.js.map +1 -1
  433. package/lib/core/tree/visitDelta.d.ts +11 -0
  434. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  435. package/lib/core/tree/visitDelta.js +1 -1
  436. package/lib/core/tree/visitDelta.js.map +1 -1
  437. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  438. package/lib/core/tree/visitorUtils.js +5 -0
  439. package/lib/core/tree/visitorUtils.js.map +1 -1
  440. package/lib/entrypoints/alpha.d.ts +1 -1
  441. package/lib/entrypoints/alpha.d.ts.map +1 -1
  442. package/lib/entrypoints/alpha.js +2 -2
  443. package/lib/entrypoints/alpha.js.map +1 -1
  444. package/lib/entrypoints/beta.js +1 -1
  445. package/lib/entrypoints/beta.js.map +1 -1
  446. package/lib/entrypoints/legacy.d.ts +1 -1
  447. package/lib/entrypoints/legacy.d.ts.map +1 -1
  448. package/lib/entrypoints/legacy.js +1 -1
  449. package/lib/entrypoints/legacy.js.map +1 -1
  450. package/lib/entrypoints/public.js +1 -1
  451. package/lib/entrypoints/public.js.map +1 -1
  452. package/lib/feature-libraries/changeAtomIdCodec.d.ts +4 -3
  453. package/lib/feature-libraries/changeAtomIdCodec.d.ts.map +1 -1
  454. package/lib/feature-libraries/changeAtomIdCodec.js +2 -0
  455. package/lib/feature-libraries/changeAtomIdCodec.js.map +1 -1
  456. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +2 -1
  457. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  458. package/lib/feature-libraries/chunked-forest/chunkedForest.js +2 -2
  459. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  460. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +4 -4
  461. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  462. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +4 -4
  463. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  464. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  465. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  466. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  467. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -2
  468. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  469. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  470. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -4
  471. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  472. package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
  473. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  474. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +12 -12
  475. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  476. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  477. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  478. package/lib/feature-libraries/chunked-forest/codec/{formatGeneric.d.ts → format/formatGeneric.d.ts} +1 -1
  479. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -0
  480. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -0
  481. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +187 -0
  482. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -0
  483. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js +112 -0
  484. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -0
  485. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +33 -0
  486. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -0
  487. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js +13 -0
  488. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -0
  489. package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts +10 -0
  490. package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -0
  491. package/lib/feature-libraries/chunked-forest/codec/format/index.js +8 -0
  492. package/lib/feature-libraries/chunked-forest/codec/format/index.js.map +1 -0
  493. package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts +93 -0
  494. package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -0
  495. package/lib/feature-libraries/chunked-forest/codec/format/versions.js +26 -0
  496. package/lib/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -0
  497. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  498. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  499. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  500. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  501. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
  502. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  503. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  504. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  505. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  506. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +4 -2
  507. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  508. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +1 -1
  509. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  510. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +1 -1
  511. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  512. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  513. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  514. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  515. package/lib/feature-libraries/cursorComparator.d.ts +23 -0
  516. package/lib/feature-libraries/cursorComparator.d.ts.map +1 -0
  517. package/lib/feature-libraries/cursorComparator.js +61 -0
  518. package/lib/feature-libraries/cursorComparator.js.map +1 -0
  519. package/lib/feature-libraries/forest-summary/codec.d.ts +1 -1
  520. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +3 -3
  521. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  522. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  523. package/lib/feature-libraries/index.d.ts +3 -2
  524. package/lib/feature-libraries/index.d.ts.map +1 -1
  525. package/lib/feature-libraries/index.js +3 -2
  526. package/lib/feature-libraries/index.js.map +1 -1
  527. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -0
  528. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  529. package/lib/feature-libraries/indexing/anchorTreeIndex.js +12 -7
  530. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  531. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  532. package/lib/feature-libraries/mitigatedChangeFamily.js +2 -2
  533. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  534. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +3 -3
  535. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  536. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  537. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  538. package/lib/feature-libraries/modular-schema/genericFieldKind.js +0 -1
  539. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  540. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +10 -10
  541. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  542. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +2 -4
  543. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  544. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +3 -3
  545. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
  546. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  547. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +3 -3
  548. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  549. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  550. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -1
  551. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  552. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +4 -3
  553. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  554. package/lib/feature-libraries/object-forest/objectForest.d.ts +1 -1
  555. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  556. package/lib/feature-libraries/object-forest/objectForest.js +2 -2
  557. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  558. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +4 -4
  559. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  560. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +1 -1
  561. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  562. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts +3 -3
  563. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  564. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  565. package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
  566. package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
  567. package/lib/feature-libraries/schema-edits/index.js +1 -1
  568. package/lib/feature-libraries/schema-edits/index.js.map +1 -1
  569. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -15
  570. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  571. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +6 -50
  572. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  573. package/lib/feature-libraries/schema-index/codec.d.ts +3 -16
  574. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  575. package/lib/feature-libraries/schema-index/codec.js +0 -19
  576. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  577. package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -1
  578. package/lib/feature-libraries/schema-index/formatV2.js +1 -1
  579. package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
  580. package/lib/feature-libraries/schema-index/index.d.ts +1 -1
  581. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  582. package/lib/feature-libraries/schema-index/index.js +1 -1
  583. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  584. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -4
  585. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  586. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  587. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +3 -3
  588. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  589. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +1 -1
  590. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  591. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +3 -3
  592. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  593. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  594. package/lib/index.d.ts +2 -2
  595. package/lib/index.d.ts.map +1 -1
  596. package/lib/index.js +1 -1
  597. package/lib/index.js.map +1 -1
  598. package/lib/packageVersion.d.ts +1 -1
  599. package/lib/packageVersion.js +1 -1
  600. package/lib/packageVersion.js.map +1 -1
  601. package/lib/shared-tree/independentView.d.ts +1 -1
  602. package/lib/shared-tree/independentView.d.ts.map +1 -1
  603. package/lib/shared-tree/independentView.js +4 -11
  604. package/lib/shared-tree/independentView.js.map +1 -1
  605. package/lib/shared-tree/index.d.ts +2 -2
  606. package/lib/shared-tree/index.d.ts.map +1 -1
  607. package/lib/shared-tree/index.js +1 -1
  608. package/lib/shared-tree/index.js.map +1 -1
  609. package/lib/shared-tree/schematizingTreeView.d.ts +2 -36
  610. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  611. package/lib/shared-tree/schematizingTreeView.js +17 -116
  612. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  613. package/lib/shared-tree/sharedTree.d.ts +3 -22
  614. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  615. package/lib/shared-tree/sharedTree.js +11 -27
  616. package/lib/shared-tree/sharedTree.js.map +1 -1
  617. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +3 -2
  618. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  619. package/lib/shared-tree/sharedTreeChangeCodecs.js +19 -12
  620. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  621. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  622. package/lib/shared-tree/sharedTreeChangeEnricher.js +2 -2
  623. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  624. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
  625. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  626. package/lib/shared-tree/sharedTreeChangeFamily.js +2 -2
  627. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  628. package/lib/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
  629. package/lib/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
  630. package/lib/shared-tree/sharedTreeChangeFormat.js +11 -5
  631. package/lib/shared-tree/sharedTreeChangeFormat.js.map +1 -1
  632. package/lib/shared-tree/tree.d.ts.map +1 -1
  633. package/lib/shared-tree/tree.js +2 -1
  634. package/lib/shared-tree/tree.js.map +1 -1
  635. package/lib/shared-tree/treeAlpha.d.ts +13 -1
  636. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  637. package/lib/shared-tree/treeAlpha.js +3 -0
  638. package/lib/shared-tree/treeAlpha.js.map +1 -1
  639. package/lib/shared-tree/treeCheckout.d.ts +34 -69
  640. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  641. package/lib/shared-tree/treeCheckout.js +889 -683
  642. package/lib/shared-tree/treeCheckout.js.map +1 -1
  643. package/lib/shared-tree/unhydratedTreeContext.js +1 -1
  644. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
  645. package/lib/shared-tree-core/editManagerCodecs.d.ts +23 -12
  646. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  647. package/lib/shared-tree-core/editManagerCodecs.js +41 -65
  648. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  649. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  650. package/lib/shared-tree-core/editManagerCodecsCommons.js +0 -1
  651. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  652. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +10 -2
  653. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  654. package/lib/shared-tree-core/editManagerCodecsV1toV4.js +16 -11
  655. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  656. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
  657. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  658. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +5 -8
  659. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  660. package/lib/shared-tree-core/index.d.ts +3 -3
  661. package/lib/shared-tree-core/index.d.ts.map +1 -1
  662. package/lib/shared-tree-core/index.js +3 -3
  663. package/lib/shared-tree-core/index.js.map +1 -1
  664. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -3
  665. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  666. package/lib/shared-tree-core/messageCodecV1ToV4.js +8 -8
  667. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  668. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts +2 -3
  669. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  670. package/lib/shared-tree-core/messageCodecVSharedBranches.js +5 -4
  671. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  672. package/lib/shared-tree-core/messageCodecs.d.ts +15 -14
  673. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  674. package/lib/shared-tree-core/messageCodecs.js +38 -71
  675. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  676. package/lib/shared-tree-core/messageFormat.d.ts +0 -1
  677. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  678. package/lib/shared-tree-core/messageFormat.js +0 -1
  679. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  680. package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -3
  681. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  682. package/lib/shared-tree-core/sharedTreeCore.js +14 -4
  683. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  684. package/lib/sharedTreeAttributes.d.ts.map +1 -1
  685. package/lib/sharedTreeAttributes.js +3 -0
  686. package/lib/sharedTreeAttributes.js.map +1 -1
  687. package/lib/simple-tree/api/index.d.ts +1 -0
  688. package/lib/simple-tree/api/index.d.ts.map +1 -1
  689. package/lib/simple-tree/api/index.js.map +1 -1
  690. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  691. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  692. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +2 -2
  693. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  694. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  695. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  696. package/lib/simple-tree/api/storedSchema.js +7 -7
  697. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  698. package/lib/simple-tree/api/tree.d.ts +7 -19
  699. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  700. package/lib/simple-tree/api/tree.js.map +1 -1
  701. package/lib/simple-tree/api/treeAlpha.d.ts +69 -0
  702. package/lib/simple-tree/api/treeAlpha.d.ts.map +1 -0
  703. package/lib/simple-tree/api/treeAlpha.js +6 -0
  704. package/lib/simple-tree/api/treeAlpha.js.map +1 -0
  705. package/lib/simple-tree/api/treeBeta.d.ts +1 -1
  706. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  707. package/lib/simple-tree/api/treeChangeEvents.d.ts +3 -0
  708. package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  709. package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
  710. package/lib/simple-tree/api/treeNodeApi.d.ts +49 -0
  711. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  712. package/lib/simple-tree/api/treeNodeApi.js +41 -2
  713. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  714. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  715. package/lib/simple-tree/core/treeNodeKernel.js +45 -8
  716. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  717. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  718. package/lib/simple-tree/core/unhydratedFlexTree.js +5 -1
  719. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  720. package/lib/simple-tree/index.d.ts +2 -2
  721. package/lib/simple-tree/index.d.ts.map +1 -1
  722. package/lib/simple-tree/index.js.map +1 -1
  723. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +16 -0
  724. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  725. package/lib/simple-tree/node-kinds/array/arrayNode.js +23 -0
  726. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  727. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +10 -1
  728. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  729. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  730. package/lib/simple-tree/node-kinds/array/index.d.ts +2 -2
  731. package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -1
  732. package/lib/simple-tree/node-kinds/array/index.js.map +1 -1
  733. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  734. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  735. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  736. package/lib/text/textDomainFormatted.d.ts +319 -9
  737. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  738. package/lib/text/textDomainFormatted.js +103 -28
  739. package/lib/text/textDomainFormatted.js.map +1 -1
  740. package/lib/treeFactory.d.ts.map +1 -1
  741. package/lib/treeFactory.js +6 -3
  742. package/lib/treeFactory.js.map +1 -1
  743. package/lib/util/referenceCounting.d.ts.map +1 -1
  744. package/lib/util/referenceCounting.js +0 -1
  745. package/lib/util/referenceCounting.js.map +1 -1
  746. package/package.json +27 -27
  747. package/scripts/generate-entrypoint-sources.sh +4 -2
  748. package/src/api.ts +11 -0
  749. package/src/codec/codec.ts +32 -2
  750. package/src/codec/index.ts +2 -3
  751. package/src/codec/versioned/codec.ts +99 -109
  752. package/src/codec/versioned/index.ts +1 -3
  753. package/src/core/forest/forest.ts +5 -2
  754. package/src/core/index.ts +4 -0
  755. package/src/core/rebase/changeRebaser.ts +8 -0
  756. package/src/core/rebase/revisionTagCodec.ts +4 -4
  757. package/src/core/rebase/utils.ts +9 -2
  758. package/src/core/schema-stored/formatV2.ts +1 -1
  759. package/src/core/tree/anchorSet.ts +67 -10
  760. package/src/core/tree/cursor.ts +52 -1
  761. package/src/core/tree/deltaUtil.ts +37 -1
  762. package/src/core/tree/detachedFieldIndexCodecs.ts +4 -4
  763. package/src/core/tree/index.ts +4 -0
  764. package/src/core/tree/visitDelta.ts +13 -1
  765. package/src/core/tree/visitorUtils.ts +5 -0
  766. package/src/entrypoints/alpha.ts +13 -6
  767. package/src/entrypoints/beta.ts +2 -2
  768. package/src/entrypoints/legacy.ts +11 -3
  769. package/src/entrypoints/public.ts +1 -1
  770. package/src/feature-libraries/changeAtomIdCodec.ts +8 -7
  771. package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -2
  772. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +18 -13
  773. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
  774. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -2
  775. package/src/feature-libraries/chunked-forest/codec/codecs.ts +16 -10
  776. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +16 -14
  777. package/src/feature-libraries/chunked-forest/codec/{formatGeneric.ts → format/formatGeneric.ts} +1 -1
  778. package/src/feature-libraries/chunked-forest/codec/{format.ts → format/formatV1.ts} +41 -111
  779. package/src/feature-libraries/chunked-forest/codec/format/formatV2.ts +31 -0
  780. package/src/feature-libraries/chunked-forest/codec/format/index.ts +31 -0
  781. package/src/feature-libraries/chunked-forest/codec/format/versions.ts +81 -0
  782. package/src/feature-libraries/chunked-forest/codec/index.ts +6 -2
  783. package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +19 -12
  784. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +6 -4
  785. package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +10 -10
  786. package/src/feature-libraries/chunked-forest/index.ts +2 -1
  787. package/src/feature-libraries/cursorComparator.ts +77 -0
  788. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +5 -5
  789. package/src/feature-libraries/index.ts +5 -3
  790. package/src/feature-libraries/indexing/anchorTreeIndex.ts +20 -10
  791. package/src/feature-libraries/mitigatedChangeFamily.ts +4 -1
  792. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +4 -5
  793. package/src/feature-libraries/modular-schema/genericFieldKind.ts +0 -1
  794. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +19 -26
  795. package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +4 -4
  796. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -5
  797. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +6 -2
  798. package/src/feature-libraries/object-forest/objectForest.ts +8 -2
  799. package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +11 -13
  800. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +4 -5
  801. package/src/feature-libraries/schema-edits/index.ts +1 -4
  802. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +10 -78
  803. package/src/feature-libraries/schema-index/codec.ts +0 -25
  804. package/src/feature-libraries/schema-index/formatV2.ts +1 -1
  805. package/src/feature-libraries/schema-index/index.ts +1 -4
  806. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +6 -6
  807. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +8 -5
  808. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +4 -5
  809. package/src/index.ts +10 -3
  810. package/src/packageVersion.ts +1 -1
  811. package/src/shared-tree/independentView.ts +5 -18
  812. package/src/shared-tree/index.ts +0 -4
  813. package/src/shared-tree/schematizingTreeView.ts +19 -165
  814. package/src/shared-tree/sharedTree.ts +16 -59
  815. package/src/shared-tree/sharedTreeChangeCodecs.ts +23 -29
  816. package/src/shared-tree/sharedTreeChangeEnricher.ts +1 -2
  817. package/src/shared-tree/sharedTreeChangeFamily.ts +2 -0
  818. package/src/shared-tree/sharedTreeChangeFormat.ts +23 -8
  819. package/src/shared-tree/tree.ts +2 -5
  820. package/src/shared-tree/treeAlpha.ts +26 -0
  821. package/src/shared-tree/treeCheckout.ts +275 -99
  822. package/src/shared-tree/unhydratedTreeContext.ts +1 -1
  823. package/src/shared-tree-core/editManagerCodecs.ts +99 -124
  824. package/src/shared-tree-core/editManagerCodecsCommons.ts +0 -1
  825. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +54 -59
  826. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +72 -95
  827. package/src/shared-tree-core/index.ts +4 -8
  828. package/src/shared-tree-core/messageCodecV1ToV4.ts +56 -71
  829. package/src/shared-tree-core/messageCodecVSharedBranches.ts +76 -92
  830. package/src/shared-tree-core/messageCodecs.ts +88 -126
  831. package/src/shared-tree-core/messageFormat.ts +0 -3
  832. package/src/shared-tree-core/sharedTreeCore.ts +14 -21
  833. package/src/sharedTreeAttributes.ts +3 -0
  834. package/src/simple-tree/api/index.ts +10 -0
  835. package/src/simple-tree/api/schemaFactory.ts +0 -2
  836. package/src/simple-tree/api/schemaFactoryAlpha.ts +13 -2
  837. package/src/simple-tree/api/storedSchema.ts +8 -19
  838. package/src/simple-tree/api/tree.ts +7 -20
  839. package/src/simple-tree/api/treeAlpha.ts +90 -0
  840. package/src/simple-tree/api/treeBeta.ts +1 -1
  841. package/src/simple-tree/api/treeChangeEvents.ts +3 -0
  842. package/src/simple-tree/api/treeNodeApi.ts +95 -3
  843. package/src/simple-tree/core/treeNodeKernel.ts +53 -7
  844. package/src/simple-tree/core/unhydratedFlexTree.ts +5 -1
  845. package/src/simple-tree/index.ts +10 -0
  846. package/src/simple-tree/node-kinds/array/arrayNode.ts +64 -0
  847. package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +25 -1
  848. package/src/simple-tree/node-kinds/array/index.ts +2 -0
  849. package/src/simple-tree/node-kinds/index.ts +2 -0
  850. package/src/text/textDomainFormatted.ts +113 -11
  851. package/src/treeFactory.ts +10 -5
  852. package/src/util/referenceCounting.ts +0 -1
  853. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +0 -383
  854. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +0 -1
  855. package/dist/feature-libraries/chunked-forest/codec/format.js +0 -191
  856. package/dist/feature-libraries/chunked-forest/codec/format.js.map +0 -1
  857. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +0 -1
  858. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +0 -1
  859. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +0 -383
  860. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +0 -1
  861. package/lib/feature-libraries/chunked-forest/codec/format.js +0 -188
  862. package/lib/feature-libraries/chunked-forest/codec/format.js.map +0 -1
  863. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +0 -1
  864. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +0 -1
  865. /package/dist/feature-libraries/chunked-forest/codec/{formatGeneric.js → format/formatGeneric.js} +0 -0
  866. /package/lib/feature-libraries/chunked-forest/codec/{formatGeneric.js → format/formatGeneric.js} +0 -0
@@ -12,13 +12,13 @@ import { type CodecTree, type CodecWriteOptions, type CodecWriteOptionsBeta, typ
12
12
  import { type GraphCommit, type IEditableForest, type JsonableTree, type TreeStoredSchema, TreeStoredSchemaRepository, type TreeStoredSchemaSubscription } from "../core/index.js";
13
13
  import { TreeCompressionStrategy, type IncrementalEncodingPolicy } from "../feature-libraries/index.js";
14
14
  import { type BranchId, type ClonableSchemaAndPolicy, type SharedTreeCoreOptionsInternal, MessageFormatVersion, SharedTreeCore, EditManagerFormatVersion } from "../shared-tree-core/index.js";
15
- import { type ITree, type ImplicitFieldSchema, type ReadSchema, type SimpleTreeSchema, type TreeView, type TreeViewAlpha, type TreeViewConfiguration, type UnsafeUnknownSchema, type VerboseTree, type ITreeAlpha, type SchemaType } from "../simple-tree/index.js";
15
+ import { type ImplicitFieldSchema, type ReadSchema, type SimpleTreeSchema, type TreeView, type TreeViewConfiguration, type UnsafeUnknownSchema, type VerboseTree, type ITreeAlpha, type SchemaType } from "../simple-tree/index.js";
16
16
  import { type Breakable, type JsonCompatible } from "../util/index.js";
17
- import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
17
+ import type { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
18
18
  import { SharedTreeChangeFormatVersion } from "./sharedTreeChangeCodecs.js";
19
19
  import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
20
20
  import type { SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
21
- import { type TreeCheckout, type BranchableTree } from "./treeCheckout.js";
21
+ import { type TreeCheckout } from "./treeCheckout.js";
22
22
  /**
23
23
  * Copy of data from an {@link ITreePrivate} at some point in time.
24
24
  * @remarks
@@ -120,25 +120,6 @@ export declare function exportSimpleSchema(storedSchema: TreeStoredSchema): Simp
120
120
  * @alpha
121
121
  */
122
122
  export declare function persistedToSimpleSchema(persisted: JsonCompatible, options: ICodecOptions): SimpleTreeSchema;
123
- /**
124
- * Get a {@link BranchableTree} from a {@link ITree}.
125
- * @remarks The branch can be used for "version control"-style coordination of edits on the tree.
126
- * @privateRemarks This function will be removed if/when the branching API becomes public,
127
- * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.
128
- * @alpha
129
- * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.
130
- */
131
- export declare function getBranch(tree: ITree): BranchableTree;
132
- /**
133
- * Get a {@link BranchableTree} from a {@link TreeView}.
134
- * @remarks The branch can be used for "version control"-style coordination of edits on the tree.
135
- * Branches are currently an unstable "alpha" API and are subject to change in the future.
136
- * @privateRemarks This function will be removed if/when the branching API becomes public,
137
- * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.
138
- * @alpha
139
- * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.
140
- */
141
- export declare function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(view: TreeViewAlpha<T>): BranchableTree;
142
123
  /**
143
124
  * Defines for each EditManagerFormatVersion the SharedTreeChangeFormatVersion to use.
144
125
  * This is an arbitrary mapping that is injected in the EditManger codec.
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTree.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE3F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,+BAA+B,CAAC;AAC7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,KAAK,EACX,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAEN,KAAK,mBAAmB,EACxB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACN,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAI1B,KAAK,aAAa,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEN,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,YAAY,EAOjB,KAAK,gBAAgB,EACrB,0BAA0B,EAC1B,KAAK,4BAA4B,EAKjC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAKN,uBAAuB,EAWvB,KAAK,yBAAyB,EAC9B,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EACN,KAAK,QAAQ,EAGb,KAAK,uBAAuB,EAG5B,KAAK,6BAA6B,EAClC,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,KAAK,KAAK,EACV,KAAK,mBAAmB,EAExB,KAAK,UAAU,EAEf,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC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;GAEG;AACH,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,4BAA4B,EACpC,YAAY,EAAE,aAAa,EAC3B,yBAAyB,EAAE,yBAAyB,GAClD,eAAe,CAOjB;AAED,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,yBAAyB,CAUxE,CAAC"}
@@ -42,18 +42,16 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
42
42
  return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.defaultSharedTreeOptions = exports.buildConfiguredForest = exports.ForestTypeExpensiveDebug = exports.ForestTypeOptimized = exports.ForestTypeReference = exports.getCodecTreeForSharedTreeFormat = exports.changeFormatVersionForMessage = exports.changeFormatVersionForEditManager = exports.getBranch = exports.persistedToSimpleSchema = exports.exportSimpleSchema = exports.SharedTreeKernel = void 0;
45
+ exports.defaultSharedTreeOptions = exports.buildConfiguredForest = exports.ForestTypeExpensiveDebug = exports.ForestTypeOptimized = exports.ForestTypeReference = exports.getCodecTreeForSharedTreeFormat = exports.changeFormatVersionForMessage = exports.changeFormatVersionForEditManager = exports.persistedToSimpleSchema = exports.exportSimpleSchema = exports.SharedTreeKernel = void 0;
46
46
  const internal_1 = require("@fluidframework/core-utils/internal");
47
47
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
48
48
  const index_js_1 = require("../codec/index.js");
49
49
  const index_js_2 = require("../core/index.js");
50
50
  const index_js_3 = require("../feature-libraries/index.js");
51
- // eslint-disable-next-line import-x/no-internal-modules
52
- const index_js_4 = require("../feature-libraries/schema-index/index.js");
51
+ const index_js_4 = require("../feature-libraries/index.js");
53
52
  const index_js_5 = require("../shared-tree-core/index.js");
54
53
  const index_js_6 = require("../simple-tree/index.js");
55
54
  const index_js_7 = require("../util/index.js");
56
- const schematizingTreeView_js_1 = require("./schematizingTreeView.js");
57
55
  const sharedTreeChangeCodecs_js_1 = require("./sharedTreeChangeCodecs.js");
58
56
  const sharedTreeChangeFamily_js_1 = require("./sharedTreeChangeFamily.js");
59
57
  const treeCheckout_js_1 = require("./treeCheckout.js");
@@ -86,7 +84,7 @@ let SharedTreeKernel = (() => {
86
84
  const forest = buildConfiguredForest(breaker, options.forest, schema, idCompressor, options.shouldEncodeIncrementally);
87
85
  const revisionTagCodec = new index_js_2.RevisionTagCodec(idCompressor);
88
86
  const removedRoots = (0, index_js_2.makeDetachedFieldIndex)("repair", revisionTagCodec, idCompressor, options);
89
- const schemaCodec = (0, index_js_3.makeSchemaCodec)(options);
87
+ const schemaCodec = index_js_4.schemaCodecBuilder.build(options);
90
88
  const schemaSummarizer = new index_js_3.SchemaSummarizer(schema, {
91
89
  getCurrentSeq: lastSequenceNumber,
92
90
  }, schemaCodec, options.minVersionForCollab);
@@ -186,7 +184,7 @@ let SharedTreeKernel = (() => {
186
184
  return this.checkouts.get(branchId) ?? this.checkoutBranch(branchId);
187
185
  }
188
186
  checkoutBranch(branchId) {
189
- const checkout = this.checkout.branch();
187
+ const checkout = this.checkout.fork();
190
188
  checkout.switchBranch(this.getSharedBranch(branchId));
191
189
  this.registerSharedBranchForEditing(branchId, checkout);
192
190
  this.registerCheckout(branchId, checkout);
@@ -260,33 +258,17 @@ exports.exportSimpleSchema = exportSimpleSchema;
260
258
  * @alpha
261
259
  */
262
260
  function persistedToSimpleSchema(persisted, options) {
263
- // Any version can be passed down to makeSchemaCodec here.
264
- // We only use the decode part, which always dispatches to the correct codec based on the version in the data, not the version passed to `makeSchemaCodec`.
265
- const schemaCodec = (0, index_js_3.makeSchemaCodec)({
266
- ...options,
267
- minVersionForCollab: index_js_1.FluidClientVersion.v2_0,
268
- });
261
+ const schemaCodec = index_js_4.schemaCodecBuilder.buildDecoder(options);
269
262
  const stored = schemaCodec.decode(persisted);
270
263
  return exportSimpleSchema(stored);
271
264
  }
272
265
  exports.persistedToSimpleSchema = persistedToSimpleSchema;
273
- function getBranch(treeOrView) {
274
- if (treeOrView instanceof schematizingTreeView_js_1.SchematizingSimpleTreeView) {
275
- return treeOrView.checkout;
276
- }
277
- const kernel = treeOrView.kernel;
278
- (0, internal_1.assert)(kernel instanceof SharedTreeKernel, 0xb56 /* Invalid ITree */);
279
- // This cast is safe so long as TreeCheckout supports all the operations on the branch interface.
280
- return kernel.checkout;
281
- }
282
- exports.getBranch = getBranch;
283
266
  /**
284
267
  * Defines for each EditManagerFormatVersion the SharedTreeChangeFormatVersion to use.
285
268
  * This is an arbitrary mapping that is injected in the EditManger codec.
286
269
  * Once an entry is defined and used in production, it cannot be changed.
287
270
  * This is because the format for SharedTree changes are not explicitly versioned.
288
271
  */
289
- // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison -- intentional comparison
290
272
  exports.changeFormatVersionForEditManager = index_js_1.DependentFormatVersion.fromPairs([
291
273
  [index_js_5.EditManagerFormatVersion.v3, sharedTreeChangeCodecs_js_1.SharedTreeChangeFormatVersion.v3],
292
274
  [index_js_5.EditManagerFormatVersion.v4, sharedTreeChangeCodecs_js_1.SharedTreeChangeFormatVersion.v4],
@@ -306,12 +288,15 @@ exports.changeFormatVersionForMessage = index_js_1.DependentFormatVersion.fromPa
306
288
  [index_js_5.MessageFormatVersion.v6, sharedTreeChangeCodecs_js_1.SharedTreeChangeFormatVersion.v5],
307
289
  ]);
308
290
  function getCodecTreeForEditManagerFormat(clientVersion) {
309
- const change = exports.changeFormatVersionForEditManager.lookup((0, index_js_5.clientVersionToEditManagerFormatVersion)(clientVersion));
291
+ const editManagerVersion = (0, index_js_5.makeEditManagerCodecBuilder)().getCodecTree(clientVersion).version;
292
+ const change = exports.changeFormatVersionForEditManager.lookup(editManagerVersion);
310
293
  const changeCodecTree = (0, sharedTreeChangeCodecs_js_1.getCodecTreeForChangeFormat)(change, clientVersion);
311
294
  return (0, index_js_5.getCodecTreeForEditManagerFormatWithChange)(clientVersion, changeCodecTree);
312
295
  }
313
296
  function getCodecTreeForMessageFormat(clientVersion) {
314
- const change = exports.changeFormatVersionForMessage.lookup((0, index_js_5.clientVersionToMessageFormatVersion)(clientVersion));
297
+ const messageVersion = (0, index_js_5.makeMessageCodecBuilder)().getCodecTree(clientVersion).version;
298
+ (0, internal_1.assert)(messageVersion !== undefined, 0xce3 /* Deprecated 'undefined' version shouldn't be selected */);
299
+ const change = exports.changeFormatVersionForMessage.lookup(messageVersion);
315
300
  const changeCodecTree = (0, sharedTreeChangeCodecs_js_1.getCodecTreeForChangeFormat)(change, clientVersion);
316
301
  return (0, index_js_5.getCodecTreeForMessageFormatWithChange)(clientVersion, changeCodecTree);
317
302
  }
@@ -376,8 +361,6 @@ exports.defaultSharedTreeOptions = {
376
361
  treeEncodeType: index_js_3.TreeCompressionStrategy.Compressed,
377
362
  disposeForksAfterTransaction: true,
378
363
  shouldEncodeIncrementally: index_js_3.defaultIncrementalEncodingPolicy,
379
- editManagerFormatSelector: index_js_5.clientVersionToEditManagerFormatVersion,
380
- messageFormatSelector: index_js_5.clientVersionToMessageFormatVersion,
381
364
  enableSharedBranches: false,
382
365
  writeVersionOverrides: new Map(),
383
366
  allowPossiblyIncompatibleWriteVersionOverrides: false,
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTree.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,kEAAmE;AASnE,uEAGkD;AAElD,gDAQ2B;AAC3B,+CAkB0B;AAC1B,4DAiBuC;AACvC,wDAAwD;AACxD,yEAA+F;AAC/F,2DAWsC;AACtC,sDAmBiC;AACjC,+CAK0B;AAE1B,uEAAuE;AACvE,2EAGqC;AACrC,2EAAqE;AAGrE,uDAA+F;AA2D/F;;;;GAIG;IAEU,gBAAgB;4BAD5B,wBAAa;;;;sBAEL,yBAAc;;;6CAAtB,SAAQ,WAAuD;QAI/D,IAAW,YAAY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C;IACH,CAAC;IACD,IAAA,eAAI,EAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ErasedType, IFluidLoadable } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor, StableId } from \"@fluidframework/id-compressor\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tIChannelView,\n\tIFluidSerializer,\n\tSharedKernel,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tUsageError,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\ttype CodecWriteOptionsBeta,\n\tDependentFormatVersion,\n\tFluidClientVersion,\n\tFormatValidatorNoOp,\n\ttype ICodecOptions,\n} from \"../codec/index.js\";\nimport {\n\ttype FieldKey,\n\ttype GraphCommit,\n\ttype IEditableForest,\n\ttype JsonableTree,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tRevisionTagCodec,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\ttype TreeStoredSchemaSubscription,\n\ttype TreeTypeSet,\n\tdetachedFieldIndexCodecBuilder,\n\tmakeDetachedFieldIndex,\n\tmoveToDetachedField,\n} from \"../core/index.js\";\nimport {\n\tDetachedFieldIndexSummarizer,\n\tFieldKinds,\n\tForestSummarizer,\n\tSchemaSummarizer,\n\tTreeCompressionStrategy,\n\tbuildChunkedForest,\n\tbuildForest,\n\tdefaultIncrementalEncodingPolicy,\n\tdefaultSchemaPolicy,\n\tfieldBatchCodecBuilder,\n\tforestCodecBuilder,\n\tjsonableTreeFromFieldCursor,\n\tmakeMitigatedChangeFamily,\n\tmakeSchemaCodec,\n\tmakeTreeChunker,\n\ttype IncrementalEncodingPolicy,\n} from \"../feature-libraries/index.js\";\n// eslint-disable-next-line import-x/no-internal-modules\nimport { schemaCodecBuilder, type FormatV1 } from \"../feature-libraries/schema-index/index.js\";\nimport {\n\ttype BranchId,\n\tclientVersionToEditManagerFormatVersion,\n\tclientVersionToMessageFormatVersion,\n\ttype ClonableSchemaAndPolicy,\n\tgetCodecTreeForEditManagerFormatWithChange,\n\tgetCodecTreeForMessageFormatWithChange,\n\ttype SharedTreeCoreOptionsInternal,\n\tMessageFormatVersion,\n\tSharedTreeCore,\n\tEditManagerFormatVersion,\n} from \"../shared-tree-core/index.js\";\nimport {\n\ttype ITree,\n\ttype ImplicitFieldSchema,\n\tNodeKind,\n\ttype ReadSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleTreeSchema,\n\ttype TreeView,\n\ttype TreeViewAlpha,\n\ttype TreeViewConfiguration,\n\ttype UnsafeUnknownSchema,\n\ttype VerboseTree,\n\ttryStoredSchemaAsArray,\n\ttype SimpleNodeSchema,\n\tFieldKind,\n\ttype ITreeAlpha,\n\ttype SimpleObjectFieldSchema,\n\ttype SimpleAllowedTypeAttributes,\n\ttype SchemaType,\n} from \"../simple-tree/index.js\";\nimport {\n\ttype Breakable,\n\tbreakingClass,\n\ttype JsonCompatible,\n\tthrowIfBroken,\n} from \"../util/index.js\";\n\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport {\n\tgetCodecTreeForChangeFormat,\n\tSharedTreeChangeFormatVersion,\n} from \"./sharedTreeChangeCodecs.js\";\nimport { SharedTreeChangeFamily } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport { type TreeCheckout, type BranchableTree, createTreeCheckout } from \"./treeCheckout.js\";\n\n/**\n * Copy of data from an {@link ITreePrivate} at some point in time.\n * @remarks\n * This is unrelated to Fluids concept of \"snapshots\".\n */\nexport interface SharedTreeContentSnapshot {\n\t/**\n\t * The schema stored in the document.\n\t *\n\t * @remarks\n\t * Edits to the schema can mutate the schema stored of the tree which took this snapshot (but this snapshot will remain the same)\n\t * This is mainly useful for debugging cases where schematize reports an incompatible view schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\t/**\n\t * All {@link TreeStatus.InDocument} content.\n\t */\n\treadonly tree: JsonableTree[];\n\t/**\n\t * All {@link TreeStatus.Removed} content.\n\t */\n\treadonly removed: [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * {@link ITree} extended with some non-public APIs.\n * @internal\n */\nexport interface ITreeInternal extends IChannelView, ITreeAlpha {}\n\n/**\n * {@link ITreeInternal} extended with some non-exported APIs.\n * @remarks\n * This allows access to the tree content using the internal data model used at the storage and \"flex\" layers,\n * and should only be needed for testing and debugging this package's internals.\n */\nexport interface ITreePrivate extends ITreeInternal {\n\t/**\n\t * Provides a copy of the current content of the tree.\n\t * This can be useful for inspecting the tree when no suitable view schema is available.\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t *\n\t * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.\n\t */\n\tcontentSnapshot(): SharedTreeContentSnapshot;\n\n\t/**\n\t * Access to internals for testing.\n\t */\n\treadonly kernel: SharedTreeKernel;\n}\n\n/**\n * The type SharedTree's kernel's view must implement so what when its merged with the underling SharedObject's API it fully implements the required tree API surface ({@link ITreePrivate }).\n */\nexport type SharedTreeKernelView = Omit<ITreePrivate, keyof (IChannelView & IFluidLoadable)>;\n\n/**\n * SharedTreeCore, configured with a good set of indexes and field kinds which will maintain compatibility over time.\n *\n * TODO: detail compatibility requirements.\n */\n@breakingClass\nexport class SharedTreeKernel\n\textends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>\n\timplements SharedKernel\n{\n\tpublic readonly checkout: TreeCheckout;\n\tpublic get storedSchema(): TreeStoredSchemaRepository {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\tprivate readonly checkouts: Map<BranchId, TreeCheckout> = new Map();\n\n\t/**\n\t * The app-facing API for SharedTree implemented by this Kernel.\n\t * @remarks\n\t * This is the API grafted onto the ISharedObject which apps can access.\n\t * It includes both the APIs used for internal testing, and public facing APIs (both stable and unstable).\n\t * Different users will have access to different subsets of this API, see {@link ITree}, {@link ITreeAlpha} and {@link ITreeInternal} which this {@link ITreePrivate} extends.\n\t */\n\tpublic readonly view: SharedTreeKernelView;\n\n\tpublic constructor(\n\t\tbreaker: Breakable,\n\t\tsharedObject: IChannelView & IFluidLoadable,\n\t\tserializer: IFluidSerializer,\n\t\tsubmitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,\n\t\tlastSequenceNumber: () => number | undefined,\n\t\tinitialSequenceNumber: number,\n\t\tprivate readonly logger: ITelemetryLoggerExt | undefined,\n\t\tidCompressor: IIdCompressor,\n\t\toptionsParam: SharedTreeOptionsInternal,\n\t) {\n\t\tconst options: Required<SharedTreeOptionsInternal> = {\n\t\t\t...defaultSharedTreeOptions,\n\t\t\t...optionsParam,\n\t\t};\n\t\tif (options.minVersionForCollab < FluidClientVersion.v2_0) {\n\t\t\tthrow new UsageError(\"SharedTree requires minVersionForCollab of at least 2.0.0\");\n\t\t}\n\t\tconst schema = new TreeStoredSchemaRepository();\n\t\tconst forest = buildConfiguredForest(\n\t\t\tbreaker,\n\t\t\toptions.forest,\n\t\t\tschema,\n\t\t\tidCompressor,\n\t\t\toptions.shouldEncodeIncrementally,\n\t\t);\n\t\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\t\tconst removedRoots = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\tidCompressor,\n\t\t\toptions,\n\t\t);\n\t\tconst schemaCodec = makeSchemaCodec(options);\n\t\tconst schemaSummarizer = new SchemaSummarizer(\n\t\t\tschema,\n\t\t\t{\n\t\t\t\tgetCurrentSeq: lastSequenceNumber,\n\t\t\t},\n\t\t\tschemaCodec,\n\t\t\toptions.minVersionForCollab,\n\t\t);\n\t\tconst fieldBatchCodec = fieldBatchCodecBuilder.build(options);\n\n\t\tconst encoderContext = {\n\t\t\tschema: {\n\t\t\t\tschema,\n\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t},\n\t\t\tencodeType: options.treeEncodeType,\n\t\t\toriginatorId: idCompressor.localSessionId,\n\t\t\tidCompressor,\n\t\t};\n\t\tconst forestSummarizer = new ForestSummarizer(\n\t\t\tforest,\n\t\t\trevisionTagCodec,\n\t\t\tencoderContext,\n\t\t\toptions,\n\t\t\tidCompressor,\n\t\t\tinitialSequenceNumber,\n\t\t\toptions.shouldEncodeIncrementally,\n\t\t);\n\t\tconst removedRootsSummarizer = new DetachedFieldIndexSummarizer(\n\t\t\tremovedRoots,\n\t\t\toptions.minVersionForCollab,\n\t\t);\n\t\tconst innerChangeFamily = new SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\toptions,\n\t\t\toptions.treeEncodeType,\n\t\t\tidCompressor,\n\t\t);\n\t\tconst changeFamily = makeMitigatedChangeFamily(\n\t\t\tinnerChangeFamily,\n\t\t\tSharedTreeChangeFamily.emptyChange,\n\t\t\t(error: unknown) => {\n\t\t\t\t// TODO:6344 Add telemetry for these errors.\n\t\t\t\t// Rethrowing the error has a different effect depending on the context in which the\n\t\t\t\t// ChangeFamily was invoked:\n\t\t\t\t// - If the ChangeFamily was invoked as part of incoming op processing, rethrowing the error\n\t\t\t\t// will cause the runtime to disconnect the client, log a severe error, and not reconnect.\n\t\t\t\t// This will not cause the host application to crash because it is not on the stack at that time.\n\t\t\t\t// TODO: let the host application know that the client is now disconnected.\n\t\t\t\t// - If the ChangeFamily was invoked as part of dealing with a local change, rethrowing the\n\t\t\t\t// error will cause the host application to crash. This is not ideal, but is better than\n\t\t\t\t// letting the application either send an invalid change to the server or allowing the\n\t\t\t\t// application to continue working when its local branches contain edits that cannot be\n\t\t\t\t// reflected in its views.\n\t\t\t\t// The best course of action for a host application in such a state is to restart.\n\t\t\t\t// TODO: let the host application know about this situation and provide a way to\n\t\t\t\t// programmatically reload the SharedTree container.\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tsuper(\n\t\t\tbreaker,\n\t\t\tsharedObject,\n\t\t\tserializer,\n\t\t\tsubmitLocalMessage,\n\t\t\tlogger,\n\t\t\t[schemaSummarizer, forestSummarizer, removedRootsSummarizer],\n\t\t\tchangeFamily,\n\t\t\toptions,\n\t\t\tchangeFormatVersionForEditManager,\n\t\t\tchangeFormatVersionForMessage,\n\t\t\tidCompressor,\n\t\t\tschema,\n\t\t\tdefaultSchemaPolicy,\n\t\t);\n\n\t\tthis.checkout = createTreeCheckout(idCompressor, this.mintRevisionTag, revisionTagCodec, {\n\t\t\tbranch: this.getLocalBranch(),\n\t\t\tchangeFamily,\n\t\t\tschema,\n\t\t\tforest,\n\t\t\tfieldBatchCodec,\n\t\t\tremovedRoots,\n\t\t\tchunkCompressionStrategy: options.treeEncodeType,\n\t\t\tlogger,\n\t\t\tbreaker: this.breaker,\n\t\t\tdisposeForksAfterTransaction: options.disposeForksAfterTransaction,\n\t\t});\n\n\t\tthis.registerSharedBranchForEditing(\"main\", this.checkout);\n\t\tthis.registerCheckout(\"main\", this.checkout);\n\n\t\tthis.view = {\n\t\t\tcontentSnapshot: () => this.contentSnapshot(),\n\t\t\texportSimpleSchema: () => this.exportSimpleSchema(),\n\t\t\texportVerbose: () => this.exportVerbose(),\n\t\t\tviewWith: this.viewWith.bind(this),\n\t\t\tviewSharedBranchWith: this.viewBranchWith.bind(this),\n\t\t\tcreateSharedBranch: this.createSharedBranch.bind(this),\n\t\t\tgetSharedBranchIds: this.getSharedBranchIds.bind(this),\n\t\t\tkernel: this,\n\t\t};\n\t}\n\n\tprivate registerCheckout(branchId: BranchId, checkout: TreeCheckout): void {\n\t\tthis.checkouts.set(branchId, checkout);\n\t}\n\n\tpublic exportVerbose(): VerboseTree | undefined {\n\t\treturn this.checkout.exportVerbose();\n\t}\n\n\tpublic exportSimpleSchema(): SimpleTreeSchema {\n\t\treturn exportSimpleSchema(this.storedSchema);\n\t}\n\n\t@throwIfBroken\n\tpublic contentSnapshot(): SharedTreeContentSnapshot {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\treturn {\n\t\t\t\tschema: this.storedSchema.clone(),\n\t\t\t\ttree: jsonableTreeFromFieldCursor(cursor),\n\t\t\t\tremoved: this.checkout.getRemovedRoots(),\n\t\t\t};\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t// For the new TreeViewAlpha API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\n\t// For the old TreeView API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\treturn this.checkout.viewWith(config) as SchematizingSimpleTreeView<TRoot> &\n\t\t\tTreeView<ReadSchema<TRoot>>;\n\t}\n\n\tpublic viewBranchWith<TRoot extends ImplicitFieldSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n\n\tpublic viewBranchWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\tconst compressedId = this.idCompressor.tryRecompress(branchId as StableId);\n\t\tif (compressedId === undefined) {\n\t\t\tthrow new UsageError(`No branch found with id: ${branchId}`);\n\t\t}\n\t\treturn this.getCheckout(compressedId).viewWith(\n\t\t\tconfig,\n\t\t) as SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\t}\n\n\tprivate getCheckout(branchId: BranchId): TreeCheckout {\n\t\treturn this.checkouts.get(branchId) ?? this.checkoutBranch(branchId);\n\t}\n\n\tprivate checkoutBranch(branchId: BranchId): TreeCheckout {\n\t\tconst checkout = this.checkout.branch();\n\t\tcheckout.switchBranch(this.getSharedBranch(branchId));\n\t\tthis.registerSharedBranchForEditing(branchId, checkout);\n\t\tthis.registerCheckout(branchId, checkout);\n\t\treturn checkout;\n\t}\n\n\tpublic override async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tawait super.loadCore(services);\n\t\tthis.checkout.load();\n\t}\n\n\tpublic override didAttach(): void {\n\t\tfor (const checkout of this.checkouts.values()) {\n\t\t\tif (checkout.transaction.size > 0) {\n\t\t\t\t// Attaching during a transaction is not currently supported.\n\t\t\t\t// At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot attach while a transaction is in progress. Commit or abort the transaction before attaching.\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tsuper.didAttach();\n\t}\n\n\tpublic override applyStashedOp(\n\t\t...args: Parameters<\n\t\t\tSharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>[\"applyStashedOp\"]\n\t\t>\n\t): void {\n\t\tfor (const checkout of this.checkouts.values()) {\n\t\t\tassert(\n\t\t\t\tcheckout.transaction.size === 0,\n\t\t\t\t0x674 /* Unexpected transaction is open while applying stashed ops */,\n\t\t\t);\n\t\t}\n\t\tsuper.applyStashedOp(...args);\n\t}\n\n\tprotected override submitCommit(\n\t\tbranchId: BranchId,\n\t\tcommit: GraphCommit<SharedTreeChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tconst checkout = this.getCheckout(branchId);\n\t\tassert(\n\t\t\tcheckout.transaction.size === 0,\n\t\t\t0xaa6 /* Cannot submit a commit while a transaction is in progress */,\n\t\t);\n\t\tif (isResubmit) {\n\t\t\treturn super.submitCommit(branchId, commit, schemaAndPolicy, isResubmit);\n\t\t}\n\n\t\t// Refrain from submitting new commits until they are validated by the checkout.\n\t\t// This is not a strict requirement for correctness in our system, but in the event that there is a bug when applying commits to the checkout\n\t\t// that causes a crash (e.g. in the forest), this will at least prevent this client from sending the problematic commit to any other clients.\n\t\tcheckout.onCommitValid(commit, () =>\n\t\t\tsuper.submitCommit(branchId, commit, schemaAndPolicy, isResubmit),\n\t\t);\n\t}\n\n\tpublic onDisconnect(): void {}\n}\n\nexport function exportSimpleSchema(\n\tstoredSchema: TreeStoredSchema,\n): SimpleTreeSchema<SchemaType.Stored> {\n\treturn {\n\t\troot: exportSimpleFieldSchemaStored(storedSchema.rootFieldSchema),\n\t\tdefinitions: new Map(\n\t\t\t[...storedSchema.nodeSchema].map(([key, schema]) => {\n\t\t\t\treturn [key, exportSimpleNodeSchemaStored(schema)];\n\t\t\t}),\n\t\t),\n\t};\n}\n\n/**\n * A way to parse schema in the persisted format from {@link extractPersistedSchema}.\n * @remarks\n * This behaves identically to {@link ITreeAlpha.exportSimpleSchema},\n * except that it gets the schema from the caller instead of from an existing tree.\n *\n * This can be useful for inspecting the contents of persisted schema,\n * such as those generated by {@link extractPersistedSchema} for use in testing.\n * Since that data format is otherwise unspecified,\n * this provides a way to inspect its contents with documented semantics.\n * @alpha\n */\nexport function persistedToSimpleSchema(\n\tpersisted: JsonCompatible,\n\toptions: ICodecOptions,\n): SimpleTreeSchema {\n\t// Any version can be passed down to makeSchemaCodec here.\n\t// We only use the decode part, which always dispatches to the correct codec based on the version in the data, not the version passed to `makeSchemaCodec`.\n\tconst schemaCodec = makeSchemaCodec({\n\t\t...options,\n\t\tminVersionForCollab: FluidClientVersion.v2_0,\n\t});\n\tconst stored = schemaCodec.decode(persisted as FormatV1);\n\treturn exportSimpleSchema(stored);\n}\n\n/**\n * Get a {@link BranchableTree} from a {@link ITree}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch(tree: ITree): BranchableTree;\n/**\n * Get a {@link BranchableTree} from a {@link TreeView}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * Branches are currently an unstable \"alpha\" API and are subject to change in the future.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\tview: TreeViewAlpha<T>,\n): BranchableTree;\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\ttreeOrView: ITree | TreeViewAlpha<T>,\n): BranchableTree {\n\tif (treeOrView instanceof SchematizingSimpleTreeView) {\n\t\treturn treeOrView.checkout as unknown as BranchableTree;\n\t}\n\tconst kernel = (treeOrView as ITree as ITreePrivate).kernel;\n\tassert(kernel instanceof SharedTreeKernel, 0xb56 /* Invalid ITree */);\n\t// This cast is safe so long as TreeCheckout supports all the operations on the branch interface.\n\treturn kernel.checkout as unknown as BranchableTree;\n}\n\n/**\n * Defines for each EditManagerFormatVersion the SharedTreeChangeFormatVersion to use.\n * This is an arbitrary mapping that is injected in the EditManger codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for SharedTree changes are not explicitly versioned.\n */\n// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison -- intentional comparison\nexport const changeFormatVersionForEditManager = DependentFormatVersion.fromPairs<\n\tEditManagerFormatVersion,\n\tSharedTreeChangeFormatVersion\n>([\n\t[EditManagerFormatVersion.v3, SharedTreeChangeFormatVersion.v3],\n\t[EditManagerFormatVersion.v4, SharedTreeChangeFormatVersion.v4],\n\t[EditManagerFormatVersion.vSharedBranches, SharedTreeChangeFormatVersion.v4],\n\t[EditManagerFormatVersion.v6, SharedTreeChangeFormatVersion.v5],\n]);\n\n/**\n * Defines for each MessageFormatVersion the SharedTreeChangeFormatVersion to use.\n * This is an arbitrary mapping that is injected in the message codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for SharedTree changes are not explicitly versioned.\n */\nexport const changeFormatVersionForMessage = DependentFormatVersion.fromPairs<\n\tMessageFormatVersion,\n\tSharedTreeChangeFormatVersion\n>([\n\t[MessageFormatVersion.v3, SharedTreeChangeFormatVersion.v3],\n\t[MessageFormatVersion.v4, SharedTreeChangeFormatVersion.v4],\n\t[MessageFormatVersion.vSharedBranches, SharedTreeChangeFormatVersion.v4],\n\t[MessageFormatVersion.v6, SharedTreeChangeFormatVersion.v5],\n]);\n\nfunction getCodecTreeForEditManagerFormat(clientVersion: MinimumVersionForCollab): CodecTree {\n\tconst change = changeFormatVersionForEditManager.lookup(\n\t\tclientVersionToEditManagerFormatVersion(clientVersion),\n\t);\n\tconst changeCodecTree = getCodecTreeForChangeFormat(change, clientVersion);\n\treturn getCodecTreeForEditManagerFormatWithChange(clientVersion, changeCodecTree);\n}\n\nfunction getCodecTreeForMessageFormat(clientVersion: MinimumVersionForCollab): CodecTree {\n\tconst change = changeFormatVersionForMessage.lookup(\n\t\tclientVersionToMessageFormatVersion(clientVersion),\n\t);\n\tconst changeCodecTree = getCodecTreeForChangeFormat(change, clientVersion);\n\treturn getCodecTreeForMessageFormatWithChange(clientVersion, changeCodecTree);\n}\n\nexport function getCodecTreeForSharedTreeFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\tconst children: CodecTree[] = [];\n\tchildren.push(forestCodecBuilder.getCodecTree(clientVersion));\n\tchildren.push(schemaCodecBuilder.getCodecTree(clientVersion));\n\tchildren.push(detachedFieldIndexCodecBuilder.getCodecTree(clientVersion));\n\tchildren.push(getCodecTreeForEditManagerFormat(clientVersion));\n\tchildren.push(getCodecTreeForMessageFormat(clientVersion));\n\tchildren.push(fieldBatchCodecBuilder.getCodecTree(clientVersion));\n\treturn {\n\t\tname: \"SharedTree\",\n\t\tversion: undefined, // SharedTree does not have a version of its own.\n\t\tchildren,\n\t};\n}\n\n/**\n * Configuration options for SharedTree.\n * @beta @input\n */\nexport type SharedTreeOptionsBeta = ForestOptions & Partial<CodecWriteOptionsBeta>;\n\n/**\n * Configuration options for SharedTree with alpha features.\n * @alpha @input\n */\nexport interface SharedTreeOptions\n\textends SharedTreeOptionsBeta,\n\t\tPartial<CodecWriteOptions>,\n\t\tPartial<SharedTreeFormatOptions> {\n\t/**\n\t * Experimental feature flag to enable shared branches.\n\t * This feature is not yet complete and should not be used in production.\n\t * Defaults to false.\n\t */\n\treadonly enableSharedBranches?: boolean;\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks\n\t * See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally?: IncrementalEncodingPolicy;\n}\n\nexport interface SharedTreeOptionsInternal\n\textends SharedTreeOptions,\n\t\tPartial<SharedTreeCoreOptionsInternal> {\n\tdisposeForksAfterTransaction?: boolean;\n}\n\n/**\n * Configuration options for SharedTree's internal tree storage.\n * @beta @input\n */\nexport interface ForestOptions {\n\t/**\n\t * The {@link ForestType} indicating which forest type should be created for the SharedTree.\n\t */\n\treadonly forest?: ForestType;\n}\n\n/**\n * Options for configuring the persisted format SharedTree uses.\n * @alpha @input\n */\nexport interface SharedTreeFormatOptions {\n\t/**\n\t * See {@link TreeCompressionStrategy}.\n\t * default: TreeCompressionStrategy.Compressed\n\t */\n\ttreeEncodeType: TreeCompressionStrategy;\n}\n\n/**\n * Used to distinguish between different forest types.\n * @remarks\n * The \"Forest\" is the internal data structure used to store all the trees (the main tree and any removed ones) for a given view or branch.\n * ForestTypes should all have the same behavior, but may differ in performance and debuggability.\n *\n * Current options are {@link ForestTypeReference}, {@link ForestTypeOptimized} and {@link ForestTypeExpensiveDebug}.\n * @privateRemarks\n * Implement using {@link toForestType}.\n * Consume using {@link buildConfiguredForest}.\n * @sealed @beta\n */\nexport interface ForestType extends ErasedType<\"ForestType\"> {}\n\n/**\n * Reference implementation of forest.\n * @remarks\n * A simple implementation with minimal complexity and moderate debuggability, validation and performance.\n * @privateRemarks\n * The \"ObjectForest\" forest type.\n * @beta\n */\nexport const ForestTypeReference = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor) =>\n\t\tbuildForest(breaker, schema),\n);\n\n/**\n * Optimized implementation of forest.\n * @remarks\n * A complex optimized forest implementation, which has minimal validation and debuggability to optimize for performance.\n * Uses an internal representation optimized for size designed to scale to larger datasets with reduced overhead.\n * @privateRemarks\n * The \"ChunkedForest\" forest type.\n * @beta\n */\nexport const ForestTypeOptimized = toForestType(\n\t(\n\t\tbreaker: Breakable,\n\t\tschema: TreeStoredSchemaSubscription,\n\t\tidCompressor: IIdCompressor,\n\t\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n\t) =>\n\t\tbuildChunkedForest(\n\t\t\tmakeTreeChunker(schema, defaultSchemaPolicy, shouldEncodeIncrementally),\n\t\t\tundefined,\n\t\t\tidCompressor,\n\t\t),\n);\n\n/**\n * Slow implementation of forest intended only for debugging.\n * @remarks\n * Includes validation with scales poorly.\n * May be asymptotically slower than {@link ForestTypeReference}, and may perform very badly with larger data sizes.\n * @privateRemarks\n * The \"ObjectForest\" forest type with expensive asserts for debugging.\n * @beta\n */\nexport const ForestTypeExpensiveDebug = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription) =>\n\t\tbuildForest(breaker, schema, undefined, true),\n);\n\ntype ForestFactory = (\n\tbreaker: Breakable,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n) => IEditableForest;\n\nfunction toForestType(factory: ForestFactory): ForestType {\n\treturn factory as unknown as ForestType;\n}\n\n/**\n * Build and return a forest of the requested type.\n */\nexport function buildConfiguredForest(\n\tbreaker: Breakable,\n\tfactory: ForestType,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n): IEditableForest {\n\treturn (factory as unknown as ForestFactory)(\n\t\tbreaker,\n\t\tschema,\n\t\tidCompressor,\n\t\tshouldEncodeIncrementally,\n\t);\n}\n\nexport const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {\n\tjsonValidator: FormatValidatorNoOp,\n\tminVersionForCollab: FluidClientVersion.v2_0,\n\tforest: ForestTypeReference,\n\ttreeEncodeType: TreeCompressionStrategy.Compressed,\n\tdisposeForksAfterTransaction: true,\n\tshouldEncodeIncrementally: defaultIncrementalEncodingPolicy,\n\teditManagerFormatSelector: clientVersionToEditManagerFormatVersion,\n\tmessageFormatSelector: clientVersionToMessageFormatVersion,\n\tenableSharedBranches: false,\n\twriteVersionOverrides: new Map(),\n\tallowPossiblyIncompatibleWriteVersionOverrides: false,\n};\n\n/**\n * Build the allowed types for a Stored Schema.\n *\n * @remarks Staged upgrades do not apply to stored schemas, so we omit the {@link SimpleAllowedTypeAttributes.isStaged | staging flag } when building {@link SimpleAllowedTypeAttributes}.\n * @param types - The types to create allowed types for.\n * @returns The allowed types.\n */\nfunction buildSimpleAllowedTypeAttributesForStoredSchema(\n\ttypes: TreeTypeSet,\n): ReadonlyMap<string, SimpleAllowedTypeAttributes<SchemaType.Stored>> {\n\tconst allowedTypesInfo = new Map<string, SimpleAllowedTypeAttributes<SchemaType.Stored>>();\n\tfor (const type of types) {\n\t\t// Stored schemas do not have staged upgrades\n\t\tallowedTypesInfo.set(type, { isStaged: undefined });\n\t}\n\treturn allowedTypesInfo;\n}\n\nfunction exportSimpleFieldSchemaStored(\n\tschema: TreeFieldStoredSchema,\n): SimpleFieldSchema<SchemaType.Stored> {\n\tlet kind: FieldKind;\n\tswitch (schema.kind) {\n\t\tcase FieldKinds.identifier.identifier: {\n\t\t\tkind = FieldKind.Identifier;\n\t\t\tbreak;\n\t\t}\n\t\tcase FieldKinds.optional.identifier: {\n\t\t\tkind = FieldKind.Optional;\n\t\t\tbreak;\n\t\t}\n\t\tcase FieldKinds.required.identifier: {\n\t\t\tkind = FieldKind.Required;\n\t\t\tbreak;\n\t\t}\n\t\tcase FieldKinds.forbidden.identifier: {\n\t\t\tkind = FieldKind.Optional;\n\t\t\tassert(schema.types.size === 0, 0xa94 /* invalid forbidden field */);\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tfail(0xaca /* invalid field kind */);\n\t\t}\n\t}\n\treturn {\n\t\tkind,\n\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(schema.types),\n\t\tmetadata: {},\n\t\tpersistedMetadata: schema.persistedMetadata,\n\t};\n}\n\n/**\n * Export a {@link SimpleNodeSchema} from a {@link TreeNodeStoredSchema}.\n * @privateRemarks\n * TODO: Persist node metadata once schema FormatV2 is supported.\n * Note on SimpleNodeSchema construction: In the persisted format `persistedMetadata` is just called `metadata` whereas the `metadata`\n * field on SimpleNodeSchema is not persisted.\n */\nfunction exportSimpleNodeSchemaStored(\n\tschema: TreeNodeStoredSchema,\n): SimpleNodeSchema<SchemaType.Stored> {\n\tconst arrayTypes = tryStoredSchemaAsArray(schema);\n\tif (arrayTypes !== undefined) {\n\t\treturn {\n\t\t\tkind: NodeKind.Array,\n\t\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(arrayTypes),\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst fields = new Map<FieldKey, SimpleObjectFieldSchema<SchemaType.Stored>>();\n\t\tfor (const [storedKey, field] of schema.objectNodeFields) {\n\t\t\tfields.set(storedKey, { ...exportSimpleFieldSchemaStored(field), storedKey });\n\t\t}\n\t\treturn {\n\t\t\tkind: NodeKind.Object,\n\t\t\tfields,\n\t\t\tallowUnknownOptionalFields: undefined,\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tassert(\n\t\t\tschema.mapFields.kind === FieldKinds.optional.identifier,\n\t\t\t0xa95 /* Invalid map schema */,\n\t\t);\n\t\treturn {\n\t\t\tkind: NodeKind.Map,\n\t\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(\n\t\t\t\tschema.mapFields.types,\n\t\t\t),\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\treturn {\n\t\t\tkind: NodeKind.Leaf,\n\t\t\tleafKind: schema.leafValue,\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tfail(0xacb /* invalid schema kind */);\n}\n"]}
1
+ {"version":3,"file":"sharedTree.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,kEAAmE;AASnE,uEAGkD;AAElD,gDAQ2B;AAC3B,+CAkB0B;AAC1B,4DAgBuC;AACvC,4DAAmE;AACnE,2DAWsC;AACtC,sDAiBiC;AACjC,+CAK0B;AAG1B,2EAGqC;AACrC,2EAAqE;AAGrE,uDAA0E;AA2D1E;;;;GAIG;IAEU,gBAAgB;4BAD5B,wBAAa;;;;sBAEL,yB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M,MAAM,GAAG,IAAI,GAAG,EAAwD,CAAC;QAC/E,KAAK,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;YAC1D,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,GAAG,6BAA6B,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QAC/E,CAAC;QACD,OAAO;YACN,IAAI,EAAE,mBAAQ,CAAC,MAAM;YACrB,MAAM;YACN,0BAA0B,EAAE,SAAS;YACrC,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,MAAM,CAAC,QAAQ;SAClC,CAAC;IACH,CAAC;IACD,IAAI,MAAM,YAAY,8BAAmB,EAAE,CAAC;QAC3C,IAAA,iBAAM,EACL,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,qBAAU,CAAC,QAAQ,CAAC,UAAU,EACxD,KAAK,CAAC,wBAAwB,CAC9B,CAAC;QACF,OAAO;YACN,IAAI,EAAE,mBAAQ,CAAC,GAAG;YAClB,kBAAkB,EAAE,+CAA+C,CAClE,MAAM,CAAC,SAAS,CAAC,KAAK,CACtB;YACD,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,MAAM,CAAC,QAAQ;SAClC,CAAC;IACH,CAAC;IACD,IAAI,MAAM,YAAY,+BAAoB,EAAE,CAAC;QAC5C,OAAO;YACN,IAAI,EAAE,mBAAQ,CAAC,IAAI;YACnB,QAAQ,EAAE,MAAM,CAAC,SAAS;YAC1B,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,MAAM,CAAC,QAAQ;SAClC,CAAC;IACH,CAAC;IACD,IAAA,eAAI,EAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ErasedType, IFluidLoadable } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor, StableId } from \"@fluidframework/id-compressor\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tIChannelView,\n\tIFluidSerializer,\n\tSharedKernel,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tUsageError,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\ttype CodecWriteOptionsBeta,\n\tDependentFormatVersion,\n\tFluidClientVersion,\n\tFormatValidatorNoOp,\n\ttype ICodecOptions,\n} from \"../codec/index.js\";\nimport {\n\ttype FieldKey,\n\ttype GraphCommit,\n\ttype IEditableForest,\n\ttype JsonableTree,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tRevisionTagCodec,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\ttype TreeStoredSchemaSubscription,\n\ttype TreeTypeSet,\n\tdetachedFieldIndexCodecBuilder,\n\tmakeDetachedFieldIndex,\n\tmoveToDetachedField,\n} from \"../core/index.js\";\nimport {\n\tDetachedFieldIndexSummarizer,\n\tFieldKinds,\n\tForestSummarizer,\n\tSchemaSummarizer,\n\tTreeCompressionStrategy,\n\tbuildChunkedForest,\n\tbuildForest,\n\tdefaultIncrementalEncodingPolicy,\n\tdefaultSchemaPolicy,\n\tfieldBatchCodecBuilder,\n\tforestCodecBuilder,\n\tjsonableTreeFromFieldCursor,\n\tmakeMitigatedChangeFamily,\n\tmakeTreeChunker,\n\ttype IncrementalEncodingPolicy,\n} from \"../feature-libraries/index.js\";\nimport { schemaCodecBuilder } from \"../feature-libraries/index.js\";\nimport {\n\ttype BranchId,\n\ttype ClonableSchemaAndPolicy,\n\tgetCodecTreeForEditManagerFormatWithChange,\n\tgetCodecTreeForMessageFormatWithChange,\n\tmakeMessageCodecBuilder,\n\ttype SharedTreeCoreOptionsInternal,\n\tMessageFormatVersion,\n\tSharedTreeCore,\n\tEditManagerFormatVersion,\n\tmakeEditManagerCodecBuilder,\n} from \"../shared-tree-core/index.js\";\nimport {\n\ttype ImplicitFieldSchema,\n\tNodeKind,\n\ttype ReadSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleTreeSchema,\n\ttype TreeView,\n\ttype TreeViewConfiguration,\n\ttype UnsafeUnknownSchema,\n\ttype VerboseTree,\n\ttryStoredSchemaAsArray,\n\ttype SimpleNodeSchema,\n\tFieldKind,\n\ttype ITreeAlpha,\n\ttype SimpleObjectFieldSchema,\n\ttype SimpleAllowedTypeAttributes,\n\ttype SchemaType,\n} from \"../simple-tree/index.js\";\nimport {\n\ttype Breakable,\n\tbreakingClass,\n\ttype JsonCompatible,\n\tthrowIfBroken,\n} from \"../util/index.js\";\n\nimport type { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport {\n\tgetCodecTreeForChangeFormat,\n\tSharedTreeChangeFormatVersion,\n} from \"./sharedTreeChangeCodecs.js\";\nimport { SharedTreeChangeFamily } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport { type TreeCheckout, createTreeCheckout } from \"./treeCheckout.js\";\n\n/**\n * Copy of data from an {@link ITreePrivate} at some point in time.\n * @remarks\n * This is unrelated to Fluids concept of \"snapshots\".\n */\nexport interface SharedTreeContentSnapshot {\n\t/**\n\t * The schema stored in the document.\n\t *\n\t * @remarks\n\t * Edits to the schema can mutate the schema stored of the tree which took this snapshot (but this snapshot will remain the same)\n\t * This is mainly useful for debugging cases where schematize reports an incompatible view schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\t/**\n\t * All {@link TreeStatus.InDocument} content.\n\t */\n\treadonly tree: JsonableTree[];\n\t/**\n\t * All {@link TreeStatus.Removed} content.\n\t */\n\treadonly removed: [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * {@link ITree} extended with some non-public APIs.\n * @internal\n */\nexport interface ITreeInternal extends IChannelView, ITreeAlpha {}\n\n/**\n * {@link ITreeInternal} extended with some non-exported APIs.\n * @remarks\n * This allows access to the tree content using the internal data model used at the storage and \"flex\" layers,\n * and should only be needed for testing and debugging this package's internals.\n */\nexport interface ITreePrivate extends ITreeInternal {\n\t/**\n\t * Provides a copy of the current content of the tree.\n\t * This can be useful for inspecting the tree when no suitable view schema is available.\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t *\n\t * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.\n\t */\n\tcontentSnapshot(): SharedTreeContentSnapshot;\n\n\t/**\n\t * Access to internals for testing.\n\t */\n\treadonly kernel: SharedTreeKernel;\n}\n\n/**\n * The type SharedTree's kernel's view must implement so what when its merged with the underling SharedObject's API it fully implements the required tree API surface ({@link ITreePrivate }).\n */\nexport type SharedTreeKernelView = Omit<ITreePrivate, keyof (IChannelView & IFluidLoadable)>;\n\n/**\n * SharedTreeCore, configured with a good set of indexes and field kinds which will maintain compatibility over time.\n *\n * TODO: detail compatibility requirements.\n */\n@breakingClass\nexport class SharedTreeKernel\n\textends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>\n\timplements SharedKernel\n{\n\tpublic readonly checkout: TreeCheckout;\n\tpublic get storedSchema(): TreeStoredSchemaRepository {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\tprivate readonly checkouts: Map<BranchId, TreeCheckout> = new Map();\n\n\t/**\n\t * The app-facing API for SharedTree implemented by this Kernel.\n\t * @remarks\n\t * This is the API grafted onto the ISharedObject which apps can access.\n\t * It includes both the APIs used for internal testing, and public facing APIs (both stable and unstable).\n\t * Different users will have access to different subsets of this API, see {@link ITree}, {@link ITreeAlpha} and {@link ITreeInternal} which this {@link ITreePrivate} extends.\n\t */\n\tpublic readonly view: SharedTreeKernelView;\n\n\tpublic constructor(\n\t\tbreaker: Breakable,\n\t\tsharedObject: IChannelView & IFluidLoadable,\n\t\tserializer: IFluidSerializer,\n\t\tsubmitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,\n\t\tlastSequenceNumber: () => number | undefined,\n\t\tinitialSequenceNumber: number,\n\t\tprivate readonly logger: ITelemetryLoggerExt | undefined,\n\t\tidCompressor: IIdCompressor,\n\t\toptionsParam: SharedTreeOptionsInternal,\n\t) {\n\t\tconst options: Required<SharedTreeOptionsInternal> = {\n\t\t\t...defaultSharedTreeOptions,\n\t\t\t...optionsParam,\n\t\t};\n\t\tif (options.minVersionForCollab < FluidClientVersion.v2_0) {\n\t\t\tthrow new UsageError(\"SharedTree requires minVersionForCollab of at least 2.0.0\");\n\t\t}\n\t\tconst schema = new TreeStoredSchemaRepository();\n\t\tconst forest = buildConfiguredForest(\n\t\t\tbreaker,\n\t\t\toptions.forest,\n\t\t\tschema,\n\t\t\tidCompressor,\n\t\t\toptions.shouldEncodeIncrementally,\n\t\t);\n\t\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\t\tconst removedRoots = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\tidCompressor,\n\t\t\toptions,\n\t\t);\n\t\tconst schemaCodec = schemaCodecBuilder.build(options);\n\t\tconst schemaSummarizer = new SchemaSummarizer(\n\t\t\tschema,\n\t\t\t{\n\t\t\t\tgetCurrentSeq: lastSequenceNumber,\n\t\t\t},\n\t\t\tschemaCodec,\n\t\t\toptions.minVersionForCollab,\n\t\t);\n\t\tconst fieldBatchCodec = fieldBatchCodecBuilder.build(options);\n\n\t\tconst encoderContext = {\n\t\t\tschema: {\n\t\t\t\tschema,\n\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t},\n\t\t\tencodeType: options.treeEncodeType,\n\t\t\toriginatorId: idCompressor.localSessionId,\n\t\t\tidCompressor,\n\t\t};\n\t\tconst forestSummarizer = new ForestSummarizer(\n\t\t\tforest,\n\t\t\trevisionTagCodec,\n\t\t\tencoderContext,\n\t\t\toptions,\n\t\t\tidCompressor,\n\t\t\tinitialSequenceNumber,\n\t\t\toptions.shouldEncodeIncrementally,\n\t\t);\n\t\tconst removedRootsSummarizer = new DetachedFieldIndexSummarizer(\n\t\t\tremovedRoots,\n\t\t\toptions.minVersionForCollab,\n\t\t);\n\t\tconst innerChangeFamily = new SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\toptions,\n\t\t\toptions.treeEncodeType,\n\t\t\tidCompressor,\n\t\t);\n\t\tconst changeFamily = makeMitigatedChangeFamily(\n\t\t\tinnerChangeFamily,\n\t\t\tSharedTreeChangeFamily.emptyChange,\n\t\t\t(error: unknown) => {\n\t\t\t\t// TODO:6344 Add telemetry for these errors.\n\t\t\t\t// Rethrowing the error has a different effect depending on the context in which the\n\t\t\t\t// ChangeFamily was invoked:\n\t\t\t\t// - If the ChangeFamily was invoked as part of incoming op processing, rethrowing the error\n\t\t\t\t// will cause the runtime to disconnect the client, log a severe error, and not reconnect.\n\t\t\t\t// This will not cause the host application to crash because it is not on the stack at that time.\n\t\t\t\t// TODO: let the host application know that the client is now disconnected.\n\t\t\t\t// - If the ChangeFamily was invoked as part of dealing with a local change, rethrowing the\n\t\t\t\t// error will cause the host application to crash. This is not ideal, but is better than\n\t\t\t\t// letting the application either send an invalid change to the server or allowing the\n\t\t\t\t// application to continue working when its local branches contain edits that cannot be\n\t\t\t\t// reflected in its views.\n\t\t\t\t// The best course of action for a host application in such a state is to restart.\n\t\t\t\t// TODO: let the host application know about this situation and provide a way to\n\t\t\t\t// programmatically reload the SharedTree container.\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tsuper(\n\t\t\tbreaker,\n\t\t\tsharedObject,\n\t\t\tserializer,\n\t\t\tsubmitLocalMessage,\n\t\t\tlogger,\n\t\t\t[schemaSummarizer, forestSummarizer, removedRootsSummarizer],\n\t\t\tchangeFamily,\n\t\t\toptions,\n\t\t\tchangeFormatVersionForEditManager,\n\t\t\tchangeFormatVersionForMessage,\n\t\t\tidCompressor,\n\t\t\tschema,\n\t\t\tdefaultSchemaPolicy,\n\t\t);\n\n\t\tthis.checkout = createTreeCheckout(idCompressor, this.mintRevisionTag, revisionTagCodec, {\n\t\t\tbranch: this.getLocalBranch(),\n\t\t\tchangeFamily,\n\t\t\tschema,\n\t\t\tforest,\n\t\t\tfieldBatchCodec,\n\t\t\tremovedRoots,\n\t\t\tchunkCompressionStrategy: options.treeEncodeType,\n\t\t\tlogger,\n\t\t\tbreaker: this.breaker,\n\t\t\tdisposeForksAfterTransaction: options.disposeForksAfterTransaction,\n\t\t});\n\n\t\tthis.registerSharedBranchForEditing(\"main\", this.checkout);\n\t\tthis.registerCheckout(\"main\", this.checkout);\n\n\t\tthis.view = {\n\t\t\tcontentSnapshot: () => this.contentSnapshot(),\n\t\t\texportSimpleSchema: () => this.exportSimpleSchema(),\n\t\t\texportVerbose: () => this.exportVerbose(),\n\t\t\tviewWith: this.viewWith.bind(this),\n\t\t\tviewSharedBranchWith: this.viewBranchWith.bind(this),\n\t\t\tcreateSharedBranch: this.createSharedBranch.bind(this),\n\t\t\tgetSharedBranchIds: this.getSharedBranchIds.bind(this),\n\t\t\tkernel: this,\n\t\t};\n\t}\n\n\tprivate registerCheckout(branchId: BranchId, checkout: TreeCheckout): void {\n\t\tthis.checkouts.set(branchId, checkout);\n\t}\n\n\tpublic exportVerbose(): VerboseTree | undefined {\n\t\treturn this.checkout.exportVerbose();\n\t}\n\n\tpublic exportSimpleSchema(): SimpleTreeSchema {\n\t\treturn exportSimpleSchema(this.storedSchema);\n\t}\n\n\t@throwIfBroken\n\tpublic contentSnapshot(): SharedTreeContentSnapshot {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\treturn {\n\t\t\t\tschema: this.storedSchema.clone(),\n\t\t\t\ttree: jsonableTreeFromFieldCursor(cursor),\n\t\t\t\tremoved: this.checkout.getRemovedRoots(),\n\t\t\t};\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t// For the new TreeViewAlpha API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\n\t// For the old TreeView API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\treturn this.checkout.viewWith(config) as SchematizingSimpleTreeView<TRoot> &\n\t\t\tTreeView<ReadSchema<TRoot>>;\n\t}\n\n\tpublic viewBranchWith<TRoot extends ImplicitFieldSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n\n\tpublic viewBranchWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\tconst compressedId = this.idCompressor.tryRecompress(branchId as StableId);\n\t\tif (compressedId === undefined) {\n\t\t\tthrow new UsageError(`No branch found with id: ${branchId}`);\n\t\t}\n\t\treturn this.getCheckout(compressedId).viewWith(\n\t\t\tconfig,\n\t\t) as SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\t}\n\n\tprivate getCheckout(branchId: BranchId): TreeCheckout {\n\t\treturn this.checkouts.get(branchId) ?? this.checkoutBranch(branchId);\n\t}\n\n\tprivate checkoutBranch(branchId: BranchId): TreeCheckout {\n\t\tconst checkout = this.checkout.fork();\n\t\tcheckout.switchBranch(this.getSharedBranch(branchId));\n\t\tthis.registerSharedBranchForEditing(branchId, checkout);\n\t\tthis.registerCheckout(branchId, checkout);\n\t\treturn checkout;\n\t}\n\n\tpublic override async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tawait super.loadCore(services);\n\t\tthis.checkout.load();\n\t}\n\n\tpublic override didAttach(): void {\n\t\tfor (const checkout of this.checkouts.values()) {\n\t\t\tif (checkout.transaction.size > 0) {\n\t\t\t\t// Attaching during a transaction is not currently supported.\n\t\t\t\t// At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot attach while a transaction is in progress. Commit or abort the transaction before attaching.\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tsuper.didAttach();\n\t}\n\n\tpublic override applyStashedOp(\n\t\t...args: Parameters<\n\t\t\tSharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>[\"applyStashedOp\"]\n\t\t>\n\t): void {\n\t\tfor (const checkout of this.checkouts.values()) {\n\t\t\tassert(\n\t\t\t\tcheckout.transaction.size === 0,\n\t\t\t\t0x674 /* Unexpected transaction is open while applying stashed ops */,\n\t\t\t);\n\t\t}\n\t\tsuper.applyStashedOp(...args);\n\t}\n\n\tprotected override submitCommit(\n\t\tbranchId: BranchId,\n\t\tcommit: GraphCommit<SharedTreeChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tconst checkout = this.getCheckout(branchId);\n\t\tassert(\n\t\t\tcheckout.transaction.size === 0,\n\t\t\t0xaa6 /* Cannot submit a commit while a transaction is in progress */,\n\t\t);\n\t\tif (isResubmit) {\n\t\t\treturn super.submitCommit(branchId, commit, schemaAndPolicy, isResubmit);\n\t\t}\n\n\t\t// Refrain from submitting new commits until they are validated by the checkout.\n\t\t// This is not a strict requirement for correctness in our system, but in the event that there is a bug when applying commits to the checkout\n\t\t// that causes a crash (e.g. in the forest), this will at least prevent this client from sending the problematic commit to any other clients.\n\t\tcheckout.onCommitValid(commit, () =>\n\t\t\tsuper.submitCommit(branchId, commit, schemaAndPolicy, isResubmit),\n\t\t);\n\t}\n\n\tpublic onDisconnect(): void {}\n}\n\nexport function exportSimpleSchema(\n\tstoredSchema: TreeStoredSchema,\n): SimpleTreeSchema<SchemaType.Stored> {\n\treturn {\n\t\troot: exportSimpleFieldSchemaStored(storedSchema.rootFieldSchema),\n\t\tdefinitions: new Map(\n\t\t\t[...storedSchema.nodeSchema].map(([key, schema]) => {\n\t\t\t\treturn [key, exportSimpleNodeSchemaStored(schema)];\n\t\t\t}),\n\t\t),\n\t};\n}\n\n/**\n * A way to parse schema in the persisted format from {@link extractPersistedSchema}.\n * @remarks\n * This behaves identically to {@link ITreeAlpha.exportSimpleSchema},\n * except that it gets the schema from the caller instead of from an existing tree.\n *\n * This can be useful for inspecting the contents of persisted schema,\n * such as those generated by {@link extractPersistedSchema} for use in testing.\n * Since that data format is otherwise unspecified,\n * this provides a way to inspect its contents with documented semantics.\n * @alpha\n */\nexport function persistedToSimpleSchema(\n\tpersisted: JsonCompatible,\n\toptions: ICodecOptions,\n): SimpleTreeSchema {\n\tconst schemaCodec = schemaCodecBuilder.buildDecoder(options);\n\tconst stored = schemaCodec.decode(persisted);\n\treturn exportSimpleSchema(stored);\n}\n\n/**\n * Defines for each EditManagerFormatVersion the SharedTreeChangeFormatVersion to use.\n * This is an arbitrary mapping that is injected in the EditManger codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for SharedTree changes are not explicitly versioned.\n */\nexport const changeFormatVersionForEditManager = DependentFormatVersion.fromPairs<\n\tEditManagerFormatVersion,\n\tSharedTreeChangeFormatVersion\n>([\n\t[EditManagerFormatVersion.v3, SharedTreeChangeFormatVersion.v3],\n\t[EditManagerFormatVersion.v4, SharedTreeChangeFormatVersion.v4],\n\t[EditManagerFormatVersion.vSharedBranches, SharedTreeChangeFormatVersion.v4],\n\t[EditManagerFormatVersion.v6, SharedTreeChangeFormatVersion.v5],\n]);\n\n/**\n * Defines for each MessageFormatVersion the SharedTreeChangeFormatVersion to use.\n * This is an arbitrary mapping that is injected in the message codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for SharedTree changes are not explicitly versioned.\n */\nexport const changeFormatVersionForMessage = DependentFormatVersion.fromPairs<\n\tMessageFormatVersion,\n\tSharedTreeChangeFormatVersion\n>([\n\t[MessageFormatVersion.v3, SharedTreeChangeFormatVersion.v3],\n\t[MessageFormatVersion.v4, SharedTreeChangeFormatVersion.v4],\n\t[MessageFormatVersion.vSharedBranches, SharedTreeChangeFormatVersion.v4],\n\t[MessageFormatVersion.v6, SharedTreeChangeFormatVersion.v5],\n]);\n\nfunction getCodecTreeForEditManagerFormat(clientVersion: MinimumVersionForCollab): CodecTree {\n\tconst editManagerVersion = makeEditManagerCodecBuilder().getCodecTree(clientVersion).version;\n\tconst change = changeFormatVersionForEditManager.lookup(editManagerVersion);\n\tconst changeCodecTree = getCodecTreeForChangeFormat(change, clientVersion);\n\treturn getCodecTreeForEditManagerFormatWithChange(clientVersion, changeCodecTree);\n}\n\nfunction getCodecTreeForMessageFormat(clientVersion: MinimumVersionForCollab): CodecTree {\n\tconst messageVersion = makeMessageCodecBuilder().getCodecTree(clientVersion).version;\n\tassert(\n\t\tmessageVersion !== undefined,\n\t\t0xce3 /* Deprecated 'undefined' version shouldn't be selected */,\n\t);\n\tconst change = changeFormatVersionForMessage.lookup(messageVersion);\n\tconst changeCodecTree = getCodecTreeForChangeFormat(change, clientVersion);\n\treturn getCodecTreeForMessageFormatWithChange(clientVersion, changeCodecTree);\n}\n\nexport function getCodecTreeForSharedTreeFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\tconst children: CodecTree[] = [];\n\tchildren.push(forestCodecBuilder.getCodecTree(clientVersion));\n\tchildren.push(schemaCodecBuilder.getCodecTree(clientVersion));\n\tchildren.push(detachedFieldIndexCodecBuilder.getCodecTree(clientVersion));\n\tchildren.push(getCodecTreeForEditManagerFormat(clientVersion));\n\tchildren.push(getCodecTreeForMessageFormat(clientVersion));\n\tchildren.push(fieldBatchCodecBuilder.getCodecTree(clientVersion));\n\treturn {\n\t\tname: \"SharedTree\",\n\t\tversion: undefined, // SharedTree does not have a version of its own.\n\t\tchildren,\n\t};\n}\n\n/**\n * Configuration options for SharedTree.\n * @beta @input\n */\nexport type SharedTreeOptionsBeta = ForestOptions & Partial<CodecWriteOptionsBeta>;\n\n/**\n * Configuration options for SharedTree with alpha features.\n * @alpha @input\n */\nexport interface SharedTreeOptions\n\textends SharedTreeOptionsBeta,\n\t\tPartial<CodecWriteOptions>,\n\t\tPartial<SharedTreeFormatOptions> {\n\t/**\n\t * Experimental feature flag to enable shared branches.\n\t * This feature is not yet complete and should not be used in production.\n\t * Defaults to false.\n\t */\n\treadonly enableSharedBranches?: boolean;\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks\n\t * See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally?: IncrementalEncodingPolicy;\n}\n\nexport interface SharedTreeOptionsInternal\n\textends SharedTreeOptions,\n\t\tPartial<SharedTreeCoreOptionsInternal> {\n\tdisposeForksAfterTransaction?: boolean;\n}\n\n/**\n * Configuration options for SharedTree's internal tree storage.\n * @beta @input\n */\nexport interface ForestOptions {\n\t/**\n\t * The {@link ForestType} indicating which forest type should be created for the SharedTree.\n\t */\n\treadonly forest?: ForestType;\n}\n\n/**\n * Options for configuring the persisted format SharedTree uses.\n * @alpha @input\n */\nexport interface SharedTreeFormatOptions {\n\t/**\n\t * See {@link TreeCompressionStrategy}.\n\t * default: TreeCompressionStrategy.Compressed\n\t */\n\ttreeEncodeType: TreeCompressionStrategy;\n}\n\n/**\n * Used to distinguish between different forest types.\n * @remarks\n * The \"Forest\" is the internal data structure used to store all the trees (the main tree and any removed ones) for a given view or branch.\n * ForestTypes should all have the same behavior, but may differ in performance and debuggability.\n *\n * Current options are {@link ForestTypeReference}, {@link ForestTypeOptimized} and {@link ForestTypeExpensiveDebug}.\n * @privateRemarks\n * Implement using {@link toForestType}.\n * Consume using {@link buildConfiguredForest}.\n * @sealed @beta\n */\nexport interface ForestType extends ErasedType<\"ForestType\"> {}\n\n/**\n * Reference implementation of forest.\n * @remarks\n * A simple implementation with minimal complexity and moderate debuggability, validation and performance.\n * @privateRemarks\n * The \"ObjectForest\" forest type.\n * @beta\n */\nexport const ForestTypeReference = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor) =>\n\t\tbuildForest(breaker, schema),\n);\n\n/**\n * Optimized implementation of forest.\n * @remarks\n * A complex optimized forest implementation, which has minimal validation and debuggability to optimize for performance.\n * Uses an internal representation optimized for size designed to scale to larger datasets with reduced overhead.\n * @privateRemarks\n * The \"ChunkedForest\" forest type.\n * @beta\n */\nexport const ForestTypeOptimized = toForestType(\n\t(\n\t\tbreaker: Breakable,\n\t\tschema: TreeStoredSchemaSubscription,\n\t\tidCompressor: IIdCompressor,\n\t\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n\t) =>\n\t\tbuildChunkedForest(\n\t\t\tmakeTreeChunker(schema, defaultSchemaPolicy, shouldEncodeIncrementally),\n\t\t\tundefined,\n\t\t\tidCompressor,\n\t\t),\n);\n\n/**\n * Slow implementation of forest intended only for debugging.\n * @remarks\n * Includes validation with scales poorly.\n * May be asymptotically slower than {@link ForestTypeReference}, and may perform very badly with larger data sizes.\n * @privateRemarks\n * The \"ObjectForest\" forest type with expensive asserts for debugging.\n * @beta\n */\nexport const ForestTypeExpensiveDebug = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription) =>\n\t\tbuildForest(breaker, schema, undefined, true),\n);\n\ntype ForestFactory = (\n\tbreaker: Breakable,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n) => IEditableForest;\n\nfunction toForestType(factory: ForestFactory): ForestType {\n\treturn factory as unknown as ForestType;\n}\n\n/**\n * Build and return a forest of the requested type.\n */\nexport function buildConfiguredForest(\n\tbreaker: Breakable,\n\tfactory: ForestType,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n): IEditableForest {\n\treturn (factory as unknown as ForestFactory)(\n\t\tbreaker,\n\t\tschema,\n\t\tidCompressor,\n\t\tshouldEncodeIncrementally,\n\t);\n}\n\nexport const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {\n\tjsonValidator: FormatValidatorNoOp,\n\tminVersionForCollab: FluidClientVersion.v2_0,\n\tforest: ForestTypeReference,\n\ttreeEncodeType: TreeCompressionStrategy.Compressed,\n\tdisposeForksAfterTransaction: true,\n\tshouldEncodeIncrementally: defaultIncrementalEncodingPolicy,\n\tenableSharedBranches: false,\n\twriteVersionOverrides: new Map(),\n\tallowPossiblyIncompatibleWriteVersionOverrides: false,\n};\n\n/**\n * Build the allowed types for a Stored Schema.\n *\n * @remarks Staged upgrades do not apply to stored schemas, so we omit the {@link SimpleAllowedTypeAttributes.isStaged | staging flag } when building {@link SimpleAllowedTypeAttributes}.\n * @param types - The types to create allowed types for.\n * @returns The allowed types.\n */\nfunction buildSimpleAllowedTypeAttributesForStoredSchema(\n\ttypes: TreeTypeSet,\n): ReadonlyMap<string, SimpleAllowedTypeAttributes<SchemaType.Stored>> {\n\tconst allowedTypesInfo = new Map<string, SimpleAllowedTypeAttributes<SchemaType.Stored>>();\n\tfor (const type of types) {\n\t\t// Stored schemas do not have staged upgrades\n\t\tallowedTypesInfo.set(type, { isStaged: undefined });\n\t}\n\treturn allowedTypesInfo;\n}\n\nfunction exportSimpleFieldSchemaStored(\n\tschema: TreeFieldStoredSchema,\n): SimpleFieldSchema<SchemaType.Stored> {\n\tlet kind: FieldKind;\n\tswitch (schema.kind) {\n\t\tcase FieldKinds.identifier.identifier: {\n\t\t\tkind = FieldKind.Identifier;\n\t\t\tbreak;\n\t\t}\n\t\tcase FieldKinds.optional.identifier: {\n\t\t\tkind = FieldKind.Optional;\n\t\t\tbreak;\n\t\t}\n\t\tcase FieldKinds.required.identifier: {\n\t\t\tkind = FieldKind.Required;\n\t\t\tbreak;\n\t\t}\n\t\tcase FieldKinds.forbidden.identifier: {\n\t\t\tkind = FieldKind.Optional;\n\t\t\tassert(schema.types.size === 0, 0xa94 /* invalid forbidden field */);\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tfail(0xaca /* invalid field kind */);\n\t\t}\n\t}\n\treturn {\n\t\tkind,\n\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(schema.types),\n\t\tmetadata: {},\n\t\tpersistedMetadata: schema.persistedMetadata,\n\t};\n}\n\n/**\n * Export a {@link SimpleNodeSchema} from a {@link TreeNodeStoredSchema}.\n * @privateRemarks\n * TODO: Persist node metadata once schema FormatV2 is supported.\n * Note on SimpleNodeSchema construction: In the persisted format `persistedMetadata` is just called `metadata` whereas the `metadata`\n * field on SimpleNodeSchema is not persisted.\n */\nfunction exportSimpleNodeSchemaStored(\n\tschema: TreeNodeStoredSchema,\n): SimpleNodeSchema<SchemaType.Stored> {\n\tconst arrayTypes = tryStoredSchemaAsArray(schema);\n\tif (arrayTypes !== undefined) {\n\t\treturn {\n\t\t\tkind: NodeKind.Array,\n\t\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(arrayTypes),\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst fields = new Map<FieldKey, SimpleObjectFieldSchema<SchemaType.Stored>>();\n\t\tfor (const [storedKey, field] of schema.objectNodeFields) {\n\t\t\tfields.set(storedKey, { ...exportSimpleFieldSchemaStored(field), storedKey });\n\t\t}\n\t\treturn {\n\t\t\tkind: NodeKind.Object,\n\t\t\tfields,\n\t\t\tallowUnknownOptionalFields: undefined,\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tassert(\n\t\t\tschema.mapFields.kind === FieldKinds.optional.identifier,\n\t\t\t0xa95 /* Invalid map schema */,\n\t\t);\n\t\treturn {\n\t\t\tkind: NodeKind.Map,\n\t\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(\n\t\t\t\tschema.mapFields.types,\n\t\t\t),\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\treturn {\n\t\t\tkind: NodeKind.Leaf,\n\t\t\tleafKind: schema.leafValue,\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tfail(0xacb /* invalid schema kind */);\n}\n"]}
@@ -4,14 +4,13 @@
4
4
  */
5
5
  import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
6
6
  import { type CodecTree, type CodecWriteOptions, type ICodecFamily } from "../codec/index.js";
7
- import { type ChangeEncodingContext, SchemaFormatVersion } from "../core/index.js";
7
+ import type { ChangeEncodingContext } from "../core/index.js";
8
8
  import { ModularChangeFormatVersion, type ModularChangeset } from "../feature-libraries/index.js";
9
9
  import { type Values } from "../util/index.js";
10
10
  import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
11
11
  export declare function makeSharedTreeChangeCodecFamily(modularChangeCodecFamily: ICodecFamily<ModularChangeset, ChangeEncodingContext>, options: CodecWriteOptions): ICodecFamily<SharedTreeChange, ChangeEncodingContext>;
12
12
  interface ChangeFormatDependencies {
13
13
  readonly modularChange: ModularChangeFormatVersion;
14
- readonly schemaChange: SchemaFormatVersion;
15
14
  }
16
15
  /**
17
16
  * The format version for `SharedTreeChange`.
@@ -27,6 +26,8 @@ export type SharedTreeChangeFormatVersion = Values<typeof SharedTreeChangeFormat
27
26
  * This is an arbitrary mapping that is injected in the SharedTree change codec.
28
27
  * Once an entry is defined and used in production, it cannot be changed.
29
28
  * This is because the format for the dependent formats are not explicitly versioned.
29
+ * @remarks
30
+ * SchemaFormatVersion (used by SchemaChangeFormat) is not included here since it is explicitly versioned.
30
31
  */
31
32
  export declare const dependenciesForChangeFormat: Map<SharedTreeChangeFormatVersion, ChangeFormatDependencies>;
32
33
  export declare function getCodecTreeForChangeFormat(version: SharedTreeChangeFormatVersion, clientVersion: MinimumVersionForCollab): CodecTree;
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeChangeCodecs.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAE5F,OAAO,EACN,KAAK,SAAS,EACd,KAAK,iBAAiB,EAGtB,KAAK,YAAY,EAKjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,KAAK,qBAAqB,EAC1B,mBAAmB,EAEnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,0BAA0B,EAC1B,KAAK,gBAAgB,EAMrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAIN,KAAK,MAAM,EACX,MAAM,kBAAkB,CAAC;AAM1B,OAAO,KAAK,EAAE,gBAAgB,EAAyB,MAAM,4BAA4B,CAAC;AAE1F,wBAAgB,+BAA+B,CAC9C,wBAAwB,EAAE,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,EAC/E,OAAO,EAAE,iBAAiB,GACxB,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAqBvD;AAED,UAAU,wBAAwB;IACjC,QAAQ,CAAC,aAAa,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CAAC,CAAC;AAEzF;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,8DAsBtC,CAAC;AAEH,wBAAgB,2BAA2B,CAC1C,OAAO,EAAE,6BAA6B,EACtC,aAAa,EAAE,uBAAuB,GACpC,SAAS,CAWX"}
@@ -7,15 +7,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.getCodecTreeForChangeFormat = exports.dependenciesForChangeFormat = exports.SharedTreeChangeFormatVersion = exports.makeSharedTreeChangeCodecFamily = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const index_js_1 = require("../codec/index.js");
10
- const index_js_2 = require("../core/index.js");
11
- const index_js_3 = require("../feature-libraries/index.js");
12
- const index_js_4 = require("../util/index.js");
10
+ const index_js_2 = require("../feature-libraries/index.js");
11
+ const index_js_3 = require("../util/index.js");
13
12
  const sharedTreeChangeFormat_js_1 = require("./sharedTreeChangeFormat.js");
14
13
  function makeSharedTreeChangeCodecFamily(modularChangeCodecFamily, options) {
15
- const schemaChangeCodecs = (0, index_js_3.makeSchemaChangeCodecs)(options);
16
- const versions = [...exports.dependenciesForChangeFormat.entries()].map(([format, { modularChange, schemaChange }]) => [
14
+ const versions = [...exports.dependenciesForChangeFormat.entries()].map(([format, { modularChange }]) => [
17
15
  format,
18
- makeSharedTreeChangeCodec(modularChangeCodecFamily.resolve(modularChange), schemaChangeCodecs.resolve(schemaChange), options),
16
+ makeSharedTreeChangeCodec(modularChangeCodecFamily.resolve(modularChange), options),
19
17
  ]);
20
18
  return (0, index_js_1.makeCodecFamily)(versions);
21
19
  }
@@ -23,7 +21,7 @@ exports.makeSharedTreeChangeCodecFamily = makeSharedTreeChangeCodecFamily;
23
21
  /**
24
22
  * The format version for `SharedTreeChange`.
25
23
  */
26
- exports.SharedTreeChangeFormatVersion = (0, index_js_4.strictEnum)("SharedTreeChangeFormatVersion", {
24
+ exports.SharedTreeChangeFormatVersion = (0, index_js_3.strictEnum)("SharedTreeChangeFormatVersion", {
27
25
  /**
28
26
  * Introduced prior to 2.0 and used beyond.
29
27
  * Reading capability must be maintained for backwards compatibility.
@@ -50,34 +48,43 @@ exports.SharedTreeChangeFormatVersion = (0, index_js_4.strictEnum)("SharedTreeCh
50
48
  * This is an arbitrary mapping that is injected in the SharedTree change codec.
51
49
  * Once an entry is defined and used in production, it cannot be changed.
52
50
  * This is because the format for the dependent formats are not explicitly versioned.
51
+ * @remarks
52
+ * SchemaFormatVersion (used by SchemaChangeFormat) is not included here since it is explicitly versioned.
53
53
  */
54
54
  exports.dependenciesForChangeFormat = new Map([
55
55
  [
56
56
  exports.SharedTreeChangeFormatVersion.v3,
57
- { modularChange: index_js_3.ModularChangeFormatVersion.v3, schemaChange: index_js_2.SchemaFormatVersion.v1 },
57
+ {
58
+ modularChange: index_js_2.ModularChangeFormatVersion.v3,
59
+ },
58
60
  ],
59
61
  [
60
62
  exports.SharedTreeChangeFormatVersion.v4,
61
- { modularChange: index_js_3.ModularChangeFormatVersion.v4, schemaChange: index_js_2.SchemaFormatVersion.v1 },
63
+ {
64
+ modularChange: index_js_2.ModularChangeFormatVersion.v4,
65
+ },
62
66
  ],
63
67
  [
64
68
  exports.SharedTreeChangeFormatVersion.v5,
65
- { modularChange: index_js_3.ModularChangeFormatVersion.v5, schemaChange: index_js_2.SchemaFormatVersion.v1 },
69
+ {
70
+ modularChange: index_js_2.ModularChangeFormatVersion.v5,
71
+ },
66
72
  ],
67
73
  ]);
68
74
  function getCodecTreeForChangeFormat(version, clientVersion) {
69
- const { modularChange, schemaChange } = exports.dependenciesForChangeFormat.get(version) ?? (0, internal_1.fail)(0xc78 /* Unknown change format */);
75
+ const { modularChange } = exports.dependenciesForChangeFormat.get(version) ?? (0, internal_1.fail)(0xc78 /* Unknown change format */);
70
76
  return {
71
77
  name: "SharedTreeChange",
72
78
  version,
73
79
  children: [
74
- (0, index_js_3.getCodecTreeForModularChangeFormat)(modularChange),
75
- (0, index_js_3.getCodecTreeForSchemaChangeFormat)(schemaChange, clientVersion),
80
+ (0, index_js_2.getCodecTreeForModularChangeFormat)(modularChange),
81
+ index_js_2.schemaCodecBuilder.getCodecTree(clientVersion),
76
82
  ],
77
83
  };
78
84
  }
79
85
  exports.getCodecTreeForChangeFormat = getCodecTreeForChangeFormat;
80
- function makeSharedTreeChangeCodec(modularChangeCodec, schemaChangeCodec, codecOptions) {
86
+ function makeSharedTreeChangeCodec(modularChangeCodec, codecOptions) {
87
+ const schemaChangeCodec = (0, index_js_2.makeSchemaChangeCodec)(codecOptions);
81
88
  const decoderLibrary = new index_js_1.DiscriminatedUnionDispatcher({
82
89
  data(encoded, context) {
83
90
  return {
@@ -92,7 +99,7 @@ function makeSharedTreeChangeCodec(modularChangeCodec, schemaChangeCodec, codecO
92
99
  };
93
100
  },
94
101
  });
95
- return (0, index_js_1.withSchemaValidation)(sharedTreeChangeFormat_js_1.EncodedSharedTreeChange, {
102
+ return (0, index_js_1.withSchemaValidation)((0, sharedTreeChangeFormat_js_1.EncodedSharedTreeChange)(schemaChangeCodec.encodedSchema), {
96
103
  encode: (change, context) => {
97
104
  const changes = [];
98
105
  let updatedSchema;
@@ -102,7 +109,7 @@ function makeSharedTreeChangeCodec(modularChangeCodec, schemaChangeCodec, codecO
102
109
  ? context.schema
103
110
  : {
104
111
  policy: context.schema === undefined
105
- ? index_js_3.defaultSchemaPolicy
112
+ ? index_js_2.defaultSchemaPolicy
106
113
  : context.schema.policy,
107
114
  schema: updatedSchema,
108
115
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeChangeCodecs.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeCodecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA2D;AAG3D,gDAU2B;AAC3B,+CAI0B;AAC1B,4DAQuC;AACvC,+CAK0B;AAE1B,2EAGqC;AAGrC,SAAgB,+BAA+B,CAC9C,wBAA+E,EAC/E,OAA0B;IAE1B,MAAM,kBAAkB,GAAG,IAAA,iCAAsB,EAAC,OAA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Z,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,EAAE;4BAC1D,YAAY,EAAE,OAAO,CAAC,YAAY;4BAClC,MAAM,EAAE,eAAe;4BACvB,YAAY,EAAE,OAAO,CAAC,YAAY;4BAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ;yBAC1B,CAAC;qBACF,CAAC,CAAC;gBACJ,CAAC;qBAAM,IAAI,aAAa,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBAC5C,OAAO,CAAC,IAAI,CAAC;wBACZ,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC;qBAC3D,CAAC,CAAC;oBACH,aAAa,GAAG,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC;gBACtD,CAAC;YACF,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE;YAClC,MAAM,OAAO,GAAyC,EAAE,CAAC;YACzD,KAAK,MAAM,SAAS,IAAI,aAAa,EAAE,CAAC;gBACvC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;YAC3D,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,CAAC;QACpB,CAAC;KACD,EACD,YAAY,CAAC,aAAa,CAC1B,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tDiscriminatedUnionDispatcher,\n\ttype FormatVersion,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\twithSchemaValidation,\n} from \"../codec/index.js\";\nimport {\n\ttype ChangeEncodingContext,\n\tSchemaFormatVersion,\n\ttype TreeStoredSchema,\n} from \"../core/index.js\";\nimport {\n\tModularChangeFormatVersion,\n\ttype ModularChangeset,\n\ttype SchemaChange,\n\tdefaultSchemaPolicy,\n\tgetCodecTreeForModularChangeFormat,\n\tgetCodecTreeForSchemaChangeFormat,\n\tmakeSchemaChangeCodecs,\n} from \"../feature-libraries/index.js\";\nimport {\n\tstrictEnum,\n\ttype JsonCompatibleReadOnly,\n\ttype Mutable,\n\ttype Values,\n} from \"../util/index.js\";\n\nimport {\n\tEncodedSharedTreeChange,\n\ttype EncodedSharedTreeInnerChange,\n} from \"./sharedTreeChangeFormat.js\";\nimport type { SharedTreeChange, SharedTreeInnerChange } from \"./sharedTreeChangeTypes.js\";\n\nexport function makeSharedTreeChangeCodecFamily(\n\tmodularChangeCodecFamily: ICodecFamily<ModularChangeset, ChangeEncodingContext>,\n\toptions: CodecWriteOptions,\n): ICodecFamily<SharedTreeChange, ChangeEncodingContext> {\n\tconst schemaChangeCodecs = makeSchemaChangeCodecs(options);\n\tconst versions: [\n\t\tFormatVersion,\n\t\tIJsonCodec<\n\t\t\tSharedTreeChange,\n\t\t\tEncodedSharedTreeChange,\n\t\t\tEncodedSharedTreeChange,\n\t\t\tChangeEncodingContext\n\t\t>,\n\t][] = [...dependenciesForChangeFormat.entries()].map(\n\t\t([format, { modularChange, schemaChange }]) => [\n\t\t\tformat,\n\t\t\tmakeSharedTreeChangeCodec(\n\t\t\t\tmodularChangeCodecFamily.resolve(modularChange),\n\t\t\t\tschemaChangeCodecs.resolve(schemaChange),\n\t\t\t\toptions,\n\t\t\t),\n\t\t],\n\t);\n\treturn makeCodecFamily(versions);\n}\n\ninterface ChangeFormatDependencies {\n\treadonly modularChange: ModularChangeFormatVersion;\n\treadonly schemaChange: SchemaFormatVersion;\n}\n\n/**\n * The format version for `SharedTreeChange`.\n */\nexport const SharedTreeChangeFormatVersion = strictEnum(\"SharedTreeChangeFormatVersion\", {\n\t/**\n\t * Introduced prior to 2.0 and used beyond.\n\t * Reading capability must be maintained for backwards compatibility.\n\t * Writing capability needs to be maintained so long as {@link lowestMinVersionForCollab} is less than 2.2.0.\n\t */\n\tv3: 3,\n\t/**\n\t * Introduced in 2.2.0.\n\t * Was inadvertently made usable for writing in 2.43.0 (through configuredSharedTree) and remains available.\n\t * Reading capability must be maintained for backwards compatibility.\n\t * Writing capability could be dropped in favor of {@link SharedTreeChangeFormatVersion.v3},\n\t * but doing so would make the pattern of writable versions more complex and gain little\n\t * because the logic for this format is shared with {@link SharedTreeChangeFormatVersion.v3}.\n\t */\n\tv4: 4,\n\t/**\n\t * Introduced and made available for writing in 2.80.0\n\t * Adds support for \"no change\" constraints.\n\t */\n\tv5: 5,\n});\nexport type SharedTreeChangeFormatVersion = Values<typeof SharedTreeChangeFormatVersion>;\n\n/**\n * Defines for each SharedTree change format the corresponding dependent formats to use.\n * This is an arbitrary mapping that is injected in the SharedTree change codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for the dependent formats are not explicitly versioned.\n */\nexport const dependenciesForChangeFormat = new Map<\n\tSharedTreeChangeFormatVersion,\n\tChangeFormatDependencies\n>([\n\t[\n\t\tSharedTreeChangeFormatVersion.v3,\n\t\t{ modularChange: ModularChangeFormatVersion.v3, schemaChange: SchemaFormatVersion.v1 },\n\t],\n\t[\n\t\tSharedTreeChangeFormatVersion.v4,\n\t\t{ modularChange: ModularChangeFormatVersion.v4, schemaChange: SchemaFormatVersion.v1 },\n\t],\n\t[\n\t\tSharedTreeChangeFormatVersion.v5,\n\t\t{ modularChange: ModularChangeFormatVersion.v5, schemaChange: SchemaFormatVersion.v1 },\n\t],\n]);\n\nexport function getCodecTreeForChangeFormat(\n\tversion: SharedTreeChangeFormatVersion,\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\tconst { modularChange, schemaChange } =\n\t\tdependenciesForChangeFormat.get(version) ?? fail(0xc78 /* Unknown change format */);\n\treturn {\n\t\tname: \"SharedTreeChange\",\n\t\tversion,\n\t\tchildren: [\n\t\t\tgetCodecTreeForModularChangeFormat(modularChange),\n\t\t\tgetCodecTreeForSchemaChangeFormat(schemaChange, clientVersion),\n\t\t],\n\t};\n}\n\nfunction makeSharedTreeChangeCodec(\n\tmodularChangeCodec: IJsonCodec<\n\t\tModularChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\tschemaChangeCodec: IJsonCodec<SchemaChange>,\n\tcodecOptions: ICodecOptions,\n): IJsonCodec<\n\tSharedTreeChange,\n\tEncodedSharedTreeChange,\n\tEncodedSharedTreeChange,\n\tChangeEncodingContext\n> {\n\tconst decoderLibrary = new DiscriminatedUnionDispatcher<\n\t\tEncodedSharedTreeInnerChange,\n\t\t[context: ChangeEncodingContext],\n\t\tSharedTreeInnerChange\n\t>({\n\t\tdata(encoded, context): SharedTreeInnerChange {\n\t\t\treturn {\n\t\t\t\ttype: \"data\",\n\t\t\t\tinnerChange: modularChangeCodec.decode(encoded, context),\n\t\t\t};\n\t\t},\n\t\tschema(encoded): SharedTreeInnerChange {\n\t\t\treturn {\n\t\t\t\ttype: \"schema\",\n\t\t\t\tinnerChange: schemaChangeCodec.decode(encoded),\n\t\t\t};\n\t\t},\n\t});\n\n\treturn withSchemaValidation(\n\t\tEncodedSharedTreeChange,\n\t\t{\n\t\t\tencode: (change, context) => {\n\t\t\t\tconst changes: EncodedSharedTreeInnerChange[] = [];\n\t\t\t\tlet updatedSchema: TreeStoredSchema | undefined;\n\t\t\t\tfor (const decodedChange of change.changes) {\n\t\t\t\t\tif (decodedChange.type === \"data\") {\n\t\t\t\t\t\tconst schemaAndPolicy =\n\t\t\t\t\t\t\tupdatedSchema === undefined\n\t\t\t\t\t\t\t\t? context.schema\n\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\tpolicy:\n\t\t\t\t\t\t\t\t\t\t\tcontext.schema === undefined\n\t\t\t\t\t\t\t\t\t\t\t\t? defaultSchemaPolicy\n\t\t\t\t\t\t\t\t\t\t\t\t: context.schema.policy,\n\t\t\t\t\t\t\t\t\t\tschema: updatedSchema,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\tchanges.push({\n\t\t\t\t\t\t\tdata: modularChangeCodec.encode(decodedChange.innerChange, {\n\t\t\t\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t\t\t\t\tschema: schemaAndPolicy,\n\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\trevision: context.revision,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t\t\t} else if (decodedChange.type === \"schema\") {\n\t\t\t\t\t\tchanges.push({\n\t\t\t\t\t\t\tschema: schemaChangeCodec.encode(decodedChange.innerChange),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tupdatedSchema = decodedChange.innerChange.schema.new;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn changes;\n\t\t\t},\n\t\t\tdecode: (encodedChange, context) => {\n\t\t\t\tconst changes: Mutable<SharedTreeChange[\"changes\"]> = [];\n\t\t\t\tfor (const subChange of encodedChange) {\n\t\t\t\t\tchanges.push(decoderLibrary.dispatch(subChange, context));\n\t\t\t\t}\n\t\t\t\treturn { changes };\n\t\t\t},\n\t\t},\n\t\tcodecOptions.jsonValidator,\n\t);\n}\n"]}
1
+ {"version":3,"file":"sharedTreeChangeCodecs.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeCodecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA2D;AAG3D,gDAS2B;AAE3B,4DAOuC;AACvC,+CAK0B;AAE1B,2EAGqC;AAGrC,SAAgB,+BAA+B,CAC9C,wBAA+E,EAC/E,OAA0B;IAE1B,MAAM,QAAQ,GAQR,CAAC,GAAG,mCAA2B,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,E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ACF,CAAC,CAAC;gBACJ,CAAC;qBAAM,IAAI,aAAa,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBAC5C,OAAO,CAAC,IAAI,CAAC;wBACZ,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC;qBAC3D,CAAC,CAAC;oBACH,aAAa,GAAG,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC;gBACtD,CAAC;YACF,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE;YAClC,MAAM,OAAO,GAAyC,EAAE,CAAC;YACzD,KAAK,MAAM,SAAS,IAAI,aAAa,EAAE,CAAC;gBACvC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;YAC3D,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,CAAC;QACpB,CAAC;KACD,EACD,YAAY,CAAC,aAAa,CAC1B,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tDiscriminatedUnionDispatcher,\n\ttype FormatVersion,\n\ttype ICodecFamily,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\twithSchemaValidation,\n} from \"../codec/index.js\";\nimport type { ChangeEncodingContext, TreeStoredSchema } from \"../core/index.js\";\nimport {\n\tModularChangeFormatVersion,\n\ttype ModularChangeset,\n\tdefaultSchemaPolicy,\n\tgetCodecTreeForModularChangeFormat,\n\tmakeSchemaChangeCodec,\n\tschemaCodecBuilder,\n} from \"../feature-libraries/index.js\";\nimport {\n\tstrictEnum,\n\ttype JsonCompatibleReadOnly,\n\ttype Mutable,\n\ttype Values,\n} from \"../util/index.js\";\n\nimport {\n\tEncodedSharedTreeChange,\n\ttype EncodedSharedTreeInnerChange,\n} from \"./sharedTreeChangeFormat.js\";\nimport type { SharedTreeChange, SharedTreeInnerChange } from \"./sharedTreeChangeTypes.js\";\n\nexport function makeSharedTreeChangeCodecFamily(\n\tmodularChangeCodecFamily: ICodecFamily<ModularChangeset, ChangeEncodingContext>,\n\toptions: CodecWriteOptions,\n): ICodecFamily<SharedTreeChange, ChangeEncodingContext> {\n\tconst versions: [\n\t\tFormatVersion,\n\t\tIJsonCodec<\n\t\t\tSharedTreeChange,\n\t\t\tEncodedSharedTreeChange,\n\t\t\tEncodedSharedTreeChange,\n\t\t\tChangeEncodingContext\n\t\t>,\n\t][] = [...dependenciesForChangeFormat.entries()].map(([format, { modularChange }]) => [\n\t\tformat,\n\t\tmakeSharedTreeChangeCodec(modularChangeCodecFamily.resolve(modularChange), options),\n\t]);\n\treturn makeCodecFamily(versions);\n}\n\ninterface ChangeFormatDependencies {\n\treadonly modularChange: ModularChangeFormatVersion;\n}\n\n/**\n * The format version for `SharedTreeChange`.\n */\nexport const SharedTreeChangeFormatVersion = strictEnum(\"SharedTreeChangeFormatVersion\", {\n\t/**\n\t * Introduced prior to 2.0 and used beyond.\n\t * Reading capability must be maintained for backwards compatibility.\n\t * Writing capability needs to be maintained so long as {@link lowestMinVersionForCollab} is less than 2.2.0.\n\t */\n\tv3: 3,\n\t/**\n\t * Introduced in 2.2.0.\n\t * Was inadvertently made usable for writing in 2.43.0 (through configuredSharedTree) and remains available.\n\t * Reading capability must be maintained for backwards compatibility.\n\t * Writing capability could be dropped in favor of {@link SharedTreeChangeFormatVersion.v3},\n\t * but doing so would make the pattern of writable versions more complex and gain little\n\t * because the logic for this format is shared with {@link SharedTreeChangeFormatVersion.v3}.\n\t */\n\tv4: 4,\n\t/**\n\t * Introduced and made available for writing in 2.80.0\n\t * Adds support for \"no change\" constraints.\n\t */\n\tv5: 5,\n});\nexport type SharedTreeChangeFormatVersion = Values<typeof SharedTreeChangeFormatVersion>;\n\n/**\n * Defines for each SharedTree change format the corresponding dependent formats to use.\n * This is an arbitrary mapping that is injected in the SharedTree change codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for the dependent formats are not explicitly versioned.\n * @remarks\n * SchemaFormatVersion (used by SchemaChangeFormat) is not included here since it is explicitly versioned.\n */\nexport const dependenciesForChangeFormat = new Map<\n\tSharedTreeChangeFormatVersion,\n\tChangeFormatDependencies\n>([\n\t[\n\t\tSharedTreeChangeFormatVersion.v3,\n\t\t{\n\t\t\tmodularChange: ModularChangeFormatVersion.v3,\n\t\t},\n\t],\n\t[\n\t\tSharedTreeChangeFormatVersion.v4,\n\t\t{\n\t\t\tmodularChange: ModularChangeFormatVersion.v4,\n\t\t},\n\t],\n\t[\n\t\tSharedTreeChangeFormatVersion.v5,\n\t\t{\n\t\t\tmodularChange: ModularChangeFormatVersion.v5,\n\t\t},\n\t],\n]);\n\nexport function getCodecTreeForChangeFormat(\n\tversion: SharedTreeChangeFormatVersion,\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\tconst { modularChange } =\n\t\tdependenciesForChangeFormat.get(version) ?? fail(0xc78 /* Unknown change format */);\n\treturn {\n\t\tname: \"SharedTreeChange\",\n\t\tversion,\n\t\tchildren: [\n\t\t\tgetCodecTreeForModularChangeFormat(modularChange),\n\t\t\tschemaCodecBuilder.getCodecTree(clientVersion),\n\t\t],\n\t};\n}\n\nfunction makeSharedTreeChangeCodec(\n\tmodularChangeCodec: IJsonCodec<\n\t\tModularChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\tcodecOptions: CodecWriteOptions,\n): IJsonCodec<\n\tSharedTreeChange,\n\tEncodedSharedTreeChange,\n\tEncodedSharedTreeChange,\n\tChangeEncodingContext\n> {\n\tconst schemaChangeCodec = makeSchemaChangeCodec(codecOptions);\n\tconst decoderLibrary = new DiscriminatedUnionDispatcher<\n\t\tEncodedSharedTreeInnerChange,\n\t\t[context: ChangeEncodingContext],\n\t\tSharedTreeInnerChange\n\t>({\n\t\tdata(encoded, context): SharedTreeInnerChange {\n\t\t\treturn {\n\t\t\t\ttype: \"data\",\n\t\t\t\tinnerChange: modularChangeCodec.decode(encoded, context),\n\t\t\t};\n\t\t},\n\t\tschema(encoded): SharedTreeInnerChange {\n\t\t\treturn {\n\t\t\t\ttype: \"schema\",\n\t\t\t\tinnerChange: schemaChangeCodec.decode(encoded),\n\t\t\t};\n\t\t},\n\t});\n\n\treturn withSchemaValidation(\n\t\tEncodedSharedTreeChange(schemaChangeCodec.encodedSchema),\n\t\t{\n\t\t\tencode: (change, context) => {\n\t\t\t\tconst changes: EncodedSharedTreeInnerChange[] = [];\n\t\t\t\tlet updatedSchema: TreeStoredSchema | undefined;\n\t\t\t\tfor (const decodedChange of change.changes) {\n\t\t\t\t\tif (decodedChange.type === \"data\") {\n\t\t\t\t\t\tconst schemaAndPolicy =\n\t\t\t\t\t\t\tupdatedSchema === undefined\n\t\t\t\t\t\t\t\t? context.schema\n\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\tpolicy:\n\t\t\t\t\t\t\t\t\t\t\tcontext.schema === undefined\n\t\t\t\t\t\t\t\t\t\t\t\t? defaultSchemaPolicy\n\t\t\t\t\t\t\t\t\t\t\t\t: context.schema.policy,\n\t\t\t\t\t\t\t\t\t\tschema: updatedSchema,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\tchanges.push({\n\t\t\t\t\t\t\tdata: modularChangeCodec.encode(decodedChange.innerChange, {\n\t\t\t\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t\t\t\t\tschema: schemaAndPolicy,\n\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\trevision: context.revision,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t\t\t} else if (decodedChange.type === \"schema\") {\n\t\t\t\t\t\tchanges.push({\n\t\t\t\t\t\t\tschema: schemaChangeCodec.encode(decodedChange.innerChange),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tupdatedSchema = decodedChange.innerChange.schema.new;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn changes;\n\t\t\t},\n\t\t\tdecode: (encodedChange, context) => {\n\t\t\t\tconst changes: Mutable<SharedTreeChange[\"changes\"]> = [];\n\t\t\t\tfor (const subChange of encodedChange) {\n\t\t\t\t\tchanges.push(decoderLibrary.dispatch(subChange, context));\n\t\t\t\t}\n\t\t\t\treturn { changes };\n\t\t\t},\n\t\t},\n\t\tcodecOptions.jsonValidator,\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeChangeEnricher.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeEnricher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAGN,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAG/B,MAAM,kBAAkB,CAAC;AAS1B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,UAAU,aAAa;IACtB,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,0BAA0B,CAAC;CAClD;AAED,UAAU,UAAU;IACnB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAC;CAC1C;AAED,qBAAa,wBAAwB;IAuBnC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CA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BAAgB,CAAC,GAAG,CAAC,MAAM,YAAY,CAAC,gBAAgB,CAAC,CAAC,GAC7E,IAAI;IAIP,OAAO,CAAC,gBAAgB;IAwCjB,CAAC,aAAa,CAAC,IAAI,IAAI;CAG9B"}
@@ -70,7 +70,7 @@ class SharedTreeChangeEnricher {
70
70
  if (this.owned === undefined) {
71
71
  this.onForkState?.();
72
72
  this.owned = {
73
- forest: this.borrowed.forest.clone(this.schema, new index_js_1.AnchorSet()),
73
+ forest: this.borrowed.forest.clone(this.schema),
74
74
  removedRoots: this.borrowed.removedRoots.clone(),
75
75
  };
76
76
  }