@fluidframework/tree 2.21.0 → 2.23.0-323641

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 (358) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +1 -0
  3. package/api-report/tree.alpha.api.md +29 -4
  4. package/api-report/tree.beta.api.md +29 -4
  5. package/api-report/tree.legacy.alpha.api.md +29 -4
  6. package/api-report/tree.legacy.public.api.md +29 -4
  7. package/api-report/tree.public.api.md +29 -4
  8. package/dist/alpha.d.ts +1 -0
  9. package/dist/beta.d.ts +1 -0
  10. package/dist/core/forest/editableForest.js +1 -1
  11. package/dist/core/forest/editableForest.js.map +1 -1
  12. package/dist/core/index.d.ts +1 -1
  13. package/dist/core/index.d.ts.map +1 -1
  14. package/dist/core/index.js.map +1 -1
  15. package/dist/core/tree/anchorSet.d.ts +2 -5
  16. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  17. package/dist/core/tree/anchorSet.js +16 -162
  18. package/dist/core/tree/anchorSet.js.map +1 -1
  19. package/dist/core/tree/index.d.ts +1 -2
  20. package/dist/core/tree/index.d.ts.map +1 -1
  21. package/dist/core/tree/index.js.map +1 -1
  22. package/dist/core/tree/pathTree.d.ts +0 -11
  23. package/dist/core/tree/pathTree.d.ts.map +1 -1
  24. package/dist/core/tree/pathTree.js.map +1 -1
  25. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  26. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  27. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  28. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  29. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
  30. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  31. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
  32. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  33. package/dist/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
  34. package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  35. package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  36. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
  37. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  38. package/dist/feature-libraries/forest-summary/forestSummarizer.js +0 -9
  39. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  40. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
  41. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  42. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  43. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -4
  44. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  45. package/dist/feature-libraries/modular-schema/genericFieldKind.js +4 -19
  46. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  47. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  48. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +16 -18
  49. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  50. package/dist/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  51. package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  52. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  53. package/dist/feature-libraries/optional-field/optionalField.js +7 -3
  54. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  55. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
  56. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  57. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -11
  58. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  59. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
  60. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  61. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
  62. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  63. package/dist/index.d.ts +3 -3
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +4 -4
  66. package/dist/index.js.map +1 -1
  67. package/dist/legacy.d.ts +1 -0
  68. package/dist/packageVersion.d.ts +1 -1
  69. package/dist/packageVersion.d.ts.map +1 -1
  70. package/dist/packageVersion.js +1 -1
  71. package/dist/packageVersion.js.map +1 -1
  72. package/dist/public.d.ts +1 -0
  73. package/dist/shared-tree/index.d.ts +1 -3
  74. package/dist/shared-tree/index.d.ts.map +1 -1
  75. package/dist/shared-tree/index.js +1 -7
  76. package/dist/shared-tree/index.js.map +1 -1
  77. package/dist/shared-tree/schematizingTreeView.d.ts +4 -5
  78. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  79. package/dist/shared-tree/schematizingTreeView.js +9 -10
  80. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  81. package/dist/shared-tree/sharedTree.d.ts +40 -39
  82. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  83. package/dist/shared-tree/sharedTree.js +84 -52
  84. package/dist/shared-tree/sharedTree.js.map +1 -1
  85. package/dist/shared-tree/treeApi.d.ts +2 -2
  86. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  87. package/dist/shared-tree/treeApi.js +9 -3
  88. package/dist/shared-tree/treeApi.js.map +1 -1
  89. package/dist/shared-tree/treeCheckout.d.ts +3 -3
  90. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  91. package/dist/shared-tree/treeCheckout.js +3 -2
  92. package/dist/shared-tree/treeCheckout.js.map +1 -1
  93. package/dist/shared-tree-core/editManager.d.ts +11 -2
  94. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  95. package/dist/shared-tree-core/editManager.js +64 -29
  96. package/dist/shared-tree-core/editManager.js.map +1 -1
  97. package/dist/shared-tree-core/editManagerSummarizer.d.ts +1 -2
  98. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  99. package/dist/shared-tree-core/editManagerSummarizer.js +0 -9
  100. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  101. package/dist/shared-tree-core/resubmitMachine.d.ts +2 -0
  102. package/dist/shared-tree-core/resubmitMachine.d.ts.map +1 -1
  103. package/dist/shared-tree-core/resubmitMachine.js.map +1 -1
  104. package/dist/shared-tree-core/sequenceIdUtils.d.ts +12 -1
  105. package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  106. package/dist/shared-tree-core/sequenceIdUtils.js +25 -7
  107. package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
  108. package/dist/shared-tree-core/sharedTreeCore.d.ts +33 -30
  109. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  110. package/dist/shared-tree-core/sharedTreeCore.js +62 -56
  111. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  112. package/dist/simple-tree/api/index.d.ts +3 -2
  113. package/dist/simple-tree/api/index.d.ts.map +1 -1
  114. package/dist/simple-tree/api/index.js +3 -1
  115. package/dist/simple-tree/api/index.js.map +1 -1
  116. package/dist/simple-tree/api/schemaFactory.d.ts +156 -63
  117. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  118. package/dist/simple-tree/api/schemaFactory.js +179 -86
  119. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  120. package/dist/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
  121. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -0
  122. package/dist/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
  123. package/dist/simple-tree/api/tree.d.ts +23 -2
  124. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  125. package/dist/simple-tree/api/tree.js.map +1 -1
  126. package/dist/simple-tree/index.d.ts +1 -1
  127. package/dist/simple-tree/index.d.ts.map +1 -1
  128. package/dist/simple-tree/index.js +3 -2
  129. package/dist/simple-tree/index.js.map +1 -1
  130. package/dist/simple-tree/schemaTypes.d.ts +2 -2
  131. package/dist/simple-tree/schemaTypes.js +1 -1
  132. package/dist/simple-tree/schemaTypes.js.map +1 -1
  133. package/dist/simple-tree/treeNodeValid.js +1 -2
  134. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  135. package/dist/treeFactory.d.ts +16 -5
  136. package/dist/treeFactory.d.ts.map +1 -1
  137. package/dist/treeFactory.js +21 -12
  138. package/dist/treeFactory.js.map +1 -1
  139. package/dist/util/breakable.d.ts +1 -1
  140. package/dist/util/breakable.d.ts.map +1 -1
  141. package/dist/util/breakable.js.map +1 -1
  142. package/dist/util/index.d.ts +1 -1
  143. package/dist/util/index.d.ts.map +1 -1
  144. package/dist/util/index.js +3 -2
  145. package/dist/util/index.js.map +1 -1
  146. package/dist/util/rangeMap.d.ts +1 -1
  147. package/dist/util/rangeMap.js +1 -1
  148. package/dist/util/rangeMap.js.map +1 -1
  149. package/dist/util/utils.d.ts +16 -0
  150. package/dist/util/utils.d.ts.map +1 -1
  151. package/dist/util/utils.js +29 -1
  152. package/dist/util/utils.js.map +1 -1
  153. package/lib/alpha.d.ts +1 -0
  154. package/lib/beta.d.ts +1 -0
  155. package/lib/core/forest/editableForest.js +1 -1
  156. package/lib/core/forest/editableForest.js.map +1 -1
  157. package/lib/core/index.d.ts +1 -1
  158. package/lib/core/index.d.ts.map +1 -1
  159. package/lib/core/index.js.map +1 -1
  160. package/lib/core/tree/anchorSet.d.ts +2 -5
  161. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  162. package/lib/core/tree/anchorSet.js +17 -163
  163. package/lib/core/tree/anchorSet.js.map +1 -1
  164. package/lib/core/tree/index.d.ts +1 -2
  165. package/lib/core/tree/index.d.ts.map +1 -1
  166. package/lib/core/tree/index.js.map +1 -1
  167. package/lib/core/tree/pathTree.d.ts +0 -11
  168. package/lib/core/tree/pathTree.d.ts.map +1 -1
  169. package/lib/core/tree/pathTree.js.map +1 -1
  170. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  171. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  172. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  173. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  174. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
  175. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  176. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
  177. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  178. package/lib/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
  179. package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  180. package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  181. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
  182. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  183. package/lib/feature-libraries/forest-summary/forestSummarizer.js +0 -9
  184. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  185. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
  186. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  187. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  188. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -4
  189. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  190. package/lib/feature-libraries/modular-schema/genericFieldKind.js +4 -19
  191. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  192. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  193. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +17 -19
  194. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  195. package/lib/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  196. package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  197. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  198. package/lib/feature-libraries/optional-field/optionalField.js +7 -3
  199. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  200. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
  201. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  202. package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -11
  203. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  204. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
  205. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  206. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
  207. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  208. package/lib/index.d.ts +3 -3
  209. package/lib/index.d.ts.map +1 -1
  210. package/lib/index.js +3 -3
  211. package/lib/index.js.map +1 -1
  212. package/lib/legacy.d.ts +1 -0
  213. package/lib/packageVersion.d.ts +1 -1
  214. package/lib/packageVersion.d.ts.map +1 -1
  215. package/lib/packageVersion.js +1 -1
  216. package/lib/packageVersion.js.map +1 -1
  217. package/lib/public.d.ts +1 -0
  218. package/lib/shared-tree/index.d.ts +1 -3
  219. package/lib/shared-tree/index.d.ts.map +1 -1
  220. package/lib/shared-tree/index.js +1 -3
  221. package/lib/shared-tree/index.js.map +1 -1
  222. package/lib/shared-tree/schematizingTreeView.d.ts +4 -5
  223. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  224. package/lib/shared-tree/schematizingTreeView.js +4 -5
  225. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  226. package/lib/shared-tree/sharedTree.d.ts +40 -39
  227. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  228. package/lib/shared-tree/sharedTree.js +82 -50
  229. package/lib/shared-tree/sharedTree.js.map +1 -1
  230. package/lib/shared-tree/treeApi.d.ts +2 -2
  231. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  232. package/lib/shared-tree/treeApi.js +8 -2
  233. package/lib/shared-tree/treeApi.js.map +1 -1
  234. package/lib/shared-tree/treeCheckout.d.ts +3 -3
  235. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  236. package/lib/shared-tree/treeCheckout.js +4 -3
  237. package/lib/shared-tree/treeCheckout.js.map +1 -1
  238. package/lib/shared-tree-core/editManager.d.ts +11 -2
  239. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  240. package/lib/shared-tree-core/editManager.js +65 -30
  241. package/lib/shared-tree-core/editManager.js.map +1 -1
  242. package/lib/shared-tree-core/editManagerSummarizer.d.ts +1 -2
  243. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  244. package/lib/shared-tree-core/editManagerSummarizer.js +0 -9
  245. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  246. package/lib/shared-tree-core/resubmitMachine.d.ts +2 -0
  247. package/lib/shared-tree-core/resubmitMachine.d.ts.map +1 -1
  248. package/lib/shared-tree-core/resubmitMachine.js.map +1 -1
  249. package/lib/shared-tree-core/sequenceIdUtils.d.ts +12 -1
  250. package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  251. package/lib/shared-tree-core/sequenceIdUtils.js +23 -5
  252. package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
  253. package/lib/shared-tree-core/sharedTreeCore.d.ts +33 -30
  254. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  255. package/lib/shared-tree-core/sharedTreeCore.js +61 -55
  256. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  257. package/lib/simple-tree/api/index.d.ts +3 -2
  258. package/lib/simple-tree/api/index.d.ts.map +1 -1
  259. package/lib/simple-tree/api/index.js +1 -0
  260. package/lib/simple-tree/api/index.js.map +1 -1
  261. package/lib/simple-tree/api/schemaFactory.d.ts +156 -63
  262. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  263. package/lib/simple-tree/api/schemaFactory.js +178 -85
  264. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  265. package/lib/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
  266. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -0
  267. package/lib/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
  268. package/lib/simple-tree/api/tree.d.ts +23 -2
  269. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  270. package/lib/simple-tree/api/tree.js.map +1 -1
  271. package/lib/simple-tree/index.d.ts +1 -1
  272. package/lib/simple-tree/index.d.ts.map +1 -1
  273. package/lib/simple-tree/index.js +1 -1
  274. package/lib/simple-tree/index.js.map +1 -1
  275. package/lib/simple-tree/schemaTypes.d.ts +2 -2
  276. package/lib/simple-tree/schemaTypes.js +1 -1
  277. package/lib/simple-tree/schemaTypes.js.map +1 -1
  278. package/lib/simple-tree/treeNodeValid.js +1 -2
  279. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  280. package/lib/treeFactory.d.ts +16 -5
  281. package/lib/treeFactory.d.ts.map +1 -1
  282. package/lib/treeFactory.js +20 -11
  283. package/lib/treeFactory.js.map +1 -1
  284. package/lib/util/breakable.d.ts +1 -1
  285. package/lib/util/breakable.d.ts.map +1 -1
  286. package/lib/util/breakable.js.map +1 -1
  287. package/lib/util/index.d.ts +1 -1
  288. package/lib/util/index.d.ts.map +1 -1
  289. package/lib/util/index.js +1 -1
  290. package/lib/util/index.js.map +1 -1
  291. package/lib/util/rangeMap.d.ts +1 -1
  292. package/lib/util/rangeMap.js +1 -1
  293. package/lib/util/rangeMap.js.map +1 -1
  294. package/lib/util/utils.d.ts +16 -0
  295. package/lib/util/utils.d.ts.map +1 -1
  296. package/lib/util/utils.js +27 -0
  297. package/lib/util/utils.js.map +1 -1
  298. package/package.json +23 -23
  299. package/src/core/forest/editableForest.ts +1 -1
  300. package/src/core/index.ts +0 -3
  301. package/src/core/tree/anchorSet.ts +38 -221
  302. package/src/core/tree/index.ts +0 -3
  303. package/src/core/tree/pathTree.ts +0 -13
  304. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
  305. package/src/feature-libraries/detachedFieldIndexSummarizer.ts +0 -11
  306. package/src/feature-libraries/flex-tree/treeEvents.ts +2 -4
  307. package/src/feature-libraries/forest-summary/forestSummarizer.ts +0 -11
  308. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +6 -2
  309. package/src/feature-libraries/modular-schema/genericFieldKind.ts +3 -35
  310. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +18 -48
  311. package/src/feature-libraries/optional-field/optionalField.ts +10 -3
  312. package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -16
  313. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +13 -2
  314. package/src/index.ts +15 -12
  315. package/src/packageVersion.ts +1 -1
  316. package/src/shared-tree/index.ts +3 -19
  317. package/src/shared-tree/schematizingTreeView.ts +18 -16
  318. package/src/shared-tree/sharedTree.ts +208 -100
  319. package/src/shared-tree/treeApi.ts +10 -1
  320. package/src/shared-tree/treeCheckout.ts +11 -8
  321. package/src/shared-tree-core/editManager.ts +80 -43
  322. package/src/shared-tree-core/editManagerSummarizer.ts +0 -11
  323. package/src/shared-tree-core/resubmitMachine.ts +2 -0
  324. package/src/shared-tree-core/sequenceIdUtils.ts +26 -5
  325. package/src/shared-tree-core/sharedTreeCore.ts +88 -99
  326. package/src/simple-tree/api/index.ts +15 -0
  327. package/src/simple-tree/api/schemaFactory.ts +203 -89
  328. package/src/{shared-tree → simple-tree/api}/transactionTypes.ts +1 -1
  329. package/src/simple-tree/api/tree.ts +31 -6
  330. package/src/simple-tree/index.ts +12 -0
  331. package/src/simple-tree/schemaTypes.ts +2 -2
  332. package/src/treeFactory.ts +29 -11
  333. package/src/util/breakable.ts +1 -1
  334. package/src/util/index.ts +1 -0
  335. package/src/util/rangeMap.ts +1 -1
  336. package/src/util/utils.ts +32 -0
  337. package/dist/core/tree/visitPath.d.ts +0 -101
  338. package/dist/core/tree/visitPath.d.ts.map +0 -1
  339. package/dist/core/tree/visitPath.js +0 -7
  340. package/dist/core/tree/visitPath.js.map +0 -1
  341. package/dist/shared-tree/publicContracts.d.ts +0 -18
  342. package/dist/shared-tree/publicContracts.d.ts.map +0 -1
  343. package/dist/shared-tree/publicContracts.js +0 -24
  344. package/dist/shared-tree/publicContracts.js.map +0 -1
  345. package/dist/shared-tree/transactionTypes.d.ts.map +0 -1
  346. package/lib/core/tree/visitPath.d.ts +0 -101
  347. package/lib/core/tree/visitPath.d.ts.map +0 -1
  348. package/lib/core/tree/visitPath.js +0 -6
  349. package/lib/core/tree/visitPath.js.map +0 -1
  350. package/lib/shared-tree/publicContracts.d.ts +0 -18
  351. package/lib/shared-tree/publicContracts.d.ts.map +0 -1
  352. package/lib/shared-tree/publicContracts.js +0 -21
  353. package/lib/shared-tree/publicContracts.js.map +0 -1
  354. package/lib/shared-tree/transactionTypes.d.ts.map +0 -1
  355. package/src/core/tree/visitPath.ts +0 -124
  356. package/src/shared-tree/publicContracts.ts +0 -24
  357. /package/dist/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
  358. /package/lib/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
