@fluidframework/tree 2.74.0-368706 → 2.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1030) hide show
  1. package/.vscode/settings.json +2 -0
  2. package/CHANGELOG.md +11 -0
  3. package/api-report/tree.alpha.api.md +19 -15
  4. package/assertTagging.config.mjs +1 -1
  5. package/dist/alpha.d.ts +3 -0
  6. package/dist/codec/codec.d.ts +32 -17
  7. package/dist/codec/codec.d.ts.map +1 -1
  8. package/dist/codec/codec.js +40 -24
  9. package/dist/codec/codec.js.map +1 -1
  10. package/dist/core/change-family/changeFamily.d.ts +1 -4
  11. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  12. package/dist/core/change-family/changeFamily.js.map +1 -1
  13. package/dist/core/change-family/index.d.ts +1 -1
  14. package/dist/core/change-family/index.d.ts.map +1 -1
  15. package/dist/core/change-family/index.js.map +1 -1
  16. package/dist/core/index.d.ts +3 -3
  17. package/dist/core/index.d.ts.map +1 -1
  18. package/dist/core/index.js +4 -6
  19. package/dist/core/index.js.map +1 -1
  20. package/dist/core/rebase/changeRebaser.d.ts +1 -6
  21. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  22. package/dist/core/rebase/changeRebaser.js.map +1 -1
  23. package/dist/core/rebase/index.d.ts +1 -1
  24. package/dist/core/rebase/index.d.ts.map +1 -1
  25. package/dist/core/rebase/index.js +1 -2
  26. package/dist/core/rebase/index.js.map +1 -1
  27. package/dist/core/rebase/types.d.ts +21 -3
  28. package/dist/core/rebase/types.d.ts.map +1 -1
  29. package/dist/core/rebase/types.js +1 -5
  30. package/dist/core/rebase/types.js.map +1 -1
  31. package/dist/core/rebase/utils.d.ts.map +1 -1
  32. package/dist/core/rebase/utils.js +7 -25
  33. package/dist/core/rebase/utils.js.map +1 -1
  34. package/dist/core/schema-stored/schema.d.ts +4 -7
  35. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  36. package/dist/core/schema-stored/schema.js +2 -2
  37. package/dist/core/schema-stored/schema.js.map +1 -1
  38. package/dist/core/tree/detachedFieldIndex.d.ts +0 -6
  39. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  40. package/dist/core/tree/detachedFieldIndex.js +0 -9
  41. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  42. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +4 -4
  43. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  44. package/dist/core/tree/detachedFieldIndexFormatCommon.js +2 -2
  45. package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  46. package/dist/core/tree/index.d.ts +1 -1
  47. package/dist/core/tree/index.d.ts.map +1 -1
  48. package/dist/core/tree/index.js +3 -4
  49. package/dist/core/tree/index.js.map +1 -1
  50. package/dist/core/tree/pathTree.d.ts +3 -11
  51. package/dist/core/tree/pathTree.d.ts.map +1 -1
  52. package/dist/core/tree/pathTree.js +2 -14
  53. package/dist/core/tree/pathTree.js.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  55. package/dist/feature-libraries/chunked-forest/basicChunk.js +0 -7
  56. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/chunkTree.js +1 -4
  59. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -2
  62. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +5 -5
  64. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/codec/format.js +4 -4
  66. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  67. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +42 -90
  68. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  69. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +69 -234
  70. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  71. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -1
  72. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  73. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +2 -11
  74. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  75. package/dist/feature-libraries/default-schema/index.d.ts +1 -2
  76. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  77. package/dist/feature-libraries/default-schema/index.js +2 -4
  78. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  79. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +6 -7
  80. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  81. package/dist/feature-libraries/default-schema/mappedEditBuilder.js +0 -15
  82. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  83. package/dist/feature-libraries/deltaUtils.d.ts +0 -1
  84. package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
  85. package/dist/feature-libraries/deltaUtils.js +1 -6
  86. package/dist/feature-libraries/deltaUtils.js.map +1 -1
  87. package/dist/feature-libraries/flex-tree/context.d.ts +0 -9
  88. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  89. package/dist/feature-libraries/flex-tree/context.js +0 -6
  90. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  91. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
  92. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  93. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  94. package/dist/feature-libraries/flex-tree/lazyField.d.ts +7 -8
  95. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  96. package/dist/feature-libraries/flex-tree/lazyField.js +8 -37
  97. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  98. package/dist/feature-libraries/forest-summary/codec.d.ts +8 -2
  99. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  100. package/dist/feature-libraries/forest-summary/codec.js +13 -11
  101. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  102. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  103. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  104. package/dist/feature-libraries/forest-summary/forestSummarizer.js +18 -9
  105. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  106. package/dist/feature-libraries/forest-summary/formatCommon.d.ts +61 -0
  107. package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -0
  108. package/dist/feature-libraries/forest-summary/{format.js → formatCommon.js} +9 -6
  109. package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -0
  110. package/dist/feature-libraries/forest-summary/{format.d.ts → formatV1.d.ts} +6 -14
  111. package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -0
  112. package/dist/feature-libraries/forest-summary/formatV1.js +11 -0
  113. package/dist/feature-libraries/forest-summary/formatV1.js.map +1 -0
  114. package/dist/feature-libraries/forest-summary/formatV2.d.ts +51 -0
  115. package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -0
  116. package/dist/feature-libraries/forest-summary/formatV2.js +11 -0
  117. package/dist/feature-libraries/forest-summary/formatV2.js.map +1 -0
  118. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +7 -15
  119. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  120. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +11 -20
  121. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  122. package/dist/feature-libraries/forest-summary/index.d.ts +1 -2
  123. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  124. package/dist/feature-libraries/forest-summary/index.js +3 -5
  125. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  126. package/dist/feature-libraries/forest-summary/summaryFormatCommon.d.ts +35 -0
  127. package/dist/feature-libraries/forest-summary/summaryFormatCommon.d.ts.map +1 -0
  128. package/dist/feature-libraries/forest-summary/summaryFormatCommon.js +43 -0
  129. package/dist/feature-libraries/forest-summary/summaryFormatCommon.js.map +1 -0
  130. package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts +11 -0
  131. package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts.map +1 -0
  132. package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.js +14 -0
  133. package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.js.map +1 -0
  134. package/dist/feature-libraries/forest-summary/summaryFormatV3.d.ts +18 -0
  135. package/dist/feature-libraries/forest-summary/summaryFormatV3.d.ts.map +1 -0
  136. package/dist/feature-libraries/forest-summary/summaryFormatV3.js +21 -0
  137. package/dist/feature-libraries/forest-summary/summaryFormatV3.js.map +1 -0
  138. package/dist/feature-libraries/forest-summary/summaryTypes.d.ts +7 -37
  139. package/dist/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
  140. package/dist/feature-libraries/forest-summary/summaryTypes.js +23 -45
  141. package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
  142. package/dist/feature-libraries/index.d.ts +3 -3
  143. package/dist/feature-libraries/index.d.ts.map +1 -1
  144. package/dist/feature-libraries/index.js +3 -6
  145. package/dist/feature-libraries/index.js.map +1 -1
  146. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  147. package/dist/feature-libraries/mapTreeCursor.js +0 -1
  148. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  149. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  150. package/dist/feature-libraries/mitigatedChangeFamily.js +2 -2
  151. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  152. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  153. package/dist/feature-libraries/modular-schema/comparison.js +1 -1
  154. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  155. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +21 -97
  156. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  157. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +7 -4
  158. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  159. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +52 -20
  160. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  161. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  162. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  163. package/dist/feature-libraries/modular-schema/genericFieldKind.js +9 -3
  164. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  165. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +2 -2
  166. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  167. package/dist/feature-libraries/modular-schema/index.d.ts +4 -4
  168. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  169. package/dist/feature-libraries/modular-schema/index.js +8 -11
  170. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  171. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  172. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  173. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +284 -8
  174. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  175. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +15 -48
  176. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  177. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +465 -1298
  178. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  179. package/{lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts → dist/feature-libraries/modular-schema/modularChangeFormat.d.ts} +2 -2
  180. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -0
  181. package/dist/feature-libraries/modular-schema/{modularChangeFormatV1.js → modularChangeFormat.js} +5 -5
  182. package/dist/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -0
  183. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +10 -50
  184. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  185. package/dist/feature-libraries/modular-schema/modularChangeTypes.js +3 -24
  186. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  187. package/dist/feature-libraries/optional-field/index.d.ts +2 -2
  188. package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
  189. package/dist/feature-libraries/optional-field/index.js +2 -1
  190. package/dist/feature-libraries/optional-field/index.js.map +1 -1
  191. package/dist/feature-libraries/optional-field/optionalField.d.ts +26 -5
  192. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  193. package/dist/feature-libraries/optional-field/optionalField.js +451 -217
  194. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  195. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +33 -24
  196. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
  197. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
  198. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
  199. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  200. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js +28 -57
  201. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  202. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  203. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +2 -3
  204. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  205. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  206. package/dist/feature-libraries/schema-index/codec.js +4 -4
  207. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  208. package/dist/feature-libraries/schema-index/formatV1.d.ts +1 -1
  209. package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -1
  210. package/dist/feature-libraries/sequence-field/compose.d.ts +7 -6
  211. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  212. package/dist/feature-libraries/sequence-field/compose.js +256 -80
  213. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  214. package/dist/feature-libraries/sequence-field/helperTypes.d.ts +10 -14
  215. package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  216. package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  217. package/dist/feature-libraries/sequence-field/index.d.ts +3 -2
  218. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  219. package/dist/feature-libraries/sequence-field/index.js +3 -1
  220. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  221. package/dist/feature-libraries/sequence-field/invert.d.ts +3 -3
  222. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  223. package/dist/feature-libraries/sequence-field/invert.js +167 -65
  224. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  225. package/dist/feature-libraries/sequence-field/markQueue.d.ts +2 -2
  226. package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  227. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  228. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +56 -4
  229. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  230. package/dist/feature-libraries/sequence-field/moveEffectTable.js +86 -7
  231. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  232. package/dist/feature-libraries/sequence-field/rebase.d.ts +3 -3
  233. package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  234. package/dist/feature-libraries/sequence-field/rebase.js +112 -106
  235. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  236. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +9 -0
  237. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +1 -0
  238. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +50 -0
  239. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -0
  240. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  241. package/dist/feature-libraries/sequence-field/replaceRevisions.js +33 -16
  242. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  243. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  244. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +2 -0
  245. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  246. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -22
  247. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  248. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +179 -358
  249. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  250. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  251. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +60 -20
  252. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  253. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
  254. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  255. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
  256. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  257. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
  258. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  259. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +109 -14
  260. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  261. package/dist/feature-libraries/sequence-field/types.d.ts +59 -30
  262. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  263. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  264. package/dist/feature-libraries/sequence-field/utils.d.ts +24 -15
  265. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  266. package/dist/feature-libraries/sequence-field/utils.js +299 -111
  267. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  268. package/dist/index.d.ts +2 -2
  269. package/dist/index.d.ts.map +1 -1
  270. package/dist/index.js +3 -1
  271. package/dist/index.js.map +1 -1
  272. package/dist/packageVersion.d.ts +1 -1
  273. package/dist/packageVersion.d.ts.map +1 -1
  274. package/dist/packageVersion.js +1 -1
  275. package/dist/packageVersion.js.map +1 -1
  276. package/dist/shared-tree/independentView.d.ts.map +1 -1
  277. package/dist/shared-tree/independentView.js +1 -1
  278. package/dist/shared-tree/independentView.js.map +1 -1
  279. package/dist/shared-tree/index.d.ts +1 -1
  280. package/dist/shared-tree/index.d.ts.map +1 -1
  281. package/dist/shared-tree/index.js.map +1 -1
  282. package/dist/shared-tree/schematizeTree.d.ts +4 -4
  283. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  284. package/dist/shared-tree/schematizeTree.js +1 -2
  285. package/dist/shared-tree/schematizeTree.js.map +1 -1
  286. package/dist/shared-tree/schematizingTreeView.d.ts +7 -2
  287. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  288. package/dist/shared-tree/schematizingTreeView.js +36 -32
  289. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  290. package/dist/shared-tree/sharedTree.d.ts +3 -9
  291. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  292. package/dist/shared-tree/sharedTree.js +0 -10
  293. package/dist/shared-tree/sharedTree.js.map +1 -1
  294. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  295. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  296. package/dist/shared-tree/sharedTreeChangeCodecs.js +2 -3
  297. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  298. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +4 -4
  299. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  300. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  301. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  302. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +6 -16
  303. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  304. package/dist/shared-tree/sharedTreeEditBuilder.js +6 -13
  305. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  306. package/dist/shared-tree/treeCheckout.d.ts +15 -12
  307. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  308. package/dist/shared-tree/treeCheckout.js +54 -48
  309. package/dist/shared-tree/treeCheckout.js.map +1 -1
  310. package/dist/shared-tree-core/branch.d.ts +2 -3
  311. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  312. package/dist/shared-tree-core/branch.js +3 -4
  313. package/dist/shared-tree-core/branch.js.map +1 -1
  314. package/dist/shared-tree-core/editManager.d.ts +2 -2
  315. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  316. package/dist/shared-tree-core/editManager.js +9 -9
  317. package/dist/shared-tree-core/editManager.js.map +1 -1
  318. package/dist/shared-tree-core/editManagerCodecs.d.ts +0 -4
  319. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  320. package/dist/shared-tree-core/editManagerCodecs.js +7 -15
  321. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  322. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
  323. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  324. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +8 -44
  325. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  326. package/dist/shared-tree-core/editManagerFormatCommons.js +2 -8
  327. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  328. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  329. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  330. package/dist/shared-tree-core/editManagerFormatV1toV4.js +0 -1
  331. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  332. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  333. package/dist/shared-tree-core/index.d.ts +3 -2
  334. package/dist/shared-tree-core/index.d.ts.map +1 -1
  335. package/dist/shared-tree-core/index.js +2 -3
  336. package/dist/shared-tree-core/index.js.map +1 -1
  337. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  338. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  339. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  340. package/dist/shared-tree-core/messageCodecs.d.ts +0 -4
  341. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  342. package/dist/shared-tree-core/messageCodecs.js +9 -17
  343. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  344. package/dist/shared-tree-core/messageFormat.d.ts +9 -50
  345. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  346. package/dist/shared-tree-core/messageFormat.js +3 -8
  347. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  348. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +2 -3
  349. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  350. package/dist/shared-tree-core/messageFormatV1ToV4.js +1 -8
  351. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  352. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +1 -1
  353. package/dist/shared-tree-core/sharedTreeCore.d.ts +0 -1
  354. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  355. package/dist/shared-tree-core/sharedTreeCore.js +1 -1
  356. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  357. package/dist/shared-tree-core/versionedSummarizer.d.ts +6 -1
  358. package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
  359. package/dist/shared-tree-core/versionedSummarizer.js +4 -3
  360. package/dist/shared-tree-core/versionedSummarizer.js.map +1 -1
  361. package/dist/simple-tree/api/eraseSchemaDetails.d.ts +89 -0
  362. package/dist/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -0
  363. package/dist/simple-tree/api/eraseSchemaDetails.js +97 -0
  364. package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -0
  365. package/dist/simple-tree/api/index.d.ts +1 -0
  366. package/dist/simple-tree/api/index.d.ts.map +1 -1
  367. package/dist/simple-tree/api/index.js +5 -1
  368. package/dist/simple-tree/api/index.js.map +1 -1
  369. package/dist/simple-tree/api/storedSchema.d.ts +1 -1
  370. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  371. package/dist/simple-tree/api/storedSchema.js +1 -2
  372. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  373. package/dist/simple-tree/api/tree.d.ts +15 -2
  374. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  375. package/dist/simple-tree/api/tree.js.map +1 -1
  376. package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
  377. package/dist/simple-tree/core/treeNode.js +1 -0
  378. package/dist/simple-tree/core/treeNode.js.map +1 -1
  379. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
  380. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  381. package/dist/simple-tree/core/unhydratedFlexTree.js +8 -59
  382. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  383. package/dist/simple-tree/createContext.d.ts.map +1 -1
  384. package/dist/simple-tree/createContext.js +1 -1
  385. package/dist/simple-tree/createContext.js.map +1 -1
  386. package/dist/simple-tree/fieldSchema.d.ts +4 -4
  387. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  388. package/dist/simple-tree/fieldSchema.js.map +1 -1
  389. package/dist/simple-tree/index.d.ts +3 -3
  390. package/dist/simple-tree/index.d.ts.map +1 -1
  391. package/dist/simple-tree/index.js +5 -3
  392. package/dist/simple-tree/index.js.map +1 -1
  393. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  394. package/dist/simple-tree/node-kinds/array/arrayNode.js +3 -5
  395. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  396. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
  397. package/dist/simple-tree/node-kinds/common.js +1 -1
  398. package/dist/simple-tree/node-kinds/common.js.map +1 -1
  399. package/dist/simple-tree/node-kinds/map/mapNode.js +2 -2
  400. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  401. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  402. package/dist/simple-tree/node-kinds/object/objectNode.js +18 -18
  403. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  404. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  405. package/dist/simple-tree/node-kinds/record/recordNode.js +2 -4
  406. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  407. package/dist/simple-tree/prepareForInsertion.d.ts +47 -54
  408. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  409. package/dist/simple-tree/prepareForInsertion.js +125 -183
  410. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  411. package/dist/simple-tree/toStoredSchema.js +3 -3
  412. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  413. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +4 -13
  414. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  415. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +11 -29
  416. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  417. package/dist/tableSchema.d.ts +3 -14
  418. package/dist/tableSchema.d.ts.map +1 -1
  419. package/dist/tableSchema.js +2 -2
  420. package/dist/tableSchema.js.map +1 -1
  421. package/dist/treeFactory.d.ts.map +1 -1
  422. package/dist/treeFactory.js +3 -17
  423. package/dist/treeFactory.js.map +1 -1
  424. package/dist/util/brand.d.ts +49 -0
  425. package/dist/util/brand.d.ts.map +1 -1
  426. package/dist/util/brand.js +47 -1
  427. package/dist/util/brand.js.map +1 -1
  428. package/dist/util/index.d.ts +2 -2
  429. package/dist/util/index.d.ts.map +1 -1
  430. package/dist/util/index.js +4 -3
  431. package/dist/util/index.js.map +1 -1
  432. package/dist/util/rangeMap.d.ts +12 -24
  433. package/dist/util/rangeMap.d.ts.map +1 -1
  434. package/dist/util/rangeMap.js +6 -46
  435. package/dist/util/rangeMap.js.map +1 -1
  436. package/docs/main/sequence-field/move-composition.md +46 -0
  437. package/eslint.config.mts +98 -0
  438. package/lib/alpha.d.ts +3 -0
  439. package/lib/codec/codec.d.ts +32 -17
  440. package/lib/codec/codec.d.ts.map +1 -1
  441. package/lib/codec/codec.js +34 -18
  442. package/lib/codec/codec.js.map +1 -1
  443. package/lib/core/change-family/changeFamily.d.ts +1 -4
  444. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  445. package/lib/core/change-family/changeFamily.js.map +1 -1
  446. package/lib/core/change-family/index.d.ts +1 -1
  447. package/lib/core/change-family/index.d.ts.map +1 -1
  448. package/lib/core/change-family/index.js.map +1 -1
  449. package/lib/core/index.d.ts +3 -3
  450. package/lib/core/index.d.ts.map +1 -1
  451. package/lib/core/index.js +2 -2
  452. package/lib/core/index.js.map +1 -1
  453. package/lib/core/rebase/changeRebaser.d.ts +1 -6
  454. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  455. package/lib/core/rebase/changeRebaser.js.map +1 -1
  456. package/lib/core/rebase/index.d.ts +1 -1
  457. package/lib/core/rebase/index.d.ts.map +1 -1
  458. package/lib/core/rebase/index.js +1 -1
  459. package/lib/core/rebase/index.js.map +1 -1
  460. package/lib/core/rebase/types.d.ts +21 -3
  461. package/lib/core/rebase/types.d.ts.map +1 -1
  462. package/lib/core/rebase/types.js +0 -3
  463. package/lib/core/rebase/types.js.map +1 -1
  464. package/lib/core/rebase/utils.d.ts.map +1 -1
  465. package/lib/core/rebase/utils.js +7 -25
  466. package/lib/core/rebase/utils.js.map +1 -1
  467. package/lib/core/schema-stored/schema.d.ts +4 -7
  468. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  469. package/lib/core/schema-stored/schema.js +3 -3
  470. package/lib/core/schema-stored/schema.js.map +1 -1
  471. package/lib/core/tree/detachedFieldIndex.d.ts +0 -6
  472. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  473. package/lib/core/tree/detachedFieldIndex.js +1 -10
  474. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  475. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +4 -4
  476. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  477. package/lib/core/tree/detachedFieldIndexFormatCommon.js +3 -3
  478. package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  479. package/lib/core/tree/index.d.ts +1 -1
  480. package/lib/core/tree/index.d.ts.map +1 -1
  481. package/lib/core/tree/index.js +1 -1
  482. package/lib/core/tree/index.js.map +1 -1
  483. package/lib/core/tree/pathTree.d.ts +3 -11
  484. package/lib/core/tree/pathTree.d.ts.map +1 -1
  485. package/lib/core/tree/pathTree.js +1 -12
  486. package/lib/core/tree/pathTree.js.map +1 -1
  487. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  488. package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -8
  489. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  490. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  491. package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -4
  492. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  493. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  494. package/lib/feature-libraries/chunked-forest/codec/codecs.js +3 -3
  495. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  496. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +5 -5
  497. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  498. package/lib/feature-libraries/chunked-forest/codec/format.js +5 -5
  499. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  500. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +42 -90
  501. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  502. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +69 -232
  503. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  504. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -1
  505. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  506. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +2 -11
  507. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  508. package/lib/feature-libraries/default-schema/index.d.ts +1 -2
  509. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  510. package/lib/feature-libraries/default-schema/index.js +1 -2
  511. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  512. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +6 -7
  513. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  514. package/lib/feature-libraries/default-schema/mappedEditBuilder.js +0 -15
  515. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  516. package/lib/feature-libraries/deltaUtils.d.ts +0 -1
  517. package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
  518. package/lib/feature-libraries/deltaUtils.js +1 -5
  519. package/lib/feature-libraries/deltaUtils.js.map +1 -1
  520. package/lib/feature-libraries/flex-tree/context.d.ts +0 -9
  521. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  522. package/lib/feature-libraries/flex-tree/context.js +0 -6
  523. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  524. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
  525. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  526. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  527. package/lib/feature-libraries/flex-tree/lazyField.d.ts +7 -8
  528. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  529. package/lib/feature-libraries/flex-tree/lazyField.js +9 -38
  530. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  531. package/lib/feature-libraries/forest-summary/codec.d.ts +8 -2
  532. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  533. package/lib/feature-libraries/forest-summary/codec.js +12 -11
  534. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  535. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  536. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  537. package/lib/feature-libraries/forest-summary/forestSummarizer.js +19 -10
  538. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  539. package/lib/feature-libraries/forest-summary/formatCommon.d.ts +61 -0
  540. package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -0
  541. package/lib/feature-libraries/forest-summary/{format.js → formatCommon.js} +8 -6
  542. package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -0
  543. package/lib/feature-libraries/forest-summary/{format.d.ts → formatV1.d.ts} +6 -14
  544. package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -0
  545. package/lib/feature-libraries/forest-summary/formatV1.js +8 -0
  546. package/lib/feature-libraries/forest-summary/formatV1.js.map +1 -0
  547. package/lib/feature-libraries/forest-summary/formatV2.d.ts +51 -0
  548. package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -0
  549. package/lib/feature-libraries/forest-summary/formatV2.js +8 -0
  550. package/lib/feature-libraries/forest-summary/formatV2.js.map +1 -0
  551. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +7 -15
  552. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  553. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +11 -20
  554. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  555. package/lib/feature-libraries/forest-summary/index.d.ts +1 -2
  556. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  557. package/lib/feature-libraries/forest-summary/index.js +1 -2
  558. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  559. package/lib/feature-libraries/forest-summary/summaryFormatCommon.d.ts +35 -0
  560. package/lib/feature-libraries/forest-summary/summaryFormatCommon.d.ts.map +1 -0
  561. package/lib/feature-libraries/forest-summary/summaryFormatCommon.js +40 -0
  562. package/lib/feature-libraries/forest-summary/summaryFormatCommon.js.map +1 -0
  563. package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts +11 -0
  564. package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts.map +1 -0
  565. package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.js +11 -0
  566. package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.js.map +1 -0
  567. package/lib/feature-libraries/forest-summary/summaryFormatV3.d.ts +18 -0
  568. package/lib/feature-libraries/forest-summary/summaryFormatV3.d.ts.map +1 -0
  569. package/lib/feature-libraries/forest-summary/summaryFormatV3.js +18 -0
  570. package/lib/feature-libraries/forest-summary/summaryFormatV3.js.map +1 -0
  571. package/lib/feature-libraries/forest-summary/summaryTypes.d.ts +7 -37
  572. package/lib/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
  573. package/lib/feature-libraries/forest-summary/summaryTypes.js +20 -43
  574. package/lib/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
  575. package/lib/feature-libraries/index.d.ts +3 -3
  576. package/lib/feature-libraries/index.d.ts.map +1 -1
  577. package/lib/feature-libraries/index.js +2 -2
  578. package/lib/feature-libraries/index.js.map +1 -1
  579. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  580. package/lib/feature-libraries/mapTreeCursor.js +1 -2
  581. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  582. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  583. package/lib/feature-libraries/mitigatedChangeFamily.js +2 -2
  584. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  585. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  586. package/lib/feature-libraries/modular-schema/comparison.js +1 -1
  587. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  588. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +21 -97
  589. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  590. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +5 -3
  591. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  592. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +52 -20
  593. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  594. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  595. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  596. package/lib/feature-libraries/modular-schema/genericFieldKind.js +9 -3
  597. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  598. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +1 -1
  599. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  600. package/lib/feature-libraries/modular-schema/index.d.ts +4 -4
  601. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  602. package/lib/feature-libraries/modular-schema/index.js +2 -3
  603. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  604. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  605. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  606. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +285 -9
  607. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  608. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +15 -48
  609. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  610. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +458 -1284
  611. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  612. package/{dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts → lib/feature-libraries/modular-schema/modularChangeFormat.d.ts} +2 -2
  613. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -0
  614. package/lib/feature-libraries/modular-schema/{modularChangeFormatV1.js → modularChangeFormat.js} +2 -2
  615. package/lib/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -0
  616. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +10 -50
  617. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  618. package/lib/feature-libraries/modular-schema/modularChangeTypes.js +2 -20
  619. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  620. package/lib/feature-libraries/optional-field/index.d.ts +2 -2
  621. package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
  622. package/lib/feature-libraries/optional-field/index.js +1 -1
  623. package/lib/feature-libraries/optional-field/index.js.map +1 -1
  624. package/lib/feature-libraries/optional-field/optionalField.d.ts +26 -5
  625. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  626. package/lib/feature-libraries/optional-field/optionalField.js +449 -217
  627. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  628. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +33 -24
  629. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
  630. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
  631. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
  632. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  633. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +26 -55
  634. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  635. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  636. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +2 -3
  637. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  638. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  639. package/lib/feature-libraries/schema-index/codec.js +5 -5
  640. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  641. package/lib/feature-libraries/schema-index/formatV1.d.ts +1 -1
  642. package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -1
  643. package/lib/feature-libraries/sequence-field/compose.d.ts +7 -6
  644. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  645. package/lib/feature-libraries/sequence-field/compose.js +258 -82
  646. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  647. package/lib/feature-libraries/sequence-field/helperTypes.d.ts +10 -14
  648. package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  649. package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  650. package/lib/feature-libraries/sequence-field/index.d.ts +3 -2
  651. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  652. package/lib/feature-libraries/sequence-field/index.js +1 -0
  653. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  654. package/lib/feature-libraries/sequence-field/invert.d.ts +3 -3
  655. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  656. package/lib/feature-libraries/sequence-field/invert.js +169 -67
  657. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  658. package/lib/feature-libraries/sequence-field/markQueue.d.ts +2 -2
  659. package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  660. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  661. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +56 -4
  662. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  663. package/lib/feature-libraries/sequence-field/moveEffectTable.js +80 -6
  664. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  665. package/lib/feature-libraries/sequence-field/rebase.d.ts +3 -3
  666. package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  667. package/lib/feature-libraries/sequence-field/rebase.js +114 -108
  668. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  669. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +9 -0
  670. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +1 -0
  671. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js +46 -0
  672. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -0
  673. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  674. package/lib/feature-libraries/sequence-field/replaceRevisions.js +33 -16
  675. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  676. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  677. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +2 -0
  678. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  679. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -22
  680. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  681. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +175 -350
  682. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  683. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  684. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +61 -21
  685. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  686. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
  687. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  688. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
  689. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  690. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
  691. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  692. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +109 -14
  693. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  694. package/lib/feature-libraries/sequence-field/types.d.ts +59 -30
  695. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  696. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  697. package/lib/feature-libraries/sequence-field/utils.d.ts +24 -15
  698. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  699. package/lib/feature-libraries/sequence-field/utils.js +292 -107
  700. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  701. package/lib/index.d.ts +2 -2
  702. package/lib/index.d.ts.map +1 -1
  703. package/lib/index.js +1 -1
  704. package/lib/index.js.map +1 -1
  705. package/lib/packageVersion.d.ts +1 -1
  706. package/lib/packageVersion.d.ts.map +1 -1
  707. package/lib/packageVersion.js +1 -1
  708. package/lib/packageVersion.js.map +1 -1
  709. package/lib/shared-tree/independentView.d.ts.map +1 -1
  710. package/lib/shared-tree/independentView.js +2 -2
  711. package/lib/shared-tree/independentView.js.map +1 -1
  712. package/lib/shared-tree/index.d.ts +1 -1
  713. package/lib/shared-tree/index.d.ts.map +1 -1
  714. package/lib/shared-tree/index.js.map +1 -1
  715. package/lib/shared-tree/schematizeTree.d.ts +4 -4
  716. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  717. package/lib/shared-tree/schematizeTree.js +2 -3
  718. package/lib/shared-tree/schematizeTree.js.map +1 -1
  719. package/lib/shared-tree/schematizingTreeView.d.ts +7 -2
  720. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  721. package/lib/shared-tree/schematizingTreeView.js +39 -35
  722. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  723. package/lib/shared-tree/sharedTree.d.ts +3 -9
  724. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  725. package/lib/shared-tree/sharedTree.js +0 -10
  726. package/lib/shared-tree/sharedTree.js.map +1 -1
  727. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  728. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  729. package/lib/shared-tree/sharedTreeChangeCodecs.js +2 -3
  730. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  731. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +4 -4
  732. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  733. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
  734. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  735. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +6 -16
  736. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  737. package/lib/shared-tree/sharedTreeEditBuilder.js +5 -11
  738. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  739. package/lib/shared-tree/treeCheckout.d.ts +15 -12
  740. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  741. package/lib/shared-tree/treeCheckout.js +57 -51
  742. package/lib/shared-tree/treeCheckout.js.map +1 -1
  743. package/lib/shared-tree-core/branch.d.ts +2 -3
  744. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  745. package/lib/shared-tree-core/branch.js +3 -4
  746. package/lib/shared-tree-core/branch.js.map +1 -1
  747. package/lib/shared-tree-core/editManager.d.ts +2 -2
  748. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  749. package/lib/shared-tree-core/editManager.js +9 -9
  750. package/lib/shared-tree-core/editManager.js.map +1 -1
  751. package/lib/shared-tree-core/editManagerCodecs.d.ts +0 -4
  752. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  753. package/lib/shared-tree-core/editManagerCodecs.js +7 -14
  754. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  755. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
  756. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  757. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +8 -44
  758. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  759. package/lib/shared-tree-core/editManagerFormatCommons.js +3 -9
  760. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  761. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  762. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  763. package/lib/shared-tree-core/editManagerFormatV1toV4.js +0 -1
  764. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  765. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  766. package/lib/shared-tree-core/index.d.ts +3 -2
  767. package/lib/shared-tree-core/index.d.ts.map +1 -1
  768. package/lib/shared-tree-core/index.js +2 -2
  769. package/lib/shared-tree-core/index.js.map +1 -1
  770. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  771. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  772. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  773. package/lib/shared-tree-core/messageCodecs.d.ts +0 -4
  774. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  775. package/lib/shared-tree-core/messageCodecs.js +9 -16
  776. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  777. package/lib/shared-tree-core/messageFormat.d.ts +9 -50
  778. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  779. package/lib/shared-tree-core/messageFormat.js +3 -8
  780. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  781. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +2 -3
  782. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  783. package/lib/shared-tree-core/messageFormatV1ToV4.js +1 -8
  784. package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  785. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +1 -1
  786. package/lib/shared-tree-core/sharedTreeCore.d.ts +0 -1
  787. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  788. package/lib/shared-tree-core/sharedTreeCore.js +1 -1
  789. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  790. package/lib/shared-tree-core/versionedSummarizer.d.ts +6 -1
  791. package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
  792. package/lib/shared-tree-core/versionedSummarizer.js +4 -3
  793. package/lib/shared-tree-core/versionedSummarizer.js.map +1 -1
  794. package/lib/simple-tree/api/eraseSchemaDetails.d.ts +89 -0
  795. package/lib/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -0
  796. package/lib/simple-tree/api/eraseSchemaDetails.js +92 -0
  797. package/lib/simple-tree/api/eraseSchemaDetails.js.map +1 -0
  798. package/lib/simple-tree/api/index.d.ts +1 -0
  799. package/lib/simple-tree/api/index.d.ts.map +1 -1
  800. package/lib/simple-tree/api/index.js +1 -0
  801. package/lib/simple-tree/api/index.js.map +1 -1
  802. package/lib/simple-tree/api/storedSchema.d.ts +1 -1
  803. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  804. package/lib/simple-tree/api/storedSchema.js +1 -2
  805. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  806. package/lib/simple-tree/api/tree.d.ts +15 -2
  807. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  808. package/lib/simple-tree/api/tree.js.map +1 -1
  809. package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
  810. package/lib/simple-tree/core/treeNode.js +1 -0
  811. package/lib/simple-tree/core/treeNode.js.map +1 -1
  812. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
  813. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  814. package/lib/simple-tree/core/unhydratedFlexTree.js +8 -58
  815. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  816. package/lib/simple-tree/createContext.d.ts.map +1 -1
  817. package/lib/simple-tree/createContext.js +1 -1
  818. package/lib/simple-tree/createContext.js.map +1 -1
  819. package/lib/simple-tree/fieldSchema.d.ts +4 -4
  820. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  821. package/lib/simple-tree/fieldSchema.js.map +1 -1
  822. package/lib/simple-tree/index.d.ts +3 -3
  823. package/lib/simple-tree/index.d.ts.map +1 -1
  824. package/lib/simple-tree/index.js +2 -2
  825. package/lib/simple-tree/index.js.map +1 -1
  826. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  827. package/lib/simple-tree/node-kinds/array/arrayNode.js +4 -6
  828. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  829. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
  830. package/lib/simple-tree/node-kinds/common.js +2 -2
  831. package/lib/simple-tree/node-kinds/common.js.map +1 -1
  832. package/lib/simple-tree/node-kinds/map/mapNode.js +2 -2
  833. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  834. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  835. package/lib/simple-tree/node-kinds/object/objectNode.js +19 -19
  836. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  837. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  838. package/lib/simple-tree/node-kinds/record/recordNode.js +2 -4
  839. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  840. package/lib/simple-tree/prepareForInsertion.d.ts +47 -54
  841. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  842. package/lib/simple-tree/prepareForInsertion.js +124 -183
  843. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  844. package/lib/simple-tree/toStoredSchema.js +3 -3
  845. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  846. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +4 -13
  847. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  848. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +9 -26
  849. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  850. package/lib/tableSchema.d.ts +3 -14
  851. package/lib/tableSchema.d.ts.map +1 -1
  852. package/lib/tableSchema.js +3 -3
  853. package/lib/tableSchema.js.map +1 -1
  854. package/lib/treeFactory.d.ts.map +1 -1
  855. package/lib/treeFactory.js +4 -18
  856. package/lib/treeFactory.js.map +1 -1
  857. package/lib/util/brand.d.ts +49 -0
  858. package/lib/util/brand.d.ts.map +1 -1
  859. package/lib/util/brand.js +44 -0
  860. package/lib/util/brand.js.map +1 -1
  861. package/lib/util/index.d.ts +2 -2
  862. package/lib/util/index.d.ts.map +1 -1
  863. package/lib/util/index.js +2 -2
  864. package/lib/util/index.js.map +1 -1
  865. package/lib/util/rangeMap.d.ts +12 -24
  866. package/lib/util/rangeMap.d.ts.map +1 -1
  867. package/lib/util/rangeMap.js +5 -44
  868. package/lib/util/rangeMap.js.map +1 -1
  869. package/package.json +24 -23
  870. package/src/codec/codec.ts +34 -18
  871. package/src/core/change-family/changeFamily.ts +0 -5
  872. package/src/core/change-family/index.ts +0 -1
  873. package/src/core/index.ts +2 -4
  874. package/src/core/rebase/changeRebaser.ts +1 -6
  875. package/src/core/rebase/index.ts +1 -1
  876. package/src/core/rebase/types.ts +26 -8
  877. package/src/core/rebase/utils.ts +7 -31
  878. package/src/core/schema-stored/schema.ts +5 -7
  879. package/src/core/tree/detachedFieldIndex.ts +1 -17
  880. package/src/core/tree/detachedFieldIndexFormatCommon.ts +4 -7
  881. package/src/core/tree/index.ts +1 -2
  882. package/src/core/tree/pathTree.ts +4 -16
  883. package/src/feature-libraries/chunked-forest/basicChunk.ts +1 -7
  884. package/src/feature-libraries/chunked-forest/chunkTree.ts +1 -6
  885. package/src/feature-libraries/chunked-forest/codec/codecs.ts +3 -2
  886. package/src/feature-libraries/chunked-forest/codec/format.ts +6 -9
  887. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +127 -393
  888. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +5 -13
  889. package/src/feature-libraries/default-schema/index.ts +5 -16
  890. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +9 -35
  891. package/src/feature-libraries/deltaUtils.ts +1 -6
  892. package/src/feature-libraries/flex-tree/context.ts +0 -17
  893. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +8 -7
  894. package/src/feature-libraries/flex-tree/lazyField.ts +24 -66
  895. package/src/feature-libraries/forest-summary/codec.ts +25 -13
  896. package/src/feature-libraries/forest-summary/forestSummarizer.ts +37 -12
  897. package/src/feature-libraries/forest-summary/{format.ts → formatCommon.ts} +10 -11
  898. package/src/feature-libraries/forest-summary/formatV1.ts +12 -0
  899. package/src/feature-libraries/forest-summary/formatV2.ts +12 -0
  900. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +18 -21
  901. package/src/feature-libraries/forest-summary/index.ts +1 -2
  902. package/src/feature-libraries/forest-summary/summaryFormatCommon.ts +41 -0
  903. package/src/feature-libraries/forest-summary/summaryFormatV1ToV2.ts +11 -0
  904. package/src/feature-libraries/forest-summary/summaryFormatV3.ts +18 -0
  905. package/src/feature-libraries/forest-summary/summaryTypes.ts +26 -46
  906. package/src/feature-libraries/index.ts +8 -21
  907. package/src/feature-libraries/mapTreeCursor.ts +1 -2
  908. package/src/feature-libraries/mitigatedChangeFamily.ts +1 -3
  909. package/src/feature-libraries/modular-schema/comparison.ts +2 -1
  910. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +44 -142
  911. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +57 -36
  912. package/src/feature-libraries/modular-schema/genericFieldKind.ts +18 -6
  913. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +1 -1
  914. package/src/feature-libraries/modular-schema/index.ts +15 -20
  915. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +499 -29
  916. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +741 -2541
  917. package/src/feature-libraries/modular-schema/{modularChangeFormatV1.ts → modularChangeFormat.ts} +1 -2
  918. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +10 -98
  919. package/src/feature-libraries/optional-field/index.ts +3 -1
  920. package/src/feature-libraries/optional-field/optionalField.ts +574 -317
  921. package/src/feature-libraries/optional-field/optionalFieldChangeTypes.ts +38 -24
  922. package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +35 -89
  923. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +2 -3
  924. package/src/feature-libraries/schema-index/codec.ts +7 -9
  925. package/src/feature-libraries/sequence-field/compose.ts +519 -134
  926. package/src/feature-libraries/sequence-field/helperTypes.ts +19 -34
  927. package/src/feature-libraries/sequence-field/index.ts +9 -0
  928. package/src/feature-libraries/sequence-field/invert.ts +228 -103
  929. package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
  930. package/src/feature-libraries/sequence-field/moveEffectTable.ts +191 -8
  931. package/src/feature-libraries/sequence-field/rebase.ts +203 -168
  932. package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +57 -0
  933. package/src/feature-libraries/sequence-field/replaceRevisions.ts +52 -31
  934. package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +2 -0
  935. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +220 -643
  936. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +68 -56
  937. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +27 -25
  938. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +129 -19
  939. package/src/feature-libraries/sequence-field/types.ts +64 -34
  940. package/src/feature-libraries/sequence-field/utils.ts +346 -133
  941. package/src/index.ts +3 -0
  942. package/src/packageVersion.ts +1 -1
  943. package/src/shared-tree/independentView.ts +1 -2
  944. package/src/shared-tree/index.ts +2 -3
  945. package/src/shared-tree/schematizeTree.ts +8 -21
  946. package/src/shared-tree/schematizingTreeView.ts +73 -50
  947. package/src/shared-tree/sharedTree.ts +3 -19
  948. package/src/shared-tree/sharedTreeChangeCodecs.ts +3 -7
  949. package/src/shared-tree/sharedTreeChangeFamily.ts +4 -7
  950. package/src/shared-tree/sharedTreeEditBuilder.ts +12 -46
  951. package/src/shared-tree/treeCheckout.ts +92 -82
  952. package/src/shared-tree-core/branch.ts +2 -8
  953. package/src/shared-tree-core/editManager.ts +2 -16
  954. package/src/shared-tree-core/editManagerCodecs.ts +7 -17
  955. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +1 -1
  956. package/src/shared-tree-core/editManagerFormatCommons.ts +6 -15
  957. package/src/shared-tree-core/editManagerFormatV1toV4.ts +1 -3
  958. package/src/shared-tree-core/index.ts +3 -2
  959. package/src/shared-tree-core/messageCodecV1ToV4.ts +1 -2
  960. package/src/shared-tree-core/messageCodecs.ts +9 -19
  961. package/src/shared-tree-core/messageFormat.ts +7 -15
  962. package/src/shared-tree-core/messageFormatV1ToV4.ts +2 -16
  963. package/src/shared-tree-core/sharedTreeCore.ts +1 -4
  964. package/src/shared-tree-core/versionedSummarizer.ts +10 -3
  965. package/src/simple-tree/api/eraseSchemaDetails.ts +123 -0
  966. package/src/simple-tree/api/index.ts +4 -0
  967. package/src/simple-tree/api/storedSchema.ts +2 -2
  968. package/src/simple-tree/api/tree.ts +16 -1
  969. package/src/simple-tree/core/treeNode.ts +1 -0
  970. package/src/simple-tree/core/unhydratedFlexTree.ts +36 -87
  971. package/src/simple-tree/createContext.ts +4 -1
  972. package/src/simple-tree/fieldSchema.ts +4 -6
  973. package/src/simple-tree/index.ts +3 -2
  974. package/src/simple-tree/node-kinds/array/arrayNode.ts +5 -7
  975. package/src/simple-tree/node-kinds/common.ts +5 -2
  976. package/src/simple-tree/node-kinds/map/mapNode.ts +4 -4
  977. package/src/simple-tree/node-kinds/object/objectNode.ts +26 -26
  978. package/src/simple-tree/node-kinds/record/recordNode.ts +9 -10
  979. package/src/simple-tree/prepareForInsertion.ts +200 -343
  980. package/src/simple-tree/toStoredSchema.ts +3 -3
  981. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +14 -42
  982. package/src/tableSchema.ts +13 -18
  983. package/src/treeFactory.ts +5 -19
  984. package/src/util/brand.ts +61 -0
  985. package/src/util/index.ts +3 -3
  986. package/src/util/rangeMap.ts +18 -72
  987. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +0 -36
  988. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +0 -1
  989. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js +0 -126
  990. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js.map +0 -1
  991. package/dist/feature-libraries/forest-summary/format.d.ts.map +0 -1
  992. package/dist/feature-libraries/forest-summary/format.js.map +0 -1
  993. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +0 -17
  994. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +0 -1
  995. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +0 -388
  996. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +0 -1
  997. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +0 -17
  998. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +0 -1
  999. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +0 -413
  1000. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +0 -1
  1001. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +0 -1
  1002. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +0 -1
  1003. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +0 -146
  1004. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +0 -1
  1005. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +0 -32
  1006. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +0 -1
  1007. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +0 -36
  1008. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +0 -1
  1009. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js +0 -122
  1010. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js.map +0 -1
  1011. package/lib/feature-libraries/forest-summary/format.d.ts.map +0 -1
  1012. package/lib/feature-libraries/forest-summary/format.js.map +0 -1
  1013. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +0 -17
  1014. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +0 -1
  1015. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +0 -384
  1016. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +0 -1
  1017. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +0 -17
  1018. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +0 -1
  1019. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js +0 -409
  1020. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +0 -1
  1021. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +0 -1
  1022. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +0 -1
  1023. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +0 -146
  1024. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +0 -1
  1025. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +0 -29
  1026. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +0 -1
  1027. package/src/feature-libraries/default-schema/locationBasedEditBuilder.ts +0 -180
  1028. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +0 -732
  1029. package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +0 -790
  1030. package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +0 -62
@@ -4,8 +4,8 @@
4
4
  */
5
5
  import { assert, oob } from "@fluidframework/core-utils/internal";
6
6
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
- import { compareFieldUpPaths, getDetachedFieldContainingFieldPath, rootField, topDownPath, } from "../../core/index.js";
8
- import { brand, RangeMap } from "../../util/index.js";
7
+ import { compareFieldUpPaths, topDownPath, } from "../../core/index.js";
8
+ import { brand } from "../../util/index.js";
9
9
  import { ModularChangeFamily, ModularEditBuilder, intoDelta as intoModularDelta, relevantRemovedRoots as relevantModularRemovedRoots, } from "../modular-schema/index.js";
10
10
  import { fieldKinds, optional, sequence, required as valueFieldKind, } from "./defaultFieldKinds.js";
11
11
  /**
@@ -23,8 +23,8 @@ export class DefaultChangeFamily {
23
23
  get codecs() {
24
24
  return this.modularFamily.codecs;
25
25
  }
26
- buildEditor(mintRevisionTag, changeReceiver, options) {
27
- return new DefaultIdBasedDataEditor(this, mintRevisionTag, changeReceiver, options);
26
+ buildEditor(mintRevisionTag, changeReceiver) {
27
+ return new DefaultEditBuilder(this, mintRevisionTag, changeReceiver);
28
28
  }
29
29
  }
30
30
  /**
@@ -50,158 +50,71 @@ export function intoDelta(taggedChange) {
50
50
  export function relevantRemovedRoots(change) {
51
51
  return relevantModularRemovedRoots(change, fieldKinds);
52
52
  }
53
- export function offsetChangesetLocalId(id, offset) {
54
- return brand(id + offset);
55
- }
56
- export function subtractChangesetLocalId(a, b) {
57
- return a - b;
58
- }
59
53
  /**
60
- * Implementation of {@link IdBasedChangeFamilyDataEditor} based on the default set of supported field kinds.
54
+ * Implementation of {@link IDefaultEditBuilder} based on the default set of supported field kinds.
61
55
  * @sealed
62
56
  */
63
- export class DefaultIdBasedDataEditor {
64
- constructor(family, mintRevisionTag, changeReceiver, options = { canMakeDetachedRootEdits: false }) {
57
+ export class DefaultEditBuilder {
58
+ constructor(family, mintRevisionTag, changeReceiver) {
65
59
  this.mintRevisionTag = mintRevisionTag;
66
- this.options = options;
67
- this.nodesWithoutCells = new RangeMap(offsetChangesetLocalId, subtractChangesetLocalId);
68
60
  this.modularBuilder = new ModularEditBuilder(family, fieldKinds, changeReceiver);
69
61
  }
70
62
  enterTransaction() {
71
- if (this.modularBuilder.isInTransaction() === false) {
72
- this.nodesWithoutCells.clear();
73
- }
74
63
  this.modularBuilder.enterTransaction();
75
64
  }
76
65
  exitTransaction() {
77
66
  this.modularBuilder.exitTransaction();
78
- if (this.modularBuilder.isInTransaction() === false) {
79
- this.nodesWithoutCells.clear();
80
- }
81
67
  }
82
68
  addNodeExistsConstraint(path) {
83
- enforceEditsToDetachedTreesOptions({ parent: path.parent, field: path.parentField }, this.options);
84
69
  this.modularBuilder.addNodeExistsConstraint(path, this.mintRevisionTag());
85
70
  }
86
71
  addNodeExistsConstraintOnRevert(path) {
87
- enforceEditsToDetachedTreesOptions({ parent: path.parent, field: path.parentField }, this.options);
88
72
  this.modularBuilder.addNodeExistsConstraintOnRevert(path, this.mintRevisionTag());
89
73
  }
90
- buildRoots(content) {
91
- const detachedRoots = [];
92
- const count = content.topLevelLength;
93
- if (count > 0) {
94
- const buildRevision = this.mintRevisionTag();
95
- const buildId = {
96
- localId: this.modularBuilder.generateId(count),
97
- revision: buildRevision,
98
- };
99
- const build = this.modularBuilder.buildTrees(buildId.localId, content, buildRevision);
100
- this.modularBuilder.submitChanges([build], buildRevision);
101
- detachedRoots.push({ first: buildId, count });
102
- this.nodesWithoutCells.set(buildId.localId, count, true);
103
- }
104
- return detachedRoots;
105
- }
106
74
  valueField(field) {
107
- enforceEditsToDetachedTreesOptions(field, this.options);
108
- const makeAttachEditDescription = (fill, revision) => {
109
- const detachLocalId = this.modularBuilder.generateId();
110
- const detach = { localId: detachLocalId, revision };
111
- const change = valueFieldKind.changeHandler.editor.set({ fill, detach });
112
- return {
113
- type: "field",
114
- field,
115
- fieldKind: valueFieldKind.identifier,
116
- change: brand(change),
117
- revision,
118
- };
119
- };
120
75
  return {
121
76
  set: (newContent) => {
122
- assert(newContent.topLevelLength === 1, "Expected exactly one node");
77
+ assert(newContent.topLevelLength === 1, 0xc12 /* Value fields should have a single top level node */);
123
78
  const revision = this.mintRevisionTag();
124
- const buildLocalId = this.modularBuilder.generateId();
125
- const buildId = { localId: buildLocalId, revision };
126
- const build = this.modularBuilder.buildTrees(buildLocalId, newContent, revision);
127
- const attach = makeAttachEditDescription(buildId, revision);
128
- this.modularBuilder.submitChanges([build, attach], revision);
129
- },
130
- attach: (newContent) => {
131
- const isWithoutCell = this.nodesWithoutCells.delete(newContent.localId, 1) === 1;
132
- if (!isWithoutCell) {
133
- throw new UsageError("A hydrated node that has been attached before cannot be attached into an object's required field. Assign new content to the field instead.");
134
- }
135
- const revision = this.mintRevisionTag();
136
- const attach = makeAttachEditDescription(newContent, revision);
137
- this.modularBuilder.submitChanges([attach], revision);
79
+ const fill = { localId: this.modularBuilder.generateId(), revision };
80
+ const detach = { localId: this.modularBuilder.generateId(), revision };
81
+ const build = this.modularBuilder.buildTrees(fill.localId, newContent, revision);
82
+ const change = brand(valueFieldKind.changeHandler.editor.set({
83
+ fill,
84
+ detach,
85
+ }));
86
+ const edit = {
87
+ type: "field",
88
+ field,
89
+ fieldKind: valueFieldKind.identifier,
90
+ change,
91
+ revision,
92
+ };
93
+ this.modularBuilder.submitChanges([build, edit], revision);
138
94
  },
139
95
  };
140
96
  }
141
97
  optionalField(field) {
142
- enforceEditsToDetachedTreesOptions(field, this.options);
143
- const makeAttachEditDescription = (fill, revision, wasEmpty) => {
144
- const detachLocalId = this.modularBuilder.generateId();
145
- const detach = { localId: detachLocalId, revision };
146
- const change = optional.changeHandler.editor.set(wasEmpty, { fill, detach });
147
- return {
148
- type: "field",
149
- field,
150
- fieldKind: optional.identifier,
151
- change: brand(change),
152
- revision,
153
- };
154
- };
155
- const editBuilder = {
98
+ return {
156
99
  set: (newContent, wasEmpty) => {
157
- if (newContent === undefined) {
158
- editBuilder.clear(wasEmpty);
159
- return;
160
- }
161
- assert(newContent.topLevelLength === 1, "Expected exactly one node");
162
- const revision = this.mintRevisionTag();
163
- const buildLocalId = this.modularBuilder.generateId();
164
- const buildId = { localId: buildLocalId, revision };
165
- const build = this.modularBuilder.buildTrees(buildLocalId, newContent, revision);
166
- const attach = makeAttachEditDescription(buildId, revision, wasEmpty);
167
- this.modularBuilder.submitChanges([build, attach], revision);
168
- },
169
- attach: (content, wasEmpty) => {
170
- if (content === undefined) {
171
- editBuilder.clear(wasEmpty);
172
- return;
173
- }
174
- const isWithoutCell = this.nodesWithoutCells.delete(content.localId, 1) === 1;
175
- if (!isWithoutCell && this.options.canMakeDetachedRootEdits !== true) {
176
- throw new UsageError(`Attach edits require a minimum version for collaboration >= TBD.`);
177
- }
178
- const revision = this.mintRevisionTag();
100
+ // The choice to ban empty chunks here instead of treating them as a clear is a subjective choice made to err of the side of more explicitness and stricter validation.
101
+ assert(newContent === undefined || newContent.topLevelLength === 1, 0xc13 /* optional fields should have a single top level node, or undefined */);
179
102
  const edits = [];
180
- let stableSrcId;
181
- if (isWithoutCell) {
182
- stableSrcId = content;
103
+ let optionalChange;
104
+ const revision = this.mintRevisionTag();
105
+ const detach = { localId: this.modularBuilder.generateId(), revision };
106
+ if (newContent !== undefined) {
107
+ const fill = { localId: this.modularBuilder.generateId(), revision };
108
+ const build = this.modularBuilder.buildTrees(fill.localId, newContent, revision);
109
+ edits.push(build);
110
+ optionalChange = optional.changeHandler.editor.set(wasEmpty, {
111
+ fill,
112
+ detach,
113
+ });
183
114
  }
184
115
  else {
185
- // If the node has an associated cell, then it may be concurrently moved to another location.
186
- // We use a rename to ensure that the node will be moved to a specific grave before the attach.
187
- stableSrcId = { localId: this.modularBuilder.generateId(), revision };
188
- const rename = {
189
- type: "global",
190
- revision,
191
- renames: [
192
- { count: 1, oldId: content, newId: stableSrcId, detachLocation: undefined },
193
- ],
194
- };
195
- edits.push(rename);
116
+ optionalChange = optional.changeHandler.editor.clear(wasEmpty, detach);
196
117
  }
197
- const attach = makeAttachEditDescription(stableSrcId, revision, wasEmpty);
198
- edits.push(attach);
199
- this.modularBuilder.submitChanges(edits, revision);
200
- },
201
- clear: (wasEmpty) => {
202
- const revision = this.mintRevisionTag();
203
- const detach = { localId: this.modularBuilder.generateId(), revision };
204
- const optionalChange = optional.changeHandler.editor.clear(wasEmpty, detach);
205
118
  const change = brand(optionalChange);
206
119
  const edit = {
207
120
  type: "field",
@@ -210,10 +123,10 @@ export class DefaultIdBasedDataEditor {
210
123
  change,
211
124
  revision,
212
125
  };
213
- this.modularBuilder.submitChanges([edit], revision);
126
+ edits.push(edit);
127
+ this.modularBuilder.submitChanges(edits, revision);
214
128
  },
215
129
  };
216
- return editBuilder;
217
130
  }
218
131
  move(sourceField, sourceIndex, count, destinationField, destIndex) {
219
132
  if (count === 0) {
@@ -222,8 +135,6 @@ export class DefaultIdBasedDataEditor {
222
135
  else if (count < 0 || !Number.isSafeInteger(count)) {
223
136
  throw new UsageError(`Expected non-negative integer count, got ${count}.`);
224
137
  }
225
- enforceEditsToDetachedTreesOptions(sourceField, this.options);
226
- enforceEditsToDetachedTreesOptions(destinationField, this.options);
227
138
  const revision = this.mintRevisionTag();
228
139
  const detachCellId = this.modularBuilder.generateId(count);
229
140
  const attachCellId = { localId: this.modularBuilder.generateId(count), revision };
@@ -236,13 +147,13 @@ export class DefaultIdBasedDataEditor {
236
147
  const attachPath = topDownPath(destinationField.parent);
237
148
  const sharedDepth = getSharedPrefixLength(detachPath, attachPath);
238
149
  let adjustedAttachField = destinationField;
239
- // `sharedDepth` is the number of elements, starting from the root, that both paths have in common.
150
+ // After the above loop, `sharedDepth` is the number of elements, starting from the root,
151
+ // that both paths have in common.
240
152
  if (sharedDepth === detachPath.length) {
241
- const lowestCommonAncestor = attachPath[sharedDepth];
242
- const attachField = lowestCommonAncestor?.parentField ?? destinationField.field;
153
+ const attachField = attachPath[sharedDepth]?.parentField ?? destinationField.field;
243
154
  if (attachField === sourceField.field) {
244
155
  // The detach occurs in an ancestor field of the field where the attach occurs.
245
- const attachAncestorIndex = lowestCommonAncestor?.parentIndex ?? destIndex;
156
+ let attachAncestorIndex = attachPath[sharedDepth]?.parentIndex ?? sourceIndex;
246
157
  if (attachAncestorIndex < sourceIndex) {
247
158
  // The attach path runs through a node located before the detached nodes.
248
159
  // No need to adjust the attach path.
@@ -251,18 +162,14 @@ export class DefaultIdBasedDataEditor {
251
162
  // The attach path runs through a node located after the detached nodes.
252
163
  // adjust the index for the node at that depth of the path, so that it is interpreted correctly
253
164
  // in the composition performed by `submitChanges`.
254
- const adjustedAttachAncestorIndex = attachAncestorIndex - count;
255
- let parent = lowestCommonAncestor === undefined
256
- ? {
257
- parent: undefined,
258
- detachedNodeId: undefined,
259
- parentIndex: adjustedAttachAncestorIndex,
260
- parentField: destinationField.field,
261
- }
262
- : {
263
- ...lowestCommonAncestor,
264
- parentIndex: adjustedAttachAncestorIndex,
265
- };
165
+ attachAncestorIndex -= count;
166
+ let parent = attachPath[sharedDepth - 1];
167
+ const parentField = attachPath[sharedDepth] ?? oob();
168
+ parent = {
169
+ parent,
170
+ parentIndex: attachAncestorIndex,
171
+ parentField: parentField.parentField,
172
+ };
266
173
  for (let i = sharedDepth + 1; i < attachPath.length; i += 1) {
267
174
  parent = {
268
175
  ...(attachPath[i] ?? oob()),
@@ -276,8 +183,8 @@ export class DefaultIdBasedDataEditor {
276
183
  }
277
184
  }
278
185
  }
279
- const moveOut = sequence.changeHandler.editor.remove(sourceIndex, count, detachCellId, revision);
280
- const moveIn = sequence.changeHandler.editor.insert(destIndex, count, attachCellId, revision, detachCellId);
186
+ const moveOut = sequence.changeHandler.editor.moveOut(sourceIndex, count, detachCellId, revision);
187
+ const moveIn = sequence.changeHandler.editor.moveIn(destIndex, count, detachCellId, attachCellId, revision);
281
188
  this.modularBuilder.submitChanges([
282
189
  {
283
190
  type: "field",
@@ -297,87 +204,26 @@ export class DefaultIdBasedDataEditor {
297
204
  }
298
205
  }
299
206
  sequenceField(field) {
300
- enforceEditsToDetachedTreesOptions(field, this.options);
301
- const makeAttachEditDescription = (index, { first, count }, revision, areWithoutCells) => {
302
- const edits = [];
303
- // If the nodes have never been attached in cell, then we must use a cell ID that matches the build ID.
304
- // This ensures back-compatibility with the v1 ModularChangeFamily model which requires that every node be associated with cell
305
- // by generating an insert whose destination cell is the cell associated with the build ID.
306
- let stableSrcId;
307
- if (areWithoutCells) {
308
- stableSrcId = first;
309
- }
310
- else {
311
- // If the node has an associated cell, then it may be concurrently moved to another location.
312
- // We use a rename to ensure that the node will be moved to a specific grave before the attach.
313
- stableSrcId = { localId: this.modularBuilder.generateId(count), revision };
314
- const rename = {
315
- type: "global",
316
- revision,
317
- renames: [
318
- {
319
- count,
320
- oldId: first,
321
- newId: stableSrcId,
322
- detachLocation: undefined,
323
- },
324
- ],
325
- };
326
- edits.push(rename);
327
- }
328
- assert(stableSrcId.revision !== undefined, "Detached nodes ID must have a revision");
329
- const change = sequence.changeHandler.editor.insert(index, count, stableSrcId, stableSrcId.revision, stableSrcId.localId);
330
- const attach = {
331
- type: "field",
332
- field,
333
- fieldKind: sequence.identifier,
334
- change: brand(change),
335
- revision,
336
- };
337
- edits.push(attach);
338
- return edits;
339
- };
340
- const editBuilder = {
207
+ return {
341
208
  insert: (index, content) => {
342
- const count = content.topLevelLength;
343
- if (count === 0) {
209
+ const length = content.topLevelLength;
210
+ if (length === 0) {
344
211
  return;
345
212
  }
346
213
  const revision = this.mintRevisionTag();
347
- const buildLocalId = this.modularBuilder.generateId();
348
- const build = this.modularBuilder.buildTrees(buildLocalId, content, revision);
349
- const roots = {
350
- first: { localId: buildLocalId, revision },
351
- count,
214
+ const firstId = { localId: this.modularBuilder.generateId(length), revision };
215
+ const build = this.modularBuilder.buildTrees(firstId.localId, content, revision);
216
+ const change = brand(sequence.changeHandler.editor.insert(index, length, firstId, revision));
217
+ const attach = {
218
+ type: "field",
219
+ field,
220
+ fieldKind: sequence.identifier,
221
+ change,
222
+ revision,
352
223
  };
353
- const attach = makeAttachEditDescription(index, roots, revision, true);
354
- this.modularBuilder.submitChanges([build, ...attach], revision);
355
- },
356
- attach: (index, newContent) => {
357
- const attachRevision = this.mintRevisionTag();
358
- let areAllWithoutCells = true;
359
- let insertOffset = 0;
360
- const edits = [];
361
- for (const range of newContent) {
362
- if (range.count === 0) {
363
- continue;
364
- }
365
- const countWithoutCells = this.nodesWithoutCells.delete(range.first.localId, range.count);
366
- assert(countWithoutCells === 0 || countWithoutCells === range.count, "All detached roots within the same ID range must either all have or all not have a cell");
367
- const areWithoutCells = countWithoutCells === range.count;
368
- if (!areWithoutCells) {
369
- areAllWithoutCells = false;
370
- }
371
- const renameAndAttach = makeAttachEditDescription(index + insertOffset, range, attachRevision, areWithoutCells);
372
- edits.push(...renameAndAttach);
373
- insertOffset += range.count;
374
- }
375
- if (!areAllWithoutCells && this.options.canMakeDetachedRootEdits !== true) {
376
- throw new UsageError(`Attach edits require a minimum version for collaboration >= TBD.`);
377
- }
378
- if (edits.length > 0) {
379
- this.modularBuilder.submitChanges(edits, attachRevision);
380
- }
224
+ // The changes have to be submitted together, otherwise they will be assigned different revisions,
225
+ // which will prevent the build ID and the insert ID from matching.
226
+ this.modularBuilder.submitChanges([build, attach], revision);
381
227
  },
382
228
  remove: (index, count) => {
383
229
  if (count === 0) {
@@ -389,15 +235,6 @@ export class DefaultIdBasedDataEditor {
389
235
  this.modularBuilder.submitChange(field, sequence.identifier, change, revision);
390
236
  },
391
237
  };
392
- return editBuilder;
393
- }
394
- }
395
- function enforceEditsToDetachedTreesOptions(field, options) {
396
- if (options.canMakeDetachedRootEdits !== true) {
397
- const topField = getDetachedFieldContainingFieldPath(field);
398
- if (topField !== rootField) {
399
- throw new UsageError(`Edits and constraints on detached trees require a minimum version for collaboration >= TBD.`);
400
- }
401
238
  }
402
239
  }
403
240
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"defaultEditBuilder.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultEditBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAGtE,OAAO,EAiBN,mBAAmB,EACnB,mCAAmC,EACnC,SAAS,EACT,WAAW,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAKN,mBAAmB,EAEnB,kBAAkB,EAClB,SAAS,IAAI,gBAAgB,EAC7B,oBAAoB,IAAI,2BAA2B,GACnD,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,QAAQ,IAAI,cAAc,GAC1B,MAAM,wBAAwB,CAAC;AAKhC;;;;GAIG;AACH,MAAM,OAAO,mBAAmB;IAK/B,YAAmB,MAA6D;QAC/E,IAAI,CAAC,aAAa,GAAG,IAAI,mBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAClE,CAAC;IAED,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;IACnC,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;IAClC,CAAC;IAEM,WAAW,CACjB,eAAkC,EAClC,cAAgE,EAChE,OA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,CAAC,CAAC;YAChF,CAAC;SACD,CAAC;QACF,OAAO,WAAW,CAAC;IACpB,CAAC;CACD;AAED,SAAS,kCAAkC,CAAC,KAAkB,EAAE,OAAsB;IACrF,IAAI,OAAO,CAAC,wBAAwB,KAAK,IAAI,EAAE,CAAC;QAC/C,MAAM,QAAQ,GAAG,mCAAmC,CAAC,KAAK,CAAC,CAAC;QAC5D,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,IAAI,UAAU,CACnB,6FAA6F,CAC7F,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC;AAwED;;GAEG;AACH,SAAS,qBAAqB,CAAC,KAAwB,EAAE,KAAwB;IAChF,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtD,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,OAAO,WAAW,GAAG,QAAQ,EAAE,CAAC;QAC/B,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,GAAG,EAAE,CAAC;QAC/C,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,GAAG,EAAE,CAAC;QAC/C,IAAI,UAAU,KAAK,UAAU,EAAE,CAAC;YAC/B,IACC,UAAU,CAAC,WAAW,KAAK,UAAU,CAAC,WAAW;gBACjD,UAAU,CAAC,WAAW,KAAK,UAAU,CAAC,WAAW,EAChD,CAAC;gBACF,MAAM;YACP,CAAC;QACF,CAAC;QACD,WAAW,IAAI,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,WAAW,CAAC;AACpB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ICodecFamily } from \"../../codec/index.js\";\nimport {\n\ttype ChangeAtomId,\n\ttype ChangeEncodingContext,\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\ttype ChangeRebaser,\n\ttype ChangesetLocalId,\n\ttype DeltaDetachedNodeId,\n\ttype DeltaRoot,\n\ttype EditorOptions,\n\ttype FieldUpPath,\n\ttype NormalizedFieldUpPath,\n\ttype NormalizedUpPath,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\ttype TreeChunk,\n\ttype UpPath,\n\tcompareFieldUpPaths,\n\tgetDetachedFieldContainingFieldPath,\n\trootField,\n\ttopDownPath,\n} from \"../../core/index.js\";\nimport { brand, RangeMap } from \"../../util/index.js\";\nimport {\n\ttype EditDescription,\n\ttype FieldChangeset,\n\ttype FieldEditDescription,\n\ttype GlobalEditDescription,\n\tModularChangeFamily,\n\ttype ModularChangeset,\n\tModularEditBuilder,\n\tintoDelta as intoModularDelta,\n\trelevantRemovedRoots as relevantModularRemovedRoots,\n} from \"../modular-schema/index.js\";\n\nimport {\n\tfieldKinds,\n\toptional,\n\tsequence,\n\trequired as valueFieldKind,\n} from \"./defaultFieldKinds.js\";\nimport type { CellId } from \"../sequence-field/index.js\";\n\nexport type DefaultChangeset = ModularChangeset;\n\n/**\n * Implementation of {@link ChangeFamily} based on the default set of supported field kinds.\n *\n * @sealed\n */\nexport class DefaultChangeFamily\n\timplements ChangeFamily<IdBasedChangeFamilyDataEditor, DefaultChangeset>\n{\n\tprivate readonly modularFamily: ModularChangeFamily;\n\n\tpublic constructor(codecs: ICodecFamily<ModularChangeset, ChangeEncodingContext>) {\n\t\tthis.modularFamily = new ModularChangeFamily(fieldKinds, codecs);\n\t}\n\n\tpublic get rebaser(): ChangeRebaser<DefaultChangeset> {\n\t\treturn this.modularFamily.rebaser;\n\t}\n\n\tpublic get codecs(): ICodecFamily<DefaultChangeset, ChangeEncodingContext> {\n\t\treturn this.modularFamily.codecs;\n\t}\n\n\tpublic buildEditor(\n\t\tmintRevisionTag: () => RevisionTag,\n\t\tchangeReceiver: (change: TaggedChange<DefaultChangeset>) => void,\n\t\toptions?: EditorOptions,\n\t): IdBasedChangeFamilyDataEditor {\n\t\treturn new DefaultIdBasedDataEditor(this, mintRevisionTag, changeReceiver, options);\n\t}\n}\n\n/**\n * @param change - The change to convert into a delta.\n */\nexport function intoDelta(taggedChange: TaggedChange<ModularChangeset>): DeltaRoot {\n\treturn intoModularDelta(taggedChange, fieldKinds);\n}\n\n/**\n * Returns the set of removed roots that should be in memory for the given change to be applied.\n * A removed root is relevant if any of the following is true:\n * - It is being inserted\n * - It is being restored\n * - It is being edited\n * - The ID it is associated with is being changed\n *\n * May be conservative by returning more removed roots than strictly necessary.\n *\n * Will never return IDs for non-root trees, even if they are removed.\n *\n * @param change - The change to be applied.\n */\nexport function relevantRemovedRoots(change: ModularChangeset): Iterable<DeltaDetachedNodeId> {\n\treturn relevantModularRemovedRoots(change, fieldKinds);\n}\n\nexport type DetachedRootIds = readonly DetachedRootIdRange[];\nexport interface DetachedRootIdRange {\n\treadonly first: ChangeAtomId;\n\treadonly count: number;\n}\n\n/**\n * Default editor for tree data changes.\n * @privateRemarks\n * When taking into account not just the content of the tree,\n * but also how the merge identities (and thus anchors, flex-tree and simple-tree nodes) of nodes before and after the edits correspond,\n * some edits are currently impossible to express.\n * Examples of these non-expressible edits include:\n *\n * - Changing the type of a node while keeping its merge identity.\n * - Changing the value of a leaf while keeping its merge identity.\n * - Swapping subtrees between two value fields.\n * - Replacing a node in the middle of a tree while reusing some of the old nodes decedents that were under value fields.\n *\n * At some point it will likely be worth supporting at least some of these, possibly using a mechanism that could support all of them if desired.\n * If/when such a mechanism becomes available, an evaluation should be done to determine if any existing editing operations should be changed to leverage it\n * (Possibly by adding opt ins at the view schema layer).\n */\nexport interface DataEditor<TContent, TDetachedRoot, TDetachedRoots> {\n\t/**\n\t * Moves a subsequence from one sequence field to another sequence field.\n\t *\n\t * Note that the `destinationIndex` is interpreted based on the state of the sequence *before* the move operation.\n\t * For example, `move(field, 0, 1, field, 2)` changes `[A, B, C]` to `[B, A, C]`.\n\t */\n\tmove(\n\t\tsourceField: NormalizedFieldUpPath,\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestinationField: NormalizedFieldUpPath,\n\t\tdestinationIndex: number,\n\t): void;\n\n\t/**\n\t * Add a constraint that the node at the given path must exist.\n\t * @param path - The path to the node that must exist.\n\t */\n\taddNodeExistsConstraint(path: NormalizedUpPath): void;\n\n\t/**\n\t * Add a constraint that the node at the given path must exist when reverting a change.\n\t * @param path - The path to the node that must exist when reverting a change.\n\t */\n\taddNodeExistsConstraintOnRevert(path: NormalizedUpPath): void;\n\n\t/**\n\t * Builds the detached roots for the given content.\n\t * @param content - The content to be built into detached nodes.\n\t *\n\t * Requires SharedTreeFormatVersion.vDetachedRoots or later.\n\t */\n\tbuildRoots(content: TContent): TDetachedRoots;\n\n\t/**\n\t * @param field - the value field which is being edited under the parent node\n\t * @returns An object with methods to edit the given field of the given parent.\n\t * The returned object can be used (i.e., have its methods called) multiple times but its lifetime\n\t * is bounded by the lifetime of this edit builder.\n\t */\n\tvalueField(field: NormalizedFieldUpPath): RequiredFieldEditor<TContent, TDetachedRoot>;\n\n\t/**\n\t * @param field - the optional field which is being edited under the parent node\n\t * @returns An object with methods to edit the given field of the given parent.\n\t * The returned object can be used (i.e., have its methods called) multiple times but its lifetime\n\t * is bounded by the lifetime of this edit builder.\n\t */\n\toptionalField(field: NormalizedFieldUpPath): OptionalFieldEditor<TContent, TDetachedRoot>;\n\n\t/**\n\t * @param field - the sequence field which is being edited under the parent node\n\t *\n\t * @returns An object with methods to edit the given field of the given parent.\n\t * The returned object can be used (i.e., have its methods called) multiple times but its lifetime\n\t * is bounded by the lifetime of this edit builder.\n\t */\n\tsequenceField(field: NormalizedFieldUpPath): SequenceFieldEditor<TContent, TDetachedRoots>;\n}\n\nexport type IdBasedChangeFamilyDataEditor = ChangeFamilyEditor &\n\tDataEditor<TreeChunk, ChangeAtomId, DetachedRootIds>;\n\nexport function offsetChangesetLocalId(\n\tid: ChangesetLocalId,\n\toffset: number,\n): ChangesetLocalId {\n\treturn brand(id + offset);\n}\n\nexport function subtractChangesetLocalId(a: ChangesetLocalId, b: ChangesetLocalId): number {\n\treturn a - b;\n}\n\n/**\n * Implementation of {@link IdBasedChangeFamilyDataEditor} based on the default set of supported field kinds.\n * @sealed\n */\nexport class DefaultIdBasedDataEditor implements IdBasedChangeFamilyDataEditor {\n\tprivate readonly modularBuilder: ModularEditBuilder;\n\tprivate readonly nodesWithoutCells: RangeMap<ChangesetLocalId, true> = new RangeMap(\n\t\toffsetChangesetLocalId,\n\t\tsubtractChangesetLocalId,\n\t);\n\n\tpublic constructor(\n\t\tfamily: ChangeFamily<ChangeFamilyEditor, DefaultChangeset>,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tchangeReceiver: (change: TaggedChange<DefaultChangeset>) => void,\n\t\tprivate readonly options: EditorOptions = { canMakeDetachedRootEdits: false },\n\t) {\n\t\tthis.modularBuilder = new ModularEditBuilder(family, fieldKinds, changeReceiver);\n\t}\n\n\tpublic enterTransaction(): void {\n\t\tif (this.modularBuilder.isInTransaction() === false) {\n\t\t\tthis.nodesWithoutCells.clear();\n\t\t}\n\t\tthis.modularBuilder.enterTransaction();\n\t}\n\tpublic exitTransaction(): void {\n\t\tthis.modularBuilder.exitTransaction();\n\t\tif (this.modularBuilder.isInTransaction() === false) {\n\t\t\tthis.nodesWithoutCells.clear();\n\t\t}\n\t}\n\n\tpublic addNodeExistsConstraint(path: NormalizedUpPath): void {\n\t\tenforceEditsToDetachedTreesOptions(\n\t\t\t{ parent: path.parent, field: path.parentField },\n\t\t\tthis.options,\n\t\t);\n\t\tthis.modularBuilder.addNodeExistsConstraint(path, this.mintRevisionTag());\n\t}\n\n\tpublic addNodeExistsConstraintOnRevert(path: NormalizedUpPath): void {\n\t\tenforceEditsToDetachedTreesOptions(\n\t\t\t{ parent: path.parent, field: path.parentField },\n\t\t\tthis.options,\n\t\t);\n\t\tthis.modularBuilder.addNodeExistsConstraintOnRevert(path, this.mintRevisionTag());\n\t}\n\n\tpublic buildRoots(content: TreeChunk): DetachedRootIds {\n\t\tconst detachedRoots = [];\n\t\tconst count = content.topLevelLength;\n\t\tif (count > 0) {\n\t\t\tconst buildRevision = this.mintRevisionTag();\n\t\t\tconst buildId = {\n\t\t\t\tlocalId: this.modularBuilder.generateId(count),\n\t\t\t\trevision: buildRevision,\n\t\t\t};\n\t\t\tconst build = this.modularBuilder.buildTrees(buildId.localId, content, buildRevision);\n\t\t\tthis.modularBuilder.submitChanges([build], buildRevision);\n\t\t\tdetachedRoots.push({ first: buildId, count });\n\t\t\tthis.nodesWithoutCells.set(buildId.localId, count, true);\n\t\t}\n\t\treturn detachedRoots;\n\t}\n\n\tpublic valueField(\n\t\tfield: NormalizedFieldUpPath,\n\t): RequiredFieldEditor<TreeChunk, ChangeAtomId> {\n\t\tenforceEditsToDetachedTreesOptions(field, this.options);\n\t\tconst makeAttachEditDescription = (\n\t\t\tfill: ChangeAtomId,\n\t\t\trevision: RevisionTag,\n\t\t): FieldEditDescription => {\n\t\t\tconst detachLocalId = this.modularBuilder.generateId();\n\t\t\tconst detach = { localId: detachLocalId, revision };\n\t\t\tconst change = valueFieldKind.changeHandler.editor.set({ fill, detach });\n\t\t\treturn {\n\t\t\t\ttype: \"field\",\n\t\t\t\tfield,\n\t\t\t\tfieldKind: valueFieldKind.identifier,\n\t\t\t\tchange: brand(change),\n\t\t\t\trevision,\n\t\t\t};\n\t\t};\n\t\treturn {\n\t\t\tset: (newContent: TreeChunk): void => {\n\t\t\t\tassert(newContent.topLevelLength === 1, \"Expected exactly one node\");\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst buildLocalId = this.modularBuilder.generateId();\n\t\t\t\tconst buildId = { localId: buildLocalId, revision };\n\t\t\t\tconst build = this.modularBuilder.buildTrees(buildLocalId, newContent, revision);\n\t\t\t\tconst attach = makeAttachEditDescription(buildId, revision);\n\t\t\t\tthis.modularBuilder.submitChanges([build, attach], revision);\n\t\t\t},\n\n\t\t\tattach: (newContent: ChangeAtomId): void => {\n\t\t\t\tconst isWithoutCell = this.nodesWithoutCells.delete(newContent.localId, 1) === 1;\n\t\t\t\tif (!isWithoutCell) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\"A hydrated node that has been attached before cannot be attached into an object's required field. Assign new content to the field instead.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst attach = makeAttachEditDescription(newContent, revision);\n\t\t\t\tthis.modularBuilder.submitChanges([attach], revision);\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic optionalField(\n\t\tfield: NormalizedFieldUpPath,\n\t): OptionalFieldEditor<TreeChunk, ChangeAtomId> {\n\t\tenforceEditsToDetachedTreesOptions(field, this.options);\n\t\tconst makeAttachEditDescription = (\n\t\t\tfill: ChangeAtomId,\n\t\t\trevision: RevisionTag,\n\t\t\twasEmpty: boolean,\n\t\t): FieldEditDescription => {\n\t\t\tconst detachLocalId = this.modularBuilder.generateId();\n\t\t\tconst detach = { localId: detachLocalId, revision };\n\t\t\tconst change = optional.changeHandler.editor.set(wasEmpty, { fill, detach });\n\t\t\treturn {\n\t\t\t\ttype: \"field\",\n\t\t\t\tfield,\n\t\t\t\tfieldKind: optional.identifier,\n\t\t\t\tchange: brand(change),\n\t\t\t\trevision,\n\t\t\t};\n\t\t};\n\t\tconst editBuilder = {\n\t\t\tset: (newContent: TreeChunk | undefined, wasEmpty: boolean): void => {\n\t\t\t\tif (newContent === undefined) {\n\t\t\t\t\teditBuilder.clear(wasEmpty);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tassert(newContent.topLevelLength === 1, \"Expected exactly one node\");\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst buildLocalId = this.modularBuilder.generateId();\n\t\t\t\tconst buildId = { localId: buildLocalId, revision };\n\t\t\t\tconst build = this.modularBuilder.buildTrees(buildLocalId, newContent, revision);\n\t\t\t\tconst attach = makeAttachEditDescription(buildId, revision, wasEmpty);\n\t\t\t\tthis.modularBuilder.submitChanges([build, attach], revision);\n\t\t\t},\n\t\t\tattach: (content: ChangeAtomId | undefined, wasEmpty: boolean): void => {\n\t\t\t\tif (content === undefined) {\n\t\t\t\t\teditBuilder.clear(wasEmpty);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst isWithoutCell = this.nodesWithoutCells.delete(content.localId, 1) === 1;\n\t\t\t\tif (!isWithoutCell && this.options.canMakeDetachedRootEdits !== true) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Attach edits require a minimum version for collaboration >= TBD.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst edits: EditDescription[] = [];\n\t\t\t\tlet stableSrcId: ChangeAtomId;\n\t\t\t\tif (isWithoutCell) {\n\t\t\t\t\tstableSrcId = content;\n\t\t\t\t} else {\n\t\t\t\t\t// If the node has an associated cell, then it may be concurrently moved to another location.\n\t\t\t\t\t// We use a rename to ensure that the node will be moved to a specific grave before the attach.\n\t\t\t\t\tstableSrcId = { localId: this.modularBuilder.generateId(), revision };\n\t\t\t\t\tconst rename: GlobalEditDescription = {\n\t\t\t\t\t\ttype: \"global\",\n\t\t\t\t\t\trevision,\n\t\t\t\t\t\trenames: [\n\t\t\t\t\t\t\t{ count: 1, oldId: content, newId: stableSrcId, detachLocation: undefined },\n\t\t\t\t\t\t],\n\t\t\t\t\t};\n\t\t\t\t\tedits.push(rename);\n\t\t\t\t}\n\t\t\t\tconst attach = makeAttachEditDescription(stableSrcId, revision, wasEmpty);\n\t\t\t\tedits.push(attach);\n\t\t\t\tthis.modularBuilder.submitChanges(edits, revision);\n\t\t\t},\n\t\t\tclear: (wasEmpty: boolean): void => {\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst detach: ChangeAtomId = { localId: this.modularBuilder.generateId(), revision };\n\t\t\t\tconst optionalChange = optional.changeHandler.editor.clear(wasEmpty, detach);\n\t\t\t\tconst change: FieldChangeset = brand(optionalChange);\n\t\t\t\tconst edit: FieldEditDescription = {\n\t\t\t\t\ttype: \"field\",\n\t\t\t\t\tfield,\n\t\t\t\t\tfieldKind: optional.identifier,\n\t\t\t\t\tchange,\n\t\t\t\t\trevision,\n\t\t\t\t};\n\t\t\t\tthis.modularBuilder.submitChanges([edit], revision);\n\t\t\t},\n\t\t};\n\t\treturn editBuilder;\n\t}\n\n\tpublic move(\n\t\tsourceField: NormalizedFieldUpPath,\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestinationField: NormalizedFieldUpPath,\n\t\tdestIndex: number,\n\t): void {\n\t\tif (count === 0) {\n\t\t\treturn;\n\t\t} else if (count < 0 || !Number.isSafeInteger(count)) {\n\t\t\tthrow new UsageError(`Expected non-negative integer count, got ${count}.`);\n\t\t}\n\t\tenforceEditsToDetachedTreesOptions(sourceField, this.options);\n\t\tenforceEditsToDetachedTreesOptions(destinationField, this.options);\n\t\tconst revision = this.mintRevisionTag();\n\t\tconst detachCellId = this.modularBuilder.generateId(count);\n\t\tconst attachCellId: CellId = { localId: this.modularBuilder.generateId(count), revision };\n\t\tif (compareFieldUpPaths(sourceField, destinationField)) {\n\t\t\tconst change = sequence.changeHandler.editor.move(\n\t\t\t\tsourceIndex,\n\t\t\t\tcount,\n\t\t\t\tdestIndex,\n\t\t\t\tdetachCellId,\n\t\t\t\tattachCellId,\n\t\t\t\trevision,\n\t\t\t);\n\t\t\tthis.modularBuilder.submitChange(\n\t\t\t\tsourceField,\n\t\t\t\tsequence.identifier,\n\t\t\t\tbrand(change),\n\t\t\t\trevision,\n\t\t\t);\n\t\t} else {\n\t\t\tconst detachPath = topDownPath(sourceField.parent);\n\t\t\tconst attachPath = topDownPath(destinationField.parent);\n\t\t\tconst sharedDepth = getSharedPrefixLength(detachPath, attachPath);\n\t\t\tlet adjustedAttachField = destinationField;\n\t\t\t// `sharedDepth` is the number of elements, starting from the root, that both paths have in common.\n\t\t\tif (sharedDepth === detachPath.length) {\n\t\t\t\tconst lowestCommonAncestor: NormalizedUpPath | undefined = attachPath[sharedDepth];\n\t\t\t\tconst attachField = lowestCommonAncestor?.parentField ?? destinationField.field;\n\t\t\t\tif (attachField === sourceField.field) {\n\t\t\t\t\t// The detach occurs in an ancestor field of the field where the attach occurs.\n\t\t\t\t\tconst attachAncestorIndex = lowestCommonAncestor?.parentIndex ?? destIndex;\n\t\t\t\t\tif (attachAncestorIndex < sourceIndex) {\n\t\t\t\t\t\t// The attach path runs through a node located before the detached nodes.\n\t\t\t\t\t\t// No need to adjust the attach path.\n\t\t\t\t\t} else if (sourceIndex + count <= attachAncestorIndex) {\n\t\t\t\t\t\t// The attach path runs through a node located after the detached nodes.\n\t\t\t\t\t\t// adjust the index for the node at that depth of the path, so that it is interpreted correctly\n\t\t\t\t\t\t// in the composition performed by `submitChanges`.\n\t\t\t\t\t\tconst adjustedAttachAncestorIndex = attachAncestorIndex - count;\n\t\t\t\t\t\tlet parent: NormalizedUpPath =\n\t\t\t\t\t\t\tlowestCommonAncestor === undefined\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tparent: undefined,\n\t\t\t\t\t\t\t\t\t\tdetachedNodeId: undefined,\n\t\t\t\t\t\t\t\t\t\tparentIndex: adjustedAttachAncestorIndex,\n\t\t\t\t\t\t\t\t\t\tparentField: destinationField.field,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t...lowestCommonAncestor,\n\t\t\t\t\t\t\t\t\t\tparentIndex: adjustedAttachAncestorIndex,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (let i = sharedDepth + 1; i < attachPath.length; i += 1) {\n\t\t\t\t\t\t\tparent = {\n\t\t\t\t\t\t\t\t...(attachPath[i] ?? oob()),\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tadjustedAttachField = { parent, field: destinationField.field };\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\"Invalid move operation: the destination is located under one of the moved elements. Consider using the Tree.contains API to detect this.\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst moveOut = sequence.changeHandler.editor.remove(\n\t\t\t\tsourceIndex,\n\t\t\t\tcount,\n\t\t\t\tdetachCellId,\n\t\t\t\trevision,\n\t\t\t);\n\t\t\tconst moveIn = sequence.changeHandler.editor.insert(\n\t\t\t\tdestIndex,\n\t\t\t\tcount,\n\t\t\t\tattachCellId,\n\t\t\t\trevision,\n\t\t\t\tdetachCellId,\n\t\t\t);\n\n\t\t\tthis.modularBuilder.submitChanges(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"field\",\n\t\t\t\t\t\tfield: sourceField,\n\t\t\t\t\t\tfieldKind: sequence.identifier,\n\t\t\t\t\t\tchange: brand(moveOut),\n\t\t\t\t\t\trevision,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"field\",\n\t\t\t\t\t\tfield: adjustedAttachField,\n\t\t\t\t\t\tfieldKind: sequence.identifier,\n\t\t\t\t\t\tchange: brand(moveIn),\n\t\t\t\t\t\trevision,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\trevision,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic sequenceField(\n\t\tfield: NormalizedFieldUpPath,\n\t): SequenceFieldEditor<TreeChunk, DetachedRootIds> {\n\t\tenforceEditsToDetachedTreesOptions(field, this.options);\n\t\tconst makeAttachEditDescription = (\n\t\t\tindex: number,\n\t\t\t{ first, count }: DetachedRootIdRange,\n\t\t\trevision: RevisionTag,\n\t\t\tareWithoutCells: boolean,\n\t\t): EditDescription[] => {\n\t\t\tconst edits: EditDescription[] = [];\n\t\t\t// If the nodes have never been attached in cell, then we must use a cell ID that matches the build ID.\n\t\t\t// This ensures back-compatibility with the v1 ModularChangeFamily model which requires that every node be associated with cell\n\t\t\t// by generating an insert whose destination cell is the cell associated with the build ID.\n\t\t\tlet stableSrcId: ChangeAtomId;\n\t\t\tif (areWithoutCells) {\n\t\t\t\tstableSrcId = first;\n\t\t\t} else {\n\t\t\t\t// If the node has an associated cell, then it may be concurrently moved to another location.\n\t\t\t\t// We use a rename to ensure that the node will be moved to a specific grave before the attach.\n\t\t\t\tstableSrcId = { localId: this.modularBuilder.generateId(count), revision };\n\t\t\t\tconst rename: GlobalEditDescription = {\n\t\t\t\t\ttype: \"global\",\n\t\t\t\t\trevision,\n\t\t\t\t\trenames: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\toldId: first,\n\t\t\t\t\t\t\tnewId: stableSrcId,\n\t\t\t\t\t\t\tdetachLocation: undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t\tedits.push(rename);\n\t\t\t}\n\t\t\tassert(stableSrcId.revision !== undefined, \"Detached nodes ID must have a revision\");\n\t\t\tconst change = sequence.changeHandler.editor.insert(\n\t\t\t\tindex,\n\t\t\t\tcount,\n\t\t\t\tstableSrcId,\n\t\t\t\tstableSrcId.revision,\n\t\t\t\tstableSrcId.localId,\n\t\t\t);\n\t\t\tconst attach: FieldEditDescription = {\n\t\t\t\ttype: \"field\",\n\t\t\t\tfield,\n\t\t\t\tfieldKind: sequence.identifier,\n\t\t\t\tchange: brand(change),\n\t\t\t\trevision,\n\t\t\t};\n\t\t\tedits.push(attach);\n\t\t\treturn edits;\n\t\t};\n\t\tconst editBuilder = {\n\t\t\tinsert: (index: number, content: TreeChunk): void => {\n\t\t\t\tconst count = content.topLevelLength;\n\t\t\t\tif (count === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst buildLocalId = this.modularBuilder.generateId();\n\t\t\t\tconst build = this.modularBuilder.buildTrees(buildLocalId, content, revision);\n\t\t\t\tconst roots: DetachedRootIdRange = {\n\t\t\t\t\tfirst: { localId: buildLocalId, revision },\n\t\t\t\t\tcount,\n\t\t\t\t};\n\n\t\t\t\tconst attach = makeAttachEditDescription(index, roots, revision, true);\n\t\t\t\tthis.modularBuilder.submitChanges([build, ...attach], revision);\n\t\t\t},\n\t\t\tattach: (index: number, newContent: DetachedRootIds): void => {\n\t\t\t\tconst attachRevision = this.mintRevisionTag();\n\t\t\t\tlet areAllWithoutCells = true;\n\t\t\t\tlet insertOffset = 0;\n\t\t\t\tconst edits: EditDescription[] = [];\n\t\t\t\tfor (const range of newContent) {\n\t\t\t\t\tif (range.count === 0) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst countWithoutCells = this.nodesWithoutCells.delete(\n\t\t\t\t\t\trange.first.localId,\n\t\t\t\t\t\trange.count,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcountWithoutCells === 0 || countWithoutCells === range.count,\n\t\t\t\t\t\t\"All detached roots within the same ID range must either all have or all not have a cell\",\n\t\t\t\t\t);\n\t\t\t\t\tconst areWithoutCells = countWithoutCells === range.count;\n\t\t\t\t\tif (!areWithoutCells) {\n\t\t\t\t\t\tareAllWithoutCells = false;\n\t\t\t\t\t}\n\t\t\t\t\tconst renameAndAttach = makeAttachEditDescription(\n\t\t\t\t\t\tindex + insertOffset,\n\t\t\t\t\t\trange,\n\t\t\t\t\t\tattachRevision,\n\t\t\t\t\t\tareWithoutCells,\n\t\t\t\t\t);\n\t\t\t\t\tedits.push(...renameAndAttach);\n\t\t\t\t\tinsertOffset += range.count;\n\t\t\t\t}\n\t\t\t\tif (!areAllWithoutCells && this.options.canMakeDetachedRootEdits !== true) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Attach edits require a minimum version for collaboration >= TBD.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (edits.length > 0) {\n\t\t\t\t\tthis.modularBuilder.submitChanges(edits, attachRevision);\n\t\t\t\t}\n\t\t\t},\n\t\t\tremove: (index: number, count: number): void => {\n\t\t\t\tif (count === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst id = this.modularBuilder.generateId(count);\n\t\t\t\tconst change: FieldChangeset = brand(\n\t\t\t\t\tsequence.changeHandler.editor.remove(index, count, id, revision),\n\t\t\t\t);\n\t\t\t\tthis.modularBuilder.submitChange(field, sequence.identifier, change, revision);\n\t\t\t},\n\t\t};\n\t\treturn editBuilder;\n\t}\n}\n\nfunction enforceEditsToDetachedTreesOptions(field: FieldUpPath, options: EditorOptions): void {\n\tif (options.canMakeDetachedRootEdits !== true) {\n\t\tconst topField = getDetachedFieldContainingFieldPath(field);\n\t\tif (topField !== rootField) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Edits and constraints on detached trees require a minimum version for collaboration >= TBD.`,\n\t\t\t);\n\t\t}\n\t}\n}\n\nexport interface RequiredFieldEditor<TContent, TDetachedRoot> {\n\t/**\n\t * Issues a change which replaces the content of the field with the given detached node.\n\t * @param content - The content to be attached in the field in the given order.\n\t * Must represent a single detached node.\n\t * Must have been created in the same JS turn.\n\t *\n\t * Requires SharedTreeFormatVersion.vDetachedRoots or later.\n\t */\n\tattach(content: TDetachedRoot): void;\n\n\t/**\n\t * Issues a change which replaces the content of the field with `newContent`.\n\t * @param newContent - the new content for the field.\n\t */\n\tset(newContent: TContent): void;\n}\n\nexport interface OptionalFieldEditor<TContent, TDetachedRoots> {\n\t/**\n\t * Issues a change which replaces the content of the field with the given detached node.\n\t * @param content - The content to be attached in the field in the given order.\n\t * Must represent a single detached node.\n\t *\n\t * Requires SharedTreeFormatVersion.vDetachedRoots or later.\n\t */\n\tattach(content: TDetachedRoots | undefined, wasEmpty: boolean): void;\n\n\t/**\n\t * Issues a change which clears content of the field.\n\t * @param wasEmpty - whether the field is empty when creating this change\n\t */\n\tclear(wasEmpty: boolean): void;\n\n\t/**\n\t * Issues a change which replaces the content of the field with `newContent`\n\t * @param newContent - the new content for the field.\n\t * @param wasEmpty - whether the field is empty when creating this change\n\t */\n\tset(newContent: TContent | undefined, wasEmpty: boolean): void;\n}\n\n/**\n * Editor for the sequence field kind.\n */\nexport interface SequenceFieldEditor<TContent, TDetachedRoots, TRemoved = void> {\n\t/**\n\t * Issues a change which attaches a sequence of detached nodes at the given `index`.\n\t * @param index - The index at which to attach the detached nodes.\n\t * @param detachedContent - The content to be attached in the field in the given order. Each node must be detached.\n\t *\n\t * Requires SharedTreeFormatVersion.vDetachedRoots or later.\n\t */\n\tattach(index: number, detachedContent: TDetachedRoots): void;\n\n\t/**\n\t * Issues a change which inserts the `newContent` at the given `index`.\n\t * @param index - the index at which to insert the `newContent`.\n\t * @param newContent - the new content to be inserted in the field.\n\t */\n\tinsert(index: number, newContent: TContent): void;\n\n\t/**\n\t * Issues a change which removes `count` elements starting at the given `index`.\n\t * @param index - The index of the first removed element.\n\t * @param count - The number of elements to remove.\n\t */\n\tremove(index: number, count: number): TRemoved;\n}\n\n/**\n * Gets the number of path elements that both paths share, starting at index 0.\n */\nfunction getSharedPrefixLength(pathA: readonly UpPath[], pathB: readonly UpPath[]): number {\n\tconst minDepth = Math.min(pathA.length, pathB.length);\n\tlet sharedDepth = 0;\n\twhile (sharedDepth < minDepth) {\n\t\tconst detachStep = pathA[sharedDepth] ?? oob();\n\t\tconst attachStep = pathB[sharedDepth] ?? oob();\n\t\tif (detachStep !== attachStep) {\n\t\t\tif (\n\t\t\t\tdetachStep.parentField !== attachStep.parentField ||\n\t\t\t\tdetachStep.parentIndex !== attachStep.parentIndex\n\t\t\t) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tsharedDepth += 1;\n\t}\n\treturn sharedDepth;\n}\n"]}
1
+ {"version":3,"file":"defaultEditBuilder.js","sourceRoot":"","sources":["../../../src/feature-libraries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AAC,cAAc,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;YAChF,CAAC;SACD,CAAC;IACH,CAAC;CACD;AAsCD;;GAEG;AACH,SAAS,qBAAqB,CAAC,KAAwB,EAAE,KAAwB;IAChF,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtD,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,OAAO,WAAW,GAAG,QAAQ,EAAE,CAAC;QAC/B,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,GAAG,EAAE,CAAC;QAC/C,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,GAAG,EAAE,CAAC;QAC/C,IAAI,UAAU,KAAK,UAAU,EAAE,CAAC;YAC/B,IACC,UAAU,CAAC,WAAW,KAAK,UAAU,CAAC,WAAW;gBACjD,UAAU,CAAC,WAAW,KAAK,UAAU,CAAC,WAAW,EAChD,CAAC;gBACF,MAAM;YACP,CAAC;QACF,CAAC;QACD,WAAW,IAAI,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,WAAW,CAAC;AACpB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ICodecFamily } from \"../../codec/index.js\";\nimport {\n\ttype ChangeAtomId,\n\ttype ChangeEncodingContext,\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\ttype ChangeRebaser,\n\ttype DeltaDetachedNodeId,\n\ttype DeltaRoot,\n\ttype FieldUpPath,\n\ttype NormalizedFieldUpPath,\n\ttype NormalizedUpPath,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\ttype TreeChunk,\n\ttype UpPath,\n\tcompareFieldUpPaths,\n\ttopDownPath,\n} from \"../../core/index.js\";\nimport { brand } from \"../../util/index.js\";\nimport {\n\ttype EditDescription,\n\ttype FieldChangeset,\n\ttype FieldEditDescription,\n\tModularChangeFamily,\n\ttype ModularChangeset,\n\tModularEditBuilder,\n\tintoDelta as intoModularDelta,\n\trelevantRemovedRoots as relevantModularRemovedRoots,\n} from \"../modular-schema/index.js\";\nimport type { OptionalChangeset } from \"../optional-field/index.js\";\nimport type { CellId } from \"../sequence-field/index.js\";\n\nimport {\n\tfieldKinds,\n\toptional,\n\tsequence,\n\trequired as valueFieldKind,\n} from \"./defaultFieldKinds.js\";\n\nexport type DefaultChangeset = ModularChangeset;\n\n/**\n * Implementation of {@link ChangeFamily} based on the default set of supported field kinds.\n *\n * @sealed\n */\nexport class DefaultChangeFamily\n\timplements ChangeFamily<DefaultEditBuilder, DefaultChangeset>\n{\n\tprivate readonly modularFamily: ModularChangeFamily;\n\n\tpublic constructor(codecs: ICodecFamily<ModularChangeset, ChangeEncodingContext>) {\n\t\tthis.modularFamily = new ModularChangeFamily(fieldKinds, codecs);\n\t}\n\n\tpublic get rebaser(): ChangeRebaser<DefaultChangeset> {\n\t\treturn this.modularFamily.rebaser;\n\t}\n\n\tpublic get codecs(): ICodecFamily<DefaultChangeset, ChangeEncodingContext> {\n\t\treturn this.modularFamily.codecs;\n\t}\n\n\tpublic buildEditor(\n\t\tmintRevisionTag: () => RevisionTag,\n\t\tchangeReceiver: (change: TaggedChange<DefaultChangeset>) => void,\n\t): DefaultEditBuilder {\n\t\treturn new DefaultEditBuilder(this, mintRevisionTag, changeReceiver);\n\t}\n}\n\n/**\n * @param change - The change to convert into a delta.\n */\nexport function intoDelta(taggedChange: TaggedChange<ModularChangeset>): DeltaRoot {\n\treturn intoModularDelta(taggedChange, fieldKinds);\n}\n\n/**\n * Returns the set of removed roots that should be in memory for the given change to be applied.\n * A removed root is relevant if any of the following is true:\n * - It is being inserted\n * - It is being restored\n * - It is being edited\n * - The ID it is associated with is being changed\n *\n * May be conservative by returning more removed roots than strictly necessary.\n *\n * Will never return IDs for non-root trees, even if they are removed.\n *\n * @param change - The change to be applied.\n */\nexport function relevantRemovedRoots(change: ModularChangeset): Iterable<DeltaDetachedNodeId> {\n\treturn relevantModularRemovedRoots(change, fieldKinds);\n}\n\n/**\n * Default editor for transactional tree data changes.\n * @privateRemarks\n * When taking into account not just the content of the tree,\n * but also how the merge identities (and thus anchors, flex-tree and simple-tree nodes) of nodes before and after the edits correspond,\n * some edits are currently impossible to express.\n * Examples of these non-expressible edits include:\n *\n * - Changing the type of a node while keeping its merge identity.\n * - Changing the value of a leaf while keeping its merge identity.\n * - Swapping subtrees between two value fields.\n * - Replacing a node in the middle of a tree while reusing some of the old nodes decedents that were under value fields.\n *\n * At some point it will likely be worth supporting at least some of these, possibly using a mechanism that could support all of them if desired.\n * If/when such a mechanism becomes available, an evaluation should be done to determine if any existing editing operations should be changed to leverage it\n * (Possibly by adding opt ins at the view schema layer).\n */\nexport interface IDefaultEditBuilder<TContent = TreeChunk> {\n\t/**\n\t * @param field - the value field which is being edited under the parent node\n\t * @returns An object with methods to edit the given field of the given parent.\n\t * The returned object can be used (i.e., have its methods called) multiple times but its lifetime\n\t * is bounded by the lifetime of this edit builder.\n\t */\n\tvalueField(field: NormalizedFieldUpPath): ValueFieldEditBuilder<TContent>;\n\n\t/**\n\t * @param field - the optional field which is being edited under the parent node\n\t * @returns An object with methods to edit the given field of the given parent.\n\t * The returned object can be used (i.e., have its methods called) multiple times but its lifetime\n\t * is bounded by the lifetime of this edit builder.\n\t */\n\toptionalField(field: NormalizedFieldUpPath): OptionalFieldEditBuilder<TContent>;\n\n\t/**\n\t * @param field - the sequence field which is being edited under the parent node\n\t *\n\t * @returns An object with methods to edit the given field of the given parent.\n\t * The returned object can be used (i.e., have its methods called) multiple times but its lifetime\n\t * is bounded by the lifetime of this edit builder.\n\t */\n\tsequenceField(field: NormalizedFieldUpPath): SequenceFieldEditBuilder<TContent>;\n\n\t/**\n\t * Moves a subsequence from one sequence field to another sequence field.\n\t *\n\t * Note that the `destinationIndex` is interpreted based on the state of the sequence *before* the move operation.\n\t * For example, `move(field, 0, 1, field, 2)` changes `[A, B, C]` to `[B, A, C]`.\n\t */\n\tmove(\n\t\tsourceField: NormalizedFieldUpPath,\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestinationField: NormalizedFieldUpPath,\n\t\tdestinationIndex: number,\n\t): void;\n\n\t/**\n\t * Add a constraint that the node at the given path must exist.\n\t * @param path - The path to the node that must exist.\n\t */\n\taddNodeExistsConstraint(path: NormalizedUpPath): void;\n\n\t/**\n\t * Add a constraint that the node at the given path must exist when reverting a change.\n\t * @param path - The path to the node that must exist when reverting a change.\n\t */\n\taddNodeExistsConstraintOnRevert(path: NormalizedUpPath): void;\n}\n\n/**\n * Implementation of {@link IDefaultEditBuilder} based on the default set of supported field kinds.\n * @sealed\n */\nexport class DefaultEditBuilder implements ChangeFamilyEditor, IDefaultEditBuilder {\n\tprivate readonly modularBuilder: ModularEditBuilder;\n\n\tpublic constructor(\n\t\tfamily: ChangeFamily<ChangeFamilyEditor, DefaultChangeset>,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tchangeReceiver: (change: TaggedChange<DefaultChangeset>) => void,\n\t) {\n\t\tthis.modularBuilder = new ModularEditBuilder(family, fieldKinds, changeReceiver);\n\t}\n\n\tpublic enterTransaction(): void {\n\t\tthis.modularBuilder.enterTransaction();\n\t}\n\tpublic exitTransaction(): void {\n\t\tthis.modularBuilder.exitTransaction();\n\t}\n\n\tpublic addNodeExistsConstraint(path: UpPath): void {\n\t\tthis.modularBuilder.addNodeExistsConstraint(path, this.mintRevisionTag());\n\t}\n\n\tpublic addNodeExistsConstraintOnRevert(path: UpPath): void {\n\t\tthis.modularBuilder.addNodeExistsConstraintOnRevert(path, this.mintRevisionTag());\n\t}\n\n\tpublic valueField(field: FieldUpPath): ValueFieldEditBuilder<TreeChunk> {\n\t\treturn {\n\t\t\tset: (newContent: TreeChunk): void => {\n\t\t\t\tassert(\n\t\t\t\t\tnewContent.topLevelLength === 1,\n\t\t\t\t\t0xc12 /* Value fields should have a single top level node */,\n\t\t\t\t);\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst fill: ChangeAtomId = { localId: this.modularBuilder.generateId(), revision };\n\t\t\t\tconst detach: ChangeAtomId = { localId: this.modularBuilder.generateId(), revision };\n\t\t\t\tconst build = this.modularBuilder.buildTrees(fill.localId, newContent, revision);\n\t\t\t\tconst change: FieldChangeset = brand(\n\t\t\t\t\tvalueFieldKind.changeHandler.editor.set({\n\t\t\t\t\t\tfill,\n\t\t\t\t\t\tdetach,\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tconst edit: FieldEditDescription = {\n\t\t\t\t\ttype: \"field\",\n\t\t\t\t\tfield,\n\t\t\t\t\tfieldKind: valueFieldKind.identifier,\n\t\t\t\t\tchange,\n\t\t\t\t\trevision,\n\t\t\t\t};\n\t\t\t\tthis.modularBuilder.submitChanges([build, edit], revision);\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic optionalField(field: FieldUpPath): OptionalFieldEditBuilder<TreeChunk> {\n\t\treturn {\n\t\t\tset: (newContent: TreeChunk | undefined, wasEmpty: boolean): void => {\n\t\t\t\t// The choice to ban empty chunks here instead of treating them as a clear is a subjective choice made to err of the side of more explicitness and stricter validation.\n\t\t\t\tassert(\n\t\t\t\t\tnewContent === undefined || newContent.topLevelLength === 1,\n\t\t\t\t\t0xc13 /* optional fields should have a single top level node, or undefined */,\n\t\t\t\t);\n\t\t\t\tconst edits: EditDescription[] = [];\n\t\t\t\tlet optionalChange: OptionalChangeset;\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst detach: ChangeAtomId = { localId: this.modularBuilder.generateId(), revision };\n\t\t\t\tif (newContent !== undefined) {\n\t\t\t\t\tconst fill: ChangeAtomId = { localId: this.modularBuilder.generateId(), revision };\n\t\t\t\t\tconst build = this.modularBuilder.buildTrees(fill.localId, newContent, revision);\n\t\t\t\t\tedits.push(build);\n\n\t\t\t\t\toptionalChange = optional.changeHandler.editor.set(wasEmpty, {\n\t\t\t\t\t\tfill,\n\t\t\t\t\t\tdetach,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\toptionalChange = optional.changeHandler.editor.clear(wasEmpty, detach);\n\t\t\t\t}\n\n\t\t\t\tconst change: FieldChangeset = brand(optionalChange);\n\t\t\t\tconst edit: FieldEditDescription = {\n\t\t\t\t\ttype: \"field\",\n\t\t\t\t\tfield,\n\t\t\t\t\tfieldKind: optional.identifier,\n\t\t\t\t\tchange,\n\t\t\t\t\trevision,\n\t\t\t\t};\n\t\t\t\tedits.push(edit);\n\n\t\t\t\tthis.modularBuilder.submitChanges(edits, revision);\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic move(\n\t\tsourceField: FieldUpPath,\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestinationField: FieldUpPath,\n\t\tdestIndex: number,\n\t): void {\n\t\tif (count === 0) {\n\t\t\treturn;\n\t\t} else if (count < 0 || !Number.isSafeInteger(count)) {\n\t\t\tthrow new UsageError(`Expected non-negative integer count, got ${count}.`);\n\t\t}\n\t\tconst revision = this.mintRevisionTag();\n\t\tconst detachCellId = this.modularBuilder.generateId(count);\n\t\tconst attachCellId: CellId = { localId: this.modularBuilder.generateId(count), revision };\n\t\tif (compareFieldUpPaths(sourceField, destinationField)) {\n\t\t\tconst change = sequence.changeHandler.editor.move(\n\t\t\t\tsourceIndex,\n\t\t\t\tcount,\n\t\t\t\tdestIndex,\n\t\t\t\tdetachCellId,\n\t\t\t\tattachCellId,\n\t\t\t\trevision,\n\t\t\t);\n\t\t\tthis.modularBuilder.submitChange(\n\t\t\t\tsourceField,\n\t\t\t\tsequence.identifier,\n\t\t\t\tbrand(change),\n\t\t\t\trevision,\n\t\t\t);\n\t\t} else {\n\t\t\tconst detachPath = topDownPath(sourceField.parent);\n\t\t\tconst attachPath = topDownPath(destinationField.parent);\n\t\t\tconst sharedDepth = getSharedPrefixLength(detachPath, attachPath);\n\t\t\tlet adjustedAttachField = destinationField;\n\t\t\t// After the above loop, `sharedDepth` is the number of elements, starting from the root,\n\t\t\t// that both paths have in common.\n\t\t\tif (sharedDepth === detachPath.length) {\n\t\t\t\tconst attachField = attachPath[sharedDepth]?.parentField ?? destinationField.field;\n\t\t\t\tif (attachField === sourceField.field) {\n\t\t\t\t\t// The detach occurs in an ancestor field of the field where the attach occurs.\n\t\t\t\t\tlet attachAncestorIndex = attachPath[sharedDepth]?.parentIndex ?? sourceIndex;\n\t\t\t\t\tif (attachAncestorIndex < sourceIndex) {\n\t\t\t\t\t\t// The attach path runs through a node located before the detached nodes.\n\t\t\t\t\t\t// No need to adjust the attach path.\n\t\t\t\t\t} else if (sourceIndex + count <= attachAncestorIndex) {\n\t\t\t\t\t\t// The attach path runs through a node located after the detached nodes.\n\t\t\t\t\t\t// adjust the index for the node at that depth of the path, so that it is interpreted correctly\n\t\t\t\t\t\t// in the composition performed by `submitChanges`.\n\t\t\t\t\t\tattachAncestorIndex -= count;\n\t\t\t\t\t\tlet parent: UpPath | undefined = attachPath[sharedDepth - 1];\n\t\t\t\t\t\tconst parentField = attachPath[sharedDepth] ?? oob();\n\t\t\t\t\t\tparent = {\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tparentIndex: attachAncestorIndex,\n\t\t\t\t\t\t\tparentField: parentField.parentField,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (let i = sharedDepth + 1; i < attachPath.length; i += 1) {\n\t\t\t\t\t\t\tparent = {\n\t\t\t\t\t\t\t\t...(attachPath[i] ?? oob()),\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tadjustedAttachField = { parent, field: destinationField.field };\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\"Invalid move operation: the destination is located under one of the moved elements. Consider using the Tree.contains API to detect this.\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst moveOut = sequence.changeHandler.editor.moveOut(\n\t\t\t\tsourceIndex,\n\t\t\t\tcount,\n\t\t\t\tdetachCellId,\n\t\t\t\trevision,\n\t\t\t);\n\t\t\tconst moveIn = sequence.changeHandler.editor.moveIn(\n\t\t\t\tdestIndex,\n\t\t\t\tcount,\n\t\t\t\tdetachCellId,\n\t\t\t\tattachCellId,\n\t\t\t\trevision,\n\t\t\t);\n\t\t\tthis.modularBuilder.submitChanges(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"field\",\n\t\t\t\t\t\tfield: sourceField,\n\t\t\t\t\t\tfieldKind: sequence.identifier,\n\t\t\t\t\t\tchange: brand(moveOut),\n\t\t\t\t\t\trevision,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"field\",\n\t\t\t\t\t\tfield: adjustedAttachField,\n\t\t\t\t\t\tfieldKind: sequence.identifier,\n\t\t\t\t\t\tchange: brand(moveIn),\n\t\t\t\t\t\trevision,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\trevision,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic sequenceField(field: FieldUpPath): SequenceFieldEditBuilder<TreeChunk> {\n\t\treturn {\n\t\t\tinsert: (index: number, content: TreeChunk): void => {\n\t\t\t\tconst length = content.topLevelLength;\n\t\t\t\tif (length === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst firstId: CellId = { localId: this.modularBuilder.generateId(length), revision };\n\t\t\t\tconst build = this.modularBuilder.buildTrees(firstId.localId, content, revision);\n\t\t\t\tconst change: FieldChangeset = brand(\n\t\t\t\t\tsequence.changeHandler.editor.insert(index, length, firstId, revision),\n\t\t\t\t);\n\t\t\t\tconst attach: FieldEditDescription = {\n\t\t\t\t\ttype: \"field\",\n\t\t\t\t\tfield,\n\t\t\t\t\tfieldKind: sequence.identifier,\n\t\t\t\t\tchange,\n\t\t\t\t\trevision,\n\t\t\t\t};\n\t\t\t\t// The changes have to be submitted together, otherwise they will be assigned different revisions,\n\t\t\t\t// which will prevent the build ID and the insert ID from matching.\n\t\t\t\tthis.modularBuilder.submitChanges([build, attach], revision);\n\t\t\t},\n\t\t\tremove: (index: number, count: number): void => {\n\t\t\t\tif (count === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst id = this.modularBuilder.generateId(count);\n\t\t\t\tconst change: FieldChangeset = brand(\n\t\t\t\t\tsequence.changeHandler.editor.remove(index, count, id, revision),\n\t\t\t\t);\n\t\t\t\tthis.modularBuilder.submitChange(field, sequence.identifier, change, revision);\n\t\t\t},\n\t\t};\n\t}\n}\n\nexport interface ValueFieldEditBuilder<TContent> {\n\t/**\n\t * Issues a change which replaces the current newContent of the field with `newContent`.\n\t * @param newContent - the new content for the field.\n\t */\n\tset(newContent: TContent): void;\n}\n\nexport interface OptionalFieldEditBuilder<TContent> {\n\t/**\n\t * Issues a change which replaces the current newContent of the field with `newContent`.\n\t * @param newContent - the new content for the field.\n\t * @param wasEmpty - whether the field is empty when creating this change.\n\t */\n\tset(newContent: TContent | undefined, wasEmpty: boolean): void;\n}\n\n/**\n * Edit builder for the sequence field kind.\n */\nexport interface SequenceFieldEditBuilder<TContent, TRemoved = void> {\n\t/**\n\t * Issues a change which inserts the `newContent` at the given `index`.\n\t * @param index - the index at which to insert the `newContent`.\n\t * @param newContent - the new content to be inserted in the field. Cursor can be in either Field or Node mode.\n\t */\n\tinsert(index: number, newContent: TContent): void;\n\n\t/**\n\t * Issues a change which removes `count` elements starting at the given `index`.\n\t * @param index - The index of the first removed element.\n\t * @param count - The number of elements to remove.\n\t */\n\tremove(index: number, count: number): TRemoved;\n}\n\n/**\n * Gets the number of path elements that both paths share, starting at index 0.\n */\nfunction getSharedPrefixLength(pathA: readonly UpPath[], pathB: readonly UpPath[]): number {\n\tconst minDepth = Math.min(pathA.length, pathB.length);\n\tlet sharedDepth = 0;\n\twhile (sharedDepth < minDepth) {\n\t\tconst detachStep = pathA[sharedDepth] ?? oob();\n\t\tconst attachStep = pathB[sharedDepth] ?? oob();\n\t\tif (detachStep !== attachStep) {\n\t\t\tif (\n\t\t\t\tdetachStep.parentField !== attachStep.parentField ||\n\t\t\t\tdetachStep.parentIndex !== attachStep.parentIndex\n\t\t\t) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tsharedDepth += 1;\n\t}\n\treturn sharedDepth;\n}\n"]}
@@ -82,7 +82,7 @@ export declare const identifier: FlexFieldKind<FieldEditor<0>, import("../../uti
82
82
  */
83
83
  export declare const forbidden: FlexFieldKind<FieldEditor<0>, import("../../util/brand.js").BrandedType<string, "tree.FieldKindIdentifier"> & "Forbidden", Multiplicity.Forbidden>;
84
84
  export declare const fieldKindConfigurations: ReadonlyMap<ModularChangeFormatVersion, FieldKindConfiguration>;
85
- export type ModularChangeFormatVersion = Brand<3 | 4 | 101, "ModularChangeFormatVersion">;
85
+ export type ModularChangeFormatVersion = Brand<3 | 4, "ModularChangeFormatVersion">;
86
86
  export declare function getCodecTreeForModularChangeFormat(version: ModularChangeFormatVersion): CodecTree;
87
87
  /**
88
88
  * All supported field kinds.
@@ -1 +1 @@
1
- {"version":3,"file":"defaultFieldKinds.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultFieldKinds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,YAAY,EAEjB,KAAK,mBAAmB,EACxB,4BAA4B,EAC5B,YAAY,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAE3B,aAAa,EACb,KAAK,gBAAgB,EAGrB,MAA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AQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CAC4B,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBAEjC,CAAC"}
@@ -21,7 +21,8 @@ export const noChangeHandler = {
21
21
  }),
22
22
  codecsFactory: () => noChangeCodecFamily,
23
23
  editor: { buildChildChanges: () => fail(0xb0d /* Child changes not supported */) },
24
- intoDelta: (change, deltaFromChild) => [],
24
+ intoDelta: (change, deltaFromChild) => ({}),
25
+ relevantRemovedRoots: (change) => [],
25
26
  isEmpty: (change) => true,
26
27
  getNestedChanges: (change) => [],
27
28
  createEmpty: () => 0,
@@ -134,16 +135,6 @@ export const fieldKindConfigurations = new Map([
134
135
  [identifier.identifier, { kind: identifier, formatVersion: 1 }],
135
136
  ]),
136
137
  ],
137
- [
138
- brand(101), // Detached roots
139
- new Map([
140
- [required.identifier, { kind: required, formatVersion: 2 }],
141
- [optional.identifier, { kind: optional, formatVersion: 2 }],
142
- [sequence.identifier, { kind: sequence, formatVersion: 2 }],
143
- [forbidden.identifier, { kind: forbidden, formatVersion: 1 }],
144
- [identifier.identifier, { kind: identifier, formatVersion: 1 }],
145
- ]),
146
- ],
147
138
  ]);
148
139
  export function getCodecTreeForModularChangeFormat(version) {
149
140
  const dependencies = fieldKindConfigurations.get(version) ?? fail(0xc7c /* Unknown modular change format */);