@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
@@ -18,23 +18,15 @@ import {
18
18
  brand,
19
19
  brandedSlot,
20
20
  fail,
21
+ getOrAddEmptyToMap,
22
+ getOrCreate,
21
23
  } from "../../util/index.js";
22
24
  import type { FieldKey } from "../schema-stored/index.js";
23
25
 
24
26
  import type * as Delta from "./delta.js";
25
- import type {
26
- DetachedPlaceUpPath,
27
- DetachedRangeUpPath,
28
- PlaceIndex,
29
- PlaceUpPath,
30
- Range,
31
- RangeUpPath,
32
- UpPath,
33
- } from "./pathTree.js";
27
+ import type { PlaceIndex, Range, UpPath } from "./pathTree.js";
34
28
  import { EmptyKey } from "./types.js";
35
29
  import type { DeltaVisitor } from "./visitDelta.js";
36
- import type { PathVisitor } from "./visitPath.js";
37
- import type { AnnouncedVisitor } from "./visitorUtils.js";
38
30
 
39
31
  /**
40
32
  * A way to refer to a particular tree location within an {@link AnchorSet}.
@@ -137,10 +129,9 @@ export interface AnchorEvents {
137
129
  * rooted at `anchor` _may_ be about to change due to updates from the batch.
138
130
  *
139
131
  * @remarks
140
- * The event can optionally return a {@link PathVisitor} to traverse the subtree.
141
132
  * Called on every parent (transitively) when a change is occurring.
142
133
  */
143
- subtreeChanging(anchor: AnchorNode): PathVisitor | void;
134
+ subtreeChanging(anchor: AnchorNode): void;
144
135
 
145
136
  /**
146
137
  * Emitted in the middle of applying a batch of changes (i.e. during a delta a visit), if something in the subtree
@@ -689,7 +680,7 @@ export class AnchorSet implements AnchorLocator {
689
680
  * It is invalid to acquire a visitor without releasing the previous one,
690
681
  * and this method will throw an error if this is attempted.
691
682
  */