@@ -31,7 +31,7 @@ import type {
31
31
  SummarySessionBranch,
32
32
  } from "./editManagerFormat.js";
33
33
  import {
34
- decrementSequenceId,
34
+ getUpperBoundOfPreviousSequenceId,
35
35
  equalSequenceIds,
36
36
  maxSequenceId,
37
37
  minSequenceId,
@@ -362,7 +362,7 @@ export class EditManager<
362
362
  if (minimumBranchBaseSequenceId !== undefined) {
363
363
  // If that branch is behind the minimum sequence id, we only want to evict commits older than it,
364
364
  // even if those commits are behind the minimum sequence id
365
- const sequenceIdBeforeMinimumBranchBase = decrementSequenceId(
365
+ const sequenceIdBeforeMinimumBranchBase = getUpperBoundOfPreviousSequenceId(
366
366
  minimumBranchBaseSequenceId,
367
367
  );
368
368
  trunkTailSequenceId = minSequenceId(
@@ -472,7 +472,7 @@ export class EditManager<
472
472
  // `EditManager` would have to be amended in one of two ways:
473
473
  // A) Changes made by the local session should be represented by a branch in `EditManager.branches`.
474
474
  // B) The contents of such a branch should be computed on demand based on the trunk.
475
- // Note that option (A) would be a simple change to `addSequencedChange` whereas (B) would likely require
475
+ // Note that option (A) would be a simple change to `addSequencedChanges` whereas (B) would likely require
476
476
  // rebasing trunk changes over the inverse of trunk changes.
477
477
  assert(
478
478
  this.localBranch.getHead() === this.trunk.getHead(),
@@ -646,24 +646,45 @@ export class EditManager<
646
646
  return Math.max(max, localPath.length);
647
647
  }
648
648
 
649
- public addSequencedChange(
650
- newCommit: Commit<TChangeset>,
649
+ /* eslint-disable jsdoc/check-indentation */
650
+ /**
651
+ * Add a bunch of sequenced changes. A bunch is a group of sequenced commits that have the following properties:
652
+ * - They are not interleaved with messages from other DDSes in the container.
653
+ * - They are all part of the same batch, which entails:
654
+ * - They are contiguous in sequencing order.
655
+ * - They are all from the same client.
656
+ * - They are all based on the same reference sequence number.
657
+ * - They are not interleaved with messages from other clients.
658
+ */
659
+ /* eslint-enable jsdoc/check-indentation */
660
+ public addSequencedChanges(
661
+ newCommits: readonly GraphCommit<TChangeset>[],
662
+ sessionId: SessionId,
651
663
  sequenceNumber: SeqNumber,
652
664
  referenceSequenceNumber: SeqNumber,
653
665
  ): void {
666
+ assert(newCommits.length > 0, "Expected at least one sequenced change");
654
667
  assert(
655
668
  sequenceNumber > this.minimumSequenceNumber,
656
669
  0x713 /* Expected change sequence number to exceed the last known minimum sequence number */,
657
670
  );
658
-
659
671
  assert(
660
672
  sequenceNumber >= // This is ">=", not ">" because changes in the same batch will have the same sequence number
661
673
  (this.sequenceMap.maxKey()?.sequenceNumber ?? minimumPossibleSequenceNumber),
662
674
  0xa64 /* Attempted to sequence change with an outdated sequence number */,
663
675
  );
664
676
 
677
+ // Returns the sequence id for the next commit to be processed in the bunch. Since all the commits have the
678
+ // same sequence number, only the index in the batch needs to be incremented.
679
+ const getNextSequenceId = (sequenceId: SequenceId): SequenceId => {
680
+ return {
681
+ sequenceNumber: sequenceId.sequenceNumber,
682
+ indexInBatch: (sequenceId.indexInBatch ?? 0) + 1,
683
+ };
684
+ };
665
685
  const commitsSequenceNumber = this.getBatch(sequenceNumber);
666
- const sequenceId: SequenceId =
686
+ // The sequence id for the next commit to be processed in the bunch.
687
+ let nextSequenceId =
667
688
  commitsSequenceNumber.length === 0
668
689
  ? {
669
690
  sequenceNumber,
@@ -673,49 +694,65 @@ export class EditManager<
673
694
  indexInBatch: commitsSequenceNumber.length,
674
695
  };
675
696
 
676
- if (newCommit.sessionId === this.localSessionId) {
677
- return this.fastForwardNextLocalCommit(sequenceId);
697
+ // Local changes, i.e., changes from this client are applied by fast forwarding the local branch commit onto
698
+ // the trunk.
699
+ if (sessionId === this.localSessionId) {
700
+ for (const _ of newCommits) {
701
+ this.fastForwardNextLocalCommit(nextSequenceId);
702
+ nextSequenceId = getNextSequenceId(nextSequenceId);
703
+ }
704
+ return;
678
705
  }
679
706
 
680
- // Get the revision that the remote change is based on
681
- const [, baseRevisionInTrunk] = this.getClosestTrunkCommit(referenceSequenceNumber);
682
- // Rebase that branch over the part of the trunk up to the base revision
683
- // This will be a no-op if the sending client has not advanced since the last time we received an edit from it
684
- const peerLocalBranch = getOrCreate(
685
- this.peerLocalBranches,
686
- newCommit.sessionId,
687
- () => new SharedTreeBranch(baseRevisionInTrunk, this.changeFamily, this.mintRevisionTag),
688
- );
689
- peerLocalBranch.rebaseOnto(this.trunk, baseRevisionInTrunk);
690
-
691
- if (peerLocalBranch.getHead() === this.trunk.getHead()) {
692
- // If the branch is fully caught up and empty after being rebased, then push to the trunk directly
693
- this.pushCommitToTrunk(sequenceId, newCommit);
694
- peerLocalBranch.setHead(this.trunk.getHead());
695
- } else {
696
- // Otherwise, rebase the change over the trunk and append it, and append the original change to the peer branch.
697
- const { duration, output: newChangeFullyRebased } = measure(() =>
698
- rebaseChange(
699
- this.changeFamily.rebaser,
700
- newCommit,
701
- peerLocalBranch.getHead(),
702
- this.trunk.getHead(),
703
- this.mintRevisionTag,
704
- ),
707
+ // Remote changes, i.e., changes from remote clients are applied in three steps.
708
+ for (const newCommit of newCommits) {
709
+ // Step 1 - Recreate the peer remote client's local environment.
710
+ // Get the revision that the remote change is based on
711
+ const [, baseRevisionInTrunk] = this.getClosestTrunkCommit(referenceSequenceNumber);
712
+ // Rebase that peer local branch over the part of the trunk up to the base revision
713
+ // This will be a no-op if the sending client has not advanced since the last time we received an edit from it
714
+ const peerLocalBranch = getOrCreate(
715
+ this.peerLocalBranches,
716
+ sessionId,
717
+ () =>
718
+ new SharedTreeBranch(baseRevisionInTrunk, this.changeFamily, this.mintRevisionTag),
705
719
  );
720
+ peerLocalBranch.rebaseOnto(this.trunk, baseRevisionInTrunk);
706
721
 
707
- this.telemetryEventBatcher?.accumulateAndLog({
708
- duration,
709
- ...newChangeFullyRebased.telemetryProperties,
710
- });
722
+ // Step 2 - Append the change to the peer branch. Rebase the change to the tip of the trunk.
723
+ if (peerLocalBranch.getHead() === this.trunk.getHead()) {
724
+ // If the branch is fully caught up and empty after being rebased, then push to the trunk directly
725
+ this.pushCommitToTrunk(nextSequenceId, { ...newCommit, sessionId });
726
+ peerLocalBranch.setHead(this.trunk.getHead());
727
+ } else {
728
+ // Otherwise, rebase the change over the trunk and append it, and append the original change to the peer branch.
729
+ const { duration, output: newChangeFullyRebased } = measure(() =>
730
+ rebaseChange(
731
+ this.changeFamily.rebaser,
732
+ newCommit,
733
+ peerLocalBranch.getHead(),
734
+ this.trunk.getHead(),
735
+ this.mintRevisionTag,
736
+ ),
737
+ );
711
738
 
712
- peerLocalBranch.apply(tagChange(newCommit.change, newCommit.revision));
713
- this.pushCommitToTrunk(sequenceId, {
714
- ...newCommit,
715
- change: newChangeFullyRebased.change,
716
- });
739
+ this.telemetryEventBatcher?.accumulateAndLog({
740
+ duration,
741
+ ...newChangeFullyRebased.telemetryProperties,
742
+ });
743
+
744
+ peerLocalBranch.apply(tagChange(newCommit.change, newCommit.revision));
745
+ this.pushCommitToTrunk(nextSequenceId, {
746
+ ...newCommit,
747
+ sessionId,
748
+ change: newChangeFullyRebased.change,
749
+ });
750
+ }
751
+
752
+ nextSequenceId = getNextSequenceId(nextSequenceId);
717
753
  }
718
754
 
755
+ // Step 3 - Rebase the local branch over the updated trunk.
719
756
  this.localBranch.rebaseOnto(this.trunk);
720
757
  }
721
758
 
@@ -7,7 +7,6 @@ import { bufferToString } from "@fluid-internal/client-utils";
7
7
  import { assert } from "@fluidframework/core-utils/internal";
8
8
  import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
9
9
  import type {
10
- IGarbageCollectionData,
11
10
  ISummaryTreeWithStats,
12
11
  ITelemetryContext,
13
12
  } from "@fluidframework/runtime-definitions/internal";
@@ -78,16 +77,6 @@ export class EditManagerSummarizer<TChangeset> implements Summarizable {
78
77
  return createSingleBlobSummary(stringKey, dataString);
79
78
  }
80
79
 
81
- public getGCData(fullGC?: boolean): IGarbageCollectionData {
82
- // TODO: Properly implement garbage collection. Right now, garbage collection is performed automatically
83
- // by the code in SharedObject (from which SharedTreeCore extends). The `runtime.uploadBlob` API delegates
84
- // to the `BlobManager`, which automatically populates the summary with ISummaryAttachment entries for each
85
- // blob.
86
- return {
87
- gcNodes: {},
88
- };
89
- }
90
-
91
80
  public async load(
92
81
  services: IChannelStorageService,
93
82
  parse: SummaryElementParser,
@@ -39,6 +39,8 @@ export interface ResubmitMachine<TChange> {
39
39
 
40
40
  /**
41
41
  * Must be called after a sequenced commit is applied.
42
+ * Note that this may be called multiples times in a row after a number of sequenced commits have been applied
43
+ * (as opposed to always being called before the next sequenced commit is applied).
42
44
  * @param isLocal - whether the sequenced commit was generated by the local session.
43
45
  */
44
46
  onSequencedCommitApplied(isLocal: boolean): void;
@@ -3,25 +3,46 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ import { assert } from "@fluidframework/core-utils/internal";
6
7
  import { brand } from "../util/index.js";
7
8
 
8
9
  import type { SequenceId } from "./editManagerFormat.js";
9
10
 
11
+ /**
12
+ * Compares two sequenceIds. Returns a negative number if a \< b, a positive number if a \> b, and 0 if a === b.
13
+ * Note that this handles cases where indexInBatch is Number.POSITIVE_INFINITY.
14
+ */
10
15
  export const sequenceIdComparator = (a: SequenceId, b: SequenceId): number =>
11
16
  a.sequenceNumber !== b.sequenceNumber
12
17
  ? a.sequenceNumber - b.sequenceNumber
13
- : (a.indexInBatch ?? 0) - (b.indexInBatch ?? 0);
18
+ : a.indexInBatch === b.indexInBatch
19
+ ? 0
20
+ : (a.indexInBatch ?? 0) - (b.indexInBatch ?? 0);
14
21
  export const equalSequenceIds = (a: SequenceId, b: SequenceId): boolean =>
15
22
  sequenceIdComparator(a, b) === 0;
16
23
  export const minSequenceId = (a: SequenceId, b: SequenceId): SequenceId =>
17
24
  sequenceIdComparator(a, b) < 0 ? a : b;
18
25
  export const maxSequenceId = (a: SequenceId, b: SequenceId): SequenceId =>
19
26
  sequenceIdComparator(a, b) > 0 ? a : b;
20
- export const decrementSequenceId = (sequenceId: SequenceId): SequenceId => {
21
- return sequenceId.indexInBatch !== undefined
27
+ /**
28
+ * Returns the upper bound (maximum possible) sequenceId that can occur just before the given sequenceId.
29
+ * Some examples:
30
+ * 1. sequenceId = \{ sequenceNumber: 1, indexInBatch: 2 \}. The upper bound is \{ sequenceNumber: 1, indexInBatch: 1 \}.
31
+ * 2. sequenceId = \{ sequenceNumber: 2 \}. The upper bound is \{ sequenceNumber: 1, indexInBatch: Number.POSITIVE_INFINITY \}.
32
+ * The indexInBatch value of the previous commit will depend on how many ops were in the previous batch of messages received.
33
+ */
34
+ export const getUpperBoundOfPreviousSequenceId = (sequenceId: SequenceId): SequenceId => {
35
+ assert(
36
+ sequenceId.indexInBatch === undefined || Number.isFinite(sequenceId.indexInBatch),
37
+ 0xabc /* indexInBatch must not be infinity */,
38
+ );
39
+ return sequenceId.indexInBatch === undefined || sequenceId.indexInBatch === 0
22
40
  ? {
41
+ sequenceNumber: brand(sequenceId.sequenceNumber - 1),
42
+ indexInBatch: Number.POSITIVE_INFINITY,
43
+ }
44
+ : {
23
45
  sequenceNumber: brand(sequenceId.sequenceNumber),
24
46
  indexInBatch: sequenceId.indexInBatch - 1,
25
- }
26
- : { sequenceNumber: brand(sequenceId.sequenceNumber - 1) };
47
+ };
27
48
  };
@@ -4,24 +4,17 @@
4
4
  */
5
5
 
6
6
  import { assert } from "@fluidframework/core-utils/internal";
7
- import type {
8
- IChannelAttributes,
9
- IFluidDataStoreRuntime,
10
- IChannelStorageService,
11
- } from "@fluidframework/datastore-definitions/internal";
12
- import type { IIdCompressor } from "@fluidframework/id-compressor";
7
+ import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
8
+ import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
13
9
  import type { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
14
10
  import type {
15
11
  IExperimentalIncrementalSummaryContext,
16
- IGarbageCollectionData,
12
+ IRuntimeMessageCollection,
17
13
  ISummaryTreeWithStats,
18
14
  ITelemetryContext,
19
15
  } from "@fluidframework/runtime-definitions/internal";
20
16
  import { SummaryTreeBuilder } from "@fluidframework/runtime-utils/internal";
21
- import {
22
- type IFluidSerializer,
23
- SharedObject,
24
- } from "@fluidframework/shared-object-base/internal";
17
+ import type { IFluidSerializer } from "@fluidframework/shared-object-base/internal";
25
18
 
26
19
  import type { ICodecOptions, IJsonCodec } from "../codec/index.js";
27
20
  import {
@@ -39,7 +32,7 @@ import {
39
32
  import {
40
33
  type JsonCompatibleReadOnly,
41
34
  brand,
42
- Breakable,
35
+ type Breakable,
43
36
  type WithBreakable,
44
37
  throwIfBroken,
45
38
  breakingClass,
@@ -57,6 +50,8 @@ import type { ResubmitMachine } from "./resubmitMachine.js";
57
50
  import { DefaultResubmitMachine } from "./defaultResubmitMachine.js";
58
51
  import { BranchCommitEnricher } from "./branchCommitEnricher.js";
59
52
  import { createChildLogger } from "@fluidframework/telemetry-utils/internal";
53
+ import type { IFluidLoadable, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
54
+ import type { IChannelView } from "../shared-tree/index.js";
60
55
 
61
56
  // TODO: Organize this to be adjacent to persisted types.
62
57
  const summarizablesTreeKey = "indexes";
@@ -75,11 +70,8 @@ export interface ClonableSchemaAndPolicy extends SchemaAndPolicy {
75
70
  */
76
71
  @breakingClass
77
72
  export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
78
- extends SharedObject
79
73
  implements WithBreakable
80
74
  {
81
- public readonly breaker: Breakable = new Breakable("Shared Tree");
82
-
83
75
  private readonly editManager: EditManager<TEditor, TChange, ChangeFamily<TEditor, TChange>>;
84
76
  private readonly summarizables: readonly [EditManagerSummarizer<TChange>, ...Summarizable[]];
85
77
  /**
@@ -89,14 +81,6 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
89
81
  */
90
82
  private detachedRevision: SeqNumber | undefined = minimumPossibleSequenceNumber;
91
83
 
92
- /**
93
- * Used to edit the state of the tree. Edits will be immediately applied locally to the tree.
94
- * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.
95
- */
96
- public get editor(): TEditor {
97
- return this.getLocalBranch().editor;
98
- }
99
-
100
84
  /**
101
85
  * Used to encode/decode messages sent to/received from the Fluid runtime.
102
86
  *
@@ -113,12 +97,10 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
113
97
  MessageEncodingContext
114
98
  >;
115
99
 
116
- private readonly idCompressor: IIdCompressor;
117
-
118
100
  private readonly resubmitMachine: ResubmitMachine<TChange>;
119
- protected readonly commitEnricher: BranchCommitEnricher<TChange>;
101
+ public readonly commitEnricher: BranchCommitEnricher<TChange>;
120
102
 
121
- protected readonly mintRevisionTag: () => RevisionTag;
103
+ public readonly mintRevisionTag: () => RevisionTag;
122
104
 
123
105
  private readonly schemaAndPolicy: ClonableSchemaAndPolicy;
124
106
 
@@ -126,50 +108,44 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
126
108
  * @param summarizables - Summarizers for all indexes used by this tree
127
109
  * @param changeFamily - The change family
128
110
  * @param editManager - The edit manager
129
- * @param id - The id of the shared object
130
111
  * @param runtime - The IFluidDataStoreRuntime which contains the shared object
131
- * @param attributes - Attributes of the shared object
132
- * @param telemetryContextPrefix - The property prefix for telemetry pertaining to this object. See {@link ITelemetryContext}
112
+ * @param editor - Used to edit the state of the tree. Edits will be immediately applied locally to the tree.
113
+ * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.
133
114
  */
134
115
  public constructor(
116
+ public readonly breaker: Breakable,
117
+ public readonly sharedObject: IChannelView & IFluidLoadable,
118
+ public readonly serializer: IFluidSerializer,
119
+ public readonly submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,
120
+ logger: ITelemetryBaseLogger | undefined,
135
121
  summarizables: readonly Summarizable[],
136
122
  changeFamily: ChangeFamily<TEditor, TChange>,
137
123
  options: ICodecOptions,
138
124
  formatOptions: ExplicitCoreCodecVersions,
139
- // Base class arguments
140
- id: string,
141
- runtime: IFluidDataStoreRuntime,
142
- attributes: IChannelAttributes,
143
- telemetryContextPrefix: string,
125
+ private readonly idCompressor: IIdCompressor,
144
126
  schema: TreeStoredSchemaRepository,
145
127
  schemaPolicy: SchemaPolicy,
146
128
  resubmitMachine?: ResubmitMachine<TChange>,
147
129
  enricher?: ChangeEnricherReadonlyCheckout<TChange>,
130
+ public readonly getEditor: () => TEditor = () => this.getLocalBranch().editor,
148
131
  ) {
149
- super(id, runtime, attributes, telemetryContextPrefix);
150
-
151
132
  this.schemaAndPolicy = {
152
133
  schema,
153
134
  policy: schemaPolicy,
154
135
  };
155
136
 
156
137
  const rebaseLogger = createChildLogger({
157
- logger: this.logger,
138
+ logger,
158
139
  namespace: "Rebase",
159
140
  });
160
141
 
161
- assert(
162
- runtime.idCompressor !== undefined,
163
- 0x886 /* IdCompressor must be enabled to use SharedTree */,
164
- );
165
- this.idCompressor = runtime.idCompressor;
166
142
  this.mintRevisionTag = () => this.idCompressor.generateCompressedId();
167
143
  /**
168
144
  * A random ID that uniquely identifies this client in the collab session.
169
145
  * This is sent alongside every op to identify which client the op originated from.
170
146
  * This is used rather than the Fluid client ID because the Fluid client ID is not stable across reconnections.
171
147
  */
172
- const localSessionId = runtime.idCompressor.localSessionId;
148
+ const localSessionId = idCompressor.localSessionId;
173
149
  this.editManager = new EditManager(
174
150
  changeFamily,
175
151
  localSessionId,
@@ -189,7 +165,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
189
165
  }
190
166
  });
191
167
 
192
- const revisionTagCodec = new RevisionTagCodec(runtime.idCompressor);
168
+ const revisionTagCodec = new RevisionTagCodec(idCompressor);
193
169
  const editManagerCodec = makeEditManagerCodec(
194
170
  this.editManager.changeFamily.codecs,
195
171
  revisionTagCodec,
@@ -212,7 +188,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
212
188
 
213
189
  this.messageCodec = makeMessageCodec(
214
190
  changeFamily.codecs,
215
- new RevisionTagCodec(runtime.idCompressor),
191
+ new RevisionTagCodec(idCompressor),
216
192
  options,
217
193
  formatOptions.message,
218
194
  );
@@ -231,7 +207,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
231
207
  // TODO: SharedObject's merging of the two summary methods into summarizeCore is not what we want here:
232
208
  // We might want to not subclass it, or override/reimplement most of its functionality.
233
209
  @throwIfBroken
234
- protected summarizeCore(
210
+ public summarizeCore(
235
211
  serializer: IFluidSerializer,
236
212
  telemetryContext?: ITelemetryContext,
237
213
  incrementalSummaryContext?: IExperimentalIncrementalSummaryContext,
@@ -243,7 +219,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
243
219
  summarizableBuilder.addWithStats(
244
220
  s.key,
245
221
  s.getAttachSummary(
246
- (contents) => serializer.stringify(contents, this.handle),
222
+ (contents) => serializer.stringify(contents, this.sharedObject.handle),
247
223
  undefined,
248
224
  undefined,
249
225
  telemetryContext,
@@ -256,7 +232,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
256
232
  return builder.getSummaryTree();
257
233
  }
258
234
 
259
- protected async loadCore(services: IChannelStorageService): Promise<void> {
235
+ public async loadCore(services: IChannelStorageService): Promise<void> {
260
236
  assert(
261
237
  this.editManager.localBranch.getHead() === this.editManager.getTrunkHead(),
262
238
  0xaaa /* All local changes should be applied to the trunk before loading from summary */,
@@ -311,7 +287,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
311
287
  isResubmit: boolean,
312
288
  ): void {
313
289
  assert(
314
- this.isAttached() === (this.detachedRevision === undefined),
290
+ this.sharedObject.isAttached() === (this.detachedRevision === undefined),
315
291
  0x95a /* Detached revision should only be set when not attached */,
316
292
  );
317
293
 
@@ -326,8 +302,9 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
326
302
  if (this.detachedRevision !== undefined) {
327
303
  const newRevision: SeqNumber = brand((this.detachedRevision as number) + 1);
328
304
  this.detachedRevision = newRevision;
329
- this.editManager.addSequencedChange(
330
- { ...enrichedCommit, sessionId: this.editManager.localSessionId },
305
+ this.editManager.addSequencedChanges(
306
+ [enrichedCommit],
307
+ this.editManager.localSessionId,
331
308
  newRevision,
332
309
  this.detachedRevision,
333
310
  );
@@ -352,42 +329,79 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
352
329
  this.resubmitMachine.onCommitSubmitted(enrichedCommit);
353
330
  }
354
331
 
355
- protected processCore(
332
+ /**
333
+ * Process a message from the runtime.
334
+ * @deprecated - Use processMessagesCore to process a bunch of messages together.
335
+ */
336
+ public processCore(
356
337
  message: ISequencedDocumentMessage,
357
338
  local: boolean,
358
339
  localOpMetadata: unknown,
359
340
  ): void {
360
- // Empty context object is passed in, as our decode function is schema-agnostic.
361
- const { commit, sessionId } = this.messageCodec.decode(message.contents, {
362
- idCompressor: this.idCompressor,
341
+ this.processMessagesCore({
342
+ envelope: message,
343
+ local,
344
+ messagesContent: [
345
+ {
346
+ clientSequenceNumber: message.clientSequenceNumber,
347
+ contents: message.contents,
348
+ localOpMetadata,
349
+ },
350
+ ],
363
351
  });
352
+ }
353
+
354
+ /**
355
+ * Process a bunch of messages from the runtime. SharedObject will call this method with a bunch of messages.
356
+ */
357
+ public processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {
358
+ const { envelope, local, messagesContent } = messagesCollection;
359
+ const commits: GraphCommit<TChange>[] = [];
360
+ let messagesSessionId: SessionId | undefined;
361
+
362
+ // Get a list of all the commits from the messages.
363
+ for (const messageContent of messagesContent) {
364
+ // Empty context object is passed in, as our decode function is schema-agnostic.
365
+ const { commit, sessionId } = this.messageCodec.decode(messageContent.contents, {
366
+ idCompressor: this.idCompressor,
367
+ });
368
+ commits.push(commit);
364
369
 
365
- this.editManager.addSequencedChange(
366
- { ...commit, sessionId },
367
- brand(message.sequenceNumber),
368
- brand(message.referenceSequenceNumber),
370
+ if (messagesSessionId !== undefined) {
371
+ assert(
372
+ messagesSessionId === sessionId,
373
+ "All messages in a bunch must have the same session ID",
374
+ );
375
+ }
376
+ messagesSessionId = sessionId;
377
+ }
378
+
379
+ assert(messagesSessionId !== undefined, "Messages must have a session ID");
380
+
381
+ this.editManager.addSequencedChanges(
382
+ commits,
383
+ messagesSessionId,
384
+ brand(envelope.sequenceNumber),
385
+ brand(envelope.referenceSequenceNumber),
369
386
  );
370
- this.resubmitMachine.onSequencedCommitApplied(local);
371
387
 
372
- this.editManager.advanceMinimumSequenceNumber(brand(message.minimumSequenceNumber));
388
+ // Update the resubmit machine for each commit applied.
389
+ for (const _ of messagesContent) {
390
+ this.resubmitMachine.onSequencedCommitApplied(local);
391
+ }
392
+
393
+ this.editManager.advanceMinimumSequenceNumber(brand(envelope.minimumSequenceNumber));
373
394
  }
374
395
 
375
- protected getLocalBranch(): SharedTreeBranch<TEditor, TChange> {
396
+ public getLocalBranch(): SharedTreeBranch<TEditor, TChange> {
376
397
  return this.editManager.localBranch;
377
398
  }
378
399
 
379
- protected onDisconnect(): void {}
380
-
381
- protected override didAttach(): void {
382
- if (this.detachedRevision !== undefined) {
383
- this.detachedRevision = undefined;
384
- }
400
+ public didAttach(): void {
401
+ this.detachedRevision = undefined;
385
402
  }
386
403
 
387
- protected override reSubmitCore(
388
- content: JsonCompatibleReadOnly,
389
- localOpMetadata: unknown,
390
- ): void {
404
+ public reSubmitCore(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {
391
405
  // Empty context object is passed in, as our decode function is schema-agnostic.
392
406
  const {
393
407
  commit: { revision },
@@ -416,31 +430,13 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
416
430
  this.submitCommit(enrichedCommit, localOpMetadata, true);
417
431
  }
418
432
 
419
- protected applyStashedOp(content: JsonCompatibleReadOnly): void {
433
+ public applyStashedOp(content: JsonCompatibleReadOnly): void {
420
434
  // Empty context object is passed in, as our decode function is schema-agnostic.
421
435
  const {
422
436
  commit: { revision, change },
423
437
  } = this.messageCodec.decode(content, { idCompressor: this.idCompressor });
424
438
  this.editManager.localBranch.apply({ change, revision });
425
439
  }
426
-
427
- public override getGCData(fullGC?: boolean): IGarbageCollectionData {
428
- const gcNodes: IGarbageCollectionData["gcNodes"] = super.getGCData(fullGC).gcNodes;
429
- for (const s of this.summarizables) {
430
- for (const [id, routes] of Object.entries(s.getGCData(fullGC).gcNodes)) {
431
- gcNodes[id] ??= [];
432
- for (const route of routes) {
433
- // Non null asserting here because we are creating an array at gcNodes[id] if it is undefined
434
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
435
- gcNodes[id]!.push(route);
436
- }
437
- }
438
- }
439
-
440
- return {
441
- gcNodes,
442
- };
443
- }
444
440
  }
445
441
 
446
442
  function isClonableSchemaPolicy(
@@ -482,13 +478,6 @@ export interface Summarizable {
482
478
  telemetryContext?: ITelemetryContext,
483
479
  ): Promise<ISummaryTreeWithStats>;
484
480
 
485
- /**
486
- * {@inheritDoc (ISharedObject:interface).getGCData}
487
- */
488
- // TODO: Change this interface (and the one in ISharedObject, if necessary) to support "handles within handles".
489
- // Consider the case of a document with history; the return value here currently grows unboundedly.
490
- getGCData(fullGC?: boolean): IGarbageCollectionData;
491
-
492
481
  /**
493
482
  * Allows the component to perform custom loading. The storage service is scoped to this component and therefore
494
483
  * paths in this component will not collide with those in other components, even if they are the same string.
@@ -15,12 +15,14 @@ export {
15
15
  type TreeViewAlpha,
16
16
  type TreeBranch,
17
17
  type TreeBranchEvents,
18
+ type ITreeAlpha,
18
19
  asTreeViewAlpha,
19
20
  } from "./tree.js";
20
21
  export {
21
22
  SchemaFactory,
22
23
  type ScopedSchemaName,
23
24
  type SchemaFactoryObjectOptions,
25
+ type schemaStatics,
24
26
  } from "./schemaFactory.js";
25
27
  export { SchemaFactoryAlpha } from "./schemaFactoryAlpha.js";
26
28
  export type {
@@ -118,6 +120,19 @@ export {
118
120
  comparePersistedSchema,
119
121
  } from "./storedSchema.js";
120
122
 
123
+ export {
124
+ type TransactionConstraint,
125
+ type NodeInDocumentConstraint,
126
+ type RunTransactionParams,
127
+ type VoidTransactionCallbackStatus,
128
+ type TransactionCallbackStatus,
129
+ type TransactionResult,
130
+ type TransactionResultExt,
131
+ type TransactionResultSuccess,
132
+ type TransactionResultFailed,
133
+ rollback,
134
+ } from "./transactionTypes.js";
135
+
121
136
  // Exporting the schema (RecursiveObject) to test that recursive types are working correctly.
122
137
  // These are `@internal` so they can't be included in the `InternalClassTreeTypes` due to https://github.com/microsoft/rushstack/issues/3639
123
138
  export {