@fluidframework/tree 2.1.0-276985 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (583) hide show
  1. package/.eslintrc.cjs +7 -0
  2. package/.vscode/Tree.code-workspace +9 -2
  3. package/CHANGELOG.md +38 -0
  4. package/README.md +55 -12
  5. package/api-report/tree.alpha.api.md +2 -1
  6. package/api-report/tree.beta.api.md +2 -1
  7. package/api-report/tree.public.api.md +2 -1
  8. package/beta.d.ts +1 -1
  9. package/dist/beta.d.ts +1 -1
  10. package/dist/core/forest/editableForest.d.ts +6 -3
  11. package/dist/core/forest/editableForest.d.ts.map +1 -1
  12. package/dist/core/forest/editableForest.js +16 -4
  13. package/dist/core/forest/editableForest.js.map +1 -1
  14. package/dist/core/index.d.ts +1 -1
  15. package/dist/core/index.d.ts.map +1 -1
  16. package/dist/core/index.js +3 -1
  17. package/dist/core/index.js.map +1 -1
  18. package/dist/core/rebase/index.d.ts +1 -1
  19. package/dist/core/rebase/index.d.ts.map +1 -1
  20. package/dist/core/rebase/index.js +3 -1
  21. package/dist/core/rebase/index.js.map +1 -1
  22. package/dist/core/rebase/types.d.ts +2 -0
  23. package/dist/core/rebase/types.d.ts.map +1 -1
  24. package/dist/core/rebase/types.js +9 -1
  25. package/dist/core/rebase/types.js.map +1 -1
  26. package/dist/core/tree/anchorSet.d.ts +1 -0
  27. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  28. package/dist/core/tree/anchorSet.js +13 -0
  29. package/dist/core/tree/anchorSet.js.map +1 -1
  30. package/dist/core/tree/detachedFieldIndex.d.ts +48 -11
  31. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  32. package/dist/core/tree/detachedFieldIndex.js +144 -20
  33. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  34. package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  35. package/dist/core/tree/detachedFieldIndexCodec.js +13 -4
  36. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  37. package/dist/core/tree/detachedFieldIndexFormat.d.ts +1 -1
  38. package/dist/core/tree/detachedFieldIndexFormat.d.ts.map +1 -1
  39. package/dist/core/tree/detachedFieldIndexFormat.js.map +1 -1
  40. package/dist/core/tree/detachedFieldIndexTypes.d.ts +39 -4
  41. package/dist/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  42. package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
  43. package/dist/core/tree/index.d.ts +2 -1
  44. package/dist/core/tree/index.d.ts.map +1 -1
  45. package/dist/core/tree/index.js.map +1 -1
  46. package/dist/core/tree/visitDelta.d.ts +3 -1
  47. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  48. package/dist/core/tree/visitDelta.js +31 -15
  49. package/dist/core/tree/visitDelta.js.map +1 -1
  50. package/dist/core/tree/visitorUtils.d.ts +3 -3
  51. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  52. package/dist/core/tree/visitorUtils.js +4 -4
  53. package/dist/core/tree/visitorUtils.js.map +1 -1
  54. package/dist/events/events.d.ts +4 -1
  55. package/dist/events/events.d.ts.map +1 -1
  56. package/dist/events/events.js.map +1 -1
  57. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +1 -1
  58. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  59. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  60. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -0
  61. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  62. package/dist/feature-libraries/editableTreeBinder.js +1 -1
  63. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  64. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +1 -10
  65. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  66. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +0 -72
  67. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  68. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +1 -51
  69. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  70. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +0 -2
  71. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  72. package/dist/feature-libraries/flex-tree/index.d.ts +3 -2
  73. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  74. package/dist/feature-libraries/flex-tree/index.js +5 -1
  75. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  76. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +1 -2
  77. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  78. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  79. package/dist/feature-libraries/flex-tree/lazyField.d.ts +1 -6
  80. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  81. package/dist/feature-libraries/flex-tree/lazyField.js +11 -32
  82. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  83. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +1 -5
  84. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  85. package/dist/feature-libraries/flex-tree/lazyNode.js +0 -30
  86. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  87. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  88. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  89. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  90. package/dist/feature-libraries/index.d.ts +3 -3
  91. package/dist/feature-libraries/index.d.ts.map +1 -1
  92. package/dist/feature-libraries/index.js +6 -3
  93. package/dist/feature-libraries/index.js.map +1 -1
  94. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +11 -0
  95. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  96. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  97. package/dist/feature-libraries/modular-schema/discrepancies.d.ts +96 -0
  98. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -0
  99. package/dist/feature-libraries/modular-schema/discrepancies.js +264 -0
  100. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -0
  101. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -2
  102. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  103. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  104. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  105. package/dist/feature-libraries/modular-schema/genericFieldKind.js +3 -0
  106. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  107. package/dist/feature-libraries/modular-schema/index.d.ts +2 -1
  108. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  109. package/dist/feature-libraries/modular-schema/index.js +3 -1
  110. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  111. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  112. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +42 -26
  113. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  114. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +51 -2
  115. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  116. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +827 -245
  117. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  118. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  119. package/dist/feature-libraries/modular-schema/modularChangeFormat.js +2 -0
  120. package/dist/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -1
  121. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +44 -1
  122. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  123. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  124. package/dist/feature-libraries/node-key/index.d.ts +0 -1
  125. package/dist/feature-libraries/node-key/index.d.ts.map +1 -1
  126. package/dist/feature-libraries/node-key/index.js +1 -3
  127. package/dist/feature-libraries/node-key/index.js.map +1 -1
  128. package/dist/feature-libraries/object-forest/objectForest.d.ts +3 -2
  129. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  130. package/dist/feature-libraries/object-forest/objectForest.js +5 -4
  131. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  132. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  133. package/dist/feature-libraries/optional-field/optionalField.js +1 -0
  134. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  135. package/dist/feature-libraries/sequence-field/index.d.ts +1 -1
  136. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  137. package/dist/feature-libraries/sequence-field/index.js +1 -2
  138. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  139. package/dist/feature-libraries/sequence-field/invert.js +1 -1
  140. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  141. package/dist/feature-libraries/sequence-field/rebase.js +6 -1
  142. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  143. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  144. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +1 -0
  145. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  146. package/dist/feature-libraries/sequence-field/utils.d.ts +2 -17
  147. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  148. package/dist/feature-libraries/sequence-field/utils.js +31 -39
  149. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  150. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +1 -0
  151. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  152. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +2 -0
  153. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  154. package/dist/index.d.ts +1 -1
  155. package/dist/index.d.ts.map +1 -1
  156. package/dist/index.js.map +1 -1
  157. package/dist/packageVersion.d.ts +1 -1
  158. package/dist/packageVersion.d.ts.map +1 -1
  159. package/dist/packageVersion.js +1 -1
  160. package/dist/packageVersion.js.map +1 -1
  161. package/dist/public.d.ts +1 -1
  162. package/dist/shared-tree/schematizingTreeView.d.ts +4 -2
  163. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  164. package/dist/shared-tree/schematizingTreeView.js +240 -184
  165. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  166. package/dist/shared-tree/sharedTree.d.ts +5 -1
  167. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  168. package/dist/shared-tree/sharedTree.js +157 -90
  169. package/dist/shared-tree/sharedTree.js.map +1 -1
  170. package/dist/shared-tree/sharedTreeChangeEnricher.js +1 -1
  171. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  172. package/dist/shared-tree/treeApi.js +1 -1
  173. package/dist/shared-tree/treeApi.js.map +1 -1
  174. package/dist/shared-tree/treeCheckout.d.ts +10 -1
  175. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  176. package/dist/shared-tree/treeCheckout.js +47 -3
  177. package/dist/shared-tree/treeCheckout.js.map +1 -1
  178. package/dist/shared-tree/treeView.d.ts.map +1 -1
  179. package/dist/shared-tree/treeView.js +7 -3
  180. package/dist/shared-tree/treeView.js.map +1 -1
  181. package/dist/shared-tree-core/branch.d.ts +6 -0
  182. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  183. package/dist/shared-tree-core/branch.js +3 -0
  184. package/dist/shared-tree-core/branch.js.map +1 -1
  185. package/dist/shared-tree-core/sharedTreeCore.d.ts +8 -6
  186. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  187. package/dist/shared-tree-core/sharedTreeCore.js +271 -209
  188. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  189. package/dist/simple-tree/arrayNode.d.ts +4 -0
  190. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  191. package/dist/simple-tree/arrayNode.js +36 -19
  192. package/dist/simple-tree/arrayNode.js.map +1 -1
  193. package/dist/simple-tree/index.d.ts +3 -3
  194. package/dist/simple-tree/index.d.ts.map +1 -1
  195. package/dist/simple-tree/index.js +2 -1
  196. package/dist/simple-tree/index.js.map +1 -1
  197. package/dist/simple-tree/leafNodeSchema.d.ts +22 -1
  198. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  199. package/dist/simple-tree/leafNodeSchema.js +2 -1
  200. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  201. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  202. package/dist/simple-tree/mapNode.js.map +1 -1
  203. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  204. package/dist/simple-tree/objectNode.js +2 -1
  205. package/dist/simple-tree/objectNode.js.map +1 -1
  206. package/dist/simple-tree/proxies.d.ts.map +1 -1
  207. package/dist/simple-tree/proxies.js +9 -25
  208. package/dist/simple-tree/proxies.js.map +1 -1
  209. package/dist/simple-tree/proxyBinding.d.ts +4 -0
  210. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  211. package/dist/simple-tree/proxyBinding.js +23 -1
  212. package/dist/simple-tree/proxyBinding.js.map +1 -1
  213. package/dist/simple-tree/schemaFactory.d.ts +16 -1
  214. package/dist/simple-tree/schemaFactory.d.ts.map +1 -1
  215. package/dist/simple-tree/schemaFactory.js +32 -4
  216. package/dist/simple-tree/schemaFactory.js.map +1 -1
  217. package/dist/simple-tree/schemaTypes.d.ts +36 -1
  218. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  219. package/dist/simple-tree/schemaTypes.js.map +1 -1
  220. package/dist/simple-tree/toFlexSchema.d.ts +2 -2
  221. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  222. package/dist/simple-tree/toFlexSchema.js +3 -2
  223. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  224. package/dist/simple-tree/tree.d.ts +4 -1
  225. package/dist/simple-tree/tree.d.ts.map +1 -1
  226. package/dist/simple-tree/tree.js +48 -1
  227. package/dist/simple-tree/tree.js.map +1 -1
  228. package/dist/simple-tree/treeNodeApi.d.ts +2 -75
  229. package/dist/simple-tree/treeNodeApi.d.ts.map +1 -1
  230. package/dist/simple-tree/treeNodeApi.js +17 -25
  231. package/dist/simple-tree/treeNodeApi.js.map +1 -1
  232. package/dist/simple-tree/treeNodeKernel.d.ts +26 -0
  233. package/dist/simple-tree/treeNodeKernel.d.ts.map +1 -0
  234. package/dist/simple-tree/treeNodeKernel.js +83 -0
  235. package/dist/simple-tree/treeNodeKernel.js.map +1 -0
  236. package/dist/simple-tree/types.d.ts +95 -3
  237. package/dist/simple-tree/types.d.ts.map +1 -1
  238. package/dist/simple-tree/types.js +120 -21
  239. package/dist/simple-tree/types.js.map +1 -1
  240. package/dist/util/breakable.d.ts +83 -0
  241. package/dist/util/breakable.d.ts.map +1 -0
  242. package/dist/util/breakable.js +178 -0
  243. package/dist/util/breakable.js.map +1 -0
  244. package/dist/util/index.d.ts +3 -2
  245. package/dist/util/index.d.ts.map +1 -1
  246. package/dist/util/index.js +9 -2
  247. package/dist/util/index.js.map +1 -1
  248. package/dist/util/nestedMap.d.ts +17 -3
  249. package/dist/util/nestedMap.d.ts.map +1 -1
  250. package/dist/util/nestedMap.js +21 -1
  251. package/dist/util/nestedMap.js.map +1 -1
  252. package/dist/util/utils.d.ts +7 -0
  253. package/dist/util/utils.d.ts.map +1 -1
  254. package/dist/util/utils.js +15 -1
  255. package/dist/util/utils.js.map +1 -1
  256. package/internal.d.ts +1 -1
  257. package/lib/beta.d.ts +1 -1
  258. package/lib/core/forest/editableForest.d.ts +6 -3
  259. package/lib/core/forest/editableForest.d.ts.map +1 -1
  260. package/lib/core/forest/editableForest.js +17 -5
  261. package/lib/core/forest/editableForest.js.map +1 -1
  262. package/lib/core/index.d.ts +1 -1
  263. package/lib/core/index.d.ts.map +1 -1
  264. package/lib/core/index.js +1 -1
  265. package/lib/core/index.js.map +1 -1
  266. package/lib/core/rebase/index.d.ts +1 -1
  267. package/lib/core/rebase/index.d.ts.map +1 -1
  268. package/lib/core/rebase/index.js +1 -1
  269. package/lib/core/rebase/index.js.map +1 -1
  270. package/lib/core/rebase/types.d.ts +2 -0
  271. package/lib/core/rebase/types.d.ts.map +1 -1
  272. package/lib/core/rebase/types.js +7 -1
  273. package/lib/core/rebase/types.js.map +1 -1
  274. package/lib/core/tree/anchorSet.d.ts +1 -0
  275. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  276. package/lib/core/tree/anchorSet.js +13 -0
  277. package/lib/core/tree/anchorSet.js.map +1 -1
  278. package/lib/core/tree/detachedFieldIndex.d.ts +48 -11
  279. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  280. package/lib/core/tree/detachedFieldIndex.js +145 -21
  281. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  282. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  283. package/lib/core/tree/detachedFieldIndexCodec.js +13 -4
  284. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  285. package/lib/core/tree/detachedFieldIndexFormat.d.ts +1 -1
  286. package/lib/core/tree/detachedFieldIndexFormat.d.ts.map +1 -1
  287. package/lib/core/tree/detachedFieldIndexFormat.js.map +1 -1
  288. package/lib/core/tree/detachedFieldIndexTypes.d.ts +39 -4
  289. package/lib/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  290. package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
  291. package/lib/core/tree/index.d.ts +2 -1
  292. package/lib/core/tree/index.d.ts.map +1 -1
  293. package/lib/core/tree/index.js.map +1 -1
  294. package/lib/core/tree/visitDelta.d.ts +3 -1
  295. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  296. package/lib/core/tree/visitDelta.js +31 -15
  297. package/lib/core/tree/visitDelta.js.map +1 -1
  298. package/lib/core/tree/visitorUtils.d.ts +3 -3
  299. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  300. package/lib/core/tree/visitorUtils.js +4 -4
  301. package/lib/core/tree/visitorUtils.js.map +1 -1
  302. package/lib/events/events.d.ts +4 -1
  303. package/lib/events/events.d.ts.map +1 -1
  304. package/lib/events/events.js.map +1 -1
  305. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +1 -1
  306. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  307. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  308. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -0
  309. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  310. package/lib/feature-libraries/editableTreeBinder.js +1 -1
  311. package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
  312. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +1 -10
  313. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  314. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +2 -74
  315. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  316. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +1 -51
  317. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  318. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +0 -2
  319. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  320. package/lib/feature-libraries/flex-tree/index.d.ts +3 -2
  321. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  322. package/lib/feature-libraries/flex-tree/index.js +2 -1
  323. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  324. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +1 -2
  325. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  326. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  327. package/lib/feature-libraries/flex-tree/lazyField.d.ts +1 -6
  328. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  329. package/lib/feature-libraries/flex-tree/lazyField.js +13 -34
  330. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  331. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +1 -5
  332. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  333. package/lib/feature-libraries/flex-tree/lazyNode.js +3 -33
  334. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  335. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  336. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  337. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  338. package/lib/feature-libraries/index.d.ts +3 -3
  339. package/lib/feature-libraries/index.d.ts.map +1 -1
  340. package/lib/feature-libraries/index.js +3 -3
  341. package/lib/feature-libraries/index.js.map +1 -1
  342. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +11 -0
  343. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  344. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  345. package/lib/feature-libraries/modular-schema/discrepancies.d.ts +96 -0
  346. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -0
  347. package/lib/feature-libraries/modular-schema/discrepancies.js +260 -0
  348. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -0
  349. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -2
  350. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  351. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  352. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  353. package/lib/feature-libraries/modular-schema/genericFieldKind.js +3 -0
  354. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  355. package/lib/feature-libraries/modular-schema/index.d.ts +2 -1
  356. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  357. package/lib/feature-libraries/modular-schema/index.js +1 -0
  358. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  359. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  360. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +42 -26
  361. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  362. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +51 -2
  363. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  364. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +826 -247
  365. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  366. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  367. package/lib/feature-libraries/modular-schema/modularChangeFormat.js +2 -0
  368. package/lib/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -1
  369. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +44 -1
  370. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  371. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  372. package/lib/feature-libraries/node-key/index.d.ts +0 -1
  373. package/lib/feature-libraries/node-key/index.d.ts.map +1 -1
  374. package/lib/feature-libraries/node-key/index.js +0 -1
  375. package/lib/feature-libraries/node-key/index.js.map +1 -1
  376. package/lib/feature-libraries/object-forest/objectForest.d.ts +3 -2
  377. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  378. package/lib/feature-libraries/object-forest/objectForest.js +5 -4
  379. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  380. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  381. package/lib/feature-libraries/optional-field/optionalField.js +1 -0
  382. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  383. package/lib/feature-libraries/sequence-field/index.d.ts +1 -1
  384. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  385. package/lib/feature-libraries/sequence-field/index.js +1 -1
  386. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  387. package/lib/feature-libraries/sequence-field/invert.js +1 -1
  388. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  389. package/lib/feature-libraries/sequence-field/rebase.js +6 -1
  390. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  391. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  392. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +2 -1
  393. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  394. package/lib/feature-libraries/sequence-field/utils.d.ts +2 -17
  395. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  396. package/lib/feature-libraries/sequence-field/utils.js +31 -39
  397. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  398. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +1 -0
  399. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  400. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +4 -2
  401. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  402. package/lib/index.d.ts +1 -1
  403. package/lib/index.d.ts.map +1 -1
  404. package/lib/index.js.map +1 -1
  405. package/lib/packageVersion.d.ts +1 -1
  406. package/lib/packageVersion.d.ts.map +1 -1
  407. package/lib/packageVersion.js +1 -1
  408. package/lib/packageVersion.js.map +1 -1
  409. package/lib/public.d.ts +1 -1
  410. package/lib/shared-tree/schematizingTreeView.d.ts +4 -2
  411. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  412. package/lib/shared-tree/schematizingTreeView.js +242 -185
  413. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  414. package/lib/shared-tree/sharedTree.d.ts +5 -1
  415. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  416. package/lib/shared-tree/sharedTree.js +158 -90
  417. package/lib/shared-tree/sharedTree.js.map +1 -1
  418. package/lib/shared-tree/sharedTreeChangeEnricher.js +1 -1
  419. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  420. package/lib/shared-tree/treeApi.js +1 -1
  421. package/lib/shared-tree/treeApi.js.map +1 -1
  422. package/lib/shared-tree/treeCheckout.d.ts +10 -1
  423. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  424. package/lib/shared-tree/treeCheckout.js +47 -3
  425. package/lib/shared-tree/treeCheckout.js.map +1 -1
  426. package/lib/shared-tree/treeView.d.ts.map +1 -1
  427. package/lib/shared-tree/treeView.js +4 -0
  428. package/lib/shared-tree/treeView.js.map +1 -1
  429. package/lib/shared-tree-core/branch.d.ts +6 -0
  430. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  431. package/lib/shared-tree-core/branch.js +3 -0
  432. package/lib/shared-tree-core/branch.js.map +1 -1
  433. package/lib/shared-tree-core/sharedTreeCore.d.ts +8 -6
  434. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  435. package/lib/shared-tree-core/sharedTreeCore.js +273 -210
  436. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  437. package/lib/simple-tree/arrayNode.d.ts +4 -0
  438. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  439. package/lib/simple-tree/arrayNode.js +39 -22
  440. package/lib/simple-tree/arrayNode.js.map +1 -1
  441. package/lib/simple-tree/index.d.ts +3 -3
  442. package/lib/simple-tree/index.d.ts.map +1 -1
  443. package/lib/simple-tree/index.js +1 -1
  444. package/lib/simple-tree/index.js.map +1 -1
  445. package/lib/simple-tree/leafNodeSchema.d.ts +22 -1
  446. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  447. package/lib/simple-tree/leafNodeSchema.js +1 -1
  448. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  449. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  450. package/lib/simple-tree/mapNode.js.map +1 -1
  451. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  452. package/lib/simple-tree/objectNode.js +3 -2
  453. package/lib/simple-tree/objectNode.js.map +1 -1
  454. package/lib/simple-tree/proxies.d.ts.map +1 -1
  455. package/lib/simple-tree/proxies.js +9 -25
  456. package/lib/simple-tree/proxies.js.map +1 -1
  457. package/lib/simple-tree/proxyBinding.d.ts +4 -0
  458. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  459. package/lib/simple-tree/proxyBinding.js +19 -0
  460. package/lib/simple-tree/proxyBinding.js.map +1 -1
  461. package/lib/simple-tree/schemaFactory.d.ts +16 -1
  462. package/lib/simple-tree/schemaFactory.d.ts.map +1 -1
  463. package/lib/simple-tree/schemaFactory.js +30 -3
  464. package/lib/simple-tree/schemaFactory.js.map +1 -1
  465. package/lib/simple-tree/schemaTypes.d.ts +36 -1
  466. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  467. package/lib/simple-tree/schemaTypes.js.map +1 -1
  468. package/lib/simple-tree/toFlexSchema.d.ts +2 -2
  469. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  470. package/lib/simple-tree/toFlexSchema.js +3 -2
  471. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  472. package/lib/simple-tree/tree.d.ts +4 -1
  473. package/lib/simple-tree/tree.d.ts.map +1 -1
  474. package/lib/simple-tree/tree.js +44 -0
  475. package/lib/simple-tree/tree.js.map +1 -1
  476. package/lib/simple-tree/treeNodeApi.d.ts +2 -75
  477. package/lib/simple-tree/treeNodeApi.d.ts.map +1 -1
  478. package/lib/simple-tree/treeNodeApi.js +20 -28
  479. package/lib/simple-tree/treeNodeApi.js.map +1 -1
  480. package/lib/simple-tree/treeNodeKernel.d.ts +26 -0
  481. package/lib/simple-tree/treeNodeKernel.d.ts.map +1 -0
  482. package/lib/simple-tree/treeNodeKernel.js +79 -0
  483. package/lib/simple-tree/treeNodeKernel.js.map +1 -0
  484. package/lib/simple-tree/types.d.ts +95 -3
  485. package/lib/simple-tree/types.d.ts.map +1 -1
  486. package/lib/simple-tree/types.js +121 -22
  487. package/lib/simple-tree/types.js.map +1 -1
  488. package/lib/util/breakable.d.ts +83 -0
  489. package/lib/util/breakable.d.ts.map +1 -0
  490. package/lib/util/breakable.js +171 -0
  491. package/lib/util/breakable.js.map +1 -0
  492. package/lib/util/index.d.ts +3 -2
  493. package/lib/util/index.d.ts.map +1 -1
  494. package/lib/util/index.js +3 -2
  495. package/lib/util/index.js.map +1 -1
  496. package/lib/util/nestedMap.d.ts +17 -3
  497. package/lib/util/nestedMap.d.ts.map +1 -1
  498. package/lib/util/nestedMap.js +19 -0
  499. package/lib/util/nestedMap.js.map +1 -1
  500. package/lib/util/utils.d.ts +7 -0
  501. package/lib/util/utils.d.ts.map +1 -1
  502. package/lib/util/utils.js +13 -0
  503. package/lib/util/utils.js.map +1 -1
  504. package/package.json +29 -27
  505. package/src/core/forest/editableForest.ts +25 -4
  506. package/src/core/index.ts +2 -0
  507. package/src/core/rebase/index.ts +2 -0
  508. package/src/core/rebase/types.ts +17 -0
  509. package/src/core/tree/anchorSet.ts +14 -0
  510. package/src/core/tree/detachedFieldIndex.ts +217 -35
  511. package/src/core/tree/detachedFieldIndexCodec.ts +17 -8
  512. package/src/core/tree/detachedFieldIndexFormat.ts +1 -1
  513. package/src/core/tree/detachedFieldIndexTypes.ts +41 -5
  514. package/src/core/tree/index.ts +2 -1
  515. package/src/core/tree/visitDelta.ts +58 -16
  516. package/src/core/tree/visitorUtils.ts +7 -4
  517. package/src/events/events.ts +4 -2
  518. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +1 -1
  519. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -0
  520. package/src/feature-libraries/editableTreeBinder.ts +1 -1
  521. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +1 -95
  522. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +0 -62
  523. package/src/feature-libraries/flex-tree/index.ts +7 -2
  524. package/src/feature-libraries/flex-tree/lazyEntity.ts +0 -3
  525. package/src/feature-libraries/flex-tree/lazyField.ts +15 -47
  526. package/src/feature-libraries/flex-tree/lazyNode.ts +1 -48
  527. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -0
  528. package/src/feature-libraries/index.ts +4 -2
  529. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +18 -0
  530. package/src/feature-libraries/modular-schema/discrepancies.ts +395 -0
  531. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +10 -2
  532. package/src/feature-libraries/modular-schema/genericFieldKind.ts +3 -0
  533. package/src/feature-libraries/modular-schema/index.ts +2 -0
  534. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +81 -35
  535. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +1521 -444
  536. package/src/feature-libraries/modular-schema/modularChangeFormat.ts +2 -0
  537. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +51 -0
  538. package/src/feature-libraries/node-key/index.ts +0 -1
  539. package/src/feature-libraries/object-forest/objectForest.ts +7 -3
  540. package/src/feature-libraries/optional-field/optionalField.ts +1 -0
  541. package/src/feature-libraries/sequence-field/index.ts +0 -2
  542. package/src/feature-libraries/sequence-field/invert.ts +1 -1
  543. package/src/feature-libraries/sequence-field/rebase.ts +7 -1
  544. package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +2 -1
  545. package/src/feature-libraries/sequence-field/utils.ts +37 -85
  546. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +10 -0
  547. package/src/index.ts +0 -1
  548. package/src/packageVersion.ts +1 -1
  549. package/src/shared-tree/schematizingTreeView.ts +6 -2
  550. package/src/shared-tree/sharedTree.ts +12 -1
  551. package/src/shared-tree/sharedTreeChangeEnricher.ts +1 -1
  552. package/src/shared-tree/treeApi.ts +1 -1
  553. package/src/shared-tree/treeCheckout.ts +60 -5
  554. package/src/shared-tree/treeView.ts +5 -0
  555. package/src/shared-tree-core/branch.ts +10 -0
  556. package/src/shared-tree-core/sharedTreeCore.ts +25 -6
  557. package/src/simple-tree/arrayNode.ts +50 -23
  558. package/src/simple-tree/index.ts +3 -3
  559. package/src/simple-tree/leafNodeSchema.ts +1 -1
  560. package/src/simple-tree/mapNode.ts +2 -2
  561. package/src/simple-tree/objectNode.ts +9 -3
  562. package/src/simple-tree/proxies.ts +10 -33
  563. package/src/simple-tree/proxyBinding.ts +23 -0
  564. package/src/simple-tree/schemaFactory.ts +37 -2
  565. package/src/simple-tree/schemaTypes.ts +36 -1
  566. package/src/simple-tree/toFlexSchema.ts +5 -4
  567. package/src/simple-tree/tree.ts +68 -4
  568. package/src/simple-tree/treeNodeApi.ts +29 -111
  569. package/src/simple-tree/treeNodeKernel.ts +91 -0
  570. package/src/simple-tree/types.ts +292 -31
  571. package/src/util/breakable.ts +214 -0
  572. package/src/util/index.ts +11 -0
  573. package/src/util/nestedMap.ts +33 -3
  574. package/src/util/utils.ts +17 -0
  575. package/dist/feature-libraries/node-key/nodeKeyIndex.d.ts +0 -41
  576. package/dist/feature-libraries/node-key/nodeKeyIndex.d.ts.map +0 -1
  577. package/dist/feature-libraries/node-key/nodeKeyIndex.js +0 -101
  578. package/dist/feature-libraries/node-key/nodeKeyIndex.js.map +0 -1
  579. package/lib/feature-libraries/node-key/nodeKeyIndex.d.ts +0 -41
  580. package/lib/feature-libraries/node-key/nodeKeyIndex.d.ts.map +0 -1
  581. package/lib/feature-libraries/node-key/nodeKeyIndex.js +0 -97
  582. package/lib/feature-libraries/node-key/nodeKeyIndex.js.map +0 -1
  583. package/src/feature-libraries/node-key/nodeKeyIndex.ts +0 -132
@@ -1 +1 @@
1
- {"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/shared-tree-core/branch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAA8B,OAAO,EAAE,MAAM,0CAA0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,wBAAwB,EAAE,EAAE,CAAC;QAElC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtB,CAAC;IAEO,iBAAiB;QACxB,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACxD,CAAC;CACD;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC/B,QAAW,EACX,MAAyB;IAEzB,MAAM,IAAI,GAAmB,EAAE,CAAC;IAChC,IAAI,CAAC,IAAI,CACR,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QAC5B,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,CAAC;IACd,CAAC,CAAC,CACF,CAAC;IACF,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { type TelemetryEventBatcher, measure } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype BranchRebaseResult,\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\tCommitKind,\n\ttype CommitMetadata,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\tfindAncestor,\n\tmakeAnonChange,\n\tmintCommit,\n\trebaseBranch,\n\ttagChange,\n\ttagRollbackInverse,\n\ttype RebaseStatsWithDuration,\n} from \"../core/index.js\";\nimport { EventEmitter, type Listenable } from \"../events/index.js\";\n\nimport { TransactionStack } from \"./transactionStack.js\";\n\n/**\n * Describes a change to a `SharedTreeBranch`. Various operations can mutate the head of the branch;\n * this change format describes each in terms of the \"removed commits\" (all commits which were present\n * on the branch before the operation but are no longer present after) and the \"new commits\" (all\n * commits which are present on the branch after the operation that were not present before). Each of\n * the following event types also provides a `change` which contains the net change to the branch\n * (or is undefined if there was no net change):\n * * Append - when one or more commits are appended to the head of the branch, for example via\n * a change applied by the branch's editor, or as a result of merging another branch into this one\n * * Remove - when one or more commits are removed from the head of the branch. This occurs\n * when a transaction is aborted and all commits pending in that transaction are removed.\n * * Replace - when an operation simultaneously removes and appends commits. For example, when this\n * branch is rebased and some commits are removed and replaced with rebased versions, or when a\n * transaction completes and all pending commits are replaced with a single squash commit.\n */\nexport type SharedTreeBranchChange<TChange> =\n\t| {\n\t\t\ttype: \"append\";\n\t\t\tchange: TaggedChange<TChange>;\n\t\t\tnewCommits: readonly GraphCommit<TChange>[];\n\t }\n\t| {\n\t\t\ttype: \"remove\";\n\t\t\tchange: TaggedChange<TChange> | undefined;\n\t\t\tremovedCommits: readonly GraphCommit<TChange>[];\n\t }\n\t| {\n\t\t\ttype: \"replace\";\n\t\t\tchange: TaggedChange<TChange> | undefined;\n\t\t\tremovedCommits: readonly GraphCommit<TChange>[];\n\t\t\tnewCommits: readonly GraphCommit<TChange>[];\n\t };\n\n/**\n * Returns the operation that caused the given {@link SharedTreeBranchChange}.\n */\nexport function getChangeReplaceType(\n\tchange: SharedTreeBranchChange<unknown> & { type: \"replace\" },\n): \"transactionCommit\" | \"rebase\" {\n\t// The \"replace\" variant of the change event is emitted by two operations: committing a transaction and doing a rebase.\n\t// Committing a transaction will always remove one or more commits (the commits that were squashed),\n\t// and will add exactly one new commit (the squash commit).\n\tif (change.removedCommits.length === 0 || change.newCommits.length !== 1) {\n\t\treturn \"rebase\";\n\t}\n\n\t// There is only one case in which a rebase both removes commits and adds exactly one new commit.\n\t// This occurs when there is exactly one divergent, but equivalent, commit on each branch:\n\t//\n\t// A ─ B (branch X)\t -- rebase Y onto X --> A ─ B (branch X)\n\t// └─ B' (branch Y) └─ (branch Y)\n\t//\n\t// B' is removed and replaced by B because both have the same revision.\n\tif (\n\t\tchange.removedCommits.length === 1 &&\n\t\tchange.removedCommits[0].revision === change.newCommits[0].revision\n\t) {\n\t\treturn \"rebase\";\n\t}\n\n\treturn \"transactionCommit\";\n}\n\n/**\n * The events emitted by a `SharedTreeBranch`\n */\nexport interface SharedTreeBranchEvents<TEditor extends ChangeFamilyEditor, TChange>\n\textends BranchTrimmingEvents {\n\t/**\n\t * Fired just before the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tbeforeChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * Fired just after the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tafterChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * {@inheritdoc TreeViewEvents.commitApplied}\n\t */\n\tcommitApplied(data: CommitMetadata): void;\n\n\t/**\n\t * Fired when this branch forks\n\t * @param fork - the new branch that forked off of this branch\n\t */\n\tfork(fork: SharedTreeBranch<TEditor, TChange>): void;\n\n\t/**\n\t * Fired after this branch is disposed\n\t */\n\tdispose(): void;\n\n\t/**\n\t * Fired after a new transaction is started.\n\t * @param isOuterTransaction - true iff the transaction being started is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionStarted(isOuterTransaction: boolean): void;\n\n\t/**\n\t * Fired after the current transaction is aborted.\n\t * @param isOuterTransaction - true iff the transaction being aborted is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionAborted(isOuterTransaction: boolean): void;\n\n\t/**\n\t * Fired after the current transaction is committed.\n\t * @param isOuterTransaction - true iff the transaction being committed is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionCommitted(isOuterTransaction: boolean): void;\n}\n\n/**\n * Events related to branch trimming.\n *\n * @remarks\n * Trimming is a very specific kind of mutation which is the only allowed mutations to branches.\n * References to commits from other commits are removed so that the commit objects can be GC'd by the JS engine.\n * This happens by changing a commit's parent property to undefined, which drops all commits that are in its \"ancestry\".\n * It is done as a performance optimization when it is determined that commits are no longer needed for future computation.\n */\nexport interface BranchTrimmingEvents {\n\t/**\n\t * Fired when some contiguous range of commits beginning with the \"global tail\" of this branch are trimmed from the branch.\n\t * This happens by deleting the parent pointer to the last commit in that range. This event can be fired at any time.\n\t */\n\tancestryTrimmed(trimmedRevisions: RevisionTag[]): void;\n}\n\n/**\n * A branch of changes that can be applied to a SharedTree.\n */\nexport class SharedTreeBranch<\n\tTEditor extends ChangeFamilyEditor,\n\tTChange,\n> extends EventEmitter<SharedTreeBranchEvents<TEditor, TChange>> {\n\tpublic readonly editor: TEditor;\n\tprivate readonly transactions = new TransactionStack();\n\t/**\n\t * After pushing a starting revision to the transaction stack, this branch might be rebased\n\t * over commits which are children of that starting revision. When the transaction is committed,\n\t * those rebased-over commits should not be included in the transaction's squash commit, even though\n\t * they exist between the starting revision and the final commit within the transaction.\n\t *\n\t * Whenever `rebaseOnto` is called during a transaction, this map is augmented with an entry from the\n\t * original merge-base to the new merge-base.\n\t *\n\t * This state need only be retained for the lifetime of the transaction.\n\t *\n\t * TODO: This strategy might need to be revisited when adding better support for async transactions.\n\t * Since:\n\t *\n\t * 1. Transactionality is guaranteed primarily by squashing at commit time\n\t * 2. Branches may be rebased with an ongoing transaction\n\t *\n\t * a rebase operation might invalidate only a portion of a transaction's commits, thus defeating the\n\t * purpose of transactionality.\n\t *\n\t * AB#6483 and children items track this work.\n\t */\n\tprivate readonly initialTransactionRevToRebasedRev = new Map<RevisionTag, RevisionTag>();\n\tprivate disposed = false;\n\tprivate readonly unsubscribeBranchTrimmer?: () => void;\n\t/**\n\t * Construct a new branch.\n\t * @param head - the head of the branch\n\t * @param changeFamily - determines the set of changes that this branch can commit\n\t * @param branchTrimmer - an optional event emitter that informs the branch it has been trimmed. If this is not supplied, then the branch must\n\t * never be trimmed. See {@link BranchTrimmingEvents} for details on trimming.\n\t */\n\tpublic constructor(\n\t\tprivate head: GraphCommit<TChange>,\n\t\tpublic readonly changeFamily: ChangeFamily<TEditor, TChange>,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tprivate readonly branchTrimmer?: Listenable<BranchTrimmingEvents>,\n\t\tprivate readonly telemetryEventBatcher?: TelemetryEventBatcher<\n\t\t\tkeyof RebaseStatsWithDuration\n\t\t>,\n\t) {\n\t\tsuper();\n\t\tthis.editor = this.changeFamily.buildEditor((change) =>\n\t\t\tthis.apply(change, mintRevisionTag()),\n\t\t);\n\t\tthis.unsubscribeBranchTrimmer = branchTrimmer?.on(\"ancestryTrimmed\", (commit) => {\n\t\t\tthis.emit(\"ancestryTrimmed\", commit);\n\t\t});\n\t}\n\n\t/**\n\t * Sets the head of this branch. Emits no change events.\n\t */\n\tpublic setHead(head: GraphCommit<TChange>): void {\n\t\tthis.assertNotDisposed();\n\t\tassert(!this.isTransacting(), 0x685 /* Cannot set head during a transaction */);\n\t\tthis.head = head;\n\t}\n\n\t/**\n\t * Apply a change to this branch.\n\t * @param change - the change to apply\n\t * @param revision - the revision of the new head commit of the branch that contains `change`\n\t * @param changeKind - the kind of change to apply\n\t * @returns the change that was applied and the new head commit of the branch\n\t */\n\tpublic apply(\n\t\tchange: TChange,\n\t\trevision: RevisionTag,\n\t\tchangeKind: CommitKind = CommitKind.Default,\n\t): [change: TChange, newCommit: GraphCommit<TChange>] {\n\t\tthis.assertNotDisposed();\n\n\t\tconst changeWithRevision = this.changeFamily.rebaser.changeRevision(change, revision);\n\n\t\tconst newHead = mintCommit(this.head, {\n\t\t\trevision,\n\t\t\tchange: changeWithRevision,\n\t\t});\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"append\",\n\t\t\tchange: tagChange(changeWithRevision, revision),\n\t\t\tnewCommits: [newHead],\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newHead;\n\n\t\t// If this is not part of a transaction, emit a commitApplied event\n\t\tif (!this.isTransacting()) {\n\t\t\tthis.emit(\"commitApplied\", { isLocal: true, kind: changeKind });\n\t\t}\n\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn [changeWithRevision, newHead];\n\t}\n\n\t/**\n\t * @returns the commit at the head of this branch.\n\t */\n\tpublic getHead(): GraphCommit<TChange> {\n\t\treturn this.head;\n\t}\n\n\t/**\n\t * Begin a transaction on this branch. If the transaction is committed via {@link commitTransaction},\n\t * all commits made since this call will be squashed into a single head commit.\n\t */\n\tpublic startTransaction(): void {\n\t\tthis.assertNotDisposed();\n\t\tconst forks = new Set<SharedTreeBranch<TEditor, TChange>>();\n\t\tconst onDisposeUnSubscribes: (() => void)[] = [];\n\t\tconst onForkUnSubscribe = onForkTransitive(this, (fork) => {\n\t\t\tforks.add(fork);\n\t\t\tonDisposeUnSubscribes.push(fork.on(\"dispose\", () => forks.delete(fork)));\n\t\t});\n\t\tthis.transactions.push(this.head.revision, () => {\n\t\t\tforks.forEach((fork) => fork.dispose());\n\t\t\tonDisposeUnSubscribes.forEach((unsubscribe) => unsubscribe());\n\t\t\tonForkUnSubscribe();\n\t\t});\n\t\tthis.editor.enterTransaction();\n\t\tthis.emit(\"transactionStarted\", this.transactions.size === 1);\n\t}\n\n\t/**\n\t * Commit the current transaction. There must be a transaction in progress that was begun via {@link startTransaction}.\n\t * If there are commits in the current transaction, they will be squashed into a new single head commit.\n\t * @returns the commits that were squashed and the new squash commit if a squash occurred, otherwise `undefined`.\n\t * @remarks If the transaction had no changes applied during its lifetime, then no squash occurs (i.e. this method is a no-op).\n\t * Even if the transaction contained only one change, it will still be replaced with an (equivalent) squash change.\n\t */\n\tpublic commitTransaction():\n\t\t| [squashedCommits: GraphCommit<TChange>[], newCommit: GraphCommit<TChange>]\n\t\t| undefined {\n\t\tthis.assertNotDisposed();\n\t\tconst [startCommit, commits] = this.popTransaction();\n\t\tthis.editor.exitTransaction();\n\n\t\tthis.emit(\"transactionCommitted\", this.transactions.size === 0);\n\t\tif (commits.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Squash the changes and make the squash commit the new head of this branch\n\t\tconst squashedChange = this.changeFamily.rebaser.compose(commits);\n\t\tconst revision = this.mintRevisionTag();\n\n\t\tconst newHead = mintCommit(startCommit, {\n\t\t\trevision,\n\t\t\tchange: this.changeFamily.rebaser.changeRevision(squashedChange, revision),\n\t\t});\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"replace\",\n\t\t\tchange: undefined,\n\t\t\tremovedCommits: commits,\n\t\t\tnewCommits: [newHead],\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newHead;\n\n\t\t// If this transaction is not nested, emit a commitApplied event\n\t\tif (!this.isTransacting()) {\n\t\t\tthis.emit(\"commitApplied\", { isLocal: true, kind: CommitKind.Default });\n\t\t}\n\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn [commits, newHead];\n\t}\n\n\t/**\n\t * Cancel the current transaction. There must be a transaction in progress that was begun via\n\t * {@link startTransaction}. All commits made during the transaction will be removed.\n\t * @returns the change to this branch resulting in the removal of the commits, and a list of the\n\t * commits that were removed.\n\t */\n\tpublic abortTransaction(): [\n\t\tchange: TChange | undefined,\n\t\tabortedCommits: GraphCommit<TChange>[],\n\t] {\n\t\tthis.assertNotDisposed();\n\t\tconst [startCommit, commits] = this.popTransaction();\n\t\tthis.editor.exitTransaction();\n\n\t\tthis.emit(\"transactionAborted\", this.transactions.size === 0);\n\t\tif (commits.length === 0) {\n\t\t\treturn [undefined, []];\n\t\t}\n\n\t\tconst inverses: TaggedChange<TChange>[] = [];\n\t\tfor (let i = commits.length - 1; i >= 0; i--) {\n\t\t\tconst revision = this.mintRevisionTag();\n\t\t\tconst inverse = this.changeFamily.rebaser.changeRevision(\n\t\t\t\tthis.changeFamily.rebaser.invert(commits[i], false),\n\t\t\t\trevision,\n\t\t\t\tcommits[i].revision,\n\t\t\t);\n\n\t\t\tinverses.push(tagRollbackInverse(inverse, revision, commits[i].revision));\n\t\t}\n\t\tconst change =\n\t\t\tinverses.length > 0 ? this.changeFamily.rebaser.compose(inverses) : undefined;\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"remove\",\n\t\t\tchange: change === undefined ? undefined : makeAnonChange(change),\n\t\t\tremovedCommits: commits,\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = startCommit;\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn [change, commits];\n\t}\n\n\t/**\n\t * True iff this branch is in the middle of a transaction that was begin via {@link startTransaction}\n\t */\n\tpublic isTransacting(): boolean {\n\t\treturn this.transactions.size !== 0;\n\t}\n\n\tprivate popTransaction(): [GraphCommit<TChange>, GraphCommit<TChange>[]] {\n\t\tconst { startRevision: startRevisionOriginal } = this.transactions.pop();\n\t\tlet startRevision = startRevisionOriginal;\n\t\twhile (this.initialTransactionRevToRebasedRev.has(startRevision)) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tstartRevision = this.initialTransactionRevToRebasedRev.get(startRevision)!;\n\t\t}\n\n\t\tif (!this.isTransacting()) {\n\t\t\tthis.initialTransactionRevToRebasedRev.clear();\n\t\t}\n\n\t\tconst commits: GraphCommit<TChange>[] = [];\n\t\tconst startCommit = findAncestor(\n\t\t\t[this.head, commits],\n\t\t\t(c) => c.revision === startRevision,\n\t\t);\n\t\tassert(\n\t\t\tstartCommit !== undefined,\n\t\t\t0x593 /* Expected branch to be ahead of transaction start revision */,\n\t\t);\n\t\treturn [startCommit, commits];\n\t}\n\n\t/**\n\t * Spawn a new branch that is based off of the current state of this branch.\n\t * Changes made to the new branch will not be applied to this branch until the new branch is merged back in.\n\t *\n\t * @remarks Forks created during a transaction will be disposed when the transaction ends.\n\t */\n\tpublic fork(): SharedTreeBranch<TEditor, TChange> {\n\t\tthis.assertNotDisposed();\n\t\tconst fork = new SharedTreeBranch(\n\t\t\tthis.head,\n\t\t\tthis.changeFamily,\n\t\t\tthis.mintRevisionTag,\n\t\t\tthis.branchTrimmer,\n\t\t);\n\t\tthis.emit(\"fork\", fork);\n\t\treturn fork;\n\t}\n\n\t/**\n\t * Rebase the changes that have been applied to this branch over divergent changes in the given branch.\n\t * After this operation completes, this branch will be based off of `branch`.\n\t *\n\t * @param branch - the branch to rebase onto\n\t * @param upTo - the furthest commit on `branch` over which to rebase (inclusive). Defaults to the head commit of `branch`.\n\t * @returns the result of the rebase or undefined if nothing changed\n\t */\n\tpublic rebaseOnto(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = branch.getHead(),\n\t): BranchRebaseResult<TChange> | undefined {\n\t\tthis.assertNotDisposed();\n\n\t\t// Rebase this branch onto the given branch\n\t\tconst rebaseResult = this.rebaseBranch(this, branch, upTo);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// The net change to this branch is provided by the `rebaseBranch` API\n\t\tconst { newSourceHead, commits } = rebaseResult;\n\t\tconst { deletedSourceCommits, targetCommits, sourceCommits } = commits;\n\n\t\tconst newCommits = targetCommits.concat(sourceCommits);\n\t\tif (this.isTransacting()) {\n\t\t\tconst src = targetCommits[0].parent?.revision;\n\t\t\tconst dst = targetCommits[targetCommits.length - 1].revision;\n\t\t\tif (src !== undefined && dst !== undefined) {\n\t\t\t\tthis.initialTransactionRevToRebasedRev.set(src, dst);\n\t\t\t}\n\t\t}\n\t\tconst changeEvent = {\n\t\t\ttype: \"replace\",\n\t\t\tget change() {\n\t\t\t\tconst change = rebaseResult.sourceChange;\n\t\t\t\treturn change === undefined ? undefined : makeAnonChange(change);\n\t\t\t},\n\t\t\tremovedCommits: deletedSourceCommits,\n\t\t\tnewCommits,\n\t\t} as const;\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newSourceHead;\n\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn rebaseResult;\n\t}\n\n\t/**\n\t * Apply all the divergent changes on the given branch to this branch.\n\t *\n\t * @param branch - the branch to merge into this branch\n\t * @returns the net change to this branch and the commits that were added to this branch by the merge,\n\t * or undefined if nothing changed\n\t */\n\tpublic merge(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t): [change: TChange, newCommits: GraphCommit<TChange>[]] | undefined {\n\t\tthis.assertNotDisposed();\n\t\tbranch.assertNotDisposed();\n\t\tassert(\n\t\t\t!branch.isTransacting(),\n\t\t\t0x597 /* Branch may not be merged while transaction is in progress */,\n\t\t);\n\n\t\t// Rebase the given branch onto this branch\n\t\tconst rebaseResult = this.rebaseBranch(branch, this);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Compute the net change to this branch\n\t\tconst sourceCommits = rebaseResult.commits.sourceCommits;\n\t\tconst change = this.changeFamily.rebaser.compose(sourceCommits);\n\t\tconst taggedChange = makeAnonChange(change);\n\t\tconst changeEvent = {\n\t\t\ttype: \"append\",\n\t\t\tget change(): TaggedChange<TChange> {\n\t\t\t\treturn taggedChange;\n\t\t\t},\n\t\t\tnewCommits: sourceCommits,\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = rebaseResult.newSourceHead;\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn [change, sourceCommits];\n\t}\n\n\t/** Rebase `branchHead` onto `onto`, but return undefined if nothing changed */\n\tprivate rebaseBranch(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tonto: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = onto.getHead(),\n\t): BranchRebaseResult<TChange> | undefined {\n\t\tconst { head } = branch;\n\t\tif (head === upTo) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst { duration, output } = measure(() =>\n\t\t\trebaseBranch(\n\t\t\t\tthis.mintRevisionTag,\n\t\t\t\tthis.changeFamily.rebaser,\n\t\t\t\thead,\n\t\t\t\tupTo,\n\t\t\t\tonto.getHead(),\n\t\t\t),\n\t\t);\n\n\t\tthis.telemetryEventBatcher?.accumulateAndLog({ duration, ...output.telemetryProperties });\n\n\t\tif (this.head === output.newSourceHead) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn output;\n\t}\n\n\t/**\n\t * Dispose this branch, freezing its state.\n\t *\n\t * @remarks\n\t * Attempts to further mutate the branch will error.\n\t * Any transactions in progress will be aborted.\n\t * Calling dispose more than once has no effect.\n\t */\n\tpublic dispose(): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\twhile (this.isTransacting()) {\n\t\t\tthis.abortTransaction();\n\t\t}\n\n\t\tthis.unsubscribeBranchTrimmer?.();\n\n\t\tthis.disposed = true;\n\t\tthis.emit(\"dispose\");\n\t}\n\n\tprivate assertNotDisposed(): void {\n\t\tassert(!this.disposed, 0x66e /* Branch is disposed */);\n\t}\n}\n\n/**\n * Registers an event listener that fires when the given forkable object forks.\n * The listener will also fire when any of those forks fork, and when those forks of forks fork, and so on.\n * @param forkable - an object that emits an event when it is forked\n * @param onFork - the fork event listener\n * @returns a function which when called will deregister all registrations (including transitive) created by this function.\n * The deregister function has undefined behavior if called more than once.\n */\nexport function onForkTransitive<T extends Listenable<{ fork: (t: T) => void }>>(\n\tforkable: T,\n\tonFork: (fork: T) => void,\n): () => void {\n\tconst offs: (() => void)[] = [];\n\toffs.push(\n\t\tforkable.on(\"fork\", (fork) => {\n\t\t\toffs.push(onForkTransitive(fork, onFork));\n\t\t\tonFork(fork);\n\t\t}),\n\t);\n\treturn () => offs.forEach((off) => off());\n}\n"]}
1
+ {"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/shared-tree-core/branch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAA8B,OAAO,EAAE,MAAM,0CAA0C,CAAC;AAE/F,OAAO,EAIN,UAAU,EAKV,YAAY,EACZ,cAAc,EACd,UAAU,EACV,YAAY,EACZ,SAAS,EACT,kBAAkB,GAElB,MAAM,kBAAkB,CAAC;AAC1B,OAAO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;YAC7B,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACzB,CAAC;QAED,IAAI,CAAC,wBAAwB,EAAE,EAAE,CAAC;QAElC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtB,CAAC;IAEO,iBAAiB;QACxB,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACxD,CAAC;CACD;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC/B,QAAW,EACX,MAAyB;IAEzB,MAAM,IAAI,GAAmB,EAAE,CAAC;IAChC,IAAI,CAAC,IAAI,CACR,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QAC5B,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,CAAC;IACd,CAAC,CAAC,CACF,CAAC;IACF,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { type TelemetryEventBatcher, measure } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype BranchRebaseResult,\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\tCommitKind,\n\ttype CommitMetadata,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\tfindAncestor,\n\tmakeAnonChange,\n\tmintCommit,\n\trebaseBranch,\n\ttagChange,\n\ttagRollbackInverse,\n\ttype RebaseStatsWithDuration,\n} from \"../core/index.js\";\nimport { EventEmitter, type Listenable } from \"../events/index.js\";\n\nimport { TransactionStack } from \"./transactionStack.js\";\n\n/**\n * Describes a change to a `SharedTreeBranch`. Various operations can mutate the head of the branch;\n * this change format describes each in terms of the \"removed commits\" (all commits which were present\n * on the branch before the operation but are no longer present after) and the \"new commits\" (all\n * commits which are present on the branch after the operation that were not present before). Each of\n * the following event types also provides a `change` which contains the net change to the branch\n * (or is undefined if there was no net change):\n * * Append - when one or more commits are appended to the head of the branch, for example via\n * a change applied by the branch's editor, or as a result of merging another branch into this one\n * * Remove - when one or more commits are removed from the head of the branch. This occurs\n * when a transaction is aborted and all commits pending in that transaction are removed.\n * * Replace - when an operation simultaneously removes and appends commits. For example, when this\n * branch is rebased and some commits are removed and replaced with rebased versions, or when a\n * transaction completes and all pending commits are replaced with a single squash commit.\n */\nexport type SharedTreeBranchChange<TChange> =\n\t| {\n\t\t\ttype: \"append\";\n\t\t\tchange: TaggedChange<TChange>;\n\t\t\tnewCommits: readonly GraphCommit<TChange>[];\n\t }\n\t| {\n\t\t\ttype: \"remove\";\n\t\t\tchange: TaggedChange<TChange> | undefined;\n\t\t\tremovedCommits: readonly GraphCommit<TChange>[];\n\t }\n\t| {\n\t\t\ttype: \"replace\";\n\t\t\tchange: TaggedChange<TChange> | undefined;\n\t\t\tremovedCommits: readonly GraphCommit<TChange>[];\n\t\t\tnewCommits: readonly GraphCommit<TChange>[];\n\t };\n\n/**\n * Returns the operation that caused the given {@link SharedTreeBranchChange}.\n */\nexport function getChangeReplaceType(\n\tchange: SharedTreeBranchChange<unknown> & { type: \"replace\" },\n): \"transactionCommit\" | \"rebase\" {\n\t// The \"replace\" variant of the change event is emitted by two operations: committing a transaction and doing a rebase.\n\t// Committing a transaction will always remove one or more commits (the commits that were squashed),\n\t// and will add exactly one new commit (the squash commit).\n\tif (change.removedCommits.length === 0 || change.newCommits.length !== 1) {\n\t\treturn \"rebase\";\n\t}\n\n\t// There is only one case in which a rebase both removes commits and adds exactly one new commit.\n\t// This occurs when there is exactly one divergent, but equivalent, commit on each branch:\n\t//\n\t// A ─ B (branch X)\t -- rebase Y onto X --> A ─ B (branch X)\n\t// └─ B' (branch Y) └─ (branch Y)\n\t//\n\t// B' is removed and replaced by B because both have the same revision.\n\tif (\n\t\tchange.removedCommits.length === 1 &&\n\t\tchange.removedCommits[0].revision === change.newCommits[0].revision\n\t) {\n\t\treturn \"rebase\";\n\t}\n\n\treturn \"transactionCommit\";\n}\n\n/**\n * The events emitted by a `SharedTreeBranch`\n */\nexport interface SharedTreeBranchEvents<TEditor extends ChangeFamilyEditor, TChange>\n\textends BranchTrimmingEvents {\n\t/**\n\t * Fired just before the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tbeforeChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * Fired just after the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tafterChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * {@inheritdoc TreeViewEvents.commitApplied}\n\t */\n\tcommitApplied(data: CommitMetadata): void;\n\n\t/**\n\t * Fired when this branch forks\n\t * @param fork - the new branch that forked off of this branch\n\t */\n\tfork(fork: SharedTreeBranch<TEditor, TChange>): void;\n\n\t/**\n\t * Fired after this branch is disposed\n\t */\n\tdispose(): void;\n\n\t/**\n\t * Fired after a new transaction is started.\n\t * @param isOuterTransaction - true iff the transaction being started is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionStarted(isOuterTransaction: boolean): void;\n\n\t/**\n\t * Fired after the current transaction is aborted.\n\t * @param isOuterTransaction - true iff the transaction being aborted is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionAborted(isOuterTransaction: boolean): void;\n\n\t/**\n\t * Fired after the current transaction is completely rolled back.\n\t * @param isOuterTransaction - true iff the transaction being aborted is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionRolledBack(isOuterTransaction: boolean): void;\n\n\t/**\n\t * Fired after the current transaction is committed.\n\t * @param isOuterTransaction - true iff the transaction being committed is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionCommitted(isOuterTransaction: boolean): void;\n}\n\n/**\n * Events related to branch trimming.\n *\n * @remarks\n * Trimming is a very specific kind of mutation which is the only allowed mutations to branches.\n * References to commits from other commits are removed so that the commit objects can be GC'd by the JS engine.\n * This happens by changing a commit's parent property to undefined, which drops all commits that are in its \"ancestry\".\n * It is done as a performance optimization when it is determined that commits are no longer needed for future computation.\n */\nexport interface BranchTrimmingEvents {\n\t/**\n\t * Fired when some contiguous range of commits beginning with the \"global tail\" of this branch are trimmed from the branch.\n\t * This happens by deleting the parent pointer to the last commit in that range. This event can be fired at any time.\n\t */\n\tancestryTrimmed(trimmedRevisions: RevisionTag[]): void;\n}\n\n/**\n * A branch of changes that can be applied to a SharedTree.\n */\nexport class SharedTreeBranch<\n\tTEditor extends ChangeFamilyEditor,\n\tTChange,\n> extends EventEmitter<SharedTreeBranchEvents<TEditor, TChange>> {\n\tpublic readonly editor: TEditor;\n\tprivate readonly transactions = new TransactionStack();\n\t/**\n\t * After pushing a starting revision to the transaction stack, this branch might be rebased\n\t * over commits which are children of that starting revision. When the transaction is committed,\n\t * those rebased-over commits should not be included in the transaction's squash commit, even though\n\t * they exist between the starting revision and the final commit within the transaction.\n\t *\n\t * Whenever `rebaseOnto` is called during a transaction, this map is augmented with an entry from the\n\t * original merge-base to the new merge-base.\n\t *\n\t * This state need only be retained for the lifetime of the transaction.\n\t *\n\t * TODO: This strategy might need to be revisited when adding better support for async transactions.\n\t * Since:\n\t *\n\t * 1. Transactionality is guaranteed primarily by squashing at commit time\n\t * 2. Branches may be rebased with an ongoing transaction\n\t *\n\t * a rebase operation might invalidate only a portion of a transaction's commits, thus defeating the\n\t * purpose of transactionality.\n\t *\n\t * AB#6483 and children items track this work.\n\t */\n\tprivate readonly initialTransactionRevToRebasedRev = new Map<RevisionTag, RevisionTag>();\n\tprivate disposed = false;\n\tprivate readonly unsubscribeBranchTrimmer?: () => void;\n\t/**\n\t * Construct a new branch.\n\t * @param head - the head of the branch\n\t * @param changeFamily - determines the set of changes that this branch can commit\n\t * @param branchTrimmer - an optional event emitter that informs the branch it has been trimmed. If this is not supplied, then the branch must\n\t * never be trimmed. See {@link BranchTrimmingEvents} for details on trimming.\n\t */\n\tpublic constructor(\n\t\tprivate head: GraphCommit<TChange>,\n\t\tpublic readonly changeFamily: ChangeFamily<TEditor, TChange>,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tprivate readonly branchTrimmer?: Listenable<BranchTrimmingEvents>,\n\t\tprivate readonly telemetryEventBatcher?: TelemetryEventBatcher<\n\t\t\tkeyof RebaseStatsWithDuration\n\t\t>,\n\t) {\n\t\tsuper();\n\t\tthis.editor = this.changeFamily.buildEditor((change) =>\n\t\t\tthis.apply(change, mintRevisionTag()),\n\t\t);\n\t\tthis.unsubscribeBranchTrimmer = branchTrimmer?.on(\"ancestryTrimmed\", (commit) => {\n\t\t\tthis.emit(\"ancestryTrimmed\", commit);\n\t\t});\n\t}\n\n\t/**\n\t * Sets the head of this branch. Emits no change events.\n\t */\n\tpublic setHead(head: GraphCommit<TChange>): void {\n\t\tthis.assertNotDisposed();\n\t\tassert(!this.isTransacting(), 0x685 /* Cannot set head during a transaction */);\n\t\tthis.head = head;\n\t}\n\n\t/**\n\t * Apply a change to this branch.\n\t * @param change - the change to apply\n\t * @param revision - the revision of the new head commit of the branch that contains `change`\n\t * @param changeKind - the kind of change to apply\n\t * @returns the change that was applied and the new head commit of the branch\n\t */\n\tpublic apply(\n\t\tchange: TChange,\n\t\trevision: RevisionTag,\n\t\tchangeKind: CommitKind = CommitKind.Default,\n\t): [change: TChange, newCommit: GraphCommit<TChange>] {\n\t\tthis.assertNotDisposed();\n\n\t\t// TODO: This should not be necessary when receiving changes from other clients.\n\t\tconst changeWithRevision = this.changeFamily.rebaser.changeRevision(change, revision);\n\n\t\tconst newHead = mintCommit(this.head, {\n\t\t\trevision,\n\t\t\tchange: changeWithRevision,\n\t\t});\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"append\",\n\t\t\tchange: tagChange(changeWithRevision, revision),\n\t\t\tnewCommits: [newHead],\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newHead;\n\n\t\t// If this is not part of a transaction, emit a commitApplied event\n\t\tif (!this.isTransacting()) {\n\t\t\tthis.emit(\"commitApplied\", { isLocal: true, kind: changeKind });\n\t\t}\n\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn [changeWithRevision, newHead];\n\t}\n\n\t/**\n\t * @returns the commit at the head of this branch.\n\t */\n\tpublic getHead(): GraphCommit<TChange> {\n\t\treturn this.head;\n\t}\n\n\t/**\n\t * Begin a transaction on this branch. If the transaction is committed via {@link commitTransaction},\n\t * all commits made since this call will be squashed into a single head commit.\n\t */\n\tpublic startTransaction(): void {\n\t\tthis.assertNotDisposed();\n\t\tconst forks = new Set<SharedTreeBranch<TEditor, TChange>>();\n\t\tconst onDisposeUnSubscribes: (() => void)[] = [];\n\t\tconst onForkUnSubscribe = onForkTransitive(this, (fork) => {\n\t\t\tforks.add(fork);\n\t\t\tonDisposeUnSubscribes.push(fork.on(\"dispose\", () => forks.delete(fork)));\n\t\t});\n\t\tthis.transactions.push(this.head.revision, () => {\n\t\t\tforks.forEach((fork) => fork.dispose());\n\t\t\tonDisposeUnSubscribes.forEach((unsubscribe) => unsubscribe());\n\t\t\tonForkUnSubscribe();\n\t\t});\n\t\tthis.editor.enterTransaction();\n\t\tthis.emit(\"transactionStarted\", this.transactions.size === 1);\n\t}\n\n\t/**\n\t * Commit the current transaction. There must be a transaction in progress that was begun via {@link startTransaction}.\n\t * If there are commits in the current transaction, they will be squashed into a new single head commit.\n\t * @returns the commits that were squashed and the new squash commit if a squash occurred, otherwise `undefined`.\n\t * @remarks If the transaction had no changes applied during its lifetime, then no squash occurs (i.e. this method is a no-op).\n\t * Even if the transaction contained only one change, it will still be replaced with an (equivalent) squash change.\n\t */\n\tpublic commitTransaction():\n\t\t| [squashedCommits: GraphCommit<TChange>[], newCommit: GraphCommit<TChange>]\n\t\t| undefined {\n\t\tthis.assertNotDisposed();\n\t\tconst [startCommit, commits] = this.popTransaction();\n\t\tthis.editor.exitTransaction();\n\n\t\tthis.emit(\"transactionCommitted\", this.transactions.size === 0);\n\t\tif (commits.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Squash the changes and make the squash commit the new head of this branch\n\t\tconst squashedChange = this.changeFamily.rebaser.compose(commits);\n\t\tconst revision = this.mintRevisionTag();\n\n\t\tconst newHead = mintCommit(startCommit, {\n\t\t\trevision,\n\t\t\tchange: this.changeFamily.rebaser.changeRevision(squashedChange, revision),\n\t\t});\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"replace\",\n\t\t\tchange: undefined,\n\t\t\tremovedCommits: commits,\n\t\t\tnewCommits: [newHead],\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newHead;\n\n\t\t// If this transaction is not nested, emit a commitApplied event\n\t\tif (!this.isTransacting()) {\n\t\t\tthis.emit(\"commitApplied\", { isLocal: true, kind: CommitKind.Default });\n\t\t}\n\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn [commits, newHead];\n\t}\n\n\t/**\n\t * Cancel the current transaction. There must be a transaction in progress that was begun via\n\t * {@link startTransaction}. All commits made during the transaction will be removed.\n\t * @returns the change to this branch resulting in the removal of the commits, and a list of the\n\t * commits that were removed.\n\t */\n\tpublic abortTransaction(): [\n\t\tchange: TChange | undefined,\n\t\tabortedCommits: GraphCommit<TChange>[],\n\t] {\n\t\tthis.assertNotDisposed();\n\t\tconst [startCommit, commits] = this.popTransaction();\n\t\tthis.editor.exitTransaction();\n\n\t\tthis.emit(\"transactionAborted\", this.transactions.size === 0);\n\t\tif (commits.length === 0) {\n\t\t\tthis.emit(\"transactionRolledBack\", this.transactions.size === 0);\n\t\t\treturn [undefined, []];\n\t\t}\n\n\t\tconst inverses: TaggedChange<TChange>[] = [];\n\t\tfor (let i = commits.length - 1; i >= 0; i--) {\n\t\t\tconst revision = this.mintRevisionTag();\n\t\t\tconst inverse = this.changeFamily.rebaser.changeRevision(\n\t\t\t\tthis.changeFamily.rebaser.invert(commits[i], false),\n\t\t\t\trevision,\n\t\t\t\tcommits[i].revision,\n\t\t\t);\n\n\t\t\tinverses.push(tagRollbackInverse(inverse, revision, commits[i].revision));\n\t\t}\n\t\tconst change =\n\t\t\tinverses.length > 0 ? this.changeFamily.rebaser.compose(inverses) : undefined;\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"remove\",\n\t\t\tchange: change === undefined ? undefined : makeAnonChange(change),\n\t\t\tremovedCommits: commits,\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = startCommit;\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\tthis.emit(\"transactionRolledBack\", this.transactions.size === 0);\n\t\treturn [change, commits];\n\t}\n\n\t/**\n\t * True iff this branch is in the middle of a transaction that was begin via {@link startTransaction}\n\t */\n\tpublic isTransacting(): boolean {\n\t\treturn this.transactions.size !== 0;\n\t}\n\n\tprivate popTransaction(): [GraphCommit<TChange>, GraphCommit<TChange>[]] {\n\t\tconst { startRevision: startRevisionOriginal } = this.transactions.pop();\n\t\tlet startRevision = startRevisionOriginal;\n\t\twhile (this.initialTransactionRevToRebasedRev.has(startRevision)) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tstartRevision = this.initialTransactionRevToRebasedRev.get(startRevision)!;\n\t\t}\n\n\t\tif (!this.isTransacting()) {\n\t\t\tthis.initialTransactionRevToRebasedRev.clear();\n\t\t}\n\n\t\tconst commits: GraphCommit<TChange>[] = [];\n\t\tconst startCommit = findAncestor(\n\t\t\t[this.head, commits],\n\t\t\t(c) => c.revision === startRevision,\n\t\t);\n\t\tassert(\n\t\t\tstartCommit !== undefined,\n\t\t\t0x593 /* Expected branch to be ahead of transaction start revision */,\n\t\t);\n\t\treturn [startCommit, commits];\n\t}\n\n\t/**\n\t * Spawn a new branch that is based off of the current state of this branch.\n\t * Changes made to the new branch will not be applied to this branch until the new branch is merged back in.\n\t *\n\t * @remarks Forks created during a transaction will be disposed when the transaction ends.\n\t */\n\tpublic fork(): SharedTreeBranch<TEditor, TChange> {\n\t\tthis.assertNotDisposed();\n\t\tconst fork = new SharedTreeBranch(\n\t\t\tthis.head,\n\t\t\tthis.changeFamily,\n\t\t\tthis.mintRevisionTag,\n\t\t\tthis.branchTrimmer,\n\t\t);\n\t\tthis.emit(\"fork\", fork);\n\t\treturn fork;\n\t}\n\n\t/**\n\t * Rebase the changes that have been applied to this branch over divergent changes in the given branch.\n\t * After this operation completes, this branch will be based off of `branch`.\n\t *\n\t * @param branch - the branch to rebase onto\n\t * @param upTo - the furthest commit on `branch` over which to rebase (inclusive). Defaults to the head commit of `branch`.\n\t * @returns the result of the rebase or undefined if nothing changed\n\t */\n\tpublic rebaseOnto(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = branch.getHead(),\n\t): BranchRebaseResult<TChange> | undefined {\n\t\tthis.assertNotDisposed();\n\n\t\t// Rebase this branch onto the given branch\n\t\tconst rebaseResult = this.rebaseBranch(this, branch, upTo);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// The net change to this branch is provided by the `rebaseBranch` API\n\t\tconst { newSourceHead, commits } = rebaseResult;\n\t\tconst { deletedSourceCommits, targetCommits, sourceCommits } = commits;\n\n\t\tconst newCommits = targetCommits.concat(sourceCommits);\n\t\tif (this.isTransacting()) {\n\t\t\tconst src = targetCommits[0].parent?.revision;\n\t\t\tconst dst = targetCommits[targetCommits.length - 1].revision;\n\t\t\tif (src !== undefined && dst !== undefined) {\n\t\t\t\tthis.initialTransactionRevToRebasedRev.set(src, dst);\n\t\t\t}\n\t\t}\n\t\tconst changeEvent = {\n\t\t\ttype: \"replace\",\n\t\t\tget change() {\n\t\t\t\tconst change = rebaseResult.sourceChange;\n\t\t\t\treturn change === undefined ? undefined : makeAnonChange(change);\n\t\t\t},\n\t\t\tremovedCommits: deletedSourceCommits,\n\t\t\tnewCommits,\n\t\t} as const;\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newSourceHead;\n\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn rebaseResult;\n\t}\n\n\t/**\n\t * Apply all the divergent changes on the given branch to this branch.\n\t *\n\t * @param branch - the branch to merge into this branch\n\t * @returns the net change to this branch and the commits that were added to this branch by the merge,\n\t * or undefined if nothing changed\n\t */\n\tpublic merge(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t): [change: TChange, newCommits: GraphCommit<TChange>[]] | undefined {\n\t\tthis.assertNotDisposed();\n\t\tbranch.assertNotDisposed();\n\t\tassert(\n\t\t\t!branch.isTransacting(),\n\t\t\t0x597 /* Branch may not be merged while transaction is in progress */,\n\t\t);\n\n\t\t// Rebase the given branch onto this branch\n\t\tconst rebaseResult = this.rebaseBranch(branch, this);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Compute the net change to this branch\n\t\tconst sourceCommits = rebaseResult.commits.sourceCommits;\n\t\tconst change = this.changeFamily.rebaser.compose(sourceCommits);\n\t\tconst taggedChange = makeAnonChange(change);\n\t\tconst changeEvent = {\n\t\t\ttype: \"append\",\n\t\t\tget change(): TaggedChange<TChange> {\n\t\t\t\treturn taggedChange;\n\t\t\t},\n\t\t\tnewCommits: sourceCommits,\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = rebaseResult.newSourceHead;\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn [change, sourceCommits];\n\t}\n\n\t/** Rebase `branchHead` onto `onto`, but return undefined if nothing changed */\n\tprivate rebaseBranch(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tonto: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = onto.getHead(),\n\t): BranchRebaseResult<TChange> | undefined {\n\t\tconst { head } = branch;\n\t\tif (head === upTo) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst { duration, output } = measure(() =>\n\t\t\trebaseBranch(\n\t\t\t\tthis.mintRevisionTag,\n\t\t\t\tthis.changeFamily.rebaser,\n\t\t\t\thead,\n\t\t\t\tupTo,\n\t\t\t\tonto.getHead(),\n\t\t\t),\n\t\t);\n\n\t\tthis.telemetryEventBatcher?.accumulateAndLog({ duration, ...output.telemetryProperties });\n\n\t\tif (this.head === output.newSourceHead) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn output;\n\t}\n\n\t/**\n\t * Dispose this branch, freezing its state.\n\t *\n\t * @remarks\n\t * Attempts to further mutate the branch will error.\n\t * Any transactions in progress will be aborted.\n\t * Calling dispose more than once has no effect.\n\t */\n\tpublic dispose(): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\twhile (this.isTransacting()) {\n\t\t\tthis.abortTransaction();\n\t\t}\n\n\t\tthis.unsubscribeBranchTrimmer?.();\n\n\t\tthis.disposed = true;\n\t\tthis.emit(\"dispose\");\n\t}\n\n\tprivate assertNotDisposed(): void {\n\t\tassert(!this.disposed, 0x66e /* Branch is disposed */);\n\t}\n}\n\n/**\n * Registers an event listener that fires when the given forkable object forks.\n * The listener will also fire when any of those forks fork, and when those forks of forks fork, and so on.\n * @param forkable - an object that emits an event when it is forked\n * @param onFork - the fork event listener\n * @returns a function which when called will deregister all registrations (including transitive) created by this function.\n * The deregister function has undefined behavior if called more than once.\n */\nexport function onForkTransitive<T extends Listenable<{ fork: (t: T) => void }>>(\n\tforkable: T,\n\tonFork: (fork: T) => void,\n): () => void {\n\tconst offs: (() => void)[] = [];\n\toffs.push(\n\t\tforkable.on(\"fork\", (fork) => {\n\t\t\toffs.push(onForkTransitive(fork, onFork));\n\t\t\tonFork(fork);\n\t\t}),\n\t);\n\treturn () => offs.forEach((off) => off());\n}\n"]}
@@ -8,7 +8,7 @@ import type { IExperimentalIncrementalSummaryContext, IGarbageCollectionData, IS
8
8
  import { type IFluidSerializer, SharedObject } from "@fluidframework/shared-object-base/internal";
9
9
  import type { ICodecOptions } from "../codec/index.js";
10
10
  import { type ChangeFamily, type ChangeFamilyEditor, type RevisionTag, type SchemaAndPolicy, type SchemaPolicy, type TreeStoredSchemaRepository } from "../core/index.js";
11
- import { type JsonCompatibleReadOnly } from "../util/index.js";
11
+ import { type JsonCompatibleReadOnly, Breakable, type WithBreakable } from "../util/index.js";
12
12
  import { type SharedTreeBranch } from "./branch.js";
13
13
  import { type ChangeEnricherReadonlyCheckout } from "./changeEnricher.js";
14
14
  import type { ResubmitMachine } from "./resubmitMachine.js";
@@ -21,12 +21,10 @@ export interface ClonableSchemaAndPolicy extends SchemaAndPolicy {
21
21
  schema: TreeStoredSchemaRepository;
22
22
  }
23
23
  /**
24
- * Generic shared tree, which needs to be configured with indexes, field kinds and a history policy to be used.
25
- *
26
- * TODO: actually implement
27
- * TODO: is history policy a detail of what indexes are used, or is there something else to it?
24
+ * Generic shared tree, which needs to be configured with indexes, field kinds and other configuration.
28
25
  */
29
- export declare class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange> extends SharedObject {
26
+ export declare class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange> extends SharedObject implements WithBreakable {
27
+ readonly breaker: Breakable;
30
28
  private readonly editManager;
31
29
  private readonly summarizables;
32
30
  /**
@@ -40,6 +38,10 @@ export declare class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
40
38
  * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.
41
39
  */
42
40
  get editor(): TEditor;
41
+ /**
42
+ * Gets the revision at the head of the trunk.
43
+ */
44
+ protected get trunkHeadRevision(): RevisionTag;
43
45
  /**
44
46
  * Used to encode/decode messages sent to/received from the Fluid runtime.
45
47
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeCore.d.ts","sourceRoot":"","sources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