692
- public acquireVisitor(): AnnouncedVisitor & DeltaVisitor {
683
+ public acquireVisitor(): DeltaVisitor {
693
684
  assert(
694
685
  this.activeVisitor === undefined,
695
686
  0x767 /* Must release existing visitor before acquiring another */,
@@ -716,25 +707,13 @@ export class AnchorSet implements AnchorLocator {
716
707
  }
717
708
  }
718
709
  },
719
- // Lookup table for path visitors collected from {@link AnchorEvents.visitSubtreeChanging} emitted events.
720
- // The key is the path of the node that the visitor is registered on. The code ensures that the path visitor visits only the appropriate subtrees
721
- // by maintaining the mapping only during time between the {@link DeltaVisitor.enterNode} and {@link DeltaVisitor.exitNode} calls for a given anchorNode.
722
- pathVisitors: new Map<PathNode, Set<PathVisitor>>(),
723
710
  parentField: undefined as FieldKey | undefined,
724
711
  parent: undefined as UpPath | undefined,
725
712
 
726
713
  /**
727
714
  * Events collected during the visit which get sent as a batch during "free".
728
715
  */
729
- bufferedEvents: [] as {
730
- node: PathNode;
731
- event: keyof AnchorEvents;
732
- /**
733
- * The key for the impacted field, if the event is associated with a key.
734
- * Some events, such as afterDestroy, do not involve a key, and thus leave this undefined.
735
- */
736
- changedField?: FieldKey;
737
- }[],
716
+ bufferedEvents: [] as BufferedEvent[],
738
717
 
739
718
  // 'currentDepth' and 'depthThresholdForSubtreeChanged' serve to keep track of when do we need to emit
740
719
  // subtreeChangedAfterBatch events.
@@ -766,25 +745,31 @@ export class AnchorSet implements AnchorLocator {
766
745
  node.removeRef();
767
746
  }
768
747
  this.anchorSet.activeVisitor = undefined;
769
- const alreadyEmitted = new Map<PathNode, string[]>();
770
- for (const { node, event } of this.bufferedEvents) {
771
- if (!alreadyEmitted.has(node)) {
772
- alreadyEmitted.set(node, []);
748
+
749
+ // Aggregate changedFields by node.
750
+ const eventsByNode: Map<PathNode, Set<FieldKey>> = new Map();
751
+ for (const { node, event, changedField } of this.bufferedEvents) {
752
+ if (event === "childrenChangedAfterBatch") {
753
+ const keys = getOrCreate(eventsByNode, node, () => new Set());
754
+ keys.add(
755
+ changedField ??
756
+ fail("childrenChangedAfterBatch events should have a changedField"),
757
+ );
773
758
  }
774
- const emittedEvents = alreadyEmitted.get(node);
775
- if (emittedEvents?.includes(event) ?? false) {
759
+ }
760
+
761
+ const alreadyEmitted = new Map<PathNode, (keyof AnchorEvents)[]>();
762
+ for (const { node, event } of this.bufferedEvents) {
763
+ const emittedEvents = getOrAddEmptyToMap(alreadyEmitted, node);
764
+ if (emittedEvents.includes(event)) {
776
765
  continue;
777
766
  }
778
- emittedEvents?.push(event);
767
+ emittedEvents.push(event);
779
768
  if (event === "childrenChangedAfterBatch") {
780
- const fieldKeys: FieldKey[] = this.bufferedEvents
781
- .filter((e) => e.node === node && e.event === event)
782
- .map(
783
- (e) =>
784
- e.changedField ??
785
- fail("childrenChangedAfterBatch events should have a changedField"),
786
- );
787
- node.events.emit(event, { changedFields: new Set(fieldKeys) });
769
+ const changedFields =
770
+ eventsByNode.get(node) ??
771
+ fail("childrenChangedAfterBatch events should have changedFields");
772
+ node.events.emit(event, { changedFields });
788
773
  } else {
789
774
  node.events.emit(event);
790
775
  }
@@ -813,47 +798,6 @@ export class AnchorSet implements AnchorLocator {
813
798
  () => {},
814
799
  );
815
800
  },
816
- beforeAttach(source: FieldKey, count: number, destination: PlaceIndex): void {
817
- assert(
818
- this.parentField !== undefined,
819
- 0x7a0 /* Must be in a field in order to attach */,
820
- );
821
- const destinationPath: PlaceUpPath = {
822
- parent: this.parent,
823
- field: this.parentField,
824
- index: destination,
825
- };
826
- const sourcePath: DetachedRangeUpPath = brand({
827
- field: source,
828
- start: 0,
829
- end: count,
830
- });
831
- for (const visitors of this.pathVisitors.values()) {
832
- for (const pathVisitor of visitors) {
833
- pathVisitor.beforeAttach(sourcePath, destinationPath);
834
- }
835
- }
836
- },
837
- afterAttach(source: FieldKey, destination: Range): void {
838
- assert(
839
- this.parentField !== undefined,
840
- 0x7a1 /* Must be in a field in order to attach */,
841
- );
842
- const sourcePath: DetachedPlaceUpPath = brand({
843
- field: source,
844
- index: 0,
845
- });
846
- const destinationPath: RangeUpPath = {
847
- parent: this.parent,
848
- field: this.parentField,
849
- ...destination,
850
- };
851
- for (const visitors of this.pathVisitors.values()) {
852
- for (const pathVisitor of visitors) {
853
- pathVisitor.afterAttach(sourcePath, destinationPath);
854
- }
855
- }
856
- },
857
801
  attach(source: FieldKey, count: number, destination: PlaceIndex): void {
858
802
  this.notifyChildrenChanging();
859
803
  this.attachEdit(source, count, destination);
@@ -877,47 +821,6 @@ export class AnchorSet implements AnchorLocator {
877
821
  this.anchorSet.moveChildren(sourcePath, destinationPath, count);
878
822
  this.depthThresholdForSubtreeChanged = this.currentDepth;
879
823
  },
880
- beforeDetach(source: Range, destination: FieldKey): void {
881
- assert(
882
- this.parentField !== undefined,
883
- 0x7a3 /* Must be in a field in order to attach */,
884
- );
885
- const sourcePath: RangeUpPath = {
886
- parent: this.parent,
887
- field: this.parentField,
888
- ...source,
889
- };
890
- const destinationPath: DetachedPlaceUpPath = brand({
891
- field: destination,
892
- index: 0,
893
- });
894
- for (const visitors of this.pathVisitors.values()) {
895
- for (const pathVisitor of visitors) {
896
- pathVisitor.beforeDetach(sourcePath, destinationPath);
897
- }
898
- }
899
- },
900
- afterDetach(source: PlaceIndex, count: number, destination: FieldKey): void {
901
- assert(
902
- this.parentField !== undefined,
903
- 0x7a4 /* Must be in a field in order to attach */,
904
- );
905
- const sourcePath: PlaceUpPath = {
906
- parent: this.parent,
907
- field: this.parentField,
908
- index: source,
909
- };
910
- const destinationPath: DetachedRangeUpPath = brand({
911
- field: destination,
912
- start: 0,
913
- end: count,
914
- });
915
- for (const visitors of this.pathVisitors.values()) {
916
- for (const pathVisitor of visitors) {
917
- pathVisitor.afterDetach(sourcePath, destinationPath);
918
- }
919
- }
920
- },
921
824
  detach(source: Range, destination: FieldKey): void {
922
825
  this.notifyChildrenChanging();
923
826
  this.detachEdit(source, destination);
@@ -941,64 +844,6 @@ export class AnchorSet implements AnchorLocator {
941
844
  this.anchorSet.moveChildren(sourcePath, destinationPath, source.end - source.start);
942
845
  this.depthThresholdForSubtreeChanged = this.currentDepth;
943
846
  },
944
- beforeReplace(newContent: FieldKey, oldContent: Range, destination: FieldKey): void {
945
- assert(
946
- this.parentField !== undefined,
947
- 0x7a6 /* Must be in a field in order to replace */,
948
- );
949
- const oldContentPath: RangeUpPath = {
950
- parent: this.parent,
951
- field: this.parentField,
952
- ...oldContent,
953
- };
954
- const newNodesSourcePath: DetachedRangeUpPath = brand({
955
- field: newContent,
956
- start: 0,
957
- end: oldContent.end - oldContent.start,
958
- });
959
- const oldNodesDestinationPath: DetachedPlaceUpPath = brand({
960
- field: destination,
961
- index: 0,
962
- });
963
- for (const visitors of this.pathVisitors.values()) {
964
- for (const pathVisitor of visitors) {
965
- pathVisitor.beforeReplace(
966
- newNodesSourcePath,
967
- oldContentPath,
968
- oldNodesDestinationPath,
969
- );
970
- }
971
- }
972
- },
973
- afterReplace(newContentSource: FieldKey, newContent: Range, oldContent: FieldKey): void {
974
- assert(
975
- this.parentField !== undefined,
976
- 0x7a7 /* Must be in a field in order to replace */,
977
- );
978
- const newContentPath: RangeUpPath = {
979
- parent: this.parent,
980
- field: this.parentField,
981
- ...newContent,
982
- };
983
- const newNodesSourcePath: DetachedPlaceUpPath = brand({
984
- field: newContentSource,
985
- index: 0,
986
- });
987
- const oldNodesDestinationPath: DetachedRangeUpPath = brand({
988
- field: oldContent,
989
- start: 0,
990
- end: newContent.end - newContent.start,
991
- });
992
- for (const visitors of this.pathVisitors.values()) {
993
- for (const pathVisitor of visitors) {
994
- pathVisitor.afterReplace(
995
- newNodesSourcePath,
996
- newContentPath,
997
- oldNodesDestinationPath,
998
- );
999
- }
1000
- }
1001
- },
1002
847
  replace(
1003
848
  newContentSource: FieldKey,
1004
849
  range: Range,
@@ -1019,34 +864,10 @@ export class AnchorSet implements AnchorLocator {
1019
864
  count,
1020
865
  );
1021
866
  },
1022
- beforeDestroy(detachedField: FieldKey, count: number): void {
1023
- const range: DetachedRangeUpPath = brand({
1024
- field: detachedField,
1025
- start: 0,
1026
- end: count,
1027
- });
1028
- for (const visitors of this.pathVisitors.values()) {
1029
- for (const pathVisitor of visitors) {
1030
- pathVisitor.beforeDestroy(range);
1031
- }
1032
- }
1033
- },
1034
867
  create(content: Delta.ProtoNodes, destination: FieldKey): void {
1035
868
  // Nothing to do since content can only be created in a new detached field,
1036
869
  // which cannot contain any anchors.
1037
870
  },
1038
- afterCreate(content: Delta.ProtoNodes, destination: FieldKey): void {
1039
- for (const visitors of this.pathVisitors.values()) {
1040
- for (const pathVisitor of visitors) {
1041
- const rangePath: DetachedRangeUpPath = brand({
1042
- field: destination,
1043
- start: 0,
1044
- end: content.length,
1045
- });
1046
- pathVisitor.afterCreate(rangePath);
1047
- }
1048
- }
1049
- },
1050
871
  enterNode(index: number): void {
1051
872
  assert(this.parentField !== undefined, 0x3ab /* Must be in a field to enter node */);
1052
873
 
@@ -1057,19 +878,7 @@ export class AnchorSet implements AnchorLocator {
1057
878
  };
1058
879
  this.parentField = undefined;
1059
880
  this.maybeWithNode((p) => {
1060
- // avoid multiple pass side-effects
1061
- if (!this.pathVisitors.has(p)) {
1062
- const visitors: (PathVisitor | void)[] = p.events.emitAndCollect(
1063
- "subtreeChanging",
1064
- p,
1065
- );
1066
- if (visitors.length > 0) {
1067
- this.pathVisitors.set(
1068
- p,
1069
- new Set(visitors.filter((v): v is PathVisitor => v !== undefined)),
1070
- );
1071
- }
1072
- }
881
+ p.events.emit("subtreeChanging", p);
1073
882
  });
1074
883
  this.currentDepth++;
1075
884
  },
@@ -1084,8 +893,6 @@ export class AnchorSet implements AnchorLocator {
1084
893
  });
1085
894
  this.depthThresholdForSubtreeChanged--;
1086
895
  }
1087
- // Remove subtree path visitors added at this node if there are any
1088
- this.pathVisitors.delete(p);
1089
896
  });
1090
897
  const parent = this.parent;
1091
898
  this.parentField = parent.parentField;
@@ -1387,3 +1194,13 @@ function binaryFind(sorted: readonly PathNode[], index: number): PathNode | unde
1387
1194
  }
1388
1195
  return undefined; // If we reach here, target is not in array (or array was not sorted)
1389
1196
  }
1197
+
1198
+ interface BufferedEvent {
1199
+ node: PathNode;
1200
+ event: keyof AnchorEvents;
1201
+ /**
1202
+ * The key for the impacted field, if the event is associated with a key.
1203
+ * Some events, such as afterDestroy, do not involve a key, and thus leave this undefined.
1204
+ */
1205
+ changedField?: FieldKey;
1206
+ }
@@ -55,8 +55,6 @@ export {
55
55
  type PlaceUpPath,
56
56
  type PlaceIndex,
57
57
  type NodeIndex,
58
- type DetachedPlaceUpPath,
59
- type DetachedRangeUpPath,
60
58
  compareUpPaths,
61
59
  compareFieldUpPaths,
62
60
  getDetachedFieldContainingPath,
@@ -98,7 +96,6 @@ export {
98
96
  combineVisitors,
99
97
  makeDetachedFieldIndex,
100
98
  } from "./visitorUtils.js";
101
- export type { PathVisitor } from "./visitPath.js";
102
99
 
103
100
  export { SparseNode, getDescendant } from "./sparseTree.js";
104
101
 
@@ -3,7 +3,6 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import type { Brand } from "../../util/index.js";
7
6
  import type { FieldKey } from "../schema-stored/index.js";
8
7
 
9
8
  import { type DetachedField, keyAsDetachedField } from "./types.js";
@@ -60,13 +59,6 @@ export interface FieldUpPath<TUpPath extends UpPath = UpPath> {
60
59
  readonly field: FieldKey; // TODO: Type information, including when in DetachedField.
61
60
  }
62
61
 
63
- /**
64
- * A range of nodes in a detached field.
65
- * Unlike RangeUpPath, such ranges are generated by create and detach operations,
66
- * as well as consumed by destroy and attach operations.
67
- */
68
- export type DetachedRangeUpPath = Brand<Omit<RangeUpPath, "parent">, "DetachedRangeUpPath">;
69
-
70
62
  /**
71
63
  * Delimits the extend of a range.
72
64
  */
@@ -101,11 +93,6 @@ export interface PlaceUpPath<TUpPath extends UpPath = UpPath> extends FieldUpPat
101
93
  readonly index: PlaceIndex;
102
94
  }
103
95
 
104
- /**
105
- * A place in a detached field.
106
- */
107
- export type DetachedPlaceUpPath = Brand<Omit<PlaceUpPath, "parent">, "DetachedRangeUpPath">;
108
-
109
96
  /**
110
97
  * Indicates the index of a node in a field.
111
98
  * Zero indicates the first node in a field.
@@ -42,7 +42,7 @@ export const noChangeHandler: FieldChangeHandler<0> = {
42
42
  rebase: (change: 0, over: 0) => 0,
43
43
  }),
44
44
  codecsFactory: () => noChangeCodecFamily,
45
- editor: { buildChildChange: (index, change) => fail("Child changes not supported") },
45
+ editor: { buildChildChanges: () => fail("Child changes not supported") },
46
46
  intoDelta: (change, deltaFromChild: ToDelta): FieldChangeDelta => ({}),
47
47
  relevantRemovedRoots: (change): Iterable<DeltaDetachedNodeId> => [],
48
48
  isEmpty: (change: 0) => true,
@@ -6,7 +6,6 @@
6
6
  import { bufferToString } from "@fluid-internal/client-utils";
7
7
  import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
8
8
  import type {
9
- IGarbageCollectionData,
10
9
  ISummaryTreeWithStats,
11
10
  ITelemetryContext,
12
11
  } from "@fluidframework/runtime-definitions/internal";
@@ -52,16 +51,6 @@ export class DetachedFieldIndexSummarizer implements Summarizable {
52
51
  return this.getAttachSummary(stringify, fullTree, trackState, telemetryContext);
53
52
  }
54
53
 
55
- public getGCData(fullGC?: boolean): IGarbageCollectionData {
56
- // TODO: Properly implement garbage collection. Right now, garbage collection is performed automatically
57
- // by the code in SharedObject (from which SharedTreeCore extends). The `runtime.uploadBlob` API delegates
58
- // to the `BlobManager`, which automatically populates the summary with ISummaryAttachment entries for each
59
- // blob.
60
- return {
61
- gcNodes: {},
62
- };
63
- }
64
-
65
54
  public async load(
66
55
  services: IChannelStorageService,
67
56
  parse: SummaryElementParser,
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import type { PathVisitor, UpPath } from "../../core/index.js";
6
+ import type { UpPath } from "../../core/index.js";
7
7
 
8
8
  /**
9
9
  * This file provides an API for working with trees which is type safe even when schema is not known.
@@ -39,13 +39,11 @@ export interface FlexTreeNodeEvents {
39
39
 
40
40
  /**
41
41
  * Raised when something in the tree is changing, including this node and its descendants.
42
- * The event can optionally return a {@link PathVisitor} to traverse the subtree
43
42
  * This event is called on every parent (transitively) when a change is occurring.
44
43
  * Includes changes to this node itself.
45
44
  * @param upPath - the path corresponding to the location of the node being changed, upward.
46
- * @returns a visitor to traverse the subtree or `void`.
47
45
  */
48
- subtreeChanging(upPath: UpPath): PathVisitor | void;
46
+ subtreeChanging(upPath: UpPath): void;
49
47
 
50
48
  /**
51
49
  * This has the same contract as {@link TreeChangeEvents.nodeChanged}
@@ -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";
@@ -114,16 +113,6 @@ export class ForestSummarizer implements Summarizable {
114
113
  return createSingleBlobSummary(treeBlobKey, this.getTreeString(stringify));
115
114
  }
116
115
 
117
- public getGCData(fullGC?: boolean): IGarbageCollectionData {
118
- // TODO: Properly implement garbage collection. Right now, garbage collection is performed automatically
119
- // by the code in SharedObject (from which SharedTreeCore extends). The `runtime.uploadBlob` API delegates
120
- // to the `BlobManager`, which automatically populates the summary with ISummaryAttachment entries for each
121
- // blob.
122
- return {
123
- gcNodes: {},
124
- };
125
- }
126
-
127
116
  public async load(
128
117
  services: IChannelStorageService,
129
118
  parse: SummaryElementParser,
@@ -201,9 +201,13 @@ export function isolatedFieldChangeRebaser<TChangeset>(data: {
201
201
 
202
202
  export interface FieldEditor<TChangeset> {
203
203
  /**
204
- * Creates a changeset which represents the given `change` to the child at `childIndex` of this editor's field.
204
+ * Creates a changeset which represents the given changes to the children of this editor's field.
205
+ * For each element in the given iterable
206
+ * - The number represents the index of the child node in the field.
207
+ * - The `NodeId` represents the nested changes for that child node.
208
+ * Note: The indices in the iterable must be ordered from smallest to largest (with no duplicates).
205
209
  */
206
- buildChildChange(childIndex: number, change: NodeId): TChangeset;
210
+ buildChildChanges(changes: Iterable<[index: number, change: NodeId]>): TChangeset;
207
211
  }
208
212
 
209
213
  /**
@@ -6,14 +6,11 @@
6
6
  import {
7
7
  type DeltaDetachedNodeId,
8
8
  type DeltaMark,
9
- type RevisionMetadataSource,
10
9
  Multiplicity,
11
10
  type RevisionTag,
12
11
  replaceAtomRevisions,
13
12
  } from "../../core/index.js";
14
- import { type IdAllocator, fail } from "../../util/index.js";
15
13
  import { assert } from "@fluidframework/core-utils/internal";
16
- import type { CrossFieldManager } from "./crossFieldQueries.js";
17
14
  import type {
18
15
  FieldChangeDelta,
19
16
  FieldChangeHandler,
@@ -43,8 +40,8 @@ export const genericChangeHandler: FieldChangeHandler<GenericChangeset> = {
43
40
  },
44
41
  codecsFactory: makeGenericChangeCodec,
45
42
  editor: {
46
- buildChildChange(index, change): GenericChangeset {
47
- return newGenericChangeset([[index, change]]);
43
+ buildChildChanges(changes: Iterable<[number, NodeId]>): GenericChangeset {
44
+ return newGenericChangeset(Array.from(changes));
48
45
  },
49
46
  },
50
47
  intoDelta: (change: GenericChangeset, deltaFromChild: ToDelta): FieldChangeDelta => {
@@ -182,39 +179,10 @@ export const genericFieldKind: FieldKindWithEditor = new FieldKindWithEditor(
182
179
  export function convertGenericChange<TChange>(
183
180
  changeset: GenericChangeset,
184
181
  target: FieldChangeHandler<TChange>,
185
- composeChild: NodeChangeComposer,
186
- genId: IdAllocator,
187
- revisionMetadata: RevisionMetadataSource,
188
182
  ): TChange {
189
- const perIndex: TChange[] = [];
190
- for (const [index, nodeChange] of changeset.entries()) {
191
- perIndex.push(target.editor.buildChildChange(index, nodeChange));
192
- }
193
-
194
- if (perIndex.length === 0) {
195
- return target.createEmpty();
196
- }
197
-
198
- return perIndex.reduce((a, b) =>
199
- target.rebaser.compose(
200
- a,
201
- b,
202
- composeChild,
203
- genId,
204
- invalidCrossFieldManager,
205
- revisionMetadata,
206
- ),
207
- );
183
+ return target.editor.buildChildChanges(changeset.entries());
208
184
  }
209
185
 
210
- const invalidFunc = (): never => fail("Should not be called when converting generic changes");
211
- const invalidCrossFieldManager: CrossFieldManager = {
212
- set: invalidFunc,
213
- get: invalidFunc,
214
- onMoveIn: invalidFunc,
215
- moveKey: invalidFunc,
216
- };
217
-
218
186
  function* relevantRemovedRoots(
219
187
  change: GenericChangeset,
220
188
  relevantRemovedRootsFromChild: RelevantRemovedRootsFromChild,