@fluidframework/tree 2.74.0 → 2.81.0-374083

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 (1318) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/api-report/tree.alpha.api.md +63 -9
  3. package/dist/alpha.d.ts +9 -0
  4. package/dist/codec/codec.d.ts +31 -3
  5. package/dist/codec/codec.d.ts.map +1 -1
  6. package/dist/codec/codec.js +10 -0
  7. package/dist/codec/codec.js.map +1 -1
  8. package/dist/codec/index.d.ts +2 -2
  9. package/dist/codec/index.d.ts.map +1 -1
  10. package/dist/codec/index.js +2 -2
  11. package/dist/codec/index.js.map +1 -1
  12. package/dist/codec/versioned/codec.d.ts +80 -22
  13. package/dist/codec/versioned/codec.d.ts.map +1 -1
  14. package/dist/codec/versioned/codec.js +137 -15
  15. package/dist/codec/versioned/codec.js.map +1 -1
  16. package/dist/codec/versioned/index.d.ts +1 -1
  17. package/dist/codec/versioned/index.d.ts.map +1 -1
  18. package/dist/codec/versioned/index.js +2 -2
  19. package/dist/codec/versioned/index.js.map +1 -1
  20. package/dist/core/change-family/changeFamily.d.ts +4 -1
  21. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  22. package/dist/core/change-family/changeFamily.js.map +1 -1
  23. package/dist/core/change-family/index.d.ts +1 -1
  24. package/dist/core/change-family/index.d.ts.map +1 -1
  25. package/dist/core/change-family/index.js.map +1 -1
  26. package/dist/core/index.d.ts +3 -3
  27. package/dist/core/index.d.ts.map +1 -1
  28. package/dist/core/index.js +7 -6
  29. package/dist/core/index.js.map +1 -1
  30. package/dist/core/rebase/changeRebaser.d.ts +42 -3
  31. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  32. package/dist/core/rebase/changeRebaser.js.map +1 -1
  33. package/dist/core/rebase/index.d.ts +2 -2
  34. package/dist/core/rebase/index.d.ts.map +1 -1
  35. package/dist/core/rebase/index.js +2 -2
  36. package/dist/core/rebase/index.js.map +1 -1
  37. package/dist/core/rebase/types.d.ts +52 -10
  38. package/dist/core/rebase/types.d.ts.map +1 -1
  39. package/dist/core/rebase/types.js +5 -12
  40. package/dist/core/rebase/types.js.map +1 -1
  41. package/dist/core/rebase/utils.d.ts.map +1 -1
  42. package/dist/core/rebase/utils.js +33 -11
  43. package/dist/core/rebase/utils.js.map +1 -1
  44. package/dist/core/schema-stored/schema.js +3 -3
  45. package/dist/core/schema-stored/schema.js.map +1 -1
  46. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  47. package/dist/core/tree/anchorSet.js +4 -4
  48. package/dist/core/tree/anchorSet.js.map +1 -1
  49. package/dist/core/tree/detachedFieldIndex.d.ts +7 -2
  50. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  51. package/dist/core/tree/detachedFieldIndex.js +21 -56
  52. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  53. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +18 -10
  54. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  55. package/dist/core/tree/detachedFieldIndexCodecCommon.js +6 -6
  56. package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  57. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts +2 -3
  58. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  59. package/dist/core/tree/detachedFieldIndexCodecV1.js +4 -5
  60. package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  61. package/dist/core/tree/detachedFieldIndexCodecV2.d.ts +2 -3
  62. package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  63. package/dist/core/tree/detachedFieldIndexCodecV2.js +4 -6
  64. package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  65. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +5 -6
  66. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  67. package/dist/core/tree/detachedFieldIndexCodecs.js +11 -41
  68. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  69. package/dist/core/tree/index.d.ts +2 -2
  70. package/dist/core/tree/index.d.ts.map +1 -1
  71. package/dist/core/tree/index.js +5 -4
  72. package/dist/core/tree/index.js.map +1 -1
  73. package/dist/core/tree/mapTree.js +1 -1
  74. package/dist/core/tree/mapTree.js.map +1 -1
  75. package/dist/core/tree/pathTree.d.ts +11 -3
  76. package/dist/core/tree/pathTree.d.ts.map +1 -1
  77. package/dist/core/tree/pathTree.js +14 -2
  78. package/dist/core/tree/pathTree.js.map +1 -1
  79. package/dist/core/tree/sparseTree.d.ts.map +1 -1
  80. package/dist/core/tree/sparseTree.js +1 -0
  81. package/dist/core/tree/sparseTree.js.map +1 -1
  82. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  83. package/dist/core/tree/treeTextFormat.js +5 -9
  84. package/dist/core/tree/treeTextFormat.js.map +1 -1
  85. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  86. package/dist/core/tree/visitDelta.js +3 -2
  87. package/dist/core/tree/visitDelta.js.map +1 -1
  88. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  89. package/dist/core/tree/visitorUtils.js +58 -18
  90. package/dist/core/tree/visitorUtils.js.map +1 -1
  91. package/dist/feature-libraries/changeAtomIdBTree.d.ts +16 -0
  92. package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -0
  93. package/dist/feature-libraries/changeAtomIdBTree.js +30 -0
  94. package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -0
  95. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  96. package/dist/feature-libraries/chunked-forest/basicChunk.js +8 -1
  97. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  98. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  99. package/dist/feature-libraries/chunked-forest/chunkTree.js +4 -1
  100. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  101. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  102. package/dist/feature-libraries/chunked-forest/chunkedForest.js +9 -7
  103. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  104. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  105. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +7 -4
  106. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  107. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  108. package/dist/feature-libraries/chunked-forest/codec/codecs.js +19 -11
  109. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  110. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -3
  111. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  112. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +9 -5
  113. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  114. package/dist/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  115. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  116. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +103 -44
  117. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  118. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +251 -77
  119. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  120. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -1
  121. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  122. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +22 -3
  123. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  124. package/dist/feature-libraries/default-schema/index.d.ts +2 -1
  125. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  126. package/dist/feature-libraries/default-schema/index.js +5 -2
  127. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  128. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +38 -0
  129. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
  130. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js +132 -0
  131. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
  132. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +9 -6
  133. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  134. package/dist/feature-libraries/default-schema/mappedEditBuilder.js +21 -0
  135. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  136. package/dist/feature-libraries/deltaUtils.d.ts +1 -0
  137. package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
  138. package/dist/feature-libraries/deltaUtils.js +6 -1
  139. package/dist/feature-libraries/deltaUtils.js.map +1 -1
  140. package/dist/feature-libraries/flex-tree/context.d.ts +9 -0
  141. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  142. package/dist/feature-libraries/flex-tree/context.js +6 -0
  143. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  144. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
  145. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  146. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  147. package/dist/feature-libraries/flex-tree/lazyField.d.ts +8 -7
  148. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  149. package/dist/feature-libraries/flex-tree/lazyField.js +44 -15
  150. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  151. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  152. package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -1
  153. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  154. package/dist/feature-libraries/index.d.ts +5 -4
  155. package/dist/feature-libraries/index.d.ts.map +1 -1
  156. package/dist/feature-libraries/index.js +15 -8
  157. package/dist/feature-libraries/index.js.map +1 -1
  158. package/dist/feature-libraries/indexing/anchorTreeIndex.js +6 -6
  159. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  160. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  161. package/dist/feature-libraries/mapTreeCursor.js +1 -0
  162. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  163. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  164. package/dist/feature-libraries/mitigatedChangeFamily.js +12 -3
  165. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  166. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  167. package/dist/feature-libraries/modular-schema/comparison.js +12 -9
  168. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  169. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +97 -21
  170. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  171. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +4 -7
  172. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  173. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +25 -0
  174. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -0
  175. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +59 -0
  176. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -0
  177. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +22 -53
  178. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  179. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  180. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  181. package/dist/feature-libraries/modular-schema/genericFieldKind.js +7 -13
  182. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  183. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +2 -2
  184. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  185. package/dist/feature-libraries/modular-schema/index.d.ts +7 -5
  186. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  187. package/dist/feature-libraries/modular-schema/index.js +12 -8
  188. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  189. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +32 -0
  190. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -0
  191. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +409 -0
  192. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -0
  193. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +15 -0
  194. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -0
  195. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +31 -0
  196. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -0
  197. package/dist/feature-libraries/modular-schema/modularChangeCodecV3.d.ts +15 -0
  198. package/dist/feature-libraries/modular-schema/modularChangeCodecV3.d.ts.map +1 -0
  199. package/dist/feature-libraries/modular-schema/modularChangeCodecV3.js +393 -0
  200. package/dist/feature-libraries/modular-schema/modularChangeCodecV3.js.map +1 -0
  201. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  202. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  203. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +32 -288
  204. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  205. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +60 -26
  206. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  207. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1519 -615
  208. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  209. package/{lib/feature-libraries/modular-schema/modularChangeFormat.d.ts → dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts} +5 -6
  210. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -0
  211. package/dist/feature-libraries/modular-schema/{modularChangeFormat.js → modularChangeFormatV1.js} +7 -7
  212. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -0
  213. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +112 -0
  214. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -0
  215. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +21 -0
  216. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -0
  217. package/dist/feature-libraries/modular-schema/modularChangeFormatV3.d.ts +146 -0
  218. package/dist/feature-libraries/modular-schema/modularChangeFormatV3.d.ts.map +1 -0
  219. package/dist/feature-libraries/modular-schema/modularChangeFormatV3.js +32 -0
  220. package/dist/feature-libraries/modular-schema/modularChangeFormatV3.js.map +1 -0
  221. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +59 -13
  222. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  223. package/dist/feature-libraries/modular-schema/modularChangeTypes.js +3 -3
  224. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  225. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -1
  226. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  227. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  228. package/dist/feature-libraries/object-forest/objectForest.js +7 -5
  229. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  230. package/dist/feature-libraries/optional-field/index.d.ts +2 -2
  231. package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
  232. package/dist/feature-libraries/optional-field/index.js +1 -2
  233. package/dist/feature-libraries/optional-field/index.js.map +1 -1
  234. package/dist/feature-libraries/optional-field/optionalField.d.ts +5 -26
  235. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  236. package/dist/feature-libraries/optional-field/optionalField.js +223 -450
  237. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  238. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +23 -0
  239. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +1 -0
  240. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +31 -0
  241. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +1 -0
  242. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +24 -33
  243. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
  244. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
  245. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
  246. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  247. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js +57 -28
  248. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  249. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +12 -0
  250. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +1 -0
  251. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js +57 -0
  252. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js.map +1 -0
  253. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  254. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +5 -1
  255. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  256. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  257. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +14 -2
  258. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  259. package/dist/feature-libraries/schema-index/codec.d.ts +7 -21
  260. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  261. package/dist/feature-libraries/schema-index/codec.js +28 -70
  262. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  263. package/dist/feature-libraries/schema-index/index.d.ts +2 -2
  264. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  265. package/dist/feature-libraries/schema-index/index.js +2 -5
  266. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  267. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +1 -9
  268. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  269. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -12
  270. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  271. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
  272. package/dist/feature-libraries/schemaChecker.js +11 -6
  273. package/dist/feature-libraries/schemaChecker.js.map +1 -1
  274. package/dist/feature-libraries/sequence-field/compose.d.ts +6 -7
  275. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  276. package/dist/feature-libraries/sequence-field/compose.js +91 -263
  277. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  278. package/dist/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
  279. package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  280. package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  281. package/dist/feature-libraries/sequence-field/index.d.ts +2 -3
  282. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  283. package/dist/feature-libraries/sequence-field/index.js +1 -3
  284. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  285. package/dist/feature-libraries/sequence-field/invert.d.ts +3 -3
  286. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  287. package/dist/feature-libraries/sequence-field/invert.js +67 -168
  288. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  289. package/dist/feature-libraries/sequence-field/markQueue.d.ts +2 -2
  290. package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  291. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  292. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
  293. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  294. package/dist/feature-libraries/sequence-field/moveEffectTable.js +10 -87
  295. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  296. package/dist/feature-libraries/sequence-field/rebase.d.ts +3 -3
  297. package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  298. package/dist/feature-libraries/sequence-field/rebase.js +120 -119
  299. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  300. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts +2 -2
  301. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  302. package/dist/feature-libraries/sequence-field/replaceRevisions.js +35 -43
  303. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  304. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  305. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +0 -2
  306. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  307. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
  308. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  309. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +365 -179
  310. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  311. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  312. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +20 -60
  313. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  314. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
  315. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  316. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
  317. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  318. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
  319. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  320. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +20 -112
  321. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  322. package/dist/feature-libraries/sequence-field/types.d.ts +30 -59
  323. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  324. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  325. package/dist/feature-libraries/sequence-field/utils.d.ts +15 -24
  326. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  327. package/dist/feature-libraries/sequence-field/utils.js +148 -318
  328. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  329. package/dist/feature-libraries/treeCursorUtils.js +7 -7
  330. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  331. package/dist/feature-libraries/treeTextCursor.js +2 -2
  332. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  333. package/dist/feature-libraries/valueUtilities.d.ts.map +1 -1
  334. package/dist/feature-libraries/valueUtilities.js +16 -8
  335. package/dist/feature-libraries/valueUtilities.js.map +1 -1
  336. package/dist/index.d.ts +4 -3
  337. package/dist/index.d.ts.map +1 -1
  338. package/dist/index.js +4 -1
  339. package/dist/index.js.map +1 -1
  340. package/dist/packageVersion.d.ts +1 -1
  341. package/dist/packageVersion.d.ts.map +1 -1
  342. package/dist/packageVersion.js +1 -1
  343. package/dist/packageVersion.js.map +1 -1
  344. package/dist/shared-tree/index.d.ts +1 -1
  345. package/dist/shared-tree/index.d.ts.map +1 -1
  346. package/dist/shared-tree/index.js.map +1 -1
  347. package/dist/shared-tree/schematizeTree.d.ts +4 -4
  348. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  349. package/dist/shared-tree/schematizeTree.js +2 -1
  350. package/dist/shared-tree/schematizeTree.js.map +1 -1
  351. package/dist/shared-tree/schematizingTreeView.d.ts +3 -8
  352. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  353. package/dist/shared-tree/schematizingTreeView.js +58 -44
  354. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  355. package/dist/shared-tree/sharedTree.d.ts +9 -3
  356. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  357. package/dist/shared-tree/sharedTree.js +72 -44
  358. package/dist/shared-tree/sharedTree.js.map +1 -1
  359. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  360. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  361. package/dist/shared-tree/sharedTreeChangeCodecs.js +10 -8
  362. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  363. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  364. package/dist/shared-tree/sharedTreeChangeEnricher.js +5 -3
  365. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  366. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +7 -6
  367. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  368. package/dist/shared-tree/sharedTreeChangeFamily.js +29 -18
  369. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  370. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
  371. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  372. package/dist/shared-tree/sharedTreeEditBuilder.js +14 -7
  373. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  374. package/dist/shared-tree/treeAlpha.d.ts +35 -29
  375. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  376. package/dist/shared-tree/treeAlpha.js +21 -23
  377. package/dist/shared-tree/treeAlpha.js.map +1 -1
  378. package/dist/shared-tree/treeCheckout.d.ts +11 -10
  379. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  380. package/dist/shared-tree/treeCheckout.js +93 -25
  381. package/dist/shared-tree/treeCheckout.js.map +1 -1
  382. package/dist/shared-tree-core/branch.d.ts +6 -3
  383. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  384. package/dist/shared-tree-core/branch.js +13 -6
  385. package/dist/shared-tree-core/branch.js.map +1 -1
  386. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  387. package/dist/shared-tree-core/branchCommitEnricher.js +1 -1
  388. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  389. package/dist/shared-tree-core/editManager.d.ts +2 -2
  390. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  391. package/dist/shared-tree-core/editManager.js +21 -15
  392. package/dist/shared-tree-core/editManager.js.map +1 -1
  393. package/dist/shared-tree-core/editManagerCodecs.d.ts +4 -0
  394. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  395. package/dist/shared-tree-core/editManagerCodecs.js +18 -5
  396. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  397. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +2 -0
  398. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  399. package/dist/shared-tree-core/editManagerFormatCommons.js +12 -0
  400. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  401. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  402. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  403. package/dist/shared-tree-core/editManagerFormatV1toV4.js +2 -0
  404. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  405. package/dist/shared-tree-core/editManagerSummarizer.js +3 -3
  406. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  407. package/dist/shared-tree-core/index.d.ts +2 -2
  408. package/dist/shared-tree-core/index.d.ts.map +1 -1
  409. package/dist/shared-tree-core/index.js +3 -1
  410. package/dist/shared-tree-core/index.js.map +1 -1
  411. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  412. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  413. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  414. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  415. package/dist/shared-tree-core/messageCodecVSharedBranches.js +2 -1
  416. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  417. package/dist/shared-tree-core/messageCodecs.d.ts +4 -0
  418. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  419. package/dist/shared-tree-core/messageCodecs.js +17 -5
  420. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  421. package/dist/shared-tree-core/messageFormat.d.ts +2 -0
  422. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  423. package/dist/shared-tree-core/messageFormat.js +12 -0
  424. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  425. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
  426. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  427. package/dist/shared-tree-core/messageFormatV1ToV4.js +9 -1
  428. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  429. package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  430. package/dist/shared-tree-core/sequenceIdUtils.js +4 -4
  431. package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
  432. package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -0
  433. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  434. package/dist/shared-tree-core/sharedTreeCore.js +13 -9
  435. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  436. package/dist/shared-tree-core/transaction.d.ts +25 -8
  437. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  438. package/dist/shared-tree-core/transaction.js +65 -30
  439. package/dist/shared-tree-core/transaction.js.map +1 -1
  440. package/dist/shared-tree-core/transactionEnricher.d.ts +2 -2
  441. package/dist/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  442. package/dist/shared-tree-core/transactionEnricher.js +3 -3
  443. package/dist/shared-tree-core/transactionEnricher.js.map +1 -1
  444. package/dist/simple-tree/api/configuration.js +1 -1
  445. package/dist/simple-tree/api/configuration.js.map +1 -1
  446. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  447. package/dist/simple-tree/api/customTree.js +13 -9
  448. package/dist/simple-tree/api/customTree.js.map +1 -1
  449. package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
  450. package/dist/simple-tree/api/discrepancies.js +21 -17
  451. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  452. package/dist/simple-tree/api/index.d.ts +2 -2
  453. package/dist/simple-tree/api/index.d.ts.map +1 -1
  454. package/dist/simple-tree/api/index.js +2 -1
  455. package/dist/simple-tree/api/index.js.map +1 -1
  456. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  457. package/dist/simple-tree/api/schemaFactory.js +12 -8
  458. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  459. package/dist/simple-tree/api/schemaFactoryAlpha.js +1 -1
  460. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  461. package/dist/simple-tree/api/schemaFactoryBeta.js +1 -1
  462. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  463. package/dist/simple-tree/api/schemaFromSimple.js +18 -9
  464. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  465. package/dist/simple-tree/api/simpleSchemaCodec.js +10 -5
  466. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  467. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  468. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +19 -15
  469. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  470. package/dist/simple-tree/api/simpleTreeIndex.js +10 -10
  471. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  472. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +244 -0
  473. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  474. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +297 -1
  475. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  476. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  477. package/dist/simple-tree/api/storedSchema.js +2 -3
  478. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  479. package/dist/simple-tree/api/transactionTypes.d.ts +17 -4
  480. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  481. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  482. package/dist/simple-tree/api/tree.d.ts +3 -1
  483. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  484. package/dist/simple-tree/api/tree.js.map +1 -1
  485. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  486. package/dist/simple-tree/api/treeNodeApi.js +21 -13
  487. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  488. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  489. package/dist/simple-tree/api/verboseTree.js +14 -9
  490. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  491. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  492. package/dist/simple-tree/core/treeNodeKernel.js +12 -5
  493. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  494. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
  495. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  496. package/dist/simple-tree/core/unhydratedFlexTree.js +79 -23
  497. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  498. package/dist/simple-tree/fieldSchema.d.ts +4 -4
  499. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  500. package/dist/simple-tree/fieldSchema.js.map +1 -1
  501. package/dist/simple-tree/getTreeNodeForField.d.ts.map +1 -1
  502. package/dist/simple-tree/getTreeNodeForField.js +2 -1
  503. package/dist/simple-tree/getTreeNodeForField.js.map +1 -1
  504. package/dist/simple-tree/index.d.ts +3 -3
  505. package/dist/simple-tree/index.d.ts.map +1 -1
  506. package/dist/simple-tree/index.js +4 -3
  507. package/dist/simple-tree/index.js.map +1 -1
  508. package/dist/simple-tree/leafNodeSchema.js +9 -6
  509. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  510. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  511. package/dist/simple-tree/node-kinds/array/arrayNode.js +22 -20
  512. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  513. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
  514. package/dist/simple-tree/node-kinds/common.js +1 -1
  515. package/dist/simple-tree/node-kinds/common.js.map +1 -1
  516. package/dist/simple-tree/node-kinds/map/mapNode.js +2 -2
  517. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  518. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  519. package/dist/simple-tree/node-kinds/object/objectNode.js +21 -22
  520. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  521. package/dist/simple-tree/node-kinds/record/recordNode.js +6 -5
  522. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  523. package/dist/simple-tree/prepareForInsertion.d.ts +54 -47
  524. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  525. package/dist/simple-tree/prepareForInsertion.js +184 -126
  526. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  527. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  528. package/dist/simple-tree/toStoredSchema.js +9 -5
  529. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  530. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +13 -4
  531. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  532. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +31 -13
  533. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  534. package/dist/text/index.d.ts +6 -0
  535. package/dist/text/index.d.ts.map +1 -0
  536. package/dist/text/index.js +10 -0
  537. package/dist/text/index.js.map +1 -0
  538. package/dist/text/textDomain.d.ts +138 -0
  539. package/dist/text/textDomain.d.ts.map +1 -0
  540. package/dist/text/textDomain.js +121 -0
  541. package/dist/text/textDomain.js.map +1 -0
  542. package/dist/treeFactory.d.ts.map +1 -1
  543. package/dist/treeFactory.js +17 -3
  544. package/dist/treeFactory.js.map +1 -1
  545. package/dist/util/bTreeUtils.d.ts +12 -4
  546. package/dist/util/bTreeUtils.d.ts.map +1 -1
  547. package/dist/util/bTreeUtils.js +15 -19
  548. package/dist/util/bTreeUtils.js.map +1 -1
  549. package/dist/util/breakable.js +7 -9
  550. package/dist/util/breakable.js.map +1 -1
  551. package/dist/util/idAllocator.d.ts.map +1 -1
  552. package/dist/util/idAllocator.js +1 -2
  553. package/dist/util/idAllocator.js.map +1 -1
  554. package/dist/util/index.d.ts +1 -1
  555. package/dist/util/index.d.ts.map +1 -1
  556. package/dist/util/index.js +2 -1
  557. package/dist/util/index.js.map +1 -1
  558. package/dist/util/nestedMap.d.ts.map +1 -1
  559. package/dist/util/nestedMap.js +13 -13
  560. package/dist/util/nestedMap.js.map +1 -1
  561. package/dist/util/rangeMap.d.ts +24 -12
  562. package/dist/util/rangeMap.d.ts.map +1 -1
  563. package/dist/util/rangeMap.js +46 -6
  564. package/dist/util/rangeMap.js.map +1 -1
  565. package/dist/util/utils.d.ts.map +1 -1
  566. package/dist/util/utils.js +16 -15
  567. package/dist/util/utils.js.map +1 -1
  568. package/docs/user-facing/merge-semantics.md +3 -2
  569. package/eslint.config.mts +5 -48
  570. package/lib/alpha.d.ts +9 -0
  571. package/lib/codec/codec.d.ts +31 -3
  572. package/lib/codec/codec.d.ts.map +1 -1
  573. package/lib/codec/codec.js +10 -0
  574. package/lib/codec/codec.js.map +1 -1
  575. package/lib/codec/index.d.ts +2 -2
  576. package/lib/codec/index.d.ts.map +1 -1
  577. package/lib/codec/index.js +1 -1
  578. package/lib/codec/index.js.map +1 -1
  579. package/lib/codec/versioned/codec.d.ts +80 -22
  580. package/lib/codec/versioned/codec.d.ts.map +1 -1
  581. package/lib/codec/versioned/codec.js +138 -15
  582. package/lib/codec/versioned/codec.js.map +1 -1
  583. package/lib/codec/versioned/index.d.ts +1 -1
  584. package/lib/codec/versioned/index.d.ts.map +1 -1
  585. package/lib/codec/versioned/index.js +1 -1
  586. package/lib/codec/versioned/index.js.map +1 -1
  587. package/lib/core/change-family/changeFamily.d.ts +4 -1
  588. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  589. package/lib/core/change-family/changeFamily.js.map +1 -1
  590. package/lib/core/change-family/index.d.ts +1 -1
  591. package/lib/core/change-family/index.d.ts.map +1 -1
  592. package/lib/core/change-family/index.js.map +1 -1
  593. package/lib/core/index.d.ts +3 -3
  594. package/lib/core/index.d.ts.map +1 -1
  595. package/lib/core/index.js +2 -2
  596. package/lib/core/index.js.map +1 -1
  597. package/lib/core/rebase/changeRebaser.d.ts +42 -3
  598. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  599. package/lib/core/rebase/changeRebaser.js.map +1 -1
  600. package/lib/core/rebase/index.d.ts +2 -2
  601. package/lib/core/rebase/index.d.ts.map +1 -1
  602. package/lib/core/rebase/index.js +1 -1
  603. package/lib/core/rebase/index.js.map +1 -1
  604. package/lib/core/rebase/types.d.ts +52 -10
  605. package/lib/core/rebase/types.d.ts.map +1 -1
  606. package/lib/core/rebase/types.js +3 -10
  607. package/lib/core/rebase/types.js.map +1 -1
  608. package/lib/core/rebase/utils.d.ts.map +1 -1
  609. package/lib/core/rebase/utils.js +33 -11
  610. package/lib/core/rebase/utils.js.map +1 -1
  611. package/lib/core/schema-stored/schema.js +3 -3
  612. package/lib/core/schema-stored/schema.js.map +1 -1
  613. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  614. package/lib/core/tree/anchorSet.js +4 -4
  615. package/lib/core/tree/anchorSet.js.map +1 -1
  616. package/lib/core/tree/detachedFieldIndex.d.ts +7 -2
  617. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  618. package/lib/core/tree/detachedFieldIndex.js +23 -58
  619. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  620. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +18 -10
  621. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  622. package/lib/core/tree/detachedFieldIndexCodecCommon.js +4 -4
  623. package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  624. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts +2 -3
  625. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  626. package/lib/core/tree/detachedFieldIndexCodecV1.js +4 -5
  627. package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  628. package/lib/core/tree/detachedFieldIndexCodecV2.d.ts +2 -3
  629. package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  630. package/lib/core/tree/detachedFieldIndexCodecV2.js +4 -6
  631. package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  632. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +5 -6
  633. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  634. package/lib/core/tree/detachedFieldIndexCodecs.js +12 -39
  635. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  636. package/lib/core/tree/index.d.ts +2 -2
  637. package/lib/core/tree/index.d.ts.map +1 -1
  638. package/lib/core/tree/index.js +2 -2
  639. package/lib/core/tree/index.js.map +1 -1
  640. package/lib/core/tree/mapTree.js +1 -1
  641. package/lib/core/tree/mapTree.js.map +1 -1
  642. package/lib/core/tree/pathTree.d.ts +11 -3
  643. package/lib/core/tree/pathTree.d.ts.map +1 -1
  644. package/lib/core/tree/pathTree.js +12 -1
  645. package/lib/core/tree/pathTree.js.map +1 -1
  646. package/lib/core/tree/sparseTree.d.ts.map +1 -1
  647. package/lib/core/tree/sparseTree.js +1 -0
  648. package/lib/core/tree/sparseTree.js.map +1 -1
  649. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  650. package/lib/core/tree/treeTextFormat.js +5 -9
  651. package/lib/core/tree/treeTextFormat.js.map +1 -1
  652. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  653. package/lib/core/tree/visitDelta.js +3 -2
  654. package/lib/core/tree/visitDelta.js.map +1 -1
  655. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  656. package/lib/core/tree/visitorUtils.js +58 -18
  657. package/lib/core/tree/visitorUtils.js.map +1 -1
  658. package/lib/feature-libraries/changeAtomIdBTree.d.ts +16 -0
  659. package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -0
  660. package/lib/feature-libraries/changeAtomIdBTree.js +24 -0
  661. package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -0
  662. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  663. package/lib/feature-libraries/chunked-forest/basicChunk.js +9 -2
  664. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  665. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  666. package/lib/feature-libraries/chunked-forest/chunkTree.js +4 -1
  667. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  668. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  669. package/lib/feature-libraries/chunked-forest/chunkedForest.js +9 -7
  670. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  671. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  672. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +7 -4
  673. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  674. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  675. package/lib/feature-libraries/chunked-forest/codec/codecs.js +19 -11
  676. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  677. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -3
  678. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  679. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +9 -5
  680. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  681. package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  682. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  683. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +103 -44
  684. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  685. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +249 -78
  686. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  687. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -1
  688. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  689. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +22 -3
  690. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  691. package/lib/feature-libraries/default-schema/index.d.ts +2 -1
  692. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  693. package/lib/feature-libraries/default-schema/index.js +2 -1
  694. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  695. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +38 -0
  696. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
  697. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js +128 -0
  698. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
  699. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +9 -6
  700. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  701. package/lib/feature-libraries/default-schema/mappedEditBuilder.js +21 -0
  702. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  703. package/lib/feature-libraries/deltaUtils.d.ts +1 -0
  704. package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
  705. package/lib/feature-libraries/deltaUtils.js +5 -1
  706. package/lib/feature-libraries/deltaUtils.js.map +1 -1
  707. package/lib/feature-libraries/flex-tree/context.d.ts +9 -0
  708. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  709. package/lib/feature-libraries/flex-tree/context.js +6 -0
  710. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  711. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
  712. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  713. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  714. package/lib/feature-libraries/flex-tree/lazyField.d.ts +8 -7
  715. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  716. package/lib/feature-libraries/flex-tree/lazyField.js +45 -16
  717. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  718. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  719. package/lib/feature-libraries/forest-summary/forestSummarizer.js +3 -1
  720. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  721. package/lib/feature-libraries/index.d.ts +5 -4
  722. package/lib/feature-libraries/index.d.ts.map +1 -1
  723. package/lib/feature-libraries/index.js +5 -4
  724. package/lib/feature-libraries/index.js.map +1 -1
  725. package/lib/feature-libraries/indexing/anchorTreeIndex.js +6 -6
  726. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  727. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  728. package/lib/feature-libraries/mapTreeCursor.js +2 -1
  729. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  730. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  731. package/lib/feature-libraries/mitigatedChangeFamily.js +12 -3
  732. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  733. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  734. package/lib/feature-libraries/modular-schema/comparison.js +12 -9
  735. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  736. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +97 -21
  737. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  738. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +3 -5
  739. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  740. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +25 -0
  741. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -0
  742. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +55 -0
  743. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -0
  744. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +22 -53
  745. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  746. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  747. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  748. package/lib/feature-libraries/modular-schema/genericFieldKind.js +8 -14
  749. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  750. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +1 -1
  751. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  752. package/lib/feature-libraries/modular-schema/index.d.ts +7 -5
  753. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  754. package/lib/feature-libraries/modular-schema/index.js +5 -3
  755. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  756. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +32 -0
  757. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -0
  758. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +402 -0
  759. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -0
  760. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +15 -0
  761. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -0
  762. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js +27 -0
  763. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -0
  764. package/lib/feature-libraries/modular-schema/modularChangeCodecV3.d.ts +15 -0
  765. package/lib/feature-libraries/modular-schema/modularChangeCodecV3.d.ts.map +1 -0
  766. package/lib/feature-libraries/modular-schema/modularChangeCodecV3.js +389 -0
  767. package/lib/feature-libraries/modular-schema/modularChangeCodecV3.js.map +1 -0
  768. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  769. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  770. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +34 -290
  771. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  772. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +60 -26
  773. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  774. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1441 -546
  775. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  776. package/{dist/feature-libraries/modular-schema/modularChangeFormat.d.ts → lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts} +5 -6
  777. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -0
  778. package/lib/feature-libraries/modular-schema/{modularChangeFormat.js → modularChangeFormatV1.js} +4 -4
  779. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -0
  780. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +112 -0
  781. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -0
  782. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +18 -0
  783. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -0
  784. package/lib/feature-libraries/modular-schema/modularChangeFormatV3.d.ts +146 -0
  785. package/lib/feature-libraries/modular-schema/modularChangeFormatV3.d.ts.map +1 -0
  786. package/lib/feature-libraries/modular-schema/modularChangeFormatV3.js +29 -0
  787. package/lib/feature-libraries/modular-schema/modularChangeFormatV3.js.map +1 -0
  788. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +59 -13
  789. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  790. package/lib/feature-libraries/modular-schema/modularChangeTypes.js +1 -1
  791. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  792. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -1
  793. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  794. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  795. package/lib/feature-libraries/object-forest/objectForest.js +7 -5
  796. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  797. package/lib/feature-libraries/optional-field/index.d.ts +2 -2
  798. package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
  799. package/lib/feature-libraries/optional-field/index.js +1 -1
  800. package/lib/feature-libraries/optional-field/index.js.map +1 -1
  801. package/lib/feature-libraries/optional-field/optionalField.d.ts +5 -26
  802. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  803. package/lib/feature-libraries/optional-field/optionalField.js +223 -448
  804. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  805. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +23 -0
  806. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +1 -0
  807. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +27 -0
  808. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +1 -0
  809. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +24 -33
  810. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
  811. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
  812. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
  813. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  814. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +55 -26
  815. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  816. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +12 -0
  817. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +1 -0
  818. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js +53 -0
  819. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js.map +1 -0
  820. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  821. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +5 -1
  822. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  823. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  824. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +15 -3
  825. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  826. package/lib/feature-libraries/schema-index/codec.d.ts +7 -21
  827. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  828. package/lib/feature-libraries/schema-index/codec.js +30 -68
  829. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  830. package/lib/feature-libraries/schema-index/index.d.ts +2 -2
  831. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  832. package/lib/feature-libraries/schema-index/index.js +2 -2
  833. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  834. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +1 -9
  835. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  836. package/lib/feature-libraries/schema-index/schemaSummarizer.js +0 -10
  837. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  838. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
  839. package/lib/feature-libraries/schemaChecker.js +11 -6
  840. package/lib/feature-libraries/schemaChecker.js.map +1 -1
  841. package/lib/feature-libraries/sequence-field/compose.d.ts +6 -7
  842. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  843. package/lib/feature-libraries/sequence-field/compose.js +93 -265
  844. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  845. package/lib/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
  846. package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  847. package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  848. package/lib/feature-libraries/sequence-field/index.d.ts +2 -3
  849. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  850. package/lib/feature-libraries/sequence-field/index.js +0 -1
  851. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  852. package/lib/feature-libraries/sequence-field/invert.d.ts +3 -3
  853. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  854. package/lib/feature-libraries/sequence-field/invert.js +69 -170
  855. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  856. package/lib/feature-libraries/sequence-field/markQueue.d.ts +2 -2
  857. package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  858. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  859. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
  860. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  861. package/lib/feature-libraries/sequence-field/moveEffectTable.js +9 -81
  862. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  863. package/lib/feature-libraries/sequence-field/rebase.d.ts +3 -3
  864. package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  865. package/lib/feature-libraries/sequence-field/rebase.js +122 -121
  866. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  867. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts +2 -2
  868. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  869. package/lib/feature-libraries/sequence-field/replaceRevisions.js +36 -44
  870. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  871. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  872. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +0 -2
  873. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  874. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
  875. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  876. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +356 -174
  877. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  878. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  879. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +21 -61
  880. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  881. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
  882. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  883. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
  884. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  885. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
  886. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  887. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +20 -112
  888. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  889. package/lib/feature-libraries/sequence-field/types.d.ts +30 -59
  890. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  891. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  892. package/lib/feature-libraries/sequence-field/utils.d.ts +15 -24
  893. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  894. package/lib/feature-libraries/sequence-field/utils.js +144 -311
  895. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  896. package/lib/feature-libraries/treeCursorUtils.js +7 -7
  897. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  898. package/lib/feature-libraries/treeTextCursor.js +2 -2
  899. package/lib/feature-libraries/treeTextCursor.js.map +1 -1
  900. package/lib/feature-libraries/valueUtilities.d.ts.map +1 -1
  901. package/lib/feature-libraries/valueUtilities.js +16 -8
  902. package/lib/feature-libraries/valueUtilities.js.map +1 -1
  903. package/lib/index.d.ts +4 -3
  904. package/lib/index.d.ts.map +1 -1
  905. package/lib/index.js +2 -1
  906. package/lib/index.js.map +1 -1
  907. package/lib/packageVersion.d.ts +1 -1
  908. package/lib/packageVersion.d.ts.map +1 -1
  909. package/lib/packageVersion.js +1 -1
  910. package/lib/packageVersion.js.map +1 -1
  911. package/lib/shared-tree/index.d.ts +1 -1
  912. package/lib/shared-tree/index.d.ts.map +1 -1
  913. package/lib/shared-tree/index.js.map +1 -1
  914. package/lib/shared-tree/schematizeTree.d.ts +4 -4
  915. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  916. package/lib/shared-tree/schematizeTree.js +3 -2
  917. package/lib/shared-tree/schematizeTree.js.map +1 -1
  918. package/lib/shared-tree/schematizingTreeView.d.ts +3 -8
  919. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  920. package/lib/shared-tree/schematizingTreeView.js +61 -47
  921. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  922. package/lib/shared-tree/sharedTree.d.ts +9 -3
  923. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  924. package/lib/shared-tree/sharedTree.js +41 -13
  925. package/lib/shared-tree/sharedTree.js.map +1 -1
  926. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  927. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  928. package/lib/shared-tree/sharedTreeChangeCodecs.js +10 -8
  929. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  930. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  931. package/lib/shared-tree/sharedTreeChangeEnricher.js +6 -4
  932. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  933. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +7 -6
  934. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  935. package/lib/shared-tree/sharedTreeChangeFamily.js +30 -19
  936. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  937. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
  938. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  939. package/lib/shared-tree/sharedTreeEditBuilder.js +12 -6
  940. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  941. package/lib/shared-tree/treeAlpha.d.ts +35 -29
  942. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  943. package/lib/shared-tree/treeAlpha.js +21 -23
  944. package/lib/shared-tree/treeAlpha.js.map +1 -1
  945. package/lib/shared-tree/treeCheckout.d.ts +11 -10
  946. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  947. package/lib/shared-tree/treeCheckout.js +97 -29
  948. package/lib/shared-tree/treeCheckout.js.map +1 -1
  949. package/lib/shared-tree-core/branch.d.ts +6 -3
  950. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  951. package/lib/shared-tree-core/branch.js +13 -6
  952. package/lib/shared-tree-core/branch.js.map +1 -1
  953. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  954. package/lib/shared-tree-core/branchCommitEnricher.js +2 -2
  955. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  956. package/lib/shared-tree-core/editManager.d.ts +2 -2
  957. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  958. package/lib/shared-tree-core/editManager.js +21 -15
  959. package/lib/shared-tree-core/editManager.js.map +1 -1
  960. package/lib/shared-tree-core/editManagerCodecs.d.ts +4 -0
  961. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  962. package/lib/shared-tree-core/editManagerCodecs.js +16 -4
  963. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  964. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +2 -0
  965. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  966. package/lib/shared-tree-core/editManagerFormatCommons.js +12 -0
  967. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  968. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  969. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  970. package/lib/shared-tree-core/editManagerFormatV1toV4.js +2 -0
  971. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  972. package/lib/shared-tree-core/editManagerSummarizer.js +3 -3
  973. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  974. package/lib/shared-tree-core/index.d.ts +2 -2
  975. package/lib/shared-tree-core/index.d.ts.map +1 -1
  976. package/lib/shared-tree-core/index.js +2 -2
  977. package/lib/shared-tree-core/index.js.map +1 -1
  978. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  979. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  980. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  981. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  982. package/lib/shared-tree-core/messageCodecVSharedBranches.js +2 -1
  983. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  984. package/lib/shared-tree-core/messageCodecs.d.ts +4 -0
  985. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  986. package/lib/shared-tree-core/messageCodecs.js +15 -4
  987. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  988. package/lib/shared-tree-core/messageFormat.d.ts +2 -0
  989. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  990. package/lib/shared-tree-core/messageFormat.js +12 -0
  991. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  992. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
  993. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  994. package/lib/shared-tree-core/messageFormatV1ToV4.js +9 -1
  995. package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  996. package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  997. package/lib/shared-tree-core/sequenceIdUtils.js +4 -4
  998. package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
  999. package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -0
  1000. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  1001. package/lib/shared-tree-core/sharedTreeCore.js +13 -9
  1002. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  1003. package/lib/shared-tree-core/transaction.d.ts +25 -8
  1004. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  1005. package/lib/shared-tree-core/transaction.js +67 -32
  1006. package/lib/shared-tree-core/transaction.js.map +1 -1
  1007. package/lib/shared-tree-core/transactionEnricher.d.ts +2 -2
  1008. package/lib/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  1009. package/lib/shared-tree-core/transactionEnricher.js +3 -3
  1010. package/lib/shared-tree-core/transactionEnricher.js.map +1 -1
  1011. package/lib/simple-tree/api/configuration.js +1 -1
  1012. package/lib/simple-tree/api/configuration.js.map +1 -1
  1013. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  1014. package/lib/simple-tree/api/customTree.js +13 -9
  1015. package/lib/simple-tree/api/customTree.js.map +1 -1
  1016. package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
  1017. package/lib/simple-tree/api/discrepancies.js +21 -17
  1018. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  1019. package/lib/simple-tree/api/index.d.ts +2 -2
  1020. package/lib/simple-tree/api/index.d.ts.map +1 -1
  1021. package/lib/simple-tree/api/index.js +1 -1
  1022. package/lib/simple-tree/api/index.js.map +1 -1
  1023. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  1024. package/lib/simple-tree/api/schemaFactory.js +12 -8
  1025. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  1026. package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -1
  1027. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  1028. package/lib/simple-tree/api/schemaFactoryBeta.js +1 -1
  1029. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  1030. package/lib/simple-tree/api/schemaFromSimple.js +18 -9
  1031. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  1032. package/lib/simple-tree/api/simpleSchemaCodec.js +10 -5
  1033. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  1034. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  1035. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +19 -15
  1036. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  1037. package/lib/simple-tree/api/simpleTreeIndex.js +10 -10
  1038. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  1039. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +244 -0
  1040. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  1041. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +270 -0
  1042. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  1043. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  1044. package/lib/simple-tree/api/storedSchema.js +4 -7
  1045. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  1046. package/lib/simple-tree/api/transactionTypes.d.ts +17 -4
  1047. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  1048. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  1049. package/lib/simple-tree/api/tree.d.ts +3 -1
  1050. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  1051. package/lib/simple-tree/api/tree.js.map +1 -1
  1052. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  1053. package/lib/simple-tree/api/treeNodeApi.js +21 -13
  1054. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  1055. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  1056. package/lib/simple-tree/api/verboseTree.js +14 -9
  1057. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  1058. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  1059. package/lib/simple-tree/core/treeNodeKernel.js +12 -5
  1060. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  1061. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
  1062. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  1063. package/lib/simple-tree/core/unhydratedFlexTree.js +78 -23
  1064. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  1065. package/lib/simple-tree/fieldSchema.d.ts +4 -4
  1066. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  1067. package/lib/simple-tree/fieldSchema.js.map +1 -1
  1068. package/lib/simple-tree/getTreeNodeForField.d.ts.map +1 -1
  1069. package/lib/simple-tree/getTreeNodeForField.js +2 -1
  1070. package/lib/simple-tree/getTreeNodeForField.js.map +1 -1
  1071. package/lib/simple-tree/index.d.ts +3 -3
  1072. package/lib/simple-tree/index.d.ts.map +1 -1
  1073. package/lib/simple-tree/index.js +2 -2
  1074. package/lib/simple-tree/index.js.map +1 -1
  1075. package/lib/simple-tree/leafNodeSchema.js +9 -6
  1076. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  1077. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  1078. package/lib/simple-tree/node-kinds/array/arrayNode.js +23 -21
  1079. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  1080. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
  1081. package/lib/simple-tree/node-kinds/common.js +2 -2
  1082. package/lib/simple-tree/node-kinds/common.js.map +1 -1
  1083. package/lib/simple-tree/node-kinds/map/mapNode.js +2 -2
  1084. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  1085. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  1086. package/lib/simple-tree/node-kinds/object/objectNode.js +22 -23
  1087. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  1088. package/lib/simple-tree/node-kinds/record/recordNode.js +6 -5
  1089. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  1090. package/lib/simple-tree/prepareForInsertion.d.ts +54 -47
  1091. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  1092. package/lib/simple-tree/prepareForInsertion.js +184 -125
  1093. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  1094. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  1095. package/lib/simple-tree/toStoredSchema.js +9 -5
  1096. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  1097. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +13 -4
  1098. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  1099. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +28 -11
  1100. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  1101. package/lib/text/index.d.ts +6 -0
  1102. package/lib/text/index.d.ts.map +1 -0
  1103. package/lib/text/index.js +6 -0
  1104. package/lib/text/index.js.map +1 -0
  1105. package/lib/text/textDomain.d.ts +138 -0
  1106. package/lib/text/textDomain.d.ts.map +1 -0
  1107. package/lib/text/textDomain.js +118 -0
  1108. package/lib/text/textDomain.js.map +1 -0
  1109. package/lib/treeFactory.d.ts.map +1 -1
  1110. package/lib/treeFactory.js +18 -4
  1111. package/lib/treeFactory.js.map +1 -1
  1112. package/lib/util/bTreeUtils.d.ts +12 -4
  1113. package/lib/util/bTreeUtils.d.ts.map +1 -1
  1114. package/lib/util/bTreeUtils.js +16 -20
  1115. package/lib/util/bTreeUtils.js.map +1 -1
  1116. package/lib/util/breakable.js +7 -9
  1117. package/lib/util/breakable.js.map +1 -1
  1118. package/lib/util/idAllocator.d.ts.map +1 -1
  1119. package/lib/util/idAllocator.js +1 -2
  1120. package/lib/util/idAllocator.js.map +1 -1
  1121. package/lib/util/index.d.ts +1 -1
  1122. package/lib/util/index.d.ts.map +1 -1
  1123. package/lib/util/index.js +1 -1
  1124. package/lib/util/index.js.map +1 -1
  1125. package/lib/util/nestedMap.d.ts.map +1 -1
  1126. package/lib/util/nestedMap.js +13 -13
  1127. package/lib/util/nestedMap.js.map +1 -1
  1128. package/lib/util/rangeMap.d.ts +24 -12
  1129. package/lib/util/rangeMap.d.ts.map +1 -1
  1130. package/lib/util/rangeMap.js +44 -5
  1131. package/lib/util/rangeMap.js.map +1 -1
  1132. package/lib/util/utils.d.ts.map +1 -1
  1133. package/lib/util/utils.js +16 -15
  1134. package/lib/util/utils.js.map +1 -1
  1135. package/package.json +33 -33
  1136. package/src/codec/codec.ts +48 -8
  1137. package/src/codec/index.ts +4 -1
  1138. package/src/codec/versioned/codec.ts +340 -22
  1139. package/src/codec/versioned/index.ts +3 -1
  1140. package/src/core/change-family/changeFamily.ts +5 -0
  1141. package/src/core/change-family/index.ts +1 -0
  1142. package/src/core/index.ts +8 -3
  1143. package/src/core/rebase/changeRebaser.ts +46 -7
  1144. package/src/core/rebase/index.ts +4 -1
  1145. package/src/core/rebase/types.ts +71 -39
  1146. package/src/core/rebase/utils.ts +42 -14
  1147. package/src/core/schema-stored/schema.ts +3 -3
  1148. package/src/core/tree/anchorSet.ts +4 -4
  1149. package/src/core/tree/detachedFieldIndex.ts +29 -74
  1150. package/src/core/tree/detachedFieldIndexCodecCommon.ts +4 -8
  1151. package/src/core/tree/detachedFieldIndexCodecV1.ts +3 -7
  1152. package/src/core/tree/detachedFieldIndexCodecV2.ts +5 -9
  1153. package/src/core/tree/detachedFieldIndexCodecs.ts +21 -64
  1154. package/src/core/tree/index.ts +3 -2
  1155. package/src/core/tree/mapTree.ts +1 -1
  1156. package/src/core/tree/pathTree.ts +16 -4
  1157. package/src/core/tree/sparseTree.ts +1 -0
  1158. package/src/core/tree/treeTextFormat.ts +5 -9
  1159. package/src/core/tree/visitDelta.ts +6 -2
  1160. package/src/core/tree/visitorUtils.ts +55 -19
  1161. package/src/feature-libraries/changeAtomIdBTree.ts +56 -0
  1162. package/src/feature-libraries/chunked-forest/basicChunk.ts +8 -2
  1163. package/src/feature-libraries/chunked-forest/chunkTree.ts +6 -1
  1164. package/src/feature-libraries/chunked-forest/chunkedForest.ts +8 -6
  1165. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +7 -4
  1166. package/src/feature-libraries/chunked-forest/codec/codecs.ts +19 -11
  1167. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +4 -3
  1168. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +9 -5
  1169. package/src/feature-libraries/chunked-forest/uniformChunk.ts +1 -1
  1170. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +442 -139
  1171. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +24 -6
  1172. package/src/feature-libraries/default-schema/index.ts +17 -5
  1173. package/src/feature-libraries/default-schema/locationBasedEditBuilder.ts +188 -0
  1174. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +41 -9
  1175. package/src/feature-libraries/deltaUtils.ts +6 -1
  1176. package/src/feature-libraries/flex-tree/context.ts +17 -0
  1177. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +7 -8
  1178. package/src/feature-libraries/flex-tree/lazyField.ts +72 -30
  1179. package/src/feature-libraries/forest-summary/forestSummarizer.ts +3 -1
  1180. package/src/feature-libraries/index.ts +32 -13
  1181. package/src/feature-libraries/indexing/anchorTreeIndex.ts +5 -5
  1182. package/src/feature-libraries/mapTreeCursor.ts +2 -1
  1183. package/src/feature-libraries/mitigatedChangeFamily.ts +14 -7
  1184. package/src/feature-libraries/modular-schema/comparison.ts +12 -9
  1185. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +142 -44
  1186. package/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts +70 -0
  1187. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +35 -64
  1188. package/src/feature-libraries/modular-schema/genericFieldKind.ts +11 -25
  1189. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +1 -1
  1190. package/src/feature-libraries/modular-schema/index.ts +20 -16
  1191. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +912 -0
  1192. package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +89 -0
  1193. package/src/feature-libraries/modular-schema/modularChangeCodecV3.ts +760 -0
  1194. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +52 -523
  1195. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2756 -884
  1196. package/src/feature-libraries/modular-schema/{modularChangeFormat.ts → modularChangeFormatV1.ts} +5 -4
  1197. package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +34 -0
  1198. package/src/feature-libraries/modular-schema/modularChangeFormatV3.ts +62 -0
  1199. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +70 -14
  1200. package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +1 -1
  1201. package/src/feature-libraries/object-forest/objectForest.ts +7 -5
  1202. package/src/feature-libraries/optional-field/index.ts +1 -3
  1203. package/src/feature-libraries/optional-field/optionalField.ts +320 -576
  1204. package/src/feature-libraries/optional-field/optionalFieldChangeFormatV3.ts +45 -0
  1205. package/src/feature-libraries/optional-field/optionalFieldChangeTypes.ts +24 -38
  1206. package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +89 -35
  1207. package/src/feature-libraries/optional-field/optionalFieldCodecV3.ts +94 -0
  1208. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +5 -1
  1209. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +18 -3
  1210. package/src/feature-libraries/schema-index/codec.ts +30 -90
  1211. package/src/feature-libraries/schema-index/index.ts +2 -4
  1212. package/src/feature-libraries/schema-index/schemaSummarizer.ts +0 -17
  1213. package/src/feature-libraries/schemaChecker.ts +11 -6
  1214. package/src/feature-libraries/sequence-field/compose.ts +147 -526
  1215. package/src/feature-libraries/sequence-field/helperTypes.ts +34 -19
  1216. package/src/feature-libraries/sequence-field/index.ts +0 -9
  1217. package/src/feature-libraries/sequence-field/invert.ts +103 -227
  1218. package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
  1219. package/src/feature-libraries/sequence-field/moveEffectTable.ts +11 -192
  1220. package/src/feature-libraries/sequence-field/rebase.ts +182 -210
  1221. package/src/feature-libraries/sequence-field/replaceRevisions.ts +54 -80
  1222. package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +0 -2
  1223. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +648 -220
  1224. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +56 -68
  1225. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +25 -27
  1226. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +25 -132
  1227. package/src/feature-libraries/sequence-field/types.ts +34 -64
  1228. package/src/feature-libraries/sequence-field/utils.ts +171 -366
  1229. package/src/feature-libraries/treeCursorUtils.ts +7 -7
  1230. package/src/feature-libraries/treeTextCursor.ts +2 -2
  1231. package/src/feature-libraries/valueUtilities.ts +16 -8
  1232. package/src/index.ts +11 -0
  1233. package/src/packageVersion.ts +1 -1
  1234. package/src/shared-tree/index.ts +3 -2
  1235. package/src/shared-tree/schematizeTree.ts +21 -8
  1236. package/src/shared-tree/schematizingTreeView.ts +79 -83
  1237. package/src/shared-tree/sharedTree.ts +50 -17
  1238. package/src/shared-tree/sharedTreeChangeCodecs.ts +14 -9
  1239. package/src/shared-tree/sharedTreeChangeEnricher.ts +6 -2
  1240. package/src/shared-tree/sharedTreeChangeFamily.ts +44 -24
  1241. package/src/shared-tree/sharedTreeEditBuilder.ts +48 -13
  1242. package/src/shared-tree/treeAlpha.ts +60 -51
  1243. package/src/shared-tree/treeCheckout.ts +160 -73
  1244. package/src/shared-tree-core/branch.ts +21 -6
  1245. package/src/shared-tree-core/branchCommitEnricher.ts +3 -8
  1246. package/src/shared-tree-core/editManager.ts +43 -29
  1247. package/src/shared-tree-core/editManagerCodecs.ts +19 -4
  1248. package/src/shared-tree-core/editManagerFormatCommons.ts +12 -0
  1249. package/src/shared-tree-core/editManagerFormatV1toV4.ts +5 -1
  1250. package/src/shared-tree-core/editManagerSummarizer.ts +3 -3
  1251. package/src/shared-tree-core/index.ts +2 -0
  1252. package/src/shared-tree-core/messageCodecV1ToV4.ts +3 -1
  1253. package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -1
  1254. package/src/shared-tree-core/messageCodecs.ts +18 -4
  1255. package/src/shared-tree-core/messageFormat.ts +12 -1
  1256. package/src/shared-tree-core/messageFormatV1ToV4.ts +18 -2
  1257. package/src/shared-tree-core/sequenceIdUtils.ts +4 -4
  1258. package/src/shared-tree-core/sharedTreeCore.ts +15 -8
  1259. package/src/shared-tree-core/transaction.ts +115 -56
  1260. package/src/shared-tree-core/transactionEnricher.ts +5 -6
  1261. package/src/simple-tree/api/configuration.ts +1 -1
  1262. package/src/simple-tree/api/customTree.ts +14 -10
  1263. package/src/simple-tree/api/discrepancies.ts +23 -17
  1264. package/src/simple-tree/api/index.ts +5 -0
  1265. package/src/simple-tree/api/schemaFactory.ts +11 -7
  1266. package/src/simple-tree/api/schemaFactoryAlpha.ts +1 -1
  1267. package/src/simple-tree/api/schemaFactoryBeta.ts +1 -1
  1268. package/src/simple-tree/api/schemaFromSimple.ts +18 -9
  1269. package/src/simple-tree/api/simpleSchemaCodec.ts +10 -5
  1270. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +21 -17
  1271. package/src/simple-tree/api/simpleTreeIndex.ts +8 -8
  1272. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +501 -0
  1273. package/src/simple-tree/api/storedSchema.ts +10 -7
  1274. package/src/simple-tree/api/transactionTypes.ts +19 -4
  1275. package/src/simple-tree/api/tree.ts +3 -1
  1276. package/src/simple-tree/api/treeNodeApi.ts +21 -13
  1277. package/src/simple-tree/api/verboseTree.ts +14 -9
  1278. package/src/simple-tree/core/treeNodeKernel.ts +12 -5
  1279. package/src/simple-tree/core/unhydratedFlexTree.ts +109 -53
  1280. package/src/simple-tree/fieldSchema.ts +6 -4
  1281. package/src/simple-tree/getTreeNodeForField.ts +2 -1
  1282. package/src/simple-tree/index.ts +7 -1
  1283. package/src/simple-tree/leafNodeSchema.ts +8 -5
  1284. package/src/simple-tree/node-kinds/array/arrayNode.ts +32 -30
  1285. package/src/simple-tree/node-kinds/common.ts +2 -5
  1286. package/src/simple-tree/node-kinds/map/mapNode.ts +4 -4
  1287. package/src/simple-tree/node-kinds/object/objectNode.ts +29 -30
  1288. package/src/simple-tree/node-kinds/record/recordNode.ts +12 -12
  1289. package/src/simple-tree/prepareForInsertion.ts +343 -201
  1290. package/src/simple-tree/toStoredSchema.ts +9 -5
  1291. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +43 -15
  1292. package/src/text/README.md +8 -0
  1293. package/src/text/index.ts +6 -0
  1294. package/src/text/textDomain.ts +199 -0
  1295. package/src/treeFactory.ts +20 -5
  1296. package/src/util/bTreeUtils.ts +34 -23
  1297. package/src/util/breakable.ts +9 -9
  1298. package/src/util/idAllocator.ts +1 -2
  1299. package/src/util/index.ts +3 -0
  1300. package/src/util/nestedMap.ts +13 -15
  1301. package/src/util/rangeMap.ts +72 -18
  1302. package/src/util/utils.ts +14 -13
  1303. package/.eslintrc.cjs +0 -140
  1304. package/assertTagging.config.mjs +0 -14
  1305. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +0 -1
  1306. package/dist/feature-libraries/modular-schema/modularChangeFormat.js.map +0 -1
  1307. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
  1308. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
  1309. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -50
  1310. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
  1311. package/docs/main/sequence-field/move-composition.md +0 -46
  1312. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +0 -1
  1313. package/lib/feature-libraries/modular-schema/modularChangeFormat.js.map +0 -1
  1314. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
  1315. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
  1316. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -46
  1317. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
  1318. package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +0 -57
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeChangeFamily.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeFamily.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AAInE,+CAU0B;AAC1B,4DASuC;AACvC,+CAM0B;AAE1B,2EAA8E;AAE9E,yEAAmE;AAEnE;;;;GAIG;AACH,MAAa,sBAAsB;IAYlC,YACC,gBAAkC,EAClC,eAAgC,EAChC,YAA+B,EAC/B,wBAAkD,EACjC,YAA4B;QAA5B,iBAAY,GAAZ,YAAY,CAAgB;QAE7C,MAAM,kBAAkB,GAAG,IAAA,uCAA4B,EACtD,kCAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,w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AAE,CAAC;IAC5E,SAAS,0BAA0B,CAAC,EAAuB;QAC1D,IAAA,yBAAc,EAAC,aAAa,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;QAClD,OAAO,eAAe,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IACD,QAAQ,CAAC,CAAC,mBAAmB,CAC5B,QAAuC;QAEvC,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;YAC3B,IAAI,CAAC,IAAA,4BAAiB,EAAC,aAAa,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3D,MAAM,EAAE,CAAC;YACV,CAAC;QACF,CAAC;IACF,CAAC;IACD,IAAI,iBAAiB,GAAG,IAAI,CAAC;IAC7B,OAAO,cAAc,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,EAAE;QAC5C,MAAM,YAAY,GAAG,kCAAkC,CAAC,UAAU,CAAC,CAAC;QACpE,IAAI,iBAAiB,EAAE,CAAC;YACvB,iBAAiB,GAAG,KAAK,CAAC;YAC1B,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,YAAY,EACZ,IAAI,CACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACP,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,mBAAmB,CAAC,YAAY,CAAC,EACjC,KAAK,CACL,CAAC;QACH,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AAlED,4CAkEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport type { CodecWriteOptions, ICodecFamily } from \"../codec/index.js\";\nimport {\n\ttype ChangeEncodingContext,\n\ttype ChangeFamily,\n\ttype ChangeRebaser,\n\ttype DeltaDetachedNodeId,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\ttype RevisionTagCodec,\n\ttype TaggedChange,\n\tmapTaggedChange,\n} from \"../core/index.js\";\nimport {\n\ttype FieldBatchCodec,\n\tModularChangeFamily,\n\ttype ModularChangeset,\n\ttype TreeChunk,\n\ttype TreeCompressionStrategy,\n\tfieldKindConfigurations,\n\tfieldKinds,\n\tmakeModularChangeCodecFamily,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype Mutable,\n\ttype NestedSet,\n\taddToNestedSet,\n\thasSingle,\n\tnestedSetContains,\n} from \"../util/index.js\";\n\nimport { makeSharedTreeChangeCodecFamily } from \"./sharedTreeChangeCodecs.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\n\n/**\n * Implementation of {@link ChangeFamily} that combines edits to fields and schema changes.\n *\n * @sealed\n */\nexport class SharedTreeChangeFamily\n\timplements\n\t\tChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,\n\t\tChangeRebaser<SharedTreeChange>\n{\n\tpublic static readonly emptyChange: SharedTreeChange = {\n\t\tchanges: [],\n\t};\n\n\tpublic readonly codecs: ICodecFamily<SharedTreeChange, ChangeEncodingContext>;\n\tprivate readonly modularChangeFamily: ModularChangeFamily;\n\n\tpublic constructor(\n\t\trevisionTagCodec: RevisionTagCodec,\n\t\tfieldBatchCodec: FieldBatchCodec,\n\t\tcodecOptions: CodecWriteOptions,\n\t\tchunkCompressionStrategy?: TreeCompressionStrategy,\n\t\tprivate readonly idCompressor?: IIdCompressor,\n\t) {\n\t\tconst modularChangeCodec = makeModularChangeCodecFamily(\n\t\t\tfieldKindConfigurations,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tcodecOptions,\n\t\t\tchunkCompressionStrategy,\n\t\t);\n\t\tthis.modularChangeFamily = new ModularChangeFamily(fieldKinds, modularChangeCodec);\n\t\tthis.codecs = makeSharedTreeChangeCodecFamily(\n\t\t\tthis.modularChangeFamily.codecs,\n\t\t\tcodecOptions,\n\t\t);\n\t}\n\n\tpublic buildEditor(\n\t\tmintRevisionTag: () => RevisionTag,\n\t\tchangeReceiver: (change: TaggedChange<SharedTreeChange>) => void,\n\t): SharedTreeEditBuilder {\n\t\treturn new SharedTreeEditBuilder(\n\t\t\tthis.modularChangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tchangeReceiver,\n\t\t);\n\t}\n\n\tpublic compose(changes: TaggedChange<SharedTreeChange>[]): SharedTreeChange {\n\t\tconst newChanges: Mutable<SharedTreeChange[\"changes\"]> = [];\n\t\tconst dataChangeRun: TaggedChange<ModularChangeset>[] = [];\n\n\t\tconst flushDataChangeRun = (): void => {\n\t\t\tif (dataChangeRun.length > 0) {\n\t\t\t\tnewChanges.push({\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.compose(dataChangeRun),\n\t\t\t\t});\n\t\t\t\tdataChangeRun.length = 0;\n\t\t\t}\n\t\t};\n\n\t\tfor (const topChange of changes) {\n\t\t\tfor (const change of topChange.change.changes) {\n\t\t\t\tif (change.type === \"schema\") {\n\t\t\t\t\tflushDataChangeRun();\n\t\t\t\t\tnewChanges.push(change);\n\t\t\t\t} else {\n\t\t\t\t\tdataChangeRun.push(mapTaggedChange(topChange, change.innerChange));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tflushDataChangeRun();\n\t\treturn { changes: newChanges };\n\t}\n\n\tpublic invert(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tisRollback: boolean,\n\t\trevision: RevisionTag,\n\t): SharedTreeChange {\n\t\tconst invertInnerChange: (\n\t\t\tinnerChange: SharedTreeChange[\"changes\"][number],\n\t\t) => SharedTreeChange[\"changes\"][number] = (innerChange) => {\n\t\t\tswitch (innerChange.type) {\n\t\t\t\tcase \"data\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"data\",\n\t\t\t\t\t\tinnerChange: this.modularChangeFamily.invert(\n\t\t\t\t\t\t\tmapTaggedChange(change, innerChange.innerChange),\n\t\t\t\t\t\t\tisRollback,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\tcase \"schema\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"schema\",\n\t\t\t\t\t\tinnerChange: {\n\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\tnew: innerChange.innerChange.schema.old,\n\t\t\t\t\t\t\t\told: innerChange.innerChange.schema.new,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tisInverse: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tfail(0xacc /* Unknown SharedTree change type. */);\n\t\t\t}\n\t\t};\n\t\treturn {\n\t\t\tchanges: change.change.changes.map(invertInnerChange).reverse(),\n\t\t};\n\t}\n\n\tpublic rebase(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tover: TaggedChange<SharedTreeChange>,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): SharedTreeChange {\n\t\tif (change.change.changes.length === 0 || over.change.changes.length === 0) {\n\t\t\treturn change.change;\n\t\t}\n\n\t\tif (hasSchemaChange(change.change) || hasSchemaChange(over.change)) {\n\t\t\t// Any SharedTreeChange (a list of sub-changes) that contains a schema change will cause ANY change that rebases over it to conflict.\n\t\t\t// Similarly, any SharedTreeChange containing a schema change will fail to rebase over ANY change.\n\t\t\t// Those two combine to mean: no concurrency with schema changes is supported.\n\t\t\t// This is fine because it's an open problem. Example: a tree with an A at the root and a schema that allows an A | B at the root will\n\t\t\t// become out of schema if a schema changes to restrict root types to just A is concurrent with a data change that sets it to a B.\n\t\t\t// We don't have an efficient way to detect this document-wide and there are varying opinions on restricting schema changes to prevent this.\n\t\t\t// A SharedTreeChange containing a schema change will NOT conflict in a non-concurrency case, as the \"meatless sandwich\" optimization\n\t\t\t// will result in rebase never being called.\n\t\t\treturn SharedTreeChangeFamily.emptyChange;\n\t\t}\n\t\tassert(\n\t\t\thasSingle(change.change.changes) && hasSingle(over.change.changes),\n\t\t\t0x884 /* SharedTreeChange should have exactly one inner change if no schema change is present. */,\n\t\t);\n\n\t\tconst dataChangeIntention = change.change.changes[0];\n\t\tconst dataChangeOver = over.change.changes[0];\n\t\tassert(\n\t\t\tdataChangeIntention.type === \"data\" && dataChangeOver.type === \"data\",\n\t\t\t0x885 /* Data change should be present. */,\n\t\t);\n\n\t\treturn {\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.rebase(\n\t\t\t\t\t\tmapTaggedChange(change, dataChangeIntention.innerChange),\n\t\t\t\t\t\tmapTaggedChange(over, dataChangeOver.innerChange),\n\t\t\t\t\t\trevisionMetadata,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n\n\tpublic changeRevision(\n\t\tchange: SharedTreeChange,\n\t\tnewRevision: RevisionTag | undefined,\n\t\trollbackOf?: RevisionTag,\n\t): SharedTreeChange {\n\t\treturn {\n\t\t\tchanges: change.changes.map((inner) => {\n\t\t\t\treturn inner.type === \"data\"\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...inner,\n\t\t\t\t\t\t\tinnerChange: this.modularChangeFamily.rebaser.changeRevision(\n\t\t\t\t\t\t\t\tinner.innerChange,\n\t\t\t\t\t\t\t\tnewRevision,\n\t\t\t\t\t\t\t\trollbackOf,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t: inner;\n\t\t\t}),\n\t\t};\n\t}\n\n\tpublic get rebaser(): ChangeRebaser<SharedTreeChange> {\n\t\treturn this;\n\t}\n}\n\nexport function hasSchemaChange(change: SharedTreeChange): boolean {\n\treturn change.changes.some((innerChange) => innerChange.type === \"schema\");\n}\n\nfunction mapDataChanges(\n\tchange: SharedTreeChange,\n\tmap: (change: ModularChangeset) => ModularChangeset,\n): SharedTreeChange {\n\treturn {\n\t\tchanges: change.changes.map((dataOrSchemaChange) => {\n\t\t\tif (dataOrSchemaChange.type === \"data\") {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: map(dataOrSchemaChange.innerChange),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn dataOrSchemaChange;\n\t\t}),\n\t};\n}\n\n/**\n * Produces an equivalent change with an updated set of appropriate refreshers.\n * @param change - The change to compute refreshers for. Not mutated.\n * @param getDetachedNode - retrieves a {@link TreeChunk} for the corresponding detached node id.\n * Is expected to read from a forest in a state that corresponds to the input context of the given change.\n * @returns An equivalent change with an updated set of appropriate refreshers.\n */\nexport function updateRefreshers(\n\tchange: SharedTreeChange,\n\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\trelevantRemovedRootsFromDataChange: (\n\t\ttaggedChange: ModularChangeset,\n\t) => Iterable<DeltaDetachedNodeId>,\n\tupdateDataChangeRefreshers: (\n\t\tchange: ModularChangeset,\n\t\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\t\tremovedRoots: Iterable<DeltaDetachedNodeId>,\n\t\trequireRefreshers: boolean,\n\t) => ModularChangeset,\n): SharedTreeChange {\n\t// Adding refreshers to a SharedTreeChange is not as simple as adding refreshers to each of its data changes.\n\t// This is because earlier data changes affect the state of the forest in ways that can influence the refreshers\n\t// needed for later data changes. This can happen in two ways:\n\t// 1. By removing a tree that is a relevant root to a later data change.\n\t// 2. By changing the contents of a tree that is a relevant root to a later data change.\n\t// (Note that these two cases can compound)\n\t// Thankfully, in both of these cases, refreshers can be omitted from the later data changes because the forest\n\t// applying those data changes is guaranteed to still have have the relevant trees in memory.\n\t// This means that for the first data change, all required refreshers should be added (and none should be missing).\n\t// While for later data changes, we should not include refreshers that either:\n\t// A) were already included in the earlier data changes\n\t// B) correspond to trees that were removed by earlier data changes\n\t// Set A is excluded by tracking which roots have already been included in the earlier data changes, and filtering\n\t// them out from the relevant removed roots.\n\t// Set B is excluded because the `getDetachedNode` is bound to return `undefined` for them, which tell\n\t// `defaultUpdateRefreshers` to ignore. One downside of this approach is that it prevents `defaultUpdateRefreshers`\n\t// from detecting cases where a detached node is missing for another reason (which would be a bug).\n\n\t// The roots that have been included as refreshers across all data changes so far.\n\tconst includedRoots: NestedSet<RevisionTag | undefined, number> = new Map();\n\tfunction getAndRememberDetachedNode(id: DeltaDetachedNodeId): TreeChunk | undefined {\n\t\taddToNestedSet(includedRoots, id.major, id.minor);\n\t\treturn getDetachedNode(id);\n\t}\n\tfunction* filterIncludedRoots(\n\t\ttoFilter: Iterable<DeltaDetachedNodeId>,\n\t): Iterable<DeltaDetachedNodeId> {\n\t\tfor (const id of toFilter) {\n\t\t\tif (!nestedSetContains(includedRoots, id.major, id.minor)) {\n\t\t\t\tyield id;\n\t\t\t}\n\t\t}\n\t}\n\tlet isFirstDataChange = true;\n\treturn mapDataChanges(change, (dataChange) => {\n\t\tconst removedRoots = relevantRemovedRootsFromDataChange(dataChange);\n\t\tif (isFirstDataChange) {\n\t\t\tisFirstDataChange = false;\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tremovedRoots,\n\t\t\t\ttrue,\n\t\t\t);\n\t\t} else {\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tfilterIncludedRoots(removedRoots),\n\t\t\t\tfalse,\n\t\t\t);\n\t\t}\n\t});\n}\n"]}
1
+ {"version":3,"file":"sharedTreeChangeFamily.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeFamily.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AAInE,+CAY0B;AAC1B,4DASuC;AACvC,+CAM0B;AAE1B,2EAA8E;AAE9E,yEAA0E;AAE1E;;;;GAIG;AACH,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M,EAAE,IAAI,UAAU,EAAE,CAAC;YAC7B,kFAAkF;YAClF,2GAA2G;YAC3G,IAAA,yBAAc,EAAC,aAAa,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;QACnD,CAAC;QACD,MAAM,YAAY,GAAG,kCAAkC,CAAC,UAAU,CAAC,CAAC;QACpE,IAAI,iBAAiB,EAAE,CAAC;YACvB,iBAAiB,GAAG,KAAK,CAAC;YAC1B,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,mBAAmB,CAAC,YAAY,CAAC,EACjC,IAAI,CACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACP,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,mBAAmB,CAAC,YAAY,CAAC,EACjC,KAAK,CACL,CAAC;QACH,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AAzED,4CAyEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport type { CodecWriteOptions, ICodecFamily } from \"../codec/index.js\";\nimport {\n\ttype ChangeEncodingContext,\n\ttype ChangeFamily,\n\ttype ChangeRebaser,\n\ttype DeltaDetachedNodeId,\n\ttype EditorOptions,\n\ttype RevisionMetadataSource,\n\ttype RevisionReplacer,\n\ttype RevisionTag,\n\ttype RevisionTagCodec,\n\ttype TaggedChange,\n\tmapTaggedChange,\n} from \"../core/index.js\";\nimport {\n\ttype FieldBatchCodec,\n\tModularChangeFamily,\n\ttype ModularChangeset,\n\ttype TreeChunk,\n\ttype TreeCompressionStrategy,\n\tfieldKindConfigurations,\n\tfieldKinds,\n\tmakeModularChangeCodecFamily,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype Mutable,\n\ttype NestedSet,\n\taddToNestedSet,\n\thasSingle,\n\tnestedSetContains,\n} from \"../util/index.js\";\n\nimport { makeSharedTreeChangeCodecFamily } from \"./sharedTreeChangeCodecs.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport { IdBasedSharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\n\n/**\n * Implementation of {@link ChangeFamily} that combines edits to fields and schema changes.\n *\n * @sealed\n */\nexport class SharedTreeChangeFamily\n\timplements\n\t\tChangeFamily<IdBasedSharedTreeEditBuilder, SharedTreeChange>,\n\t\tChangeRebaser<SharedTreeChange>\n{\n\tpublic static readonly emptyChange: SharedTreeChange = {\n\t\tchanges: [],\n\t};\n\n\tpublic readonly codecs: ICodecFamily<SharedTreeChange, ChangeEncodingContext>;\n\tprivate readonly modularChangeFamily: ModularChangeFamily;\n\n\tpublic constructor(\n\t\trevisionTagCodec: RevisionTagCodec,\n\t\tfieldBatchCodec: FieldBatchCodec,\n\t\tcodecOptions: CodecWriteOptions,\n\t\tchunkCompressionStrategy?: TreeCompressionStrategy,\n\t\tprivate readonly idCompressor?: IIdCompressor,\n\t) {\n\t\tconst modularChangeCodec = makeModularChangeCodecFamily(\n\t\t\tfieldKindConfigurations,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tcodecOptions,\n\t\t\tchunkCompressionStrategy,\n\t\t);\n\t\tthis.modularChangeFamily = new ModularChangeFamily(\n\t\t\tfieldKinds,\n\t\t\tmodularChangeCodec,\n\t\t\tcodecOptions,\n\t\t);\n\t\tthis.codecs = makeSharedTreeChangeCodecFamily(\n\t\t\tthis.modularChangeFamily.codecs,\n\t\t\tcodecOptions,\n\t\t);\n\t}\n\n\tpublic buildEditor(\n\t\tmintRevisionTag: () => RevisionTag,\n\t\tchangeReceiver: (change: TaggedChange<SharedTreeChange>) => void,\n\t\toptions?: EditorOptions,\n\t): IdBasedSharedTreeEditBuilder {\n\t\treturn new IdBasedSharedTreeEditBuilder(\n\t\t\tthis.modularChangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tchangeReceiver,\n\t\t\toptions,\n\t\t);\n\t}\n\n\tpublic compose(changes: TaggedChange<SharedTreeChange>[]): SharedTreeChange {\n\t\tconst newChanges: Mutable<SharedTreeChange[\"changes\"]> = [];\n\t\tconst dataChangeRun: TaggedChange<ModularChangeset>[] = [];\n\n\t\tconst flushDataChangeRun = (): void => {\n\t\t\tif (dataChangeRun.length > 0) {\n\t\t\t\tnewChanges.push({\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.compose(dataChangeRun),\n\t\t\t\t});\n\t\t\t\tdataChangeRun.length = 0;\n\t\t\t}\n\t\t};\n\n\t\tfor (const topChange of changes) {\n\t\t\tfor (const change of topChange.change.changes) {\n\t\t\t\tif (change.type === \"schema\") {\n\t\t\t\t\tflushDataChangeRun();\n\t\t\t\t\tnewChanges.push(change);\n\t\t\t\t} else {\n\t\t\t\t\tdataChangeRun.push(mapTaggedChange(topChange, change.innerChange));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tflushDataChangeRun();\n\t\treturn { changes: newChanges };\n\t}\n\n\tpublic invert(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tisRollback: boolean,\n\t\trevision: RevisionTag,\n\t): SharedTreeChange {\n\t\tconst invertInnerChange: (\n\t\t\tinnerChange: SharedTreeChange[\"changes\"][number],\n\t\t) => SharedTreeChange[\"changes\"][number] = (innerChange) => {\n\t\t\tswitch (innerChange.type) {\n\t\t\t\tcase \"data\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"data\",\n\t\t\t\t\t\tinnerChange: this.modularChangeFamily.invert(\n\t\t\t\t\t\t\tmapTaggedChange(change, innerChange.innerChange),\n\t\t\t\t\t\t\tisRollback,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tcase \"schema\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"schema\",\n\t\t\t\t\t\tinnerChange: {\n\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\tnew: innerChange.innerChange.schema.old,\n\t\t\t\t\t\t\t\told: innerChange.innerChange.schema.new,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tisInverse: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tfail(0xacc /* Unknown SharedTree change type. */);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\treturn {\n\t\t\tchanges: change.change.changes.map(invertInnerChange).reverse(),\n\t\t};\n\t}\n\n\tpublic rebase(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tover: TaggedChange<SharedTreeChange>,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): SharedTreeChange {\n\t\tif (change.change.changes.length === 0 || over.change.changes.length === 0) {\n\t\t\treturn change.change;\n\t\t}\n\n\t\tif (hasSchemaChange(change.change) || hasSchemaChange(over.change)) {\n\t\t\t// Any SharedTreeChange (a list of sub-changes) that contains a schema change will cause ANY change that rebases over it to conflict.\n\t\t\t// Similarly, any SharedTreeChange containing a schema change will fail to rebase over ANY change.\n\t\t\t// Those two combine to mean: no concurrency with schema changes is supported.\n\t\t\t// This is fine because it's an open problem. Example: a tree with an A at the root and a schema that allows an A | B at the root will\n\t\t\t// become out of schema if a schema changes to restrict root types to just A is concurrent with a data change that sets it to a B.\n\t\t\t// We don't have an efficient way to detect this document-wide and there are varying opinions on restricting schema changes to prevent this.\n\t\t\t// A SharedTreeChange containing a schema change will NOT conflict in a non-concurrency case, as the \"meatless sandwich\" optimization\n\t\t\t// will result in rebase never being called.\n\t\t\treturn SharedTreeChangeFamily.emptyChange;\n\t\t}\n\t\tassert(\n\t\t\thasSingle(change.change.changes) && hasSingle(over.change.changes),\n\t\t\t0x884 /* SharedTreeChange should have exactly one inner change if no schema change is present. */,\n\t\t);\n\n\t\tconst dataChangeIntention = change.change.changes[0];\n\t\tconst dataChangeOver = over.change.changes[0];\n\t\tassert(\n\t\t\tdataChangeIntention.type === \"data\" && dataChangeOver.type === \"data\",\n\t\t\t0x885 /* Data change should be present. */,\n\t\t);\n\n\t\treturn {\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.rebase(\n\t\t\t\t\t\tmapTaggedChange(change, dataChangeIntention.innerChange),\n\t\t\t\t\t\tmapTaggedChange(over, dataChangeOver.innerChange),\n\t\t\t\t\t\trevisionMetadata,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n\n\tpublic getRevisions(change: SharedTreeChange): Set<RevisionTag | undefined> {\n\t\tconst aggregated: Set<RevisionTag | undefined> = new Set();\n\t\tfor (const innerChange of change.changes) {\n\t\t\tif (innerChange.type === \"data\") {\n\t\t\t\tconst innerRevisions = this.modularChangeFamily.rebaser.getRevisions(\n\t\t\t\t\tinnerChange.innerChange,\n\t\t\t\t);\n\t\t\t\tfor (const tag of innerRevisions) {\n\t\t\t\t\taggregated.add(tag);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn aggregated;\n\t}\n\n\tpublic changeRevision(\n\t\tchange: SharedTreeChange,\n\t\treplacer: RevisionReplacer,\n\t): SharedTreeChange {\n\t\treturn mapDataChanges(change, (inner) =>\n\t\t\tthis.modularChangeFamily.rebaser.changeRevision(inner, replacer),\n\t\t);\n\t}\n\n\tpublic get rebaser(): ChangeRebaser<SharedTreeChange> {\n\t\treturn this;\n\t}\n}\n\nexport function hasSchemaChange(change: SharedTreeChange): boolean {\n\treturn change.changes.some((innerChange) => innerChange.type === \"schema\");\n}\n\nfunction mapDataChanges(\n\tchange: SharedTreeChange,\n\tmap: (change: ModularChangeset) => ModularChangeset,\n): SharedTreeChange {\n\treturn {\n\t\tchanges: change.changes.map((dataOrSchemaChange) => {\n\t\t\tif (dataOrSchemaChange.type === \"data\") {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: map(dataOrSchemaChange.innerChange),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn dataOrSchemaChange;\n\t\t}),\n\t};\n}\n\n/**\n * Produces an equivalent change with an updated set of appropriate refreshers.\n * @param change - The change to compute refreshers for. Not mutated.\n * @param getDetachedNode - retrieves a {@link TreeChunk} for the corresponding detached node id.\n * Is expected to read from a forest in a state that corresponds to the input context of the given change.\n * @returns An equivalent change with an updated set of appropriate refreshers.\n */\nexport function updateRefreshers(\n\tchange: SharedTreeChange,\n\tbuildsFromDataChange: (taggedChange: ModularChangeset) => Iterable<DeltaDetachedNodeId>,\n\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\trelevantRemovedRootsFromDataChange: (\n\t\ttaggedChange: ModularChangeset,\n\t) => Iterable<DeltaDetachedNodeId>,\n\tupdateDataChangeRefreshers: (\n\t\tchange: ModularChangeset,\n\t\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\t\tremovedRoots: Iterable<DeltaDetachedNodeId>,\n\t\trequireRefreshers: boolean,\n\t) => ModularChangeset,\n): SharedTreeChange {\n\t// Adding refreshers to a SharedTreeChange is not as simple as adding refreshers to each of its data changes.\n\t// This is because earlier data changes affect the state of the forest in ways that can influence the refreshers\n\t// needed for later data changes. This can happen in two ways:\n\t// 1. By removing a tree that is a relevant root to a later data change.\n\t// 2. By changing the contents of a tree that is a relevant root to a later data change.\n\t// (Note that these two cases can compound)\n\t// Thankfully, in both of these cases, refreshers can be omitted from the later data changes because the forest\n\t// applying those data changes is guaranteed to still have have the relevant trees in memory.\n\t// This means that for the first data change, all required refreshers should be added (and none should be missing).\n\t// While for later data changes, we should not include refreshers that either:\n\t// A) were already included in the earlier data changes\n\t// B) correspond to trees that were removed by earlier data changes\n\t// Set A is excluded by tracking which roots have already been included in the earlier data changes, and filtering\n\t// them out from the relevant removed roots.\n\t// Set B is excluded because the `getDetachedNode` is bound to return `undefined` for them, which tell\n\t// `defaultUpdateRefreshers` to ignore. One downside of this approach is that it prevents `defaultUpdateRefreshers`\n\t// from detecting cases where a detached node is missing for another reason (which would be a bug).\n\n\t// The roots that have been included as refreshers across all data changes so far.\n\tconst includedRoots: NestedSet<RevisionTag | undefined, number> = new Map();\n\tfunction getAndRememberDetachedNode(id: DeltaDetachedNodeId): TreeChunk | undefined {\n\t\taddToNestedSet(includedRoots, id.major, id.minor);\n\t\treturn getDetachedNode(id);\n\t}\n\tfunction* filterIncludedRoots(\n\t\ttoFilter: Iterable<DeltaDetachedNodeId>,\n\t): Iterable<DeltaDetachedNodeId> {\n\t\tfor (const id of toFilter) {\n\t\t\tif (!nestedSetContains(includedRoots, id.major, id.minor)) {\n\t\t\t\tyield id;\n\t\t\t}\n\t\t}\n\t}\n\tlet isFirstDataChange = true;\n\treturn mapDataChanges(change, (dataChange) => {\n\t\tconst builtRoots = buildsFromDataChange(dataChange);\n\t\tfor (const id of builtRoots) {\n\t\t\t// Detached root IDs that are used for builds are only ever used by a single node,\n\t\t\t// so there is no risk of excluding needed refreshers by adding them to the list of already included roots.\n\t\t\taddToNestedSet(includedRoots, id.major, id.minor);\n\t\t}\n\t\tconst removedRoots = relevantRemovedRootsFromDataChange(dataChange);\n\t\tif (isFirstDataChange) {\n\t\t\tisFirstDataChange = false;\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tfilterIncludedRoots(removedRoots),\n\t\t\t\ttrue,\n\t\t\t);\n\t\t} else {\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tfilterIncludedRoots(removedRoots),\n\t\t\t\tfalse,\n\t\t\t);\n\t\t}\n\t});\n}\n"]}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { ChangeFamilyEditor, RevisionTag, TaggedChange, TreeStoredSchema } from "../core/index.js";
6
- import { DefaultEditBuilder, type IDefaultEditBuilder, type ModularChangeFamily } from "../feature-libraries/index.js";
5
+ import type { ChangeAtomId, ChangeFamilyEditor, EditorOptions, RevisionTag, TaggedChange, TreeChunk, TreeStoredSchema } from "../core/index.js";
6
+ import { DefaultIdBasedDataEditor, LocationBasedDataEditor, type DetachedRootIds, type DetachedRootLocation, type DetachedRootsLocation, type Locator, type DataEditor, type ModularChangeFamily } from "../feature-libraries/index.js";
7
7
  import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
8
8
  /**
9
9
  * Editor for schema changes.
@@ -20,19 +20,29 @@ export interface ISchemaEditor {
20
20
  /**
21
21
  * SharedTree editor for transactional tree data and schema changes.
22
22
  */
23
- export interface ISharedTreeEditor extends IDefaultEditBuilder {
23
+ export interface IIdBasedSharedTreeEditor extends DataEditor<TreeChunk, ChangeAtomId, DetachedRootIds> {
24
+ /**
25
+ * Editor for schema changes.
26
+ */
27
+ schema: ISchemaEditor;
28
+ }
29
+ export interface ILocationBasedSharedTreeEditor extends DataEditor<TreeChunk, DetachedRootLocation, DetachedRootsLocation> {
24
30
  /**
25
31
  * Editor for schema changes.
26
32
  */
27
33
  schema: ISchemaEditor;
28
34
  }
29
35
  /**
30
- * Implementation of {@link IDefaultEditBuilder} based on the default set of supported field kinds.
36
+ * Implementation of {@link DataEditor} based on the default set of supported field kinds.
31
37
  * @sealed
32
38
  */
33
- export declare class SharedTreeEditBuilder extends DefaultEditBuilder implements ChangeFamilyEditor, ISharedTreeEditor {
39
+ export declare class IdBasedSharedTreeEditBuilder extends DefaultIdBasedDataEditor implements ChangeFamilyEditor, IIdBasedSharedTreeEditor {
34
40
  private readonly changeReceiver;
35
41
  readonly schema: ISchemaEditor;
36
- constructor(modularChangeFamily: ModularChangeFamily, mintRevisionTag: () => RevisionTag, changeReceiver: (change: TaggedChange<SharedTreeChange>) => void);
42
+ constructor(modularChangeFamily: ModularChangeFamily, mintRevisionTag: () => RevisionTag, changeReceiver: (change: TaggedChange<SharedTreeChange>) => void, options?: EditorOptions);
43
+ }
44
+ export declare class LocationBasedSharedTreeEditBuilder extends LocationBasedDataEditor implements ILocationBasedSharedTreeEditor {
45
+ readonly schema: ISchemaEditor;
46
+ constructor(idBasedEditor: IIdBasedSharedTreeEditor, locator: Locator);
37
47
  }
38
48
  //# sourceMappingURL=sharedTreeEditBuilder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeEditBuilder.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeEditBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B;;;;OAIG;IACH,eAAe,CAAC,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAChF;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC7D;;OAEG;IACH,MAAM,EAAE,aAAa,CAAC;CACtB;AAED;;;GAGG;AACH,qBAAa,qBACZ,SAAQ,kBACR,YAAW,kBAAkB,EAAE,iBAAiB;IAO/C,OAAO,CAAC,QAAQ,CAAC,cAAc;IALhC,SAAgB,MAAM,EAAE,aAAa,CAAC;gBAGrC,mBAAmB,EAAE,mBAAmB,EACxC,eAAe,EAAE,MAAM,WAAW,EACjB,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,gBAAgB,CAAC,KAAK,IAAI;CA4BlF"}
1
+ {"version":3,"file":"sharedTreeEditBuilder.d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,8BAA8B;IAEzC,SAAgB,MAAM,EAAE,aAAa,CAAC;gBAEnB,aAAa,EAAE,wBAAwB,EAAE,OAAO,EAAE,OAAO;CAI5E"}
@@ -4,22 +4,22 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.SharedTreeEditBuilder = void 0;
7
+ exports.LocationBasedSharedTreeEditBuilder = exports.IdBasedSharedTreeEditBuilder = void 0;
8
8
  const index_js_1 = require("../feature-libraries/index.js");
9
9
  /**
10
- * Implementation of {@link IDefaultEditBuilder} based on the default set of supported field kinds.
10
+ * Implementation of {@link DataEditor} based on the default set of supported field kinds.
11
11
  * @sealed
12
12
  */
13
- class SharedTreeEditBuilder extends index_js_1.DefaultEditBuilder {
14
- constructor(modularChangeFamily, mintRevisionTag, changeReceiver) {
13
+ class IdBasedSharedTreeEditBuilder extends index_js_1.DefaultIdBasedDataEditor {
14
+ constructor(modularChangeFamily, mintRevisionTag, changeReceiver, options) {
15
15
  super(modularChangeFamily, mintRevisionTag, (taggedChange) => changeReceiver({
16
16
  ...taggedChange,
17
17
  change: { changes: [{ type: "data", innerChange: taggedChange.change }] },
18
- }));
18
+ }), options, modularChangeFamily.codecOptions);
19
19
  this.changeReceiver = changeReceiver;
20
20
  this.schema = {
21
21
  setStoredSchema: (oldSchema, newSchema) => {
22
- this.changeReceiver({
22
+ changeReceiver({
23
23
  revision: mintRevisionTag(),
24
24
  change: {
25
25
  changes: [
@@ -37,5 +37,12 @@ class SharedTreeEditBuilder extends index_js_1.DefaultEditBuilder {
37
37
  };
38
38
  }
39
39
  }
40
- exports.SharedTreeEditBuilder = SharedTreeEditBuilder;
40
+ exports.IdBasedSharedTreeEditBuilder = IdBasedSharedTreeEditBuilder;
41
+ class LocationBasedSharedTreeEditBuilder extends index_js_1.LocationBasedDataEditor {
42
+ constructor(idBasedEditor, locator) {
43
+ super(idBasedEditor, locator);
44
+ this.schema = idBasedEditor.schema;
45
+ }
46
+ }
47
+ exports.LocationBasedSharedTreeEditBuilder = LocationBasedSharedTreeEditBuilder;
41
48
  //# sourceMappingURL=sharedTreeEditBuilder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeEditBuilder.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeEditBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,4DAIuC;AA2BvC;;;GAGG;AACH,MAAa,qBACZ,SAAQ,6BAAkB;IAK1B,YACC,mBAAwC,EACxC,eAAkC,EACjB,cAAgE;QAEjF,KAAK,CAAC,mBAAmB,EAAE,eAAe,EAAE,CAAC,YAAY,EAAE,EAAE,CAC5D,cAAc,CAAC;YACd,GAAG,YAAY;YACf,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE;SACzE,CAAC,CACF,CAAC;QAPe,mBAAc,GAAd,cAAc,CAAkD;QASjF,IAAI,CAAC,MAAM,GAAG;YACb,eAAe,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE;gBACzC,IAAI,CAAC,cAAc,CAAC;oBACnB,QAAQ,EAAE,eAAe,EAAE;oBAC3B,MAAM,EAAE;wBACP,OAAO,EAAE;4BACR;gCACC,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE;oCACZ,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE;oCAC1C,SAAS,EAAE,KAAK;iCAChB;6BACD;yBACD;qBACD;iBACD,CAAC,CAAC;YACJ,CAAC;SACD,CAAC;IACH,CAAC;CACD;AArCD,sDAqCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tChangeFamilyEditor,\n\tRevisionTag,\n\tTaggedChange,\n\tTreeStoredSchema,\n} from \"../core/index.js\";\nimport {\n\tDefaultEditBuilder,\n\ttype IDefaultEditBuilder,\n\ttype ModularChangeFamily,\n} from \"../feature-libraries/index.js\";\n\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\n\n/**\n * Editor for schema changes.\n * The only currently supported operation is to replace the stored schema.\n */\nexport interface ISchemaEditor {\n\t/**\n\t * Updates the stored schema.\n\t * @param oldSchema - The schema being overwritten.\n\t * @param newSchema - The new schema to apply.\n\t */\n\tsetStoredSchema(oldSchema: TreeStoredSchema, newSchema: TreeStoredSchema): void;\n}\n\n/**\n * SharedTree editor for transactional tree data and schema changes.\n */\nexport interface ISharedTreeEditor extends IDefaultEditBuilder {\n\t/**\n\t * Editor for schema changes.\n\t */\n\tschema: ISchemaEditor;\n}\n\n/**\n * Implementation of {@link IDefaultEditBuilder} based on the default set of supported field kinds.\n * @sealed\n */\nexport class SharedTreeEditBuilder\n\textends DefaultEditBuilder\n\timplements ChangeFamilyEditor, ISharedTreeEditor\n{\n\tpublic readonly schema: ISchemaEditor;\n\n\tpublic constructor(\n\t\tmodularChangeFamily: ModularChangeFamily,\n\t\tmintRevisionTag: () => RevisionTag,\n\t\tprivate readonly changeReceiver: (change: TaggedChange<SharedTreeChange>) => void,\n\t) {\n\t\tsuper(modularChangeFamily, mintRevisionTag, (taggedChange) =>\n\t\t\tchangeReceiver({\n\t\t\t\t...taggedChange,\n\t\t\t\tchange: { changes: [{ type: \"data\", innerChange: taggedChange.change }] },\n\t\t\t}),\n\t\t);\n\n\t\tthis.schema = {\n\t\t\tsetStoredSchema: (oldSchema, newSchema) => {\n\t\t\t\tthis.changeReceiver({\n\t\t\t\t\trevision: mintRevisionTag(),\n\t\t\t\t\tchange: {\n\t\t\t\t\t\tchanges: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"schema\",\n\t\t\t\t\t\t\t\tinnerChange: {\n\t\t\t\t\t\t\t\t\tschema: { new: newSchema, old: oldSchema },\n\t\t\t\t\t\t\t\t\tisInverse: false,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"sharedTreeEditBuilder.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeEditBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH,4DASuC;AAoCvC;;;GAGG;AACH,MAAa,4BACZ,SAAQ,mCAAwB;IAKhC,YACC,mBAAwC,EACxC,eAAkC,EACjB,cAAgE,EACjF,OAAuB;QAEvB,KAAK,CACJ,mBAAmB,EACnB,eAAe,EACf,CAAC,YAAY,EAAE,EAAE,CAChB,cAAc,CAAC;YACd,GAAG,YAAY;YACf,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE;SACzE,CAAC,EACH,OAAO,EACP,mBAAmB,CAAC,YAAY,CAChC,CAAC;QAbe,mBAAc,GAAd,cAAc,CAAkD;QAejF,IAAI,CAAC,MAAM,GAAG;YACb,eAAe,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE;gBACzC,cAAc,CAAC;oBACd,QAAQ,EAAE,eAAe,EAAE;oBAC3B,MAAM,EAAE;wBACP,OAAO,EAAE;4BACR;gCACC,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE;oCACZ,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE;oCAC1C,SAAS,EAAE,KAAK;iCAChB;6BACD;yBACD;qBACD;iBACD,CAAC,CAAC;YACJ,CAAC;SACD,CAAC;IACH,CAAC;CACD;AA3CD,oEA2CC;AAED,MAAa,kCACZ,SAAQ,kCAAuB;IAK/B,YAAmB,aAAuC,EAAE,OAAgB;QAC3E,KAAK,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;IACpC,CAAC;CACD;AAVD,gFAUC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tChangeAtomId,\n\tChangeFamilyEditor,\n\tEditorOptions,\n\tRevisionTag,\n\tTaggedChange,\n\tTreeChunk,\n\tTreeStoredSchema,\n} from \"../core/index.js\";\nimport {\n\tDefaultIdBasedDataEditor,\n\tLocationBasedDataEditor,\n\ttype DetachedRootIds,\n\ttype DetachedRootLocation,\n\ttype DetachedRootsLocation,\n\ttype Locator,\n\ttype DataEditor,\n\ttype ModularChangeFamily,\n} from \"../feature-libraries/index.js\";\n\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\n\n/**\n * Editor for schema changes.\n * The only currently supported operation is to replace the stored schema.\n */\nexport interface ISchemaEditor {\n\t/**\n\t * Updates the stored schema.\n\t * @param oldSchema - The schema being overwritten.\n\t * @param newSchema - The new schema to apply.\n\t */\n\tsetStoredSchema(oldSchema: TreeStoredSchema, newSchema: TreeStoredSchema): void;\n}\n\n/**\n * SharedTree editor for transactional tree data and schema changes.\n */\nexport interface IIdBasedSharedTreeEditor\n\textends DataEditor<TreeChunk, ChangeAtomId, DetachedRootIds> {\n\t/**\n\t * Editor for schema changes.\n\t */\n\tschema: ISchemaEditor;\n}\n\nexport interface ILocationBasedSharedTreeEditor\n\textends DataEditor<TreeChunk, DetachedRootLocation, DetachedRootsLocation> {\n\t/**\n\t * Editor for schema changes.\n\t */\n\tschema: ISchemaEditor;\n}\n\n/**\n * Implementation of {@link DataEditor} based on the default set of supported field kinds.\n * @sealed\n */\nexport class IdBasedSharedTreeEditBuilder\n\textends DefaultIdBasedDataEditor\n\timplements ChangeFamilyEditor, IIdBasedSharedTreeEditor\n{\n\tpublic readonly schema: ISchemaEditor;\n\n\tpublic constructor(\n\t\tmodularChangeFamily: ModularChangeFamily,\n\t\tmintRevisionTag: () => RevisionTag,\n\t\tprivate readonly changeReceiver: (change: TaggedChange<SharedTreeChange>) => void,\n\t\toptions?: EditorOptions,\n\t) {\n\t\tsuper(\n\t\t\tmodularChangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\t(taggedChange) =>\n\t\t\t\tchangeReceiver({\n\t\t\t\t\t...taggedChange,\n\t\t\t\t\tchange: { changes: [{ type: \"data\", innerChange: taggedChange.change }] },\n\t\t\t\t}),\n\t\t\toptions,\n\t\t\tmodularChangeFamily.codecOptions,\n\t\t);\n\n\t\tthis.schema = {\n\t\t\tsetStoredSchema: (oldSchema, newSchema) => {\n\t\t\t\tchangeReceiver({\n\t\t\t\t\trevision: mintRevisionTag(),\n\t\t\t\t\tchange: {\n\t\t\t\t\t\tchanges: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"schema\",\n\t\t\t\t\t\t\t\tinnerChange: {\n\t\t\t\t\t\t\t\t\tschema: { new: newSchema, old: oldSchema },\n\t\t\t\t\t\t\t\t\tisInverse: false,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t}\n}\n\nexport class LocationBasedSharedTreeEditBuilder\n\textends LocationBasedDataEditor\n\timplements ILocationBasedSharedTreeEditor\n{\n\tpublic readonly schema: ISchemaEditor;\n\n\tpublic constructor(idBasedEditor: IIdBasedSharedTreeEditor, locator: Locator) {\n\t\tsuper(idBasedEditor, locator);\n\t\tthis.schema = idBasedEditor.schema;\n\t}\n}\n"]}
@@ -4,66 +4,71 @@
4
4
  */
5
5
  import type { IFluidHandle } from "@fluidframework/core-interfaces";
6
6
  import type { IIdCompressor } from "@fluidframework/id-compressor";
7
- import { TreeNode, type Unhydrated, type ImplicitFieldSchema, type InsertableField, type TreeFieldFromImplicitField, type TreeLeafValue, type UnsafeUnknownSchema, type TreeEncodingOptions, type VerboseTree, type TreeBranch, type TreeParsingOptions, type ConciseTree, type TreeNodeSchema } from "../simple-tree/index.js";
7
+ import { TreeNode, type Unhydrated, type ImplicitFieldSchema, type InsertableField, type TreeFieldFromImplicitField, type TreeLeafValue, type UnsafeUnknownSchema, type TreeEncodingOptions, type VerboseTree, type TreeBranch, type TreeParsingOptions, type ConciseTree, type TreeNodeSchema, type TreeBranchAlpha } from "../simple-tree/index.js";
8
8
  import { type JsonCompatible } from "../util/index.js";
9
9
  import { type ICodecOptions, type CodecWriteOptions } from "../codec/index.js";
10
- import type { TreeBranchAlpha } from "../simple-tree/index.js";
11
10
  /**
12
- * A utility interface for retrieving or converting node identifiers.
13
- *
11
+ * A utility interface for manipulating node identifiers.
14
12
  * @remarks
15
13
  * This provides methods to:
16
14
  *
17
- * - Retrieve long or short identifiers from nodes
18
- *
19
- * - Convert between long identifiers and short identifiers
20
- *
21
- * - Generates long identifiers
15
+ * - Retrieve identifiers from nodes
16
+ * - Generate identifiers
17
+ * - Convert between short numeric identifiers and long string identifiers
22
18
  *
23
19
  * @alpha @sealed
24
20
  */
25
21
  export interface TreeIdentifierUtils {
26
22
  /**
27
- * Returns the contents of a node's {@link SchemaFactory.identifier} field as a stable identifier.
28
- * If the identifier field does not exist, returns undefined.
23
+ * Returns the identifier of a node.
24
+ * @remarks
25
+ * This returns the node's UUID if and only if it has exactly one {@link SchemaFactory.identifier | identifier field}.
26
+ * If it has no identifier field, this returns undefined.
27
+ * If it has more than one identifier field, this throws an error.
28
+ * In that case, query the identifier fields directly instead.
29
29
  *
30
30
  * @param node - The TreeNode you want to get the identifier from,
31
31
  */
32
32
  (node: TreeNode): string | undefined;
33
33
  /**
34
- * Returns the shortened identifier as a number given long identifier known by the id compressor on the branch if possible.
35
- * Otherwise, it will return the original string identifier provided.
36
- * If the id does not exist, or is unknown by the id compressor, it returns undefined.
34
+ * Returns the shortened identifier as a number given a UUID known by the id compressor on the branch.
35
+ * @remarks
36
+ * If the given string is not a valid identifier and/or was not generated by the SharedTree, this will return `undefined`.
37
+ *
38
+ * See {@link TreeIdentifierUtils.getShort} for additional details about shortened identifiers.
37
39
  *
38
- * This method is the inverse of {@link TreeIdentifierUtils.lengthen}. If you shorten an identifier
39
- * and then immediately pass it to {@link TreeIdentifierUtils.lengthen}, you will get the original string back.
40
+ * This method is the inverse of {@link TreeIdentifierUtils.lengthen}.
41
+ * If you shorten an identifier and then immediately pass it to {@link TreeIdentifierUtils.lengthen}, you will get the original string back.
40
42
  *
41
- * @param branch - TreeBranch from where you get the idCompressor to do the decompression.
42
- * @param nodeIdentifier - the stable identifier that needs to be shortened.
43
+ * @param branch - The branch (and/or view) of the SharedTree that will perform the compression.
44
+ * @param nodeIdentifier - the stable identifier to be shortened.
43
45
  */
44
46
  shorten(branch: TreeBranch, nodeIdentifier: string): number | undefined;
45
47
  /**
46
- * Returns the stable id as a string if the identifier is decompressible and known by the id compressor. Otherwise, it will throw an error.
48
+ * Returns the stable id as a string if the identifier is decompressible and known by the id compressor.
49
+ * @remarks
50
+ * If the given number does not correspond to a valid identifier generated by the SharedTree, this will return `undefined`.
47
51
  *
48
- * This method is the inverse of {@link TreeIdentifierUtils.shorten}. If you lengthen an identifier
49
- * and then immediately pass it to {@link TreeIdentifierUtils.shorten}, you will get the original short identifier back.
52
+ * This method is the inverse of {@link TreeIdentifierUtils.shorten}.
53
+ * If you lengthen an identifier and then immediately pass it to {@link TreeIdentifierUtils.shorten}, you will get the original short identifier back.
50
54
  *
51
- * @param branch - TreeBranch from where you want to get the id compressor to do the decompression.
52
- * @param nodeIdentifier - The local identifier that needs to be expanded.
55
+ * @param branch - The branch (and/or view) of the SharedTree that will perform the decompression.
56
+ * @param nodeIdentifier - The local identifier to be lengthened.
53
57
  */
54
58
  lengthen(branch: TreeBranch, nodeIdentifier: number): string;
55
59
  /**
56
- * Returns the {@link SchemaFactory.identifier | identifier} of the given node in the most compressed form possible.
60
+ * Returns the {@link TreeIdentifierUtils.shorten | shortened} form of the identifier {@link SchemaFactory.identifier | identifier} for the given node.
57
61
  * @remarks
58
62
  * If the node is {@link Unhydrated | hydrated} and its identifier is a valid UUID that was automatically generated by the SharedTree it is part of (or something else using the same {@link @fluidframework/id-compressor#IIdCompressor}), then this will return a process-unique integer corresponding to that identifier.
59
63
  * This is useful for performance-sensitive scenarios involving many nodes with identifiers that need to be compactly retained in memory or used for efficient lookup.
60
- * Note that automatically generated identifiers that were accessed before the node was hydrated will return the generated UUID, not the process-unique integer.
64
+ * Note that automatically generated identifiers that were accessed before the node was hydrated will not yield a short identifier until after hydration.
61
65
  *
62
- * If the node's identifier is any other user-provided string, then this will return undefined.
66
+ * If the node's identifier is any other user-provided string, then this will return `undefined`.
63
67
  *
64
68
  * If the node has no identifier (that is, it has no {@link SchemaFactory.identifier | identifier} field), then this returns `undefined`.
65
69
  *
66
70
  * If the node has more than one identifier, then this will throw an error.
71
+ * In that case, retrieve the identifiers individually via their fields instead.
67
72
  *
68
73
  * The returned integer should not be serialized or preserved outside of the current process.
69
74
  * Its lifetime is that of the current in-memory instance of the FF container for this client, and it is not guaranteed to be unique or stable outside of that context.
@@ -71,10 +76,11 @@ export interface TreeIdentifierUtils {
71
76
  */
72
77
  getShort(node: TreeNode): number | undefined;
73
78
  /**
74
- * Creates and returns a long identifier.
75
- * The long identifier is a compressible, stable identifier generated by the tree's ID compressor.
79
+ * Creates a new identifier.
80
+ * @remarks
81
+ * The returned UUID string can be {@link TreeIdentifierUtils.shorten | shortened} for high-performance scenarios.
76
82
  *
77
- * @param branch - TreeBranch from where you want to get the id compressor to generate the identifier from.
83
+ * @param branch - The branch (and/or view) of the SharedTree that will generate and manage the identifier.
78
84
  */
79
85
  create(branch: TreeBranch): string;
80
86
  }
@@ -1 +1 @@
1
- {"version":3,"file":"treeAlpha.d.ts","sourceRoot":"","sources":["../../src/shared-tree/treeAlpha.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OA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17
17
  const schematizingTreeView_js_1 = require("./schematizingTreeView.js");
18
18
  const runtime_utils_1 = require("@fluidframework/runtime-utils");
19
19
  const identifier = (node) => {
20
- const nodeIdentifier = (0, index_js_1.getIdentifierFromNode)(node, "uncompressed");
21
- if (typeof nodeIdentifier === "number") {
22
- throw new TypeError("identifier should be uncompressed.");
23
- }
24
- return nodeIdentifier;
20
+ return (0, index_js_1.getIdentifierFromNode)(node, "uncompressed");
25
21
  };
26
22
  identifier.shorten = (branch, nodeIdentifier) => {
27
- const nodeKeyManager = branch
28
- .nodeKeyManager;
23
+ (0, internal_1.assert)(branch instanceof schematizingTreeView_js_1.SchematizingSimpleTreeView, 0xcac /* Unexpected branch implementation */);
24
+ const { nodeKeyManager } = branch;
29
25
  const localNodeKey = nodeKeyManager.tryLocalizeNodeIdentifier(nodeIdentifier);
30
- return localNodeKey !== undefined ? (0, index_js_2.extractFromOpaque)(localNodeKey) : undefined;
26
+ return localNodeKey === undefined ? undefined : (0, index_js_2.extractFromOpaque)(localNodeKey);
31
27
  };
32
28
  identifier.lengthen = (branch, nodeIdentifier) => {
33
- const nodeKeyManager = branch
34
- .nodeKeyManager;
35
- return nodeKeyManager.stabilizeNodeIdentifier(nodeIdentifier);
29
+ (0, internal_1.assert)(branch instanceof schematizingTreeView_js_1.SchematizingSimpleTreeView, 0xcad /* Unexpected branch implementation */);
30
+ const { nodeKeyManager } = branch;
31
+ const local = (0, index_js_2.brand)(nodeIdentifier);
32
+ return nodeKeyManager.stabilizeNodeIdentifier(local);
36
33
  };
37
34
  identifier.getShort = (node) => {
38
35
  const shortIdentifier = (0, index_js_1.getIdentifierFromNode)(node, "compressed");
@@ -90,14 +87,14 @@ class NodeSubscription {
90
87
  return;
91
88
  }
92
89
  const subscription = subscriptions.get(flexNode);
93
- if (subscription !== undefined) {
94
- // Already subscribed to this node.
95
- subscription.keys = undefined; // Now subscribed to all keys.
96
- }
97
- else {
90
+ if (subscription === undefined) {
98
91
  const newSubscription = new NodeSubscription(invalidate, flexNode);
99
92
  subscriptions.set(flexNode, newSubscription);
100
93
  }
94
+ else {
95
+ // Already subscribed to this node.
96
+ subscription.keys = undefined; // Now subscribed to all keys.
97
+ }
101
98
  },
102
99
  observeNodeField(flexNode, key) {
103
100
  if (flexNode.value !== undefined) {
@@ -105,17 +102,17 @@ class NodeSubscription {
105
102
  return;
106
103
  }
107
104
  const subscription = subscriptions.get(flexNode);
108
- if (subscription !== undefined) {
105
+ if (subscription === undefined) {
106
+ const newSubscription = new NodeSubscription(invalidate, flexNode);
107
+ newSubscription.keys = new Set([key]);
108
+ subscriptions.set(flexNode, newSubscription);
109
+ }
110
+ else {
109
111
  // Already subscribed to this node: if not subscribed to all keys, subscribe to this one.
110
112
  // TODO:Performance: due to how JavaScript set ordering works,
111
113
  // it might be faster to check `has` and only add if not present in case the same field is viewed many times.
112
114
  subscription.keys?.add(key);
113
115
  }
114
- else {
115
- const newSubscription = new NodeSubscription(invalidate, flexNode);
116
- newSubscription.keys = new Set([key]);
117
- subscriptions.set(flexNode, newSubscription);
118
- }
119
116
  },
120
117
  observeParentOf(node) {
121
118
  // Supporting parent tracking is more difficult that it might seem at first.
@@ -305,11 +302,12 @@ exports.TreeAlpha = {
305
302
  }
306
303
  return (0, index_js_1.getOrCreateNodeFromInnerUnboxedNode)(childFlexTree);
307
304
  }
308
- case index_js_1.NodeKind.Map:
305
+ case index_js_1.NodeKind.Map: {
309
306
  if (typeof propertyKey !== "string") {
310
307
  // Map nodes only support string keys.
311
308
  return undefined;
312
309
  }
310
+ }
313
311
  // Fall through
314
312
  case index_js_1.NodeKind.Record:
315
313
  case index_js_1.NodeKind.Object: {