@fluidframework/tree 2.73.0 → 2.74.0-368706

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 (1294) hide show
  1. package/.vscode/settings.json +2 -2
  2. package/api-report/tree.alpha.api.md +133 -85
  3. package/api-report/tree.beta.api.md +0 -1
  4. package/api-report/tree.legacy.beta.api.md +0 -1
  5. package/api-report/tree.legacy.public.api.md +0 -1
  6. package/api-report/tree.public.api.md +0 -1
  7. package/dist/alpha.d.ts +7 -2
  8. package/dist/codec/codec.d.ts +14 -1
  9. package/dist/codec/codec.d.ts.map +1 -1
  10. package/dist/codec/codec.js +11 -0
  11. package/dist/codec/codec.js.map +1 -1
  12. package/dist/codec/versioned/codec.d.ts +1 -1
  13. package/dist/codec/versioned/codec.d.ts.map +1 -1
  14. package/dist/codec/versioned/codec.js.map +1 -1
  15. package/dist/codec/versioned/format.d.ts +4 -1
  16. package/dist/codec/versioned/format.d.ts.map +1 -1
  17. package/dist/codec/versioned/format.js +4 -1
  18. package/dist/codec/versioned/format.js.map +1 -1
  19. package/dist/core/change-family/changeFamily.d.ts +4 -1
  20. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  21. package/dist/core/change-family/changeFamily.js.map +1 -1
  22. package/dist/core/change-family/index.d.ts +1 -1
  23. package/dist/core/change-family/index.d.ts.map +1 -1
  24. package/dist/core/change-family/index.js.map +1 -1
  25. package/dist/core/index.d.ts +3 -3
  26. package/dist/core/index.d.ts.map +1 -1
  27. package/dist/core/index.js +7 -4
  28. package/dist/core/index.js.map +1 -1
  29. package/dist/core/rebase/changeRebaser.d.ts +6 -1
  30. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  31. package/dist/core/rebase/changeRebaser.js.map +1 -1
  32. package/dist/core/rebase/index.d.ts +1 -1
  33. package/dist/core/rebase/index.d.ts.map +1 -1
  34. package/dist/core/rebase/index.js +2 -1
  35. package/dist/core/rebase/index.js.map +1 -1
  36. package/dist/core/rebase/types.d.ts +2 -1
  37. package/dist/core/rebase/types.d.ts.map +1 -1
  38. package/dist/core/rebase/types.js +5 -1
  39. package/dist/core/rebase/types.js.map +1 -1
  40. package/dist/core/rebase/utils.d.ts.map +1 -1
  41. package/dist/core/rebase/utils.js +25 -7
  42. package/dist/core/rebase/utils.js.map +1 -1
  43. package/dist/core/tree/detachedFieldIndex.d.ts +40 -13
  44. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  45. package/dist/core/tree/detachedFieldIndex.js +21 -12
  46. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  47. package/dist/core/tree/index.d.ts +4 -3
  48. package/dist/core/tree/index.d.ts.map +1 -1
  49. package/dist/core/tree/index.js +6 -2
  50. package/dist/core/tree/index.js.map +1 -1
  51. package/dist/core/tree/pathTree.d.ts +11 -3
  52. package/dist/core/tree/pathTree.d.ts.map +1 -1
  53. package/dist/core/tree/pathTree.js +14 -2
  54. package/dist/core/tree/pathTree.js.map +1 -1
  55. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/basicChunk.js +7 -0
  57. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  59. package/dist/feature-libraries/chunked-forest/chunkTree.js +4 -1
  60. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +2 -2
  62. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/codecs.js +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +15 -7
  66. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
  67. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +7 -2
  69. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  70. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +90 -42
  71. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  72. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +234 -69
  73. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  74. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +4 -4
  75. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  76. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +33 -28
  77. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  78. package/dist/feature-libraries/default-schema/index.d.ts +2 -1
  79. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  80. package/dist/feature-libraries/default-schema/index.js +4 -2
  81. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  82. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +36 -0
  83. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
  84. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js +126 -0
  85. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
  86. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +7 -6
  87. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  88. package/dist/feature-libraries/default-schema/mappedEditBuilder.js +15 -0
  89. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  90. package/dist/feature-libraries/deltaUtils.d.ts +1 -0
  91. package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
  92. package/dist/feature-libraries/deltaUtils.js +6 -1
  93. package/dist/feature-libraries/deltaUtils.js.map +1 -1
  94. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +30 -8
  95. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  96. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +41 -11
  97. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  98. package/dist/feature-libraries/flex-tree/context.d.ts +9 -0
  99. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  100. package/dist/feature-libraries/flex-tree/context.js +6 -0
  101. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  102. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
  103. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  104. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  105. package/dist/feature-libraries/flex-tree/lazyField.d.ts +8 -7
  106. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  107. package/dist/feature-libraries/flex-tree/lazyField.js +37 -8
  108. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  109. package/dist/feature-libraries/forest-summary/codec.d.ts +2 -2
  110. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  111. package/dist/feature-libraries/forest-summary/codec.js +4 -4
  112. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  113. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +9 -13
  114. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  115. package/dist/feature-libraries/forest-summary/forestSummarizer.js +22 -27
  116. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  117. package/dist/feature-libraries/forest-summary/format.d.ts +41 -5
  118. package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
  119. package/dist/feature-libraries/forest-summary/format.js +7 -7
  120. package/dist/feature-libraries/forest-summary/format.js.map +1 -1
  121. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +11 -9
  122. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  123. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +16 -29
  124. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  125. package/dist/feature-libraries/forest-summary/index.d.ts +2 -1
  126. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  127. package/dist/feature-libraries/forest-summary/index.js +3 -2
  128. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  129. package/dist/feature-libraries/forest-summary/summaryTypes.d.ts +47 -0
  130. package/dist/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -0
  131. package/dist/feature-libraries/forest-summary/summaryTypes.js +57 -0
  132. package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -0
  133. package/dist/feature-libraries/index.d.ts +5 -5
  134. package/dist/feature-libraries/index.d.ts.map +1 -1
  135. package/dist/feature-libraries/index.js +7 -4
  136. package/dist/feature-libraries/index.js.map +1 -1
  137. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  138. package/dist/feature-libraries/mapTreeCursor.js +1 -0
  139. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  140. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  141. package/dist/feature-libraries/mitigatedChangeFamily.js +2 -2
  142. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  143. package/dist/feature-libraries/modular-schema/comparison.d.ts +18 -2
  144. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  145. package/dist/feature-libraries/modular-schema/comparison.js +54 -3
  146. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  147. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +97 -21
  148. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  149. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +4 -7
  150. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  151. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +20 -52
  152. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  153. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  154. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +25 -13
  155. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  156. package/dist/feature-libraries/modular-schema/fieldKind.js +0 -21
  157. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  158. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  159. package/dist/feature-libraries/modular-schema/genericFieldKind.js +7 -10
  160. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  161. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +2 -2
  162. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  163. package/dist/feature-libraries/modular-schema/index.d.ts +5 -5
  164. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  165. package/dist/feature-libraries/modular-schema/index.js +12 -8
  166. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  167. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +17 -0
  168. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -0
  169. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +388 -0
  170. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -0
  171. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +17 -0
  172. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -0
  173. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +413 -0
  174. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -0
  175. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +4 -4
  176. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  177. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +8 -284
  178. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  179. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +48 -15
  180. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  181. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1298 -465
  182. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  183. package/dist/feature-libraries/modular-schema/{modularChangeFormat.d.ts → modularChangeFormatV1.d.ts} +2 -2
  184. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -0
  185. package/dist/feature-libraries/modular-schema/{modularChangeFormat.js → modularChangeFormatV1.js} +5 -5
  186. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -0
  187. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +146 -0
  188. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -0
  189. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +32 -0
  190. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -0
  191. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +50 -10
  192. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  193. package/dist/feature-libraries/modular-schema/modularChangeTypes.js +24 -3
  194. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  195. package/dist/feature-libraries/optional-field/index.d.ts +2 -2
  196. package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
  197. package/dist/feature-libraries/optional-field/index.js +1 -2
  198. package/dist/feature-libraries/optional-field/index.js.map +1 -1
  199. package/dist/feature-libraries/optional-field/optionalField.d.ts +5 -26
  200. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  201. package/dist/feature-libraries/optional-field/optionalField.js +217 -451
  202. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  203. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +24 -33
  204. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
  205. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
  206. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
  207. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  208. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js +57 -28
  209. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  210. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +27 -8
  211. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  212. package/dist/feature-libraries/schema-index/schemaSummarizer.js +42 -16
  213. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  214. package/dist/feature-libraries/sequence-field/compose.d.ts +6 -7
  215. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  216. package/dist/feature-libraries/sequence-field/compose.js +80 -256
  217. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  218. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  219. package/dist/feature-libraries/sequence-field/formatV2.js +1 -0
  220. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  221. package/dist/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
  222. package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  223. package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  224. package/dist/feature-libraries/sequence-field/index.d.ts +2 -3
  225. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  226. package/dist/feature-libraries/sequence-field/index.js +1 -3
  227. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  228. package/dist/feature-libraries/sequence-field/invert.d.ts +3 -3
  229. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  230. package/dist/feature-libraries/sequence-field/invert.js +65 -167
  231. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  232. package/dist/feature-libraries/sequence-field/markQueue.d.ts +2 -2
  233. package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  234. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  235. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
  236. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  237. package/dist/feature-libraries/sequence-field/moveEffectTable.js +7 -86
  238. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  239. package/dist/feature-libraries/sequence-field/rebase.d.ts +3 -3
  240. package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  241. package/dist/feature-libraries/sequence-field/rebase.js +106 -112
  242. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  243. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  244. package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -33
  245. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  246. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  247. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +0 -2
  248. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  249. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
  250. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  251. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +358 -179
  252. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  253. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  254. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +20 -60
  255. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  256. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
  257. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  258. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
  259. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  260. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
  261. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  262. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +14 -109
  263. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  264. package/dist/feature-libraries/sequence-field/types.d.ts +30 -59
  265. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  266. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  267. package/dist/feature-libraries/sequence-field/utils.d.ts +15 -24
  268. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  269. package/dist/feature-libraries/sequence-field/utils.js +111 -299
  270. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  271. package/dist/feature-libraries/treeCompressionUtils.d.ts +2 -12
  272. package/dist/feature-libraries/treeCompressionUtils.d.ts.map +1 -1
  273. package/dist/feature-libraries/treeCompressionUtils.js +4 -14
  274. package/dist/feature-libraries/treeCompressionUtils.js.map +1 -1
  275. package/dist/index.d.ts +3 -3
  276. package/dist/index.d.ts.map +1 -1
  277. package/dist/index.js +6 -3
  278. package/dist/index.js.map +1 -1
  279. package/dist/packageVersion.d.ts +1 -1
  280. package/dist/packageVersion.d.ts.map +1 -1
  281. package/dist/packageVersion.js +1 -1
  282. package/dist/packageVersion.js.map +1 -1
  283. package/dist/shared-tree/independentView.d.ts +1 -1
  284. package/dist/shared-tree/independentView.d.ts.map +1 -1
  285. package/dist/shared-tree/independentView.js.map +1 -1
  286. package/dist/shared-tree/index.d.ts +1 -1
  287. package/dist/shared-tree/index.d.ts.map +1 -1
  288. package/dist/shared-tree/index.js.map +1 -1
  289. package/dist/shared-tree/schematizeTree.d.ts +4 -4
  290. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  291. package/dist/shared-tree/schematizeTree.js +2 -1
  292. package/dist/shared-tree/schematizeTree.js.map +1 -1
  293. package/dist/shared-tree/schematizingTreeView.d.ts +1 -5
  294. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  295. package/dist/shared-tree/schematizingTreeView.js +32 -33
  296. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  297. package/dist/shared-tree/sharedTree.d.ts +18 -15
  298. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  299. package/dist/shared-tree/sharedTree.js +15 -4
  300. package/dist/shared-tree/sharedTree.js.map +1 -1
  301. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  302. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  303. package/dist/shared-tree/sharedTreeChangeCodecs.js +1 -0
  304. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  305. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +20 -8
  306. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  307. package/dist/shared-tree/sharedTreeChangeEnricher.js +25 -11
  308. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  309. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +6 -6
  310. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  311. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  312. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  313. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
  314. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  315. package/dist/shared-tree/sharedTreeEditBuilder.js +13 -6
  316. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  317. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  318. package/dist/shared-tree/treeAlpha.js +1 -1
  319. package/dist/shared-tree/treeAlpha.js.map +1 -1
  320. package/dist/shared-tree/treeCheckout.d.ts +14 -12
  321. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  322. package/dist/shared-tree/treeCheckout.js +66 -17
  323. package/dist/shared-tree/treeCheckout.js.map +1 -1
  324. package/dist/shared-tree-core/branch.d.ts +3 -2
  325. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  326. package/dist/shared-tree-core/branch.js +4 -3
  327. package/dist/shared-tree-core/branch.js.map +1 -1
  328. package/dist/shared-tree-core/editManager.d.ts +2 -2
  329. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  330. package/dist/shared-tree-core/editManager.js +9 -9
  331. package/dist/shared-tree-core/editManager.js.map +1 -1
  332. package/dist/shared-tree-core/editManagerCodecs.d.ts +4 -0
  333. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  334. package/dist/shared-tree-core/editManagerCodecs.js +16 -6
  335. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  336. package/{lib/shared-tree-core/editManagerCodecsV5.d.ts → dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts} +3 -3
  337. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -0
  338. package/dist/shared-tree-core/{editManagerCodecsV5.js → editManagerCodecsVSharedBranches.js} +7 -7
  339. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -0
  340. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +20 -6
  341. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  342. package/dist/shared-tree-core/editManagerFormatCommons.js +22 -7
  343. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  344. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  345. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  346. package/dist/shared-tree-core/editManagerFormatV1toV4.js +1 -0
  347. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  348. package/dist/shared-tree-core/{editManagerFormatV5.d.ts → editManagerFormatVSharedBranches.d.ts} +3 -3
  349. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -0
  350. package/dist/shared-tree-core/{editManagerFormatV5.js → editManagerFormatVSharedBranches.js} +2 -2
  351. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -0
  352. package/dist/shared-tree-core/editManagerSummarizer.d.ts +29 -9
  353. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  354. package/dist/shared-tree-core/editManagerSummarizer.js +41 -13
  355. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  356. package/dist/shared-tree-core/index.d.ts +5 -3
  357. package/dist/shared-tree-core/index.d.ts.map +1 -1
  358. package/dist/shared-tree-core/index.js +8 -1
  359. package/dist/shared-tree-core/index.js.map +1 -1
  360. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  361. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  362. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  363. package/{lib/shared-tree-core/messageCodecV5.d.ts → dist/shared-tree-core/messageCodecVSharedBranches.d.ts} +2 -2
  364. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -0
  365. package/dist/shared-tree-core/{messageCodecV5.js → messageCodecVSharedBranches.js} +6 -6
  366. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -0
  367. package/dist/shared-tree-core/messageCodecs.d.ts +4 -0
  368. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  369. package/dist/shared-tree-core/messageCodecs.js +16 -6
  370. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  371. package/dist/shared-tree-core/messageFormat.d.ts +20 -6
  372. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  373. package/dist/shared-tree-core/messageFormat.js +22 -7
  374. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  375. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
  376. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  377. package/dist/shared-tree-core/messageFormatV1ToV4.js +8 -1
  378. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  379. package/dist/shared-tree-core/{messageFormatV5.d.ts → messageFormatVSharedBranches.d.ts} +5 -7
  380. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -0
  381. package/dist/shared-tree-core/{messageFormatV5.js → messageFormatVSharedBranches.js} +3 -2
  382. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -0
  383. package/dist/shared-tree-core/sharedTreeCore.d.ts +14 -47
  384. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  385. package/dist/shared-tree-core/sharedTreeCore.js +30 -18
  386. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  387. package/dist/shared-tree-core/summaryTypes.d.ts +94 -0
  388. package/dist/shared-tree-core/summaryTypes.d.ts.map +1 -0
  389. package/dist/shared-tree-core/summaryTypes.js +47 -0
  390. package/dist/shared-tree-core/summaryTypes.js.map +1 -0
  391. package/dist/shared-tree-core/versionedSummarizer.d.ts +67 -0
  392. package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -0
  393. package/dist/shared-tree-core/versionedSummarizer.js +63 -0
  394. package/dist/shared-tree-core/versionedSummarizer.js.map +1 -0
  395. package/dist/simple-tree/api/configuration.d.ts +3 -26
  396. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  397. package/dist/simple-tree/api/configuration.js +10 -21
  398. package/dist/simple-tree/api/configuration.js.map +1 -1
  399. package/dist/simple-tree/api/dirtyIndex.d.ts +11 -0
  400. package/dist/simple-tree/api/dirtyIndex.d.ts.map +1 -1
  401. package/dist/simple-tree/api/dirtyIndex.js +7 -0
  402. package/dist/simple-tree/api/dirtyIndex.js.map +1 -1
  403. package/dist/simple-tree/api/discrepancies.d.ts +1 -1
  404. package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
  405. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  406. package/dist/simple-tree/api/getSimpleSchema.d.ts +3 -3
  407. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  408. package/dist/simple-tree/api/getSimpleSchema.js +9 -3
  409. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  410. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +16 -13
  411. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
  412. package/dist/simple-tree/api/incrementalAllowedTypes.js +24 -14
  413. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  414. package/dist/simple-tree/api/index.d.ts +4 -5
  415. package/dist/simple-tree/api/index.d.ts.map +1 -1
  416. package/dist/simple-tree/api/index.js +5 -6
  417. package/dist/simple-tree/api/index.js.map +1 -1
  418. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
  419. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  420. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  421. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +5 -5
  422. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  423. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  424. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  425. package/dist/simple-tree/api/schemaFactoryRecursive.js +0 -1
  426. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  427. package/dist/simple-tree/api/schemaFromSimple.d.ts +6 -1
  428. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  429. package/dist/simple-tree/api/schemaFromSimple.js +5 -0
  430. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  431. package/dist/simple-tree/api/schemaStatics.d.ts +12 -12
  432. package/dist/simple-tree/api/simpleSchemaCodec.d.ts +15 -3
  433. package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
  434. package/dist/simple-tree/api/simpleSchemaCodec.js +18 -6
  435. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  436. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
  437. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  438. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  439. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +8 -1
  440. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  441. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +13 -8
  442. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  443. package/dist/simple-tree/api/tree.d.ts +1 -1
  444. package/dist/simple-tree/api/tree.js.map +1 -1
  445. package/dist/simple-tree/api/typesUnsafe.d.ts +3 -3
  446. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  447. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  448. package/dist/simple-tree/core/allowedTypes.d.ts +2 -2
  449. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
  450. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  451. package/dist/simple-tree/core/index.d.ts +1 -1
  452. package/dist/simple-tree/core/index.d.ts.map +1 -1
  453. package/dist/simple-tree/core/index.js +2 -3
  454. package/dist/simple-tree/core/index.js.map +1 -1
  455. package/dist/simple-tree/core/toStored.d.ts +17 -15
  456. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  457. package/dist/simple-tree/core/toStored.js +5 -40
  458. package/dist/simple-tree/core/toStored.js.map +1 -1
  459. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  460. package/dist/simple-tree/core/treeNodeKernel.js +1 -0
  461. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  462. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
  463. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  464. package/dist/simple-tree/core/unhydratedFlexTree.js +59 -8
  465. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  466. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
  467. package/dist/simple-tree/core/walkSchema.js +4 -0
  468. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  469. package/dist/simple-tree/createContext.d.ts.map +1 -1
  470. package/dist/simple-tree/createContext.js +20 -5
  471. package/dist/simple-tree/createContext.js.map +1 -1
  472. package/dist/simple-tree/fieldSchema.d.ts +7 -7
  473. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  474. package/dist/simple-tree/fieldSchema.js.map +1 -1
  475. package/dist/simple-tree/index.d.ts +8 -7
  476. package/dist/simple-tree/index.d.ts.map +1 -1
  477. package/dist/simple-tree/index.js +16 -13
  478. package/dist/simple-tree/index.js.map +1 -1
  479. package/dist/simple-tree/leafNodeSchema.d.ts +5 -5
  480. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  481. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  482. package/dist/simple-tree/node-kinds/array/arrayNode.js +6 -3
  483. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  484. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +3 -3
  485. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  486. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  487. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
  488. package/dist/simple-tree/node-kinds/common.js +1 -1
  489. package/dist/simple-tree/node-kinds/common.js.map +1 -1
  490. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  491. package/dist/simple-tree/node-kinds/map/mapNode.js +2 -2
  492. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  493. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +3 -3
  494. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  495. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  496. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  497. package/dist/simple-tree/node-kinds/object/objectNode.js +19 -18
  498. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  499. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +2 -2
  500. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  501. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  502. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  503. package/dist/simple-tree/node-kinds/record/recordNode.js +4 -2
  504. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  505. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -3
  506. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  507. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  508. package/dist/simple-tree/prepareForInsertion.d.ts +54 -47
  509. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  510. package/dist/simple-tree/prepareForInsertion.js +183 -125
  511. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  512. package/dist/simple-tree/simpleSchema.d.ts +55 -23
  513. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  514. package/dist/simple-tree/simpleSchema.js +17 -0
  515. package/dist/simple-tree/simpleSchema.js.map +1 -1
  516. package/dist/simple-tree/simpleSchemaFormatV1.d.ts +1 -1
  517. package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
  518. package/dist/simple-tree/simpleSchemaFormatV1.js +8 -1
  519. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  520. package/dist/simple-tree/toStoredSchema.d.ts +58 -11
  521. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  522. package/dist/simple-tree/toStoredSchema.js +205 -30
  523. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  524. package/dist/simple-tree/treeSchema.d.ts +23 -0
  525. package/dist/simple-tree/treeSchema.d.ts.map +1 -0
  526. package/dist/simple-tree/treeSchema.js +25 -0
  527. package/dist/simple-tree/treeSchema.js.map +1 -0
  528. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +13 -4
  529. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  530. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +29 -11
  531. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  532. package/dist/tableSchema.d.ts +117 -63
  533. package/dist/tableSchema.d.ts.map +1 -1
  534. package/dist/tableSchema.js +159 -58
  535. package/dist/tableSchema.js.map +1 -1
  536. package/dist/treeFactory.d.ts +5 -0
  537. package/dist/treeFactory.d.ts.map +1 -1
  538. package/dist/treeFactory.js +29 -8
  539. package/dist/treeFactory.js.map +1 -1
  540. package/dist/util/breakable.js +3 -3
  541. package/dist/util/breakable.js.map +1 -1
  542. package/dist/util/index.d.ts +2 -1
  543. package/dist/util/index.d.ts.map +1 -1
  544. package/dist/util/index.js +4 -1
  545. package/dist/util/index.js.map +1 -1
  546. package/dist/util/rangeMap.d.ts +24 -12
  547. package/dist/util/rangeMap.d.ts.map +1 -1
  548. package/dist/util/rangeMap.js +46 -6
  549. package/dist/util/rangeMap.js.map +1 -1
  550. package/dist/util/readSnapshotBlob.d.ts +13 -0
  551. package/dist/util/readSnapshotBlob.d.ts.map +1 -0
  552. package/dist/util/readSnapshotBlob.js +18 -0
  553. package/dist/util/readSnapshotBlob.js.map +1 -0
  554. package/dist/util/typeCheckTests.d.ts.map +1 -1
  555. package/dist/util/typeCheckTests.js.map +1 -1
  556. package/lib/alpha.d.ts +7 -2
  557. package/lib/codec/codec.d.ts +14 -1
  558. package/lib/codec/codec.d.ts.map +1 -1
  559. package/lib/codec/codec.js +11 -0
  560. package/lib/codec/codec.js.map +1 -1
  561. package/lib/codec/versioned/codec.d.ts +1 -1
  562. package/lib/codec/versioned/codec.d.ts.map +1 -1
  563. package/lib/codec/versioned/codec.js.map +1 -1
  564. package/lib/codec/versioned/format.d.ts +4 -1
  565. package/lib/codec/versioned/format.d.ts.map +1 -1
  566. package/lib/codec/versioned/format.js +4 -1
  567. package/lib/codec/versioned/format.js.map +1 -1
  568. package/lib/core/change-family/changeFamily.d.ts +4 -1
  569. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  570. package/lib/core/change-family/changeFamily.js.map +1 -1
  571. package/lib/core/change-family/index.d.ts +1 -1
  572. package/lib/core/change-family/index.d.ts.map +1 -1
  573. package/lib/core/change-family/index.js.map +1 -1
  574. package/lib/core/index.d.ts +3 -3
  575. package/lib/core/index.d.ts.map +1 -1
  576. package/lib/core/index.js +2 -2
  577. package/lib/core/index.js.map +1 -1
  578. package/lib/core/rebase/changeRebaser.d.ts +6 -1
  579. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  580. package/lib/core/rebase/changeRebaser.js.map +1 -1
  581. package/lib/core/rebase/index.d.ts +1 -1
  582. package/lib/core/rebase/index.d.ts.map +1 -1
  583. package/lib/core/rebase/index.js +1 -1
  584. package/lib/core/rebase/index.js.map +1 -1
  585. package/lib/core/rebase/types.d.ts +2 -1
  586. package/lib/core/rebase/types.d.ts.map +1 -1
  587. package/lib/core/rebase/types.js +3 -0
  588. package/lib/core/rebase/types.js.map +1 -1
  589. package/lib/core/rebase/utils.d.ts.map +1 -1
  590. package/lib/core/rebase/utils.js +25 -7
  591. package/lib/core/rebase/utils.js.map +1 -1
  592. package/lib/core/tree/detachedFieldIndex.d.ts +40 -13
  593. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  594. package/lib/core/tree/detachedFieldIndex.js +22 -13
  595. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  596. package/lib/core/tree/index.d.ts +4 -3
  597. package/lib/core/tree/index.d.ts.map +1 -1
  598. package/lib/core/tree/index.js +3 -2
  599. package/lib/core/tree/index.js.map +1 -1
  600. package/lib/core/tree/pathTree.d.ts +11 -3
  601. package/lib/core/tree/pathTree.d.ts.map +1 -1
  602. package/lib/core/tree/pathTree.js +12 -1
  603. package/lib/core/tree/pathTree.js.map +1 -1
  604. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  605. package/lib/feature-libraries/chunked-forest/basicChunk.js +8 -1
  606. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  607. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  608. package/lib/feature-libraries/chunked-forest/chunkTree.js +4 -1
  609. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  610. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +2 -2
  611. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  612. package/lib/feature-libraries/chunked-forest/codec/codecs.js +2 -2
  613. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  614. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +15 -7
  615. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
  616. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
  617. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +7 -2
  618. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  619. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +90 -42
  620. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  621. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +232 -69
  622. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  623. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +4 -4
  624. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  625. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +34 -29
  626. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  627. package/lib/feature-libraries/default-schema/index.d.ts +2 -1
  628. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  629. package/lib/feature-libraries/default-schema/index.js +2 -1
  630. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  631. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +36 -0
  632. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
  633. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js +122 -0
  634. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
  635. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +7 -6
  636. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  637. package/lib/feature-libraries/default-schema/mappedEditBuilder.js +15 -0
  638. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  639. package/lib/feature-libraries/deltaUtils.d.ts +1 -0
  640. package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
  641. package/lib/feature-libraries/deltaUtils.js +5 -1
  642. package/lib/feature-libraries/deltaUtils.js.map +1 -1
  643. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +30 -8
  644. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  645. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +38 -8
  646. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  647. package/lib/feature-libraries/flex-tree/context.d.ts +9 -0
  648. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  649. package/lib/feature-libraries/flex-tree/context.js +6 -0
  650. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  651. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
  652. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  653. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  654. package/lib/feature-libraries/flex-tree/lazyField.d.ts +8 -7
  655. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  656. package/lib/feature-libraries/flex-tree/lazyField.js +38 -9
  657. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  658. package/lib/feature-libraries/forest-summary/codec.d.ts +2 -2
  659. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  660. package/lib/feature-libraries/forest-summary/codec.js +5 -5
  661. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  662. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +9 -13
  663. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  664. package/lib/feature-libraries/forest-summary/forestSummarizer.js +19 -24
  665. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  666. package/lib/feature-libraries/forest-summary/format.d.ts +41 -5
  667. package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
  668. package/lib/feature-libraries/forest-summary/format.js +3 -3
  669. package/lib/feature-libraries/forest-summary/format.js.map +1 -1
  670. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +11 -9
  671. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  672. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +13 -26
  673. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  674. package/lib/feature-libraries/forest-summary/index.d.ts +2 -1
  675. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  676. package/lib/feature-libraries/forest-summary/index.js +2 -1
  677. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  678. package/lib/feature-libraries/forest-summary/summaryTypes.d.ts +47 -0
  679. package/lib/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -0
  680. package/lib/feature-libraries/forest-summary/summaryTypes.js +53 -0
  681. package/lib/feature-libraries/forest-summary/summaryTypes.js.map +1 -0
  682. package/lib/feature-libraries/index.d.ts +5 -5
  683. package/lib/feature-libraries/index.d.ts.map +1 -1
  684. package/lib/feature-libraries/index.js +4 -4
  685. package/lib/feature-libraries/index.js.map +1 -1
  686. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  687. package/lib/feature-libraries/mapTreeCursor.js +2 -1
  688. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  689. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  690. package/lib/feature-libraries/mitigatedChangeFamily.js +2 -2
  691. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  692. package/lib/feature-libraries/modular-schema/comparison.d.ts +18 -2
  693. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  694. package/lib/feature-libraries/modular-schema/comparison.js +55 -5
  695. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  696. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +97 -21
  697. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  698. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +3 -5
  699. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  700. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +20 -52
  701. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  702. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  703. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +25 -13
  704. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  705. package/lib/feature-libraries/modular-schema/fieldKind.js +0 -21
  706. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  707. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  708. package/lib/feature-libraries/modular-schema/genericFieldKind.js +7 -10
  709. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  710. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +1 -1
  711. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  712. package/lib/feature-libraries/modular-schema/index.d.ts +5 -5
  713. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  714. package/lib/feature-libraries/modular-schema/index.js +4 -3
  715. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  716. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +17 -0
  717. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -0
  718. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +384 -0
  719. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -0
  720. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +17 -0
  721. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -0
  722. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js +409 -0
  723. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -0
  724. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +4 -4
  725. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  726. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +10 -286
  727. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  728. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +48 -15
  729. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  730. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1284 -458
  731. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  732. package/lib/feature-libraries/modular-schema/{modularChangeFormat.d.ts → modularChangeFormatV1.d.ts} +2 -2
  733. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -0
  734. package/lib/feature-libraries/modular-schema/{modularChangeFormat.js → modularChangeFormatV1.js} +2 -2
  735. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -0
  736. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +146 -0
  737. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -0
  738. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +29 -0
  739. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -0
  740. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +50 -10
  741. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  742. package/lib/feature-libraries/modular-schema/modularChangeTypes.js +20 -2
  743. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  744. package/lib/feature-libraries/optional-field/index.d.ts +2 -2
  745. package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
  746. package/lib/feature-libraries/optional-field/index.js +1 -1
  747. package/lib/feature-libraries/optional-field/index.js.map +1 -1
  748. package/lib/feature-libraries/optional-field/optionalField.d.ts +5 -26
  749. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  750. package/lib/feature-libraries/optional-field/optionalField.js +217 -449
  751. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  752. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +24 -33
  753. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
  754. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
  755. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
  756. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  757. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +55 -26
  758. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  759. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +27 -8
  760. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  761. package/lib/feature-libraries/schema-index/schemaSummarizer.js +38 -12
  762. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  763. package/lib/feature-libraries/sequence-field/compose.d.ts +6 -7
  764. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  765. package/lib/feature-libraries/sequence-field/compose.js +82 -258
  766. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  767. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  768. package/lib/feature-libraries/sequence-field/formatV2.js +1 -0
  769. package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
  770. package/lib/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
  771. package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  772. package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  773. package/lib/feature-libraries/sequence-field/index.d.ts +2 -3
  774. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  775. package/lib/feature-libraries/sequence-field/index.js +0 -1
  776. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  777. package/lib/feature-libraries/sequence-field/invert.d.ts +3 -3
  778. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  779. package/lib/feature-libraries/sequence-field/invert.js +67 -169
  780. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  781. package/lib/feature-libraries/sequence-field/markQueue.d.ts +2 -2
  782. package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  783. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  784. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
  785. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  786. package/lib/feature-libraries/sequence-field/moveEffectTable.js +6 -80
  787. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  788. package/lib/feature-libraries/sequence-field/rebase.d.ts +3 -3
  789. package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  790. package/lib/feature-libraries/sequence-field/rebase.js +108 -114
  791. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  792. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  793. package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -33
  794. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  795. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  796. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +0 -2
  797. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  798. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
  799. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  800. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +350 -175
  801. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  802. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  803. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +21 -61
  804. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  805. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
  806. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  807. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
  808. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  809. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
  810. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  811. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +14 -109
  812. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  813. package/lib/feature-libraries/sequence-field/types.d.ts +30 -59
  814. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  815. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  816. package/lib/feature-libraries/sequence-field/utils.d.ts +15 -24
  817. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  818. package/lib/feature-libraries/sequence-field/utils.js +107 -292
  819. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  820. package/lib/feature-libraries/treeCompressionUtils.d.ts +2 -12
  821. package/lib/feature-libraries/treeCompressionUtils.d.ts.map +1 -1
  822. package/lib/feature-libraries/treeCompressionUtils.js +3 -13
  823. package/lib/feature-libraries/treeCompressionUtils.js.map +1 -1
  824. package/lib/index.d.ts +3 -3
  825. package/lib/index.d.ts.map +1 -1
  826. package/lib/index.js +2 -2
  827. package/lib/index.js.map +1 -1
  828. package/lib/packageVersion.d.ts +1 -1
  829. package/lib/packageVersion.d.ts.map +1 -1
  830. package/lib/packageVersion.js +1 -1
  831. package/lib/packageVersion.js.map +1 -1
  832. package/lib/shared-tree/independentView.d.ts +1 -1
  833. package/lib/shared-tree/independentView.d.ts.map +1 -1
  834. package/lib/shared-tree/independentView.js.map +1 -1
  835. package/lib/shared-tree/index.d.ts +1 -1
  836. package/lib/shared-tree/index.d.ts.map +1 -1
  837. package/lib/shared-tree/index.js.map +1 -1
  838. package/lib/shared-tree/schematizeTree.d.ts +4 -4
  839. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  840. package/lib/shared-tree/schematizeTree.js +3 -2
  841. package/lib/shared-tree/schematizeTree.js.map +1 -1
  842. package/lib/shared-tree/schematizingTreeView.d.ts +1 -5
  843. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  844. package/lib/shared-tree/schematizingTreeView.js +35 -36
  845. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  846. package/lib/shared-tree/sharedTree.d.ts +18 -15
  847. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  848. package/lib/shared-tree/sharedTree.js +15 -4
  849. package/lib/shared-tree/sharedTree.js.map +1 -1
  850. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  851. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  852. package/lib/shared-tree/sharedTreeChangeCodecs.js +1 -0
  853. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  854. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +20 -8
  855. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  856. package/lib/shared-tree/sharedTreeChangeEnricher.js +25 -11
  857. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  858. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +6 -6
  859. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  860. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
  861. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  862. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
  863. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  864. package/lib/shared-tree/sharedTreeEditBuilder.js +11 -5
  865. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  866. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  867. package/lib/shared-tree/treeAlpha.js +2 -2
  868. package/lib/shared-tree/treeAlpha.js.map +1 -1
  869. package/lib/shared-tree/treeCheckout.d.ts +14 -12
  870. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  871. package/lib/shared-tree/treeCheckout.js +69 -20
  872. package/lib/shared-tree/treeCheckout.js.map +1 -1
  873. package/lib/shared-tree-core/branch.d.ts +3 -2
  874. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  875. package/lib/shared-tree-core/branch.js +4 -3
  876. package/lib/shared-tree-core/branch.js.map +1 -1
  877. package/lib/shared-tree-core/editManager.d.ts +2 -2
  878. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  879. package/lib/shared-tree-core/editManager.js +9 -9
  880. package/lib/shared-tree-core/editManager.js.map +1 -1
  881. package/lib/shared-tree-core/editManagerCodecs.d.ts +4 -0
  882. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  883. package/lib/shared-tree-core/editManagerCodecs.js +14 -5
  884. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  885. package/{dist/shared-tree-core/editManagerCodecsV5.d.ts → lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts} +3 -3
  886. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -0
  887. package/lib/shared-tree-core/{editManagerCodecsV5.js → editManagerCodecsVSharedBranches.js} +4 -4
  888. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -0
  889. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +20 -6
  890. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  891. package/lib/shared-tree-core/editManagerFormatCommons.js +22 -7
  892. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  893. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  894. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  895. package/lib/shared-tree-core/editManagerFormatV1toV4.js +1 -0
  896. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  897. package/lib/shared-tree-core/{editManagerFormatV5.d.ts → editManagerFormatVSharedBranches.d.ts} +3 -3
  898. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -0
  899. package/lib/shared-tree-core/{editManagerFormatV5.js → editManagerFormatVSharedBranches.js} +2 -2
  900. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -0
  901. package/lib/shared-tree-core/editManagerSummarizer.d.ts +29 -9
  902. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  903. package/lib/shared-tree-core/editManagerSummarizer.js +39 -11
  904. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  905. package/lib/shared-tree-core/index.d.ts +5 -3
  906. package/lib/shared-tree-core/index.d.ts.map +1 -1
  907. package/lib/shared-tree-core/index.js +4 -2
  908. package/lib/shared-tree-core/index.js.map +1 -1
  909. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  910. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  911. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  912. package/{dist/shared-tree-core/messageCodecV5.d.ts → lib/shared-tree-core/messageCodecVSharedBranches.d.ts} +2 -2
  913. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -0
  914. package/lib/shared-tree-core/{messageCodecV5.js → messageCodecVSharedBranches.js} +3 -3
  915. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -0
  916. package/lib/shared-tree-core/messageCodecs.d.ts +4 -0
  917. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  918. package/lib/shared-tree-core/messageCodecs.js +14 -5
  919. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  920. package/lib/shared-tree-core/messageFormat.d.ts +20 -6
  921. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  922. package/lib/shared-tree-core/messageFormat.js +22 -7
  923. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  924. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
  925. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  926. package/lib/shared-tree-core/messageFormatV1ToV4.js +8 -1
  927. package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  928. package/lib/shared-tree-core/{messageFormatV5.d.ts → messageFormatVSharedBranches.d.ts} +5 -7
  929. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -0
  930. package/lib/shared-tree-core/{messageFormatV5.js → messageFormatVSharedBranches.js} +3 -2
  931. package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -0
  932. package/lib/shared-tree-core/sharedTreeCore.d.ts +14 -47
  933. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  934. package/lib/shared-tree-core/sharedTreeCore.js +28 -16
  935. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  936. package/lib/shared-tree-core/summaryTypes.d.ts +94 -0
  937. package/lib/shared-tree-core/summaryTypes.d.ts.map +1 -0
  938. package/lib/shared-tree-core/summaryTypes.js +43 -0
  939. package/lib/shared-tree-core/summaryTypes.js.map +1 -0
  940. package/lib/shared-tree-core/versionedSummarizer.d.ts +67 -0
  941. package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -0
  942. package/lib/shared-tree-core/versionedSummarizer.js +59 -0
  943. package/lib/shared-tree-core/versionedSummarizer.js.map +1 -0
  944. package/lib/simple-tree/api/configuration.d.ts +3 -26
  945. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  946. package/lib/simple-tree/api/configuration.js +14 -25
  947. package/lib/simple-tree/api/configuration.js.map +1 -1
  948. package/lib/simple-tree/api/dirtyIndex.d.ts +11 -0
  949. package/lib/simple-tree/api/dirtyIndex.d.ts.map +1 -1
  950. package/lib/simple-tree/api/dirtyIndex.js +7 -0
  951. package/lib/simple-tree/api/dirtyIndex.js.map +1 -1
  952. package/lib/simple-tree/api/discrepancies.d.ts +1 -1
  953. package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
  954. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  955. package/lib/simple-tree/api/getSimpleSchema.d.ts +3 -3
  956. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  957. package/lib/simple-tree/api/getSimpleSchema.js +9 -3
  958. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  959. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +16 -13
  960. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
  961. package/lib/simple-tree/api/incrementalAllowedTypes.js +23 -13
  962. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  963. package/lib/simple-tree/api/index.d.ts +4 -5
  964. package/lib/simple-tree/api/index.d.ts.map +1 -1
  965. package/lib/simple-tree/api/index.js +3 -4
  966. package/lib/simple-tree/api/index.js.map +1 -1
  967. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
  968. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  969. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  970. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +5 -5
  971. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  972. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  973. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  974. package/lib/simple-tree/api/schemaFactoryRecursive.js +0 -1
  975. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  976. package/lib/simple-tree/api/schemaFromSimple.d.ts +6 -1
  977. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  978. package/lib/simple-tree/api/schemaFromSimple.js +5 -0
  979. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  980. package/lib/simple-tree/api/schemaStatics.d.ts +12 -12
  981. package/lib/simple-tree/api/simpleSchemaCodec.d.ts +15 -3
  982. package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
  983. package/lib/simple-tree/api/simpleSchemaCodec.js +15 -3
  984. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  985. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
  986. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  987. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  988. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +8 -1
  989. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  990. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +15 -10
  991. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  992. package/lib/simple-tree/api/tree.d.ts +1 -1
  993. package/lib/simple-tree/api/tree.js.map +1 -1
  994. package/lib/simple-tree/api/typesUnsafe.d.ts +3 -3
  995. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  996. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  997. package/lib/simple-tree/core/allowedTypes.d.ts +2 -2
  998. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
  999. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  1000. package/lib/simple-tree/core/index.d.ts +1 -1
  1001. package/lib/simple-tree/core/index.d.ts.map +1 -1
  1002. package/lib/simple-tree/core/index.js +1 -1
  1003. package/lib/simple-tree/core/index.js.map +1 -1
  1004. package/lib/simple-tree/core/toStored.d.ts +17 -15
  1005. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  1006. package/lib/simple-tree/core/toStored.js +4 -37
  1007. package/lib/simple-tree/core/toStored.js.map +1 -1
  1008. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  1009. package/lib/simple-tree/core/treeNodeKernel.js +1 -0
  1010. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  1011. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
  1012. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  1013. package/lib/simple-tree/core/unhydratedFlexTree.js +58 -8
  1014. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  1015. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
  1016. package/lib/simple-tree/core/walkSchema.js +5 -1
  1017. package/lib/simple-tree/core/walkSchema.js.map +1 -1
  1018. package/lib/simple-tree/createContext.d.ts.map +1 -1
  1019. package/lib/simple-tree/createContext.js +20 -5
  1020. package/lib/simple-tree/createContext.js.map +1 -1
  1021. package/lib/simple-tree/fieldSchema.d.ts +7 -7
  1022. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  1023. package/lib/simple-tree/fieldSchema.js.map +1 -1
  1024. package/lib/simple-tree/index.d.ts +8 -7
  1025. package/lib/simple-tree/index.d.ts.map +1 -1
  1026. package/lib/simple-tree/index.js +6 -5
  1027. package/lib/simple-tree/index.js.map +1 -1
  1028. package/lib/simple-tree/leafNodeSchema.d.ts +5 -5
  1029. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  1030. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  1031. package/lib/simple-tree/node-kinds/array/arrayNode.js +7 -4
  1032. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  1033. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +3 -3
  1034. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  1035. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  1036. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
  1037. package/lib/simple-tree/node-kinds/common.js +2 -2
  1038. package/lib/simple-tree/node-kinds/common.js.map +1 -1
  1039. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  1040. package/lib/simple-tree/node-kinds/map/mapNode.js +2 -2
  1041. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  1042. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +3 -3
  1043. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  1044. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  1045. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  1046. package/lib/simple-tree/node-kinds/object/objectNode.js +20 -19
  1047. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  1048. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +2 -2
  1049. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  1050. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  1051. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  1052. package/lib/simple-tree/node-kinds/record/recordNode.js +4 -2
  1053. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  1054. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -3
  1055. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  1056. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  1057. package/lib/simple-tree/prepareForInsertion.d.ts +54 -47
  1058. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  1059. package/lib/simple-tree/prepareForInsertion.js +183 -124
  1060. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  1061. package/lib/simple-tree/simpleSchema.d.ts +55 -23
  1062. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  1063. package/lib/simple-tree/simpleSchema.js +16 -1
  1064. package/lib/simple-tree/simpleSchema.js.map +1 -1
  1065. package/lib/simple-tree/simpleSchemaFormatV1.d.ts +1 -1
  1066. package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
  1067. package/lib/simple-tree/simpleSchemaFormatV1.js +8 -1
  1068. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  1069. package/lib/simple-tree/toStoredSchema.d.ts +58 -11
  1070. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  1071. package/lib/simple-tree/toStoredSchema.js +204 -31
  1072. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  1073. package/lib/simple-tree/treeSchema.d.ts +23 -0
  1074. package/lib/simple-tree/treeSchema.d.ts.map +1 -0
  1075. package/lib/simple-tree/treeSchema.js +21 -0
  1076. package/lib/simple-tree/treeSchema.js.map +1 -0
  1077. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +13 -4
  1078. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  1079. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +26 -9
  1080. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  1081. package/lib/tableSchema.d.ts +117 -63
  1082. package/lib/tableSchema.d.ts.map +1 -1
  1083. package/lib/tableSchema.js +160 -59
  1084. package/lib/tableSchema.js.map +1 -1
  1085. package/lib/treeFactory.d.ts +5 -0
  1086. package/lib/treeFactory.d.ts.map +1 -1
  1087. package/lib/treeFactory.js +28 -8
  1088. package/lib/treeFactory.js.map +1 -1
  1089. package/lib/util/breakable.js +3 -3
  1090. package/lib/util/breakable.js.map +1 -1
  1091. package/lib/util/index.d.ts +2 -1
  1092. package/lib/util/index.d.ts.map +1 -1
  1093. package/lib/util/index.js +2 -1
  1094. package/lib/util/index.js.map +1 -1
  1095. package/lib/util/rangeMap.d.ts +24 -12
  1096. package/lib/util/rangeMap.d.ts.map +1 -1
  1097. package/lib/util/rangeMap.js +44 -5
  1098. package/lib/util/rangeMap.js.map +1 -1
  1099. package/lib/util/readSnapshotBlob.d.ts +13 -0
  1100. package/lib/util/readSnapshotBlob.d.ts.map +1 -0
  1101. package/lib/util/readSnapshotBlob.js +14 -0
  1102. package/lib/util/readSnapshotBlob.js.map +1 -0
  1103. package/lib/util/typeCheckTests.d.ts.map +1 -1
  1104. package/lib/util/typeCheckTests.js.map +1 -1
  1105. package/package.json +22 -22
  1106. package/src/codec/codec.ts +15 -1
  1107. package/src/codec/versioned/codec.ts +1 -1
  1108. package/src/codec/versioned/format.ts +4 -1
  1109. package/src/core/change-family/changeFamily.ts +5 -0
  1110. package/src/core/change-family/index.ts +1 -0
  1111. package/src/core/index.ts +7 -2
  1112. package/src/core/rebase/changeRebaser.ts +6 -1
  1113. package/src/core/rebase/index.ts +1 -0
  1114. package/src/core/rebase/types.ts +8 -1
  1115. package/src/core/rebase/utils.ts +31 -7
  1116. package/src/core/tree/detachedFieldIndex.ts +71 -14
  1117. package/src/core/tree/index.ts +9 -3
  1118. package/src/core/tree/pathTree.ts +16 -4
  1119. package/src/feature-libraries/chunked-forest/basicChunk.ts +7 -1
  1120. package/src/feature-libraries/chunked-forest/chunkTree.ts +6 -1
  1121. package/src/feature-libraries/chunked-forest/codec/codecs.ts +3 -7
  1122. package/src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts +18 -11
  1123. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +9 -9
  1124. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +393 -127
  1125. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +35 -38
  1126. package/src/feature-libraries/default-schema/index.ts +16 -5
  1127. package/src/feature-libraries/default-schema/locationBasedEditBuilder.ts +180 -0
  1128. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +35 -9
  1129. package/src/feature-libraries/deltaUtils.ts +6 -1
  1130. package/src/feature-libraries/detachedFieldIndexSummarizer.ts +62 -15
  1131. package/src/feature-libraries/flex-tree/context.ts +17 -0
  1132. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +7 -8
  1133. package/src/feature-libraries/flex-tree/lazyField.ts +66 -24
  1134. package/src/feature-libraries/forest-summary/codec.ts +8 -8
  1135. package/src/feature-libraries/forest-summary/forestSummarizer.ts +47 -39
  1136. package/src/feature-libraries/forest-summary/format.ts +4 -4
  1137. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +23 -39
  1138. package/src/feature-libraries/forest-summary/index.ts +2 -1
  1139. package/src/feature-libraries/forest-summary/summaryTypes.ts +61 -0
  1140. package/src/feature-libraries/index.ts +23 -14
  1141. package/src/feature-libraries/mapTreeCursor.ts +2 -1
  1142. package/src/feature-libraries/mitigatedChangeFamily.ts +3 -1
  1143. package/src/feature-libraries/modular-schema/comparison.ts +63 -5
  1144. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +142 -44
  1145. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +36 -57
  1146. package/src/feature-libraries/modular-schema/fieldKind.ts +24 -40
  1147. package/src/feature-libraries/modular-schema/genericFieldKind.ts +10 -19
  1148. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +1 -1
  1149. package/src/feature-libraries/modular-schema/index.ts +21 -15
  1150. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +732 -0
  1151. package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +790 -0
  1152. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +32 -505
  1153. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2542 -742
  1154. package/src/feature-libraries/modular-schema/{modularChangeFormat.ts → modularChangeFormatV1.ts} +2 -1
  1155. package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +62 -0
  1156. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +98 -10
  1157. package/src/feature-libraries/optional-field/index.ts +1 -3
  1158. package/src/feature-libraries/optional-field/optionalField.ts +317 -574
  1159. package/src/feature-libraries/optional-field/optionalFieldChangeTypes.ts +24 -38
  1160. package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +89 -35
  1161. package/src/feature-libraries/schema-index/schemaSummarizer.ts +59 -18
  1162. package/src/feature-libraries/sequence-field/compose.ts +134 -519
  1163. package/src/feature-libraries/sequence-field/formatV2.ts +1 -0
  1164. package/src/feature-libraries/sequence-field/helperTypes.ts +34 -19
  1165. package/src/feature-libraries/sequence-field/index.ts +0 -9
  1166. package/src/feature-libraries/sequence-field/invert.ts +103 -228
  1167. package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
  1168. package/src/feature-libraries/sequence-field/moveEffectTable.ts +8 -191
  1169. package/src/feature-libraries/sequence-field/rebase.ts +168 -203
  1170. package/src/feature-libraries/sequence-field/replaceRevisions.ts +31 -52
  1171. package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +0 -2
  1172. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +643 -220
  1173. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +56 -68
  1174. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +25 -27
  1175. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +19 -129
  1176. package/src/feature-libraries/sequence-field/types.ts +34 -64
  1177. package/src/feature-libraries/sequence-field/utils.ts +133 -346
  1178. package/src/feature-libraries/treeCompressionUtils.ts +1 -15
  1179. package/src/index.ts +7 -2
  1180. package/src/packageVersion.ts +1 -1
  1181. package/src/shared-tree/independentView.ts +1 -1
  1182. package/src/shared-tree/index.ts +3 -2
  1183. package/src/shared-tree/schematizeTree.ts +21 -8
  1184. package/src/shared-tree/schematizingTreeView.ts +50 -68
  1185. package/src/shared-tree/sharedTree.ts +51 -30
  1186. package/src/shared-tree/sharedTreeChangeCodecs.ts +5 -1
  1187. package/src/shared-tree/sharedTreeChangeEnricher.ts +31 -11
  1188. package/src/shared-tree/sharedTreeChangeFamily.ts +9 -6
  1189. package/src/shared-tree/sharedTreeEditBuilder.ts +46 -12
  1190. package/src/shared-tree/treeAlpha.ts +2 -3
  1191. package/src/shared-tree/treeCheckout.ts +106 -33
  1192. package/src/shared-tree-core/branch.ts +8 -2
  1193. package/src/shared-tree-core/editManager.ts +16 -2
  1194. package/src/shared-tree-core/editManagerCodecs.ts +17 -5
  1195. package/src/shared-tree-core/{editManagerCodecsV5.ts → editManagerCodecsVSharedBranches.ts} +3 -3
  1196. package/src/shared-tree-core/editManagerFormatCommons.ts +22 -7
  1197. package/src/shared-tree-core/editManagerFormatV1toV4.ts +3 -1
  1198. package/src/shared-tree-core/{editManagerFormatV5.ts → editManagerFormatVSharedBranches.ts} +2 -2
  1199. package/src/shared-tree-core/editManagerSummarizer.ts +58 -16
  1200. package/src/shared-tree-core/index.ts +11 -3
  1201. package/src/shared-tree-core/messageCodecV1ToV4.ts +2 -1
  1202. package/src/shared-tree-core/{messageCodecV5.ts → messageCodecVSharedBranches.ts} +3 -3
  1203. package/src/shared-tree-core/messageCodecs.ts +17 -5
  1204. package/src/shared-tree-core/messageFormat.ts +22 -7
  1205. package/src/shared-tree-core/messageFormatV1ToV4.ts +16 -2
  1206. package/src/shared-tree-core/{messageFormatV5.ts → messageFormatVSharedBranches.ts} +4 -6
  1207. package/src/shared-tree-core/sharedTreeCore.ts +67 -76
  1208. package/src/shared-tree-core/summaryTypes.ts +122 -0
  1209. package/src/shared-tree-core/versionedSummarizer.ts +107 -0
  1210. package/src/simple-tree/api/configuration.ts +21 -68
  1211. package/src/simple-tree/api/dirtyIndex.ts +11 -0
  1212. package/src/simple-tree/api/discrepancies.ts +1 -1
  1213. package/src/simple-tree/api/getSimpleSchema.ts +13 -6
  1214. package/src/simple-tree/api/incrementalAllowedTypes.ts +34 -20
  1215. package/src/simple-tree/api/index.ts +4 -5
  1216. package/src/simple-tree/api/schemaCompatibilityTester.ts +1 -1
  1217. package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -2
  1218. package/src/simple-tree/api/schemaFactoryRecursive.ts +0 -2
  1219. package/src/simple-tree/api/schemaFromSimple.ts +11 -5
  1220. package/src/simple-tree/api/simpleSchemaCodec.ts +17 -3
  1221. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -1
  1222. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +18 -10
  1223. package/src/simple-tree/api/tree.ts +1 -1
  1224. package/src/simple-tree/api/typesUnsafe.ts +7 -3
  1225. package/src/simple-tree/core/allowedTypes.ts +3 -3
  1226. package/src/simple-tree/core/index.ts +2 -2
  1227. package/src/simple-tree/core/toStored.ts +22 -55
  1228. package/src/simple-tree/core/treeNodeKernel.ts +1 -0
  1229. package/src/simple-tree/core/unhydratedFlexTree.ts +87 -36
  1230. package/src/simple-tree/core/walkSchema.ts +6 -0
  1231. package/src/simple-tree/createContext.ts +26 -11
  1232. package/src/simple-tree/fieldSchema.ts +16 -7
  1233. package/src/simple-tree/index.ts +13 -12
  1234. package/src/simple-tree/node-kinds/array/arrayNode.ts +14 -7
  1235. package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +3 -3
  1236. package/src/simple-tree/node-kinds/common.ts +2 -5
  1237. package/src/simple-tree/node-kinds/map/mapNode.ts +9 -6
  1238. package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +3 -3
  1239. package/src/simple-tree/node-kinds/object/objectNode.ts +28 -27
  1240. package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +6 -2
  1241. package/src/simple-tree/node-kinds/record/recordNode.ts +15 -11
  1242. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +3 -3
  1243. package/src/simple-tree/prepareForInsertion.ts +343 -200
  1244. package/src/simple-tree/simpleSchema.ts +79 -32
  1245. package/src/simple-tree/simpleSchemaFormatV1.ts +9 -1
  1246. package/src/simple-tree/toStoredSchema.ts +319 -61
  1247. package/src/simple-tree/treeSchema.ts +54 -0
  1248. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +42 -14
  1249. package/src/tableSchema.ts +485 -166
  1250. package/src/treeFactory.ts +32 -9
  1251. package/src/util/breakable.ts +4 -4
  1252. package/src/util/index.ts +5 -0
  1253. package/src/util/rangeMap.ts +72 -18
  1254. package/src/util/readSnapshotBlob.ts +23 -0
  1255. package/src/util/typeCheckTests.ts +0 -1
  1256. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +0 -1
  1257. package/dist/feature-libraries/modular-schema/modularChangeFormat.js.map +0 -1
  1258. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
  1259. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
  1260. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -50
  1261. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
  1262. package/dist/shared-tree-core/editManagerCodecsV5.d.ts.map +0 -1
  1263. package/dist/shared-tree-core/editManagerCodecsV5.js.map +0 -1
  1264. package/dist/shared-tree-core/editManagerFormatV5.d.ts.map +0 -1
  1265. package/dist/shared-tree-core/editManagerFormatV5.js.map +0 -1
  1266. package/dist/shared-tree-core/messageCodecV5.d.ts.map +0 -1
  1267. package/dist/shared-tree-core/messageCodecV5.js.map +0 -1
  1268. package/dist/shared-tree-core/messageFormatV5.d.ts.map +0 -1
  1269. package/dist/shared-tree-core/messageFormatV5.js.map +0 -1
  1270. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +0 -40
  1271. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +0 -1
  1272. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +0 -177
  1273. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +0 -1
  1274. package/docs/main/sequence-field/move-composition.md +0 -46
  1275. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +0 -1
  1276. package/lib/feature-libraries/modular-schema/modularChangeFormat.js.map +0 -1
  1277. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
  1278. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
  1279. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -46
  1280. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
  1281. package/lib/shared-tree-core/editManagerCodecsV5.d.ts.map +0 -1
  1282. package/lib/shared-tree-core/editManagerCodecsV5.js.map +0 -1
  1283. package/lib/shared-tree-core/editManagerFormatV5.d.ts.map +0 -1
  1284. package/lib/shared-tree-core/editManagerFormatV5.js.map +0 -1
  1285. package/lib/shared-tree-core/messageCodecV5.d.ts.map +0 -1
  1286. package/lib/shared-tree-core/messageCodecV5.js.map +0 -1
  1287. package/lib/shared-tree-core/messageFormatV5.d.ts.map +0 -1
  1288. package/lib/shared-tree-core/messageFormatV5.js.map +0 -1
  1289. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +0 -40
  1290. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +0 -1
  1291. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +0 -171
  1292. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +0 -1
  1293. package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +0 -57
  1294. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +0 -209
@@ -40,7 +40,7 @@ class EditManager {
40
40
  * @param mintRevisionTag - a function which generates globally unique revision tags
41
41
  * @param onSharedBranchCreated - called when a new shared branch is created. This is not called for the main branch.
42
42
  */
43
- constructor(changeFamily, localSessionId, mintRevisionTag, onSharedBranchCreated, logger) {
43
+ constructor(changeFamily, localSessionId, mintRevisionTag, onSharedBranchCreated, editorOptions, logger) {
44
44
  this.changeFamily = changeFamily;
45
45
  this.localSessionId = localSessionId;
46
46
  this.mintRevisionTag = mintRevisionTag;
@@ -73,8 +73,8 @@ class EditManager {
73
73
  category: "performance",
74
74
  }, logger, maxRebaseStatsAggregationCount);
75
75
  }
76
- const mainTrunk = new branch_js_1.SharedTreeBranch(this.trunkBase, changeFamily, mintRevisionTag, this._events, this.telemetryEventBatcher);
77
- this.createAndAddSharedBranch("main", undefined, undefined, mainTrunk);
76
+ const mainTrunk = new branch_js_1.SharedTreeBranch(this.trunkBase, changeFamily, mintRevisionTag, this._events, this.telemetryEventBatcher, editorOptions);
77
+ this.createAndAddSharedBranch("main", undefined, undefined, mainTrunk, editorOptions);
78
78
  }
79
79
  getLocalBranch(branchId) {
80
80
  return this.getSharedBranch(branchId).localBranch;
@@ -314,8 +314,8 @@ class EditManager {
314
314
  const hadBranch = this.sharedBranches.delete(branchId);
315
315
  (0, internal_1.assert)(hadBranch, 0xc5c /* Expected branch to exist */);
316
316
  }
317
- createAndAddSharedBranch(branchId, sessionId, parent, branch) {
318
- const sharedBranch = this.createSharedBranch(branchId, sessionId, parent, branch);
317
+ createAndAddSharedBranch(branchId, sessionId, parent, branch, editorOptions) {
318
+ const sharedBranch = this.createSharedBranch(branchId, sessionId, parent, branch, editorOptions);
319
319
  this.addSharedBranch(branchId, sharedBranch);
320
320
  return sharedBranch;
321
321
  }
@@ -331,8 +331,8 @@ class EditManager {
331
331
  this.onSharedBranchCreated?.(branchId);
332
332
  }
333
333
  }
334
- createSharedBranch(branchId, sessionId, parent, branch) {
335
- const sharedBranch = new SharedBranch(parent, branch, branchId, sessionId, minimumPossibleSequenceId, this.changeFamily, this.mintRevisionTag, this._events, this.telemetryEventBatcher);
334
+ createSharedBranch(branchId, sessionId, parent, branch, editorOptions) {
335
+ const sharedBranch = new SharedBranch(parent, branch, branchId, sessionId, minimumPossibleSequenceId, this.changeFamily, this.mintRevisionTag, this._events, this.telemetryEventBatcher, editorOptions);
336
336
  return sharedBranch;
337
337
  }
338
338
  /* eslint-disable jsdoc/check-indentation */
@@ -399,7 +399,7 @@ function getPathFromBase(branchHead, baseBranchHead) {
399
399
  return path;
400
400
  }
401
401
  class SharedBranch {
402
- constructor(parentBranch, trunk, id, sessionId, baseCommitSequenceId, changeFamily, mintRevisionTag, branchTrimmer, telemetryEventBatcher) {
402
+ constructor(parentBranch, trunk, id, sessionId, baseCommitSequenceId, changeFamily, mintRevisionTag, branchTrimmer, telemetryEventBatcher, editorOptions) {
403
403
  this.parentBranch = parentBranch;
404
404
  this.trunk = trunk;
405
405
  this.id = id;
@@ -427,7 +427,7 @@ class SharedBranch {
427
427
  * This does not include an entry for the {@link trunkBase}.
428
428
  */
429
429
  this.commitMetadata = new Map();
430
- this.localBranch = new branch_js_1.SharedTreeBranch(this.trunk.getHead(), changeFamily, mintRevisionTag, branchTrimmer, telemetryEventBatcher);
430
+ this.localBranch = new branch_js_1.SharedTreeBranch(this.trunk.getHead(), changeFamily, mintRevisionTag, branchTrimmer, telemetryEventBatcher, editorOptions);
431
431
  this.sequenceIdToCommit.set(baseCommitSequenceId, this.trunk.getHead());
432
432
  this.localBranch.events.on("afterChange", (event) => {
433
433
  if (event.type === "append") {
@@ -1 +1 @@
1
- {"version":3,"file":"editManager.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AACnE,+DAA6D;AAE7D,gEAAkD;AAElD,+CAU0B;AAC1B,+CAAiF;AAEjF,2CAKqB;AAQrB,6DAM8B;AAC9B,uEAGkD;AAGrC,QAAA,6BAA6B,GAAc,IAAA,gBAAK,EAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACvF,MAAM,yBAAyB,GAAe;IAC7C,cAAc,EAAE,qCAA6B;CAC7C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,YAAY,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,iBAAiB,EAAE,CAAC;YAC1D,MAAM,MAAM,GACX,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;gBACnC,IAAA,eAAI,EAAC,KAAK,CAAC,wEAAwE,CAAC,CAAC;YAEtF,IAAI,CAAC,iBAAiB,CAAC,GAAG,CACzB,SAAS,EACT,IAAI,4BAAgB,CACnB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,qBAAU,EAAE,MAAM,CAAC,EACzC,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,eAAe,CACpB,CACD,CAAC;QACH,CAAC;IACF,CAAC;CACD;AAED,2GAA2G;AAC3G,6EAA6E;AAC7E,SAAS,iBAAiB,CAAC,UAAsB;IAChD,OAAO;QACN,cAAc,EAAE,UAAU,CAAC,cAAc;QACzC,YAAY,EAAE,CAAC,UAAU,CAAC,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC;KAChD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { SessionId } from \"@fluidframework/id-compressor\";\nimport { BTree } from \"@tylerbu/sorted-btree-es6\";\n\nimport {\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\tfindAncestor,\n\tfindCommonAncestor,\n\tmintCommit,\n\ttype RebaseStatsWithDuration,\n\ttagChange,\n} from \"../core/index.js\";\nimport { type Mutable, brand, getOrCreate, mapIterable } from \"../util/index.js\";\n\nimport {\n\tSharedTreeBranch,\n\ttype BranchTrimmingEvents,\n\tonForkTransitive,\n\ttype BranchId,\n} from \"./branch.js\";\nimport type {\n\tCommit,\n\tSeqNumber,\n\tSequenceId,\n\tSequencedCommit,\n\tSummarySessionBranch,\n} from \"./editManagerFormatCommons.js\";\nimport {\n\tgetUpperBoundOfPreviousSequenceId,\n\tequalSequenceIds,\n\tmaxSequenceId,\n\tminSequenceId,\n\tsequenceIdComparator,\n} from \"./sequenceIdUtils.js\";\nimport {\n\tTelemetryEventBatcher,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\n\nexport const minimumPossibleSequenceNumber: SeqNumber = brand(Number.MIN_SAFE_INTEGER);\nconst minimumPossibleSequenceId: SequenceId = {\n\tsequenceNumber: minimumPossibleSequenceNumber,\n};\n\n/**\n * A special revision tag for the initial {@link EditManager.trunkBase} commit.\n * @remarks This tag is used to supply the _initial_ trunk base with a known revision.\n * The trunk base may advance over time, after which point the trunk base will have a different revision.\n * When {@link EditManager.getSummaryData | serializing} and deserializing, peer branches that include the trunk base commit in their history will always use this tag.\n */\nconst rootRevision = \"root\" as const satisfies RevisionTag;\n\n/**\n * Max number of telemetry log call that may be aggregated before being sent.\n */\nconst maxRebaseStatsAggregationCount = 1000;\n\n/**\n * Represents a local branch of a document and interprets the effect on the document of adding sequenced changes,\n * which were based on a given session's branch, to the document history\n */\n// TODO: Try to reduce this to a single type parameter\nexport class EditManager<\n\tTEditor extends ChangeFamilyEditor,\n\tTChangeset,\n\tTChangeFamily extends ChangeFamily<TEditor, TChangeset>,\n> {\n\tprivate readonly _events = createEmitter<BranchTrimmingEvents>();\n\n\tprivate readonly sharedBranches = new Map<BranchId, SharedBranch<TEditor, TChangeset>>();\n\n\t/**\n\t * Tracks where on the trunk of the main branch all registered branches are based.\n\t * Each key is the sequence id of a commit on the trunk,\n\t * and the value is the set of all branches who have that commit as their common ancestor with the trunk.\n\t *\n\t * @remarks\n\t * This does not include the local branch.\n\t */\n\tprivate readonly trunkBranches = new BTree<\n\t\tSequenceId,\n\t\tSet<SharedTreeBranch<TEditor, TChangeset>>\n\t>(undefined, sequenceIdComparator);\n\n\t/**\n\t * The sequence number of the newest commit on the trunk that has been received by all peers.\n\t * Defaults to {@link minimumPossibleSequenceNumber} if no commits have been received.\n\t *\n\t * @remarks If there are more than one commit with the same sequence number we assume this refers to the last commit in the batch.\n\t */\n\tprivate minimumSequenceNumber = minimumPossibleSequenceNumber;\n\n\t/**\n\t * A special commit that is a \"base\" (tail) of the trunk, though not part of the trunk itself.\n\t * This makes it possible to model the trunk in the same way as any other branch (it branches off of a base commit)\n\t * which allows it to use branching APIs to interact with the other branches.\n\t * Each time trunk eviction occurs, the most recent evicted commit becomes the new `trunkBase`.\n\t */\n\tprivate trunkBase: GraphCommit<TChangeset>;\n\n\tprivate readonly telemetryEventBatcher:\n\t\t| TelemetryEventBatcher<keyof RebaseStatsWithDuration>\n\t\t| undefined;\n\n\t/**\n\t * @param changeFamily - the change family of changes on the trunk and local branch\n\t * @param localSessionId - the id of the local session that will be used for local commits\n\t * @param mintRevisionTag - a function which generates globally unique revision tags\n\t * @param onSharedBranchCreated - called when a new shared branch is created. This is not called for the main branch.\n\t */\n\tpublic constructor(\n\t\tpublic readonly changeFamily: TChangeFamily,\n\t\tpublic readonly localSessionId: SessionId,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tprivate readonly onSharedBranchCreated?: (branchId: BranchId) => void,\n\t\tlogger?: ITelemetryLoggerExt,\n\t) {\n\t\tthis.trunkBase = {\n\t\t\trevision: rootRevision,\n\t\t\tchange: changeFamily.rebaser.compose([]),\n\t\t};\n\n\t\tif (logger !== undefined) {\n\t\t\tthis.telemetryEventBatcher = new TelemetryEventBatcher(\n\t\t\t\t{\n\t\t\t\t\teventName: \"rebaseProcessing\",\n\t\t\t\t\tcategory: \"performance\",\n\t\t\t\t},\n\t\t\t\tlogger,\n\t\t\t\tmaxRebaseStatsAggregationCount,\n\t\t\t);\n\t\t}\n\n\t\tconst mainTrunk = new SharedTreeBranch(\n\t\t\tthis.trunkBase,\n\t\t\tchangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tthis._events,\n\t\t\tthis.telemetryEventBatcher,\n\t\t);\n\n\t\tthis.createAndAddSharedBranch(\"main\", undefined, undefined, mainTrunk);\n\t}\n\n\tpublic getLocalBranch(branchId: BranchId): SharedTreeBranch<TEditor, TChangeset> {\n\t\treturn this.getSharedBranch(branchId).localBranch;\n\t}\n\n\tprivate getSharedBranch(branchId: BranchId): SharedBranch<TEditor, TChangeset> {\n\t\treturn this.sharedBranches.get(branchId) ?? fail(0xc56 /* Branch does not exist */);\n\t}\n\n\t/**\n\t * Make the given branch known to the `EditManager`. The `EditManager` will ensure that all registered\n\t * branches remain usable even as the minimum sequence number advances.\n\t *\n\t * TODO#AB6926: Refactor local branch management into a separate class that encapsulates `trunkBranches` and everything\n\t * that touches it.\n\t * TODO#AB6925: Maintain the divergence point between each branch and the trunk so that we don't have to recompute\n\t * it so often.\n\t */\n\tprivate registerBranch(branch: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tthis.trackBranch(branch);\n\t\t// Whenever the branch is rebased, update our record of its base trunk commit\n\t\tconst offBeforeRebase = branch.events.on(\"beforeChange\", (args) => {\n\t\t\tif (args.type === \"rebase\") {\n\t\t\t\tthis.untrackBranch(branch);\n\t\t\t}\n\t\t});\n\t\tconst offAfterRebase = branch.events.on(\"afterChange\", (args) => {\n\t\t\tif (args.type === \"rebase\") {\n\t\t\t\tthis.trackBranch(branch);\n\t\t\t\tthis.trimHistory();\n\t\t\t}\n\t\t});\n\t\t// When the branch is disposed, update our branch set and trim the trunk\n\t\tconst offDispose = branch.events.on(\"dispose\", () => {\n\t\t\tthis.untrackBranch(branch);\n\t\t\tthis.trimHistory();\n\t\t\toffBeforeRebase();\n\t\t\toffAfterRebase();\n\t\t\toffDispose();\n\t\t});\n\t}\n\n\tprivate trackBranch(b: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tconst main = this.getSharedBranch(\"main\");\n\t\tconst trunkCommit =\n\t\t\tfindCommonAncestor(main.trunk.getHead(), b.getHead()) ??\n\t\t\tfail(0xad2 /* Expected branch to be related to main */);\n\t\tconst sequenceId = main.getCommitSequenceId(trunkCommit.revision);\n\t\tconst branches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());\n\n\t\tassert(!branches.has(b), 0x670 /* Branch was registered more than once */);\n\t\tbranches.add(b);\n\t}\n\n\tprivate untrackBranch(b: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tconst main = this.getSharedBranch(\"main\");\n\t\tconst trunkCommit =\n\t\t\tfindCommonAncestor(main.trunk.getHead(), b.getHead()) ??\n\t\t\tfail(0xad3 /* Expected branch to be related to main */);\n\t\tconst sequenceId = main.getCommitSequenceId(trunkCommit.revision);\n\t\tconst branches =\n\t\t\tthis.trunkBranches.get(sequenceId) ?? fail(0xad4 /* Expected branch to be tracked */);\n\n\t\tassert(branches.delete(b), 0x671 /* Expected branch to be tracked */);\n\t\tif (branches.size === 0) {\n\t\t\tthis.trunkBranches.delete(sequenceId);\n\t\t}\n\t}\n\n\t/**\n\t * Return the sequenced number of the latest sequenced change.\n\t */\n\tpublic getLatestSequenceNumber(): SeqNumber | undefined {\n\t\tlet maxSequenceNumber: SeqNumber | undefined;\n\t\tfor (const branch of this.sharedBranches.values()) {\n\t\t\tconst branchMax = branch.getCommitSequenceId(\n\t\t\t\tbranch.trunk.getHead().revision,\n\t\t\t).sequenceNumber;\n\t\t\tif (maxSequenceNumber === undefined || maxSequenceNumber < branchMax) {\n\t\t\t\tmaxSequenceNumber = branchMax;\n\t\t\t}\n\t\t}\n\n\t\treturn maxSequenceNumber;\n\t}\n\n\t/**\n\t * Advances the minimum sequence number, and removes all commits from the trunk which lie outside the collaboration window,\n\t * if they are not retained by revertibles or local branches.\n\t * @param minimumSequenceNumber - the sequence number of the newest commit that all peers (including this one) have received and applied to their trunks.\n\t *\n\t * @remarks If there are more than one commit with the same sequence number we assume this refers to the last commit in the batch.\n\t */\n\tpublic advanceMinimumSequenceNumber(\n\t\tminimumSequenceNumber: SeqNumber,\n\t\ttrimHistory = true,\n\t): void {\n\t\tif (minimumSequenceNumber === this.minimumSequenceNumber) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(\n\t\t\tminimumSequenceNumber > this.minimumSequenceNumber,\n\t\t\t0x476 /* number must be larger or equal to current minimumSequenceNumber. */,\n\t\t);\n\n\t\tthis.minimumSequenceNumber = minimumSequenceNumber;\n\t\tif (trimHistory) {\n\t\t\tthis.trimHistory();\n\t\t}\n\t}\n\n\t/**\n\t * Examines the latest known minimum sequence number and the trunk bases of any registered branches to determine\n\t * if any commits on the trunk are unreferenced and unneeded for future computation; those found are evicted from the trunk.\n\t */\n\tprivate trimHistory(): void {\n\t\t/** The sequence id of the most recent commit on the trunk that will be trimmed */\n\t\tlet trunkTailSequenceId: SequenceId = {\n\t\t\tsequenceNumber: this.minimumSequenceNumber,\n\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t};\n\t\t// If there are any outstanding registered branches, get the one that is the oldest (has the \"most behind\" trunk base)\n\t\tconst minimumBranchBaseSequenceId = this.trunkBranches.minKey();\n\t\tif (minimumBranchBaseSequenceId !== undefined) {\n\t\t\t// If that branch is behind the minimum sequence id, we only want to evict commits older than it,\n\t\t\t// even if those commits are behind the minimum sequence id\n\t\t\tconst sequenceIdBeforeMinimumBranchBase = getUpperBoundOfPreviousSequenceId(\n\t\t\t\tminimumBranchBaseSequenceId,\n\t\t\t);\n\t\t\ttrunkTailSequenceId = minSequenceId(\n\t\t\t\ttrunkTailSequenceId,\n\t\t\t\tsequenceIdBeforeMinimumBranchBase,\n\t\t\t);\n\t\t}\n\n\t\tconst mainBranch = this.getSharedBranch(\"main\");\n\n\t\tconst [sequenceId, latestEvicted] = mainBranch.getClosestTrunkCommit(\n\t\t\tmaxSequenceId(\n\t\t\t\ttrunkTailSequenceId,\n\t\t\t\tmainBranch.sequenceIdToCommit.minKey() ?? minimumPossibleSequenceId,\n\t\t\t),\n\t\t);\n\n\t\t// Don't do any work if the commit found by the search is already the tail of the trunk\n\t\tif (latestEvicted === this.trunkBase) {\n\t\t\treturn;\n\t\t}\n\n\t\t// This mutation is a performance hack. If commits are truly immutable, then changing the trunk's tail requires\n\t\t// regenerating the entire commit graph. Instead, we can simply chop off the tail like this if we're certain\n\t\t// that there are no outstanding references to any of the commits being removed (other than the references via\n\t\t// the trunk). The peer branches have been rebased to the head of the trunk, the local branch is already rebased\n\t\t// to the head of the trunk, and all other branches are tracked by `trunkBranches` and known to be ahead of or at\n\t\t// `newTrunkBase`. Therefore, no branches should have unique references to any of the commits being evicted here.\n\t\t// We mutate the most recent of the evicted commits to become the new trunk base. That way, any other commits that\n\t\t// have parent pointers to the latest evicted commit will stay linked, even though that it is no longer part of the trunk.\n\t\tconst newTrunkBase = latestEvicted as Mutable<typeof latestEvicted>;\n\n\t\t// collect the revisions that will be trimmed to send as part of the branch trimmed event\n\t\tconst trimmedCommits = getPathFromBase(newTrunkBase, this.trunkBase);\n\t\tconst trimmedRevisions = trimmedCommits.map((c) => c.revision);\n\n\t\t// The minimum sequence number informs us that all peer branches are at least caught up to the tail commit,\n\t\t// so rebase them accordingly. This is necessary to prevent peer branches from referencing any evicted commits.\n\t\tmainBranch.trimHistory(latestEvicted, sequenceId);\n\n\t\t// Only the last trimmed commit, which is the new trunk base, should remain accessible.\n\t\tfor (const commit of trimmedCommits.slice(0, -1)) {\n\t\t\tReflect.defineProperty(commit, \"change\", {\n\t\t\t\tget: () =>\n\t\t\t\t\tassert(false, 0xa5e /* Should not access 'change' property of an evicted commit */),\n\t\t\t});\n\t\t\tReflect.defineProperty(commit, \"revision\", {\n\t\t\t\tget: () =>\n\t\t\t\t\tassert(\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t0xa5f /* Should not access 'revision' property of an evicted commit */,\n\t\t\t\t\t),\n\t\t\t});\n\t\t\tReflect.defineProperty(commit, \"parent\", {\n\t\t\t\tget: () =>\n\t\t\t\t\tassert(false, 0xa60 /* Should not access 'parent' property of an evicted commit */),\n\t\t\t});\n\t\t}\n\n\t\t// Dropping the parent field removes (transitively) all references to the evicted commits so they can be garbage collected.\n\t\tdelete newTrunkBase.parent;\n\t\tthis.trunkBase = newTrunkBase;\n\n\t\tthis._events.emit(\"ancestryTrimmed\", trimmedRevisions);\n\t}\n\n\tpublic isEmpty(): boolean {\n\t\tfor (const branch of this.sharedBranches.values()) {\n\t\t\tif (!branch.isEmpty(this.trunkBase)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn this.minimumSequenceNumber === minimumPossibleSequenceNumber;\n\t}\n\n\tpublic getSummaryData(): SummaryData<TChangeset> {\n\t\t// Trimming the trunk before serializing ensures that the trunk data in the summary is as minimal as possible.\n\t\tthis.trimHistory();\n\n\t\tconst minSeqNumberToSummarize: SequenceId = {\n\t\t\tsequenceNumber: brand(this.minimumSequenceNumber + 1),\n\t\t};\n\t\tlet minBaseSeqId: SequenceId = minSeqNumberToSummarize;\n\t\tconst mainBranch = this.getSharedBranch(\"main\");\n\t\tconst branches = new Map<BranchId, SharedBranchSummaryData<TChangeset>>();\n\t\tfor (const [branchId, branch] of this.sharedBranches) {\n\t\t\tif (branchId !== \"main\") {\n\t\t\t\tconst branchSummary = branch.getSummaryData(\n\t\t\t\t\tminSeqNumberToSummarize,\n\t\t\t\t\tthis.trunkBase.revision,\n\t\t\t\t);\n\t\t\t\tbranches.set(branchId, branchSummary);\n\t\t\t\tassert(branchSummary.base !== undefined, 0xc57 /* Branch summary must have a base */);\n\t\t\t\tconst baseSequenceId = mainBranch.getCommitSequenceId(branchSummary.base);\n\t\t\t\tminBaseSeqId = minSequenceId(minBaseSeqId, baseSequenceId);\n\t\t\t}\n\t\t}\n\t\tconst mainSummary = mainBranch.getSummaryData(minBaseSeqId, this.trunkBase.revision);\n\t\treturn { main: mainSummary, branches, originator: this.localSessionId };\n\t}\n\n\tpublic loadSummaryData(data: SummaryData<TChangeset>): void {\n\t\tassert(\n\t\t\tthis.isEmpty(),\n\t\t\t0x68a /* Attempted to load from summary after edit manager was already mutated */,\n\t\t);\n\t\t// Record the tags of each trunk commit as we generate the trunk so they can be looked up quickly\n\t\t// when hydrating the peer branches below\n\t\tconst trunkRevisionCache = new Map<RevisionTag, GraphCommit<TChangeset>>();\n\t\ttrunkRevisionCache.set(this.trunkBase.revision, this.trunkBase);\n\t\tconst mainBranch =\n\t\t\tthis.sharedBranches.get(\"main\") ?? fail(0xc58 /* Main branch must exist */);\n\t\tmainBranch.loadSummaryData(data.main, trunkRevisionCache);\n\t\tif (data.branches !== undefined) {\n\t\t\tfor (const [branchId, branchData] of data.branches) {\n\t\t\t\tconst branch = this.createSharedBranch(\n\t\t\t\t\tbranchId,\n\t\t\t\t\tbranchData.session,\n\t\t\t\t\tmainBranch,\n\t\t\t\t\tmainBranch.trunk.fork(),\n\t\t\t\t);\n\t\t\t\tbranch.loadSummaryData(branchData, trunkRevisionCache);\n\t\t\t\tthis.addSharedBranch(branchId, branch);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic getTrunkHead(branchId: BranchId): GraphCommit<TChangeset> {\n\t\treturn this.getSharedBranch(branchId).trunk.getHead();\n\t}\n\n\tpublic getTrunkChanges(branchId: BranchId): TChangeset[] {\n\t\treturn this.getTrunkCommits(branchId).map((c) => c.change);\n\t}\n\n\tpublic getTrunkCommits(branchId: BranchId): GraphCommit<TChangeset>[] {\n\t\treturn getPathFromBase(this.getTrunkHead(branchId), this.trunkBase);\n\t}\n\n\tpublic getLocalCommits(branchId: BranchId): readonly GraphCommit<TChangeset>[] {\n\t\tconst branch = this.getSharedBranch(branchId);\n\t\treturn branch.getLocalCommits();\n\t}\n\n\t/**\n\t * Gets the length of the longest branch maintained by this `EditManager`.\n\t * This may be the length of a peer branch or the local branch.\n\t *\n\t * @remarks\n\t * The length is counted from the lowest common ancestor with the trunk such that a fully sequenced branch would\n\t * have length zero.\n\t */\n\tpublic getLongestBranchLength(): number {\n\t\tlet max = 0;\n\t\tfor (const branch of this.sharedBranches.values()) {\n\t\t\tmax = Math.max(max, branch.getLongestBranchLength());\n\t\t}\n\t\treturn max;\n\t}\n\n\tpublic sequenceBranchCreation(\n\t\tsessionId: SessionId,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tbranchId: BranchId,\n\t): void {\n\t\tif (sessionId === this.localSessionId) {\n\t\t\tassert(this.sharedBranches.has(branchId), 0xc59 /* Expected branch to already exist */);\n\t\t\treturn;\n\t\t}\n\n\t\tconst mainBranch = this.getSharedBranch(\"main\");\n\t\tconst branchTrunk = mainBranch.rebasePeer(sessionId, referenceSequenceNumber).fork();\n\t\tthis.createAndAddSharedBranch(branchId, sessionId, mainBranch, branchTrunk);\n\t}\n\n\tpublic addNewBranch(branchId: BranchId): void {\n\t\tconst main = this.getSharedBranch(\"main\") ?? fail(0xc5a /* Main branch must exist */);\n\t\tthis.createAndAddSharedBranch(\n\t\t\tbranchId,\n\t\t\tthis.localSessionId,\n\t\t\tmain,\n\t\t\tthis.getLocalBranch(\"main\").fork(),\n\t\t);\n\t}\n\n\tpublic getSharedBranchIds(): BranchId[] {\n\t\treturn Array.from(this.sharedBranches.keys());\n\t}\n\n\tpublic removeBranch(branchId: BranchId): void {\n\t\tassert(branchId !== \"main\", 0xc5b /* Cannot remove main branch */);\n\t\tconst hadBranch = this.sharedBranches.delete(branchId);\n\t\tassert(hadBranch, 0xc5c /* Expected branch to exist */);\n\t}\n\n\tprivate createAndAddSharedBranch(\n\t\tbranchId: BranchId,\n\t\tsessionId: SessionId | undefined,\n\t\tparent: SharedBranch<TEditor, TChangeset> | undefined,\n\t\tbranch: SharedTreeBranch<TEditor, TChangeset>,\n\t): SharedBranch<TEditor, TChangeset> {\n\t\tconst sharedBranch = this.createSharedBranch(branchId, sessionId, parent, branch);\n\t\tthis.addSharedBranch(branchId, sharedBranch);\n\t\treturn sharedBranch;\n\t}\n\n\tprivate addSharedBranch(\n\t\tbranchId: BranchId,\n\t\tbranch: SharedBranch<TEditor, TChangeset>,\n\t): void {\n\t\tassert(\n\t\t\t!this.sharedBranches.has(branchId),\n\t\t\t0xc5d /* A branch with this ID already exists */,\n\t\t);\n\t\tthis.sharedBranches.set(branchId, branch);\n\n\t\t// Track all forks of the local branch for purposes of trunk eviction. Unlike the local branch, they have\n\t\t// an unknown lifetime and rebase frequency, so we can not make any assumptions about which trunk commits\n\t\t// they require and therefore we monitor them explicitly.\n\t\tonForkTransitive(branch.localBranch, (fork) => this.registerBranch(fork));\n\n\t\tif (branchId !== \"main\") {\n\t\t\tthis.registerBranch(branch.localBranch);\n\t\t\tthis.onSharedBranchCreated?.(branchId);\n\t\t}\n\t}\n\n\tprivate createSharedBranch(\n\t\tbranchId: BranchId,\n\t\tsessionId: SessionId | undefined,\n\t\tparent: SharedBranch<TEditor, TChangeset> | undefined,\n\t\tbranch: SharedTreeBranch<TEditor, TChangeset>,\n\t): SharedBranch<TEditor, TChangeset> {\n\t\tconst sharedBranch = new SharedBranch(\n\t\t\tparent,\n\t\t\tbranch,\n\t\t\tbranchId,\n\t\t\tsessionId,\n\t\t\tminimumPossibleSequenceId,\n\t\t\tthis.changeFamily,\n\t\t\tthis.mintRevisionTag,\n\t\t\tthis._events,\n\t\t\tthis.telemetryEventBatcher,\n\t\t);\n\n\t\treturn sharedBranch;\n\t}\n\n\t/* eslint-disable jsdoc/check-indentation */\n\t/**\n\t * Add a bunch of sequenced changes. A bunch is a group of sequenced commits that have the following properties:\n\t * - They are not interleaved with messages from other DDSes in the container.\n\t * - They are all part of the same batch, which entails:\n\t * - They are contiguous in sequencing order.\n\t * - They are all from the same client.\n\t * - They are all based on the same reference sequence number.\n\t * - They are not interleaved with messages from other clients.\n\t */\n\t/* eslint-enable jsdoc/check-indentation */\n\tpublic addSequencedChanges(\n\t\tnewCommits: readonly GraphCommit<TChangeset>[],\n\t\tsessionId: SessionId,\n\t\tsequenceNumber: SeqNumber,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tbranchId: BranchId,\n\t): void {\n\t\tassert(newCommits.length > 0, 0xad8 /* Expected at least one sequenced change */);\n\t\tassert(\n\t\t\tsequenceNumber > this.minimumSequenceNumber,\n\t\t\t0x713 /* Expected change sequence number to exceed the last known minimum sequence number */,\n\t\t);\n\n\t\tconst branch = this.getSharedBranch(branchId);\n\n\t\tconst onSequenceLocalCommit = (\n\t\t\tcommit: GraphCommit<TChangeset>,\n\t\t\tsequenceId: SequenceId,\n\t\t\tpreviousSequenceId: SequenceId,\n\t\t): void => {\n\t\t\t// Next, we need to update the sequence IDs that our local branches (user's branches, not peer branches) are associated with.\n\t\t\t// In particular, if a local branch is based on the previous trunk head (the branch's first ancestor in the trunk is the commit that was the head before we pushed the new commit)\n\t\t\t// and also branches off of the local branch (it has an ancestor that is part of the local branch), it needs to have its sequence number advanced to be that of the new trunk head.\n\t\t\t// Intuitively, this makes sense because:\n\t\t\t// 1. The trunk's head just advanced forward by some (sequence) amount.\n\t\t\t// 2. The local branch is always rebased to be branching off of the head of the trunk (not literally in this case, because of the optimization, but in effect).\n\t\t\t// 3. Therefore, the entire local branch just advanced forward by some (sequence) amount, and any commits downstream of it which track the sequence numbers of their base commits on the trunk should also advance.\n\t\t\t// This update is not necessarily required for all local branches, since some may have fallen behind the local branch and are based on older trunk commits (such branches do not need updating).\n\t\t\tconst currentBranches = this.trunkBranches.get(previousSequenceId);\n\t\t\tif (currentBranches !== undefined) {\n\t\t\t\tconst newBranches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());\n\t\t\t\tfor (const forkedBranch of currentBranches) {\n\t\t\t\t\t// Check every branch associated with the old sequence ID and advance it if it is based on the local branch (specifically, on the local branch as it was before we pushed its first commit to the trunk).\n\t\t\t\t\t// We validate this by checking if the branch's head is a descendant of the local commit that we just pushed.\n\t\t\t\t\tif (findAncestor(forkedBranch.getHead(), (c) => c === commit) !== undefined) {\n\t\t\t\t\t\tnewBranches.add(forkedBranch);\n\t\t\t\t\t\tcurrentBranches.delete(forkedBranch);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Clean up our trunk branches map by removing any empty sets.\n\t\t\t\tif (currentBranches.size === 0) {\n\t\t\t\t\tthis.trunkBranches.delete(previousSequenceId);\n\t\t\t\t}\n\t\t\t\tif (newBranches.size === 0) {\n\t\t\t\t\tthis.trunkBranches.delete(sequenceId);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst areLocalCommits = sessionId === this.localSessionId;\n\t\tbranch.addSequencedChanges(\n\t\t\tnewCommits,\n\t\t\tsessionId,\n\t\t\tsequenceNumber,\n\t\t\tareLocalCommits,\n\t\t\treferenceSequenceNumber,\n\t\t\tonSequenceLocalCommit,\n\t\t);\n\t}\n\n\tpublic findLocalCommit(\n\t\tbranchId: BranchId,\n\t\trevision: RevisionTag,\n\t): [commit: GraphCommit<TChangeset>, commitsAfter: GraphCommit<TChangeset>[]] {\n\t\tconst commits: GraphCommit<TChangeset>[] = [];\n\t\tconst commit = findAncestor(\n\t\t\t[this.getSharedBranch(branchId).localBranch.getHead(), commits],\n\t\t\t(c) => c.revision === revision,\n\t\t);\n\t\tassert(commit !== undefined, 0x599 /* Expected local branch to contain revision */);\n\t\treturn [commit, commits];\n\t}\n}\n\n/**\n * The in-memory data that summaries contain\n */\nexport interface SummaryData<TChangeset> {\n\treadonly originator?: SessionId;\n\treadonly main: SharedBranchSummaryData<TChangeset>;\n\treadonly branches?: ReadonlyMap<BranchId, SharedBranchSummaryData<TChangeset>>;\n}\n\nexport interface SharedBranchSummaryData<TChangeset> {\n\treadonly id?: BranchId;\n\treadonly name?: string;\n\treadonly session?: SessionId;\n\treadonly author?: string;\n\treadonly base?: RevisionTag;\n\treadonly trunk: readonly SequencedCommit<TChangeset>[];\n\treadonly peerLocalBranches: ReadonlyMap<SessionId, SummarySessionBranch<TChangeset>>;\n}\n\n/**\n * Gets the path from the base of a branch to its head.\n */\nfunction getPathFromBase<TCommit extends { parent?: TCommit }>(\n\tbranchHead: TCommit,\n\tbaseBranchHead: TCommit,\n): TCommit[] {\n\tconst path: TCommit[] = [];\n\tassert(\n\t\tfindCommonAncestor([branchHead, path], baseBranchHead) !== undefined,\n\t\t0x573 /* Expected branches to be related */,\n\t);\n\treturn path;\n}\n\nclass SharedBranch<TEditor extends ChangeFamilyEditor, TChangeset> {\n\t/**\n\t * This branch holds the changes made by this client which have not yet been confirmed as sequenced changes.\n\t */\n\tpublic readonly localBranch: SharedTreeBranch<TEditor, TChangeset>;\n\n\t/**\n\t * Branches are maintained to represent the local change list that the issuing client had\n\t * at the time of submitting the latest known edit on the branch.\n\t * This means the head commit of each branch is always in its original (non-rebased) form.\n\t */\n\tprivate readonly peerLocalBranches: Map<SessionId, SharedTreeBranch<TEditor, TChangeset>> =\n\t\tnew Map();\n\n\t/**\n\t * A map from a sequence id to the commit which has that sequence id.\n\t * This also includes an entry for the {@link trunkBase} which always has the lowest key in the map.\n\t */\n\tpublic readonly sequenceIdToCommit = new BTree<SequenceId, GraphCommit<TChangeset>>(\n\t\tundefined,\n\t\tsequenceIdComparator,\n\t);\n\n\t/**\n\t * The list of commits (from oldest to most recent) that are on the local branch but not on the trunk.\n\t * When a local commit is sequenced, the first commit in this list shifted onto the tip of the trunk.\n\t */\n\tprivate readonly localCommits: GraphCommit<TChangeset>[] = [];\n\n\t/**\n\t * Records extra data associated with sequenced commits.\n\t * This does not include an entry for the {@link trunkBase}.\n\t */\n\tprivate readonly commitMetadata = new Map<\n\t\tRevisionTag,\n\t\t{ sequenceId: SequenceId; sessionId: SessionId }\n\t>();\n\n\tpublic constructor(\n\t\tpublic readonly parentBranch: SharedBranch<TEditor, TChangeset> | undefined,\n\t\tpublic readonly trunk: SharedTreeBranch<TEditor, TChangeset>,\n\t\tprivate readonly id: BranchId,\n\t\tprivate readonly sessionId: SessionId | undefined,\n\t\tbaseCommitSequenceId: SequenceId,\n\t\tprivate readonly changeFamily: ChangeFamily<TEditor, TChangeset>,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tbranchTrimmer: Listenable<BranchTrimmingEvents>,\n\t\ttelemetryEventBatcher: TelemetryEventBatcher<keyof RebaseStatsWithDuration> | undefined,\n\t) {\n\t\tthis.localBranch = new SharedTreeBranch(\n\t\t\tthis.trunk.getHead(),\n\t\t\tchangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tbranchTrimmer,\n\t\t\ttelemetryEventBatcher,\n\t\t);\n\n\t\tthis.sequenceIdToCommit.set(baseCommitSequenceId, this.trunk.getHead());\n\n\t\tthis.localBranch.events.on(\"afterChange\", (event) => {\n\t\t\tif (event.type === \"append\") {\n\t\t\t\tfor (const commit of event.newCommits) {\n\t\t\t\t\tthis.localCommits.push(commit);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.localCommits.length = 0;\n\t\t\t\tfindCommonAncestor(\n\t\t\t\t\t[this.localBranch.getHead(), this.localCommits],\n\t\t\t\t\tthis.trunk.getHead(),\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic addSequencedChanges(\n\t\tnewCommits: readonly GraphCommit<TChangeset>[],\n\t\tsessionId: SessionId,\n\t\tsequenceNumber: SeqNumber,\n\t\tareLocalCommits: boolean,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tonSequenceLocalCommit: OnSequenceCommit<TChangeset>,\n\t): void {\n\t\tassert(\n\t\t\tsequenceNumber >= // This is \">=\", not \">\" because changes in the same batch will have the same sequence number\n\t\t\t\t(this.sequenceIdToCommit.maxKey()?.sequenceNumber ?? minimumPossibleSequenceNumber),\n\t\t\t0xa64 /* Attempted to sequence change with an outdated sequence number */,\n\t\t);\n\n\t\tconst batchSize = this.getBatchSize(sequenceNumber);\n\t\t// The sequence id for the next commit to be processed in the bunch.\n\t\tlet nextSequenceId =\n\t\t\tbatchSize === 0\n\t\t\t\t? {\n\t\t\t\t\t\tsequenceNumber,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tsequenceNumber,\n\t\t\t\t\t\tindexInBatch: batchSize,\n\t\t\t\t\t};\n\n\t\t// Local changes, i.e., changes from this client are applied by fast forwarding the local branch commit onto\n\t\t// the trunk.\n\t\tif (areLocalCommits) {\n\t\t\tfor (const { revision } of newCommits) {\n\t\t\t\tthis.sequenceLocalCommit(revision, nextSequenceId, sessionId, onSequenceLocalCommit);\n\t\t\t\tnextSequenceId = getNextSequenceId(nextSequenceId);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Remote changes, i.e., changes from remote clients are applied in three steps.\n\t\t// Step 1 - Recreate the peer remote client's local environment.\n\t\t// Get the revision that the remote change is based on and rebase that peer local branch over the part of the\n\t\t// trunk up to the base revision. This will be a no-op if the sending client has not advanced since the last\n\t\t// time we received an edit from it\n\t\tconst peerLocalBranch = this.rebasePeer(sessionId, referenceSequenceNumber);\n\n\t\t// Step 2 - Append the changes to the peer branch and rebase the changes to the tip of the trunk.\n\t\tif (peerLocalBranch.getHead() === this.trunk.getHead()) {\n\t\t\t// If the peer local branch is fully caught up and empty (no changes relative to the trunk) after being\n\t\t\t// rebased, then push changes to the trunk directly and update the peer branch to the trunk's head.\n\t\t\tfor (const newCommit of newCommits) {\n\t\t\t\tthis.pushCommitToTrunk(nextSequenceId, { ...newCommit, sessionId });\n\t\t\t\tnextSequenceId = getNextSequenceId(nextSequenceId);\n\t\t\t}\n\t\t\tpeerLocalBranch.setHead(this.trunk.getHead());\n\t\t} else {\n\t\t\t// Otherwise, push the changes to the peer local branch and merge the branch into the trunk.\n\t\t\tfor (const newCommit of newCommits) {\n\t\t\t\tpeerLocalBranch.apply(tagChange(newCommit.change, newCommit.revision));\n\t\t\t}\n\t\t\tconst result = this.trunk.merge(peerLocalBranch);\n\t\t\tif (result !== undefined) {\n\t\t\t\t// If the merge resulted in any changes to the trunk, update the sequence map and trunk metadata\n\t\t\t\t// with the rebased commits.\n\t\t\t\tfor (const sourceCommit of result.sourceCommits) {\n\t\t\t\t\tthis.sequenceIdToCommit.set(nextSequenceId, sourceCommit);\n\t\t\t\t\tthis.commitMetadata.set(sourceCommit.revision, {\n\t\t\t\t\t\tsequenceId: nextSequenceId,\n\t\t\t\t\t\tsessionId,\n\t\t\t\t\t});\n\t\t\t\t\tnextSequenceId = getNextSequenceId(nextSequenceId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Step 3 - Rebase the local branch over the updated trunk.\n\t\tthis.localBranch.rebaseOnto(this.trunk);\n\t}\n\n\tpublic isEmpty(baseCommit: GraphCommit<TChangeset>): boolean {\n\t\treturn (\n\t\t\tthis.trunk.getHead() === baseCommit &&\n\t\t\tthis.peerLocalBranches.size === 0 &&\n\t\t\tthis.localBranch.getHead() === this.trunk.getHead()\n\t\t);\n\t}\n\n\tpublic rebasePeer(\n\t\tsessionId: SessionId,\n\t\treferenceSequenceNumber: SeqNumber,\n\t): SharedTreeBranch<TEditor, TChangeset> {\n\t\tconst [, baseRevisionInTrunk] = this.getClosestTrunkCommit(referenceSequenceNumber);\n\t\tconst peerLocalBranch = getOrCreate(\n\t\t\tthis.peerLocalBranches,\n\t\t\tsessionId,\n\t\t\t() => new SharedTreeBranch(baseRevisionInTrunk, this.changeFamily, this.mintRevisionTag),\n\t\t);\n\t\tpeerLocalBranch.rebaseOnto(this.trunk, baseRevisionInTrunk);\n\t\treturn peerLocalBranch;\n\t}\n\n\tpublic getPeerBranchOrTrunk(sessionId: SessionId): SharedTreeBranch<TEditor, TChangeset> {\n\t\treturn this.peerLocalBranches.get(sessionId) ?? this.trunk;\n\t}\n\n\t/**\n\t * Gets the length of the longest branch maintained by this `SharedBranch`.\n\t * This may be the length of a peer branch or the local branch.\n\t *\n\t * @remarks\n\t * The length is counted from the lowest common ancestor with the trunk such that a fully sequenced branch would\n\t * have length zero.\n\t */\n\tpublic getLongestBranchLength(): number {\n\t\tlet max = 0;\n\t\tconst trunkHead = this.trunk.getHead();\n\t\tfor (const branch of this.peerLocalBranches.values()) {\n\t\t\tconst branchPath = getPathFromBase(branch.getHead(), trunkHead);\n\t\t\tif (branchPath.length > max) {\n\t\t\t\tmax = branchPath.length;\n\t\t\t}\n\t\t}\n\t\tconst localPath = getPathFromBase(this.localBranch.getHead(), trunkHead);\n\t\treturn Math.max(max, localPath.length);\n\t}\n\n\tpublic trimHistory(newBase: GraphCommit<TChangeset>, sequenceId: SequenceId): void {\n\t\tthis.rebasePeers(newBase);\n\n\t\tthis.sequenceIdToCommit.editRange(\n\t\t\tminimumPossibleSequenceId,\n\t\t\tsequenceId,\n\t\t\ttrue,\n\t\t\t(s, commit) => {\n\t\t\t\t// Cleanup look-aside data for each evicted commit\n\t\t\t\tthis.commitMetadata.delete(commit.revision);\n\t\t\t\t// Delete all evicted commits from `sequenceMap` except for the latest one, which is the new `trunkBase`\n\t\t\t\tif (equalSequenceIds(s, sequenceId)) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcommit === newBase,\n\t\t\t\t\t\t0x729 /* Expected last evicted commit to be new trunk base */,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\treturn { delete: true };\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\n\t\tconst trunkSize = getPathFromBase(this.trunk.getHead(), newBase).length;\n\t\tassert(\n\t\t\tthis.sequenceIdToCommit.size === trunkSize + 1,\n\t\t\t0x744 /* The size of the sequenceMap must have one element more than the trunk */,\n\t\t);\n\t\tassert(\n\t\t\tthis.commitMetadata.size === trunkSize,\n\t\t\t0x745 /* The size of the trunkMetadata must be the same as the trunk */,\n\t\t);\n\t}\n\n\tprivate rebasePeers(commit: GraphCommit<TChangeset>): void {\n\t\tfor (const [, branch] of this.peerLocalBranches) {\n\t\t\tbranch.rebaseOnto(this.trunk, commit);\n\t\t}\n\n\t\t// The metadata for new trunk base revision needs to be deleted before modifying it.\n\t\tthis.commitMetadata.delete(commit.revision);\n\t}\n\n\tpublic getLocalCommits(): readonly GraphCommit<TChangeset>[] {\n\t\treturn this.localCommits;\n\t}\n\n\t/**\n\t * Promote the oldest un-sequenced commit on the local branch to the head of the trunk.\n\t * @param sequenceId - The sequence id of the new trunk commit\n\t * @remarks This method is a performance optimization for the scenario where this client receives its own change back after sequencing.\n\t * The normal (not optimized) process in this case would be to apply the new sequenced commit to the trunk and then rebase the local branch over the trunk.\n\t * The first commit will be \"the same\" (as in, it will have the same revision) as the commit that was just sequenced, so the rebase will be a no-op.\n\t * Because the rebase is a no-op, we can skip it entirely and simply remove the commit from the local branch and append it to the trunk.\n\t * Avoiding the overhead of the rebase process, even when it's a no-op, has real measured performance benefits and is worth the added complexity here.\n\t */\n\tprivate sequenceLocalCommit(\n\t\trevision: RevisionTag,\n\t\tsequenceId: SequenceId,\n\t\tsessionId: SessionId,\n\t\tonSequenceLocalCommit: OnSequenceCommit<TChangeset>,\n\t): void {\n\t\tif (this.commitMetadata.has(revision)) {\n\t\t\t// This can happen if the commit came from a shared branch and was concurrently merged by another client.\n\t\t\t// In this case, the newly sequenced commit is redundant and should therefore be ignored.\n\t\t\treturn;\n\t\t}\n\n\t\t// First, push the local commit to the trunk.\n\t\t// We are mutating our `localCommits` cache here,but there is no need to actually change the `localBranch` itself because it will simply catch up later if/when it next rebases.\n\t\tconst firstLocalCommit = this.localCommits.shift();\n\t\tassert(\n\t\t\tfirstLocalCommit !== undefined,\n\t\t\t0x6b5 /* Received a sequenced change from the local session despite having no local changes */,\n\t\t);\n\n\t\tconst prevSequenceId = this.getCommitSequenceId(this.trunk.getHead().revision);\n\t\tthis.pushGraphCommitToTrunk(sequenceId, firstLocalCommit, sessionId);\n\t\tonSequenceLocalCommit(firstLocalCommit, sequenceId, prevSequenceId);\n\t}\n\n\t/**\n\t * Finds the most recent trunk commit that was sequenced at or before the given point.\n\t * @param searchBy - the sequence number or the sequence id to search for\n\t * @remarks Fails if there is no eligible commit.\n\t * @returns the closest commit and its sequence id\n\t */\n\tpublic getClosestTrunkCommit(searchBy: SeqNumber): [SequenceId, GraphCommit<TChangeset>];\n\tpublic getClosestTrunkCommit(searchBy: SequenceId): [SequenceId, GraphCommit<TChangeset>];\n\tpublic getClosestTrunkCommit(\n\t\tsearchBy: SeqNumber | SequenceId,\n\t): [SequenceId, GraphCommit<TChangeset>] {\n\t\tconst sequenceId: SequenceId =\n\t\t\ttypeof searchBy === \"number\"\n\t\t\t\t? {\n\t\t\t\t\t\t// This is to make sure that the correct commit is selected in this 2 scenarios:\n\t\t\t\t\t\t// 1) The commit is unique for that sequence number\n\t\t\t\t\t\t// 2) There are more than one commit for the same sequence number, in this case we need to select the last one.\n\t\t\t\t\t\tsequenceNumber: searchBy,\n\t\t\t\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t\t\t\t}\n\t\t\t\t: searchBy;\n\n\t\tconst commit = this.sequenceIdToCommit.getPairOrNextLower(sequenceId);\n\t\tassert(commit !== undefined, 0x746 /* sequence id has been evicted */);\n\t\treturn commit;\n\t}\n\n\tprivate pushGraphCommitToTrunk(\n\t\tsequenceId: SequenceId,\n\t\tgraphCommit: GraphCommit<TChangeset>,\n\t\tsessionId: SessionId,\n\t): void {\n\t\tthis.trunk.setHead(graphCommit);\n\t\tthis.registerSequencedCommit(sequenceId, sessionId, graphCommit);\n\t}\n\n\tprivate pushCommitToTrunk(sequenceId: SequenceId, commit: Commit<TChangeset>): void {\n\t\tconst mintedCommit = mintCommit(this.trunk.getHead(), commit);\n\t\tthis.pushGraphCommitToTrunk(sequenceId, mintedCommit, commit.sessionId);\n\t}\n\n\tprivate registerSequencedCommit(\n\t\tsequenceId: SequenceId,\n\t\tsessionId: SessionId,\n\t\tcommit: GraphCommit<TChangeset>,\n\t): void {\n\t\tthis.sequenceIdToCommit.set(sequenceId, commit);\n\t\tthis.commitMetadata.set(commit.revision, { sequenceId, sessionId });\n\t}\n\n\tpublic getCommitSequenceId(commitRevision: RevisionTag): SequenceId {\n\t\tconst id = this.commitMetadata.get(commitRevision)?.sequenceId;\n\t\tif (id === undefined) {\n\t\t\treturn minimumPossibleSequenceId;\n\t\t}\n\t\treturn id;\n\t}\n\n\t// TODO: Document that this is to handle receiving separate commits with the same sequence ID,\n\t// as a batch of changes are not guaranteed to be processed as one bunch.\n\tprivate getBatchSize(sequenceNumber: SeqNumber): number {\n\t\tconst startSequenceId: SequenceId = {\n\t\t\tsequenceNumber,\n\t\t};\n\t\tconst endSequenceId: SequenceId = {\n\t\t\tsequenceNumber: brand((sequenceNumber as number) + 1),\n\t\t};\n\n\t\treturn this.sequenceIdToCommit.getRange(startSequenceId, endSequenceId, false).length;\n\t}\n\n\tpublic getSummaryData(\n\t\tminSeqNumberToSummarize: SequenceId,\n\t\ttrunkBaseRevision: RevisionTag,\n\t): SharedBranchSummaryData<TChangeset> {\n\t\t// The assert below is acceptable at present because summarization only ever occurs on a client with no\n\t\t// local/in-flight changes.\n\t\t// In the future we may wish to relax this constraint. For that to work, the current implementation of\n\t\t// `EditManager` would have to be amended in one of two ways:\n\t\t// A) Changes made by the local session should be represented by a branch in `EditManager.branches`.\n\t\t// B) The contents of such a branch should be computed on demand based on the trunk.\n\t\t// Note that option (A) would be a simple change to `addSequencedChanges` whereas (B) would likely require\n\t\t// rebasing trunk changes over the inverse of trunk changes.\n\t\tassert(\n\t\t\tthis.localBranch.getHead() === this.trunk.getHead(),\n\t\t\t0xc5e /* Clients with local changes cannot be used to generate summaries */,\n\t\t);\n\n\t\tlet parentHead: GraphCommit<TChangeset>;\n\t\tif (this.parentBranch === undefined) {\n\t\t\tconst oldestCommitInCollabWindow =\n\t\t\t\tthis.getClosestTrunkCommit(minSeqNumberToSummarize)[1];\n\t\t\t// Path construction is exclusive, so we need to use the parent of the oldest commit in the window if it exists\n\t\t\tparentHead = oldestCommitInCollabWindow.parent ?? oldestCommitInCollabWindow;\n\t\t} else {\n\t\t\tparentHead = this.parentBranch.trunk.getHead();\n\t\t}\n\n\t\tconst childBranchTrunkCommits: GraphCommit<TChangeset>[] = [];\n\t\tconst forkPointFromMainTrunk = findCommonAncestor(\n\t\t\t[this.trunk.getHead(), childBranchTrunkCommits],\n\t\t\tparentHead,\n\t\t);\n\t\tassert(\n\t\t\tforkPointFromMainTrunk !== undefined,\n\t\t\t0xc5f /* Expected child branch to be based on main branch */,\n\t\t);\n\n\t\tconst trunk = childBranchTrunkCommits.map((c) => {\n\t\t\tconst metadata =\n\t\t\t\tthis.commitMetadata.get(c.revision) ??\n\t\t\t\tfail(0xad5 /* Expected metadata for trunk commit */);\n\t\t\tconst commit: SequencedCommit<TChangeset> = {\n\t\t\t\tchange: c.change,\n\t\t\t\trevision: c.revision,\n\t\t\t\tsequenceNumber: metadata.sequenceId.sequenceNumber,\n\t\t\t\tsessionId: metadata.sessionId,\n\t\t\t};\n\t\t\tif (metadata.sequenceId.indexInBatch !== undefined) {\n\t\t\t\tcommit.indexInBatch = metadata.sequenceId.indexInBatch;\n\t\t\t}\n\t\t\treturn commit;\n\t\t});\n\n\t\tconst peerLocalBranches = new Map<SessionId, SummarySessionBranch<TChangeset>>(\n\t\t\tmapIterable(this.peerLocalBranches.entries(), ([sessionId, branch]) => {\n\t\t\t\tconst branchPath: GraphCommit<TChangeset>[] = [];\n\t\t\t\tconst ancestor =\n\t\t\t\t\tfindCommonAncestor([branch.getHead(), branchPath], this.trunk.getHead()) ??\n\t\t\t\t\tfail(0xad6 /* Expected branch to be based on trunk */);\n\n\t\t\t\tconst base =\n\t\t\t\t\tancestor.revision === trunkBaseRevision ? rootRevision : ancestor.revision;\n\t\t\t\treturn [\n\t\t\t\t\tsessionId,\n\t\t\t\t\t{\n\t\t\t\t\t\tbase,\n\t\t\t\t\t\tcommits: branchPath.map((c) => {\n\t\t\t\t\t\t\tconst commit: Commit<TChangeset> = {\n\t\t\t\t\t\t\t\tchange: c.change,\n\t\t\t\t\t\t\t\trevision: c.revision,\n\t\t\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\treturn commit;\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}),\n\t\t);\n\n\t\tconst trunkBase =\n\t\t\tthis.parentBranch === undefined ? undefined : forkPointFromMainTrunk.revision;\n\t\treturn { trunk, peerLocalBranches, base: trunkBase, id: this.id, session: this.sessionId };\n\t}\n\n\tpublic loadSummaryData(\n\t\tdata: SharedBranchSummaryData<TChangeset>,\n\t\ttrunkRevisionCache: Map<RevisionTag, GraphCommit<TChangeset>>,\n\t): void {\n\t\tassert(\n\t\t\t(this.parentBranch === undefined) === (data.base === undefined),\n\t\t\t0xc60 /* Expected branch base to match presence of parent branch */,\n\t\t);\n\t\tconst parentTrunkBase =\n\t\t\ttrunkRevisionCache.get(data.base ?? rootRevision) ??\n\t\t\tfail(0xc61 /* Expected base revision to be in trunk cache */);\n\t\tthis.trunk.setHead(\n\t\t\tdata.trunk.reduce((base, c) => {\n\t\t\t\tconst sequenceId: SequenceId =\n\t\t\t\t\tc.indexInBatch === undefined\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tsequenceNumber: c.sequenceNumber,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tsequenceNumber: c.sequenceNumber,\n\t\t\t\t\t\t\t\tindexInBatch: c.indexInBatch,\n\t\t\t\t\t\t\t};\n\t\t\t\tconst commit = mintCommit(base, c);\n\t\t\t\tthis.sequenceIdToCommit.set(sequenceId, commit);\n\t\t\t\tthis.commitMetadata.set(c.revision, {\n\t\t\t\t\tsequenceId,\n\t\t\t\t\tsessionId: c.sessionId,\n\t\t\t\t});\n\t\t\t\ttrunkRevisionCache.set(c.revision, commit);\n\t\t\t\treturn commit;\n\t\t\t}, parentTrunkBase),\n\t\t);\n\n\t\tthis.localBranch.setHead(this.trunk.getHead());\n\n\t\tfor (const [sessionId, branch] of data.peerLocalBranches) {\n\t\t\tconst commit =\n\t\t\t\ttrunkRevisionCache.get(branch.base) ??\n\t\t\t\tfail(0xad7 /* Expected summary branch to be based off of a revision in the trunk */);\n\n\t\t\tthis.peerLocalBranches.set(\n\t\t\t\tsessionId,\n\t\t\t\tnew SharedTreeBranch(\n\t\t\t\t\tbranch.commits.reduce(mintCommit, commit),\n\t\t\t\t\tthis.changeFamily,\n\t\t\t\t\tthis.mintRevisionTag,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n}\n\n// Returns the sequence id for the next commit to be processed in the bunch. Since all the commits have the\n// same sequence number, only the index in the batch needs to be incremented.\nfunction getNextSequenceId(sequenceId: SequenceId): SequenceId {\n\treturn {\n\t\tsequenceNumber: sequenceId.sequenceNumber,\n\t\tindexInBatch: (sequenceId.indexInBatch ?? 0) + 1,\n\t};\n}\n\ntype OnSequenceCommit<TChangeset> = (\n\tcommit: GraphCommit<TChangeset>,\n\tsequenceId: SequenceId,\n\tprevSequenceId: SequenceId,\n) => void;\n"]}
1
+ {"version":3,"file":"editManager.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AACnE,+DAA6D;AAE7D,gEAAkD;AAElD,+CAW0B;AAC1B,+CAAiF;AAEjF,2CAKqB;AAQrB,6DAM8B;AAC9B,uEAGkD;AAGrC,QAAA,6BAA6B,GAAc,IAAA,gBAAK,EAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACvF,MAAM,yBAAyB,GAAe;IAC7C,cAAc,EAAE,qCAA6B;CAC7C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,YAAY,GAAG,MAAqC,CAAC;AAE3D;;GAEG;AACH,MAAM,8BAA8B,GAAG,IAAI,CAAC;AAE5C;;;GAGG;AACH,sDAAsD;AACtD,MAAa,WAAW;IA0CvB;;;;;OAKG;IACH,YACiB,YAA2B,EAC3B,cAAyB,EACxB,eAAkC,EAClC,qBAAoD,EACrE,aAA6B,EAC7B,MAA4B;QALZ,iBAAY,GAAZ,YAAY,CAAe;QAC3B,mBAAc,GAAd,cAAc,CAAW;QACxB,oBAAe,GAAf,eAAe,CAAmB;QAClC,0BAAqB,GAArB,qBAAqB,CAA+B;QA/CrD,YAAO,GAAG,IAAA,4BAAa,GAAwB,CAAC;QAEhD,mBAAc,GAAG,IAAI,GAAG,EAA+C,CAAC;QAEzF;;;;;;;WAOG;QACc,kBAAa,GAAG,IAAI,wBAAK,CAGxC,SAAS,EAAE,yCAAoB,CAAC,CAAC;QAEnC;;;;;WAKG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AAO;QACN,cAAc,EAAE,UAAU,CAAC,cAAc;QACzC,YAAY,EAAE,CAAC,UAAU,CAAC,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC;KAChD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { SessionId } from \"@fluidframework/id-compressor\";\nimport { BTree } from \"@tylerbu/sorted-btree-es6\";\n\nimport {\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\tfindAncestor,\n\tfindCommonAncestor,\n\tmintCommit,\n\ttype RebaseStatsWithDuration,\n\ttagChange,\n\ttype EditorOptions,\n} from \"../core/index.js\";\nimport { type Mutable, brand, getOrCreate, mapIterable } from \"../util/index.js\";\n\nimport {\n\tSharedTreeBranch,\n\ttype BranchTrimmingEvents,\n\tonForkTransitive,\n\ttype BranchId,\n} from \"./branch.js\";\nimport type {\n\tCommit,\n\tSeqNumber,\n\tSequenceId,\n\tSequencedCommit,\n\tSummarySessionBranch,\n} from \"./editManagerFormatCommons.js\";\nimport {\n\tgetUpperBoundOfPreviousSequenceId,\n\tequalSequenceIds,\n\tmaxSequenceId,\n\tminSequenceId,\n\tsequenceIdComparator,\n} from \"./sequenceIdUtils.js\";\nimport {\n\tTelemetryEventBatcher,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\n\nexport const minimumPossibleSequenceNumber: SeqNumber = brand(Number.MIN_SAFE_INTEGER);\nconst minimumPossibleSequenceId: SequenceId = {\n\tsequenceNumber: minimumPossibleSequenceNumber,\n};\n\n/**\n * A special revision tag for the initial {@link EditManager.trunkBase} commit.\n * @remarks This tag is used to supply the _initial_ trunk base with a known revision.\n * The trunk base may advance over time, after which point the trunk base will have a different revision.\n * When {@link EditManager.getSummaryData | serializing} and deserializing, peer branches that include the trunk base commit in their history will always use this tag.\n */\nconst rootRevision = \"root\" as const satisfies RevisionTag;\n\n/**\n * Max number of telemetry log call that may be aggregated before being sent.\n */\nconst maxRebaseStatsAggregationCount = 1000;\n\n/**\n * Represents a local branch of a document and interprets the effect on the document of adding sequenced changes,\n * which were based on a given session's branch, to the document history\n */\n// TODO: Try to reduce this to a single type parameter\nexport class EditManager<\n\tTEditor extends ChangeFamilyEditor,\n\tTChangeset,\n\tTChangeFamily extends ChangeFamily<TEditor, TChangeset>,\n> {\n\tprivate readonly _events = createEmitter<BranchTrimmingEvents>();\n\n\tprivate readonly sharedBranches = new Map<BranchId, SharedBranch<TEditor, TChangeset>>();\n\n\t/**\n\t * Tracks where on the trunk of the main branch all registered branches are based.\n\t * Each key is the sequence id of a commit on the trunk,\n\t * and the value is the set of all branches who have that commit as their common ancestor with the trunk.\n\t *\n\t * @remarks\n\t * This does not include the local branch.\n\t */\n\tprivate readonly trunkBranches = new BTree<\n\t\tSequenceId,\n\t\tSet<SharedTreeBranch<TEditor, TChangeset>>\n\t>(undefined, sequenceIdComparator);\n\n\t/**\n\t * The sequence number of the newest commit on the trunk that has been received by all peers.\n\t * Defaults to {@link minimumPossibleSequenceNumber} if no commits have been received.\n\t *\n\t * @remarks If there are more than one commit with the same sequence number we assume this refers to the last commit in the batch.\n\t */\n\tprivate minimumSequenceNumber = minimumPossibleSequenceNumber;\n\n\t/**\n\t * A special commit that is a \"base\" (tail) of the trunk, though not part of the trunk itself.\n\t * This makes it possible to model the trunk in the same way as any other branch (it branches off of a base commit)\n\t * which allows it to use branching APIs to interact with the other branches.\n\t * Each time trunk eviction occurs, the most recent evicted commit becomes the new `trunkBase`.\n\t */\n\tprivate trunkBase: GraphCommit<TChangeset>;\n\n\tprivate readonly telemetryEventBatcher:\n\t\t| TelemetryEventBatcher<keyof RebaseStatsWithDuration>\n\t\t| undefined;\n\n\t/**\n\t * @param changeFamily - the change family of changes on the trunk and local branch\n\t * @param localSessionId - the id of the local session that will be used for local commits\n\t * @param mintRevisionTag - a function which generates globally unique revision tags\n\t * @param onSharedBranchCreated - called when a new shared branch is created. This is not called for the main branch.\n\t */\n\tpublic constructor(\n\t\tpublic readonly changeFamily: TChangeFamily,\n\t\tpublic readonly localSessionId: SessionId,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tprivate readonly onSharedBranchCreated?: (branchId: BranchId) => void,\n\t\teditorOptions?: EditorOptions,\n\t\tlogger?: ITelemetryLoggerExt,\n\t) {\n\t\tthis.trunkBase = {\n\t\t\trevision: rootRevision,\n\t\t\tchange: changeFamily.rebaser.compose([]),\n\t\t};\n\n\t\tif (logger !== undefined) {\n\t\t\tthis.telemetryEventBatcher = new TelemetryEventBatcher(\n\t\t\t\t{\n\t\t\t\t\teventName: \"rebaseProcessing\",\n\t\t\t\t\tcategory: \"performance\",\n\t\t\t\t},\n\t\t\t\tlogger,\n\t\t\t\tmaxRebaseStatsAggregationCount,\n\t\t\t);\n\t\t}\n\n\t\tconst mainTrunk = new SharedTreeBranch(\n\t\t\tthis.trunkBase,\n\t\t\tchangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tthis._events,\n\t\t\tthis.telemetryEventBatcher,\n\t\t\teditorOptions,\n\t\t);\n\n\t\tthis.createAndAddSharedBranch(\"main\", undefined, undefined, mainTrunk, editorOptions);\n\t}\n\n\tpublic getLocalBranch(branchId: BranchId): SharedTreeBranch<TEditor, TChangeset> {\n\t\treturn this.getSharedBranch(branchId).localBranch;\n\t}\n\n\tprivate getSharedBranch(branchId: BranchId): SharedBranch<TEditor, TChangeset> {\n\t\treturn this.sharedBranches.get(branchId) ?? fail(0xc56 /* Branch does not exist */);\n\t}\n\n\t/**\n\t * Make the given branch known to the `EditManager`. The `EditManager` will ensure that all registered\n\t * branches remain usable even as the minimum sequence number advances.\n\t *\n\t * TODO#AB6926: Refactor local branch management into a separate class that encapsulates `trunkBranches` and everything\n\t * that touches it.\n\t * TODO#AB6925: Maintain the divergence point between each branch and the trunk so that we don't have to recompute\n\t * it so often.\n\t */\n\tprivate registerBranch(branch: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tthis.trackBranch(branch);\n\t\t// Whenever the branch is rebased, update our record of its base trunk commit\n\t\tconst offBeforeRebase = branch.events.on(\"beforeChange\", (args) => {\n\t\t\tif (args.type === \"rebase\") {\n\t\t\t\tthis.untrackBranch(branch);\n\t\t\t}\n\t\t});\n\t\tconst offAfterRebase = branch.events.on(\"afterChange\", (args) => {\n\t\t\tif (args.type === \"rebase\") {\n\t\t\t\tthis.trackBranch(branch);\n\t\t\t\tthis.trimHistory();\n\t\t\t}\n\t\t});\n\t\t// When the branch is disposed, update our branch set and trim the trunk\n\t\tconst offDispose = branch.events.on(\"dispose\", () => {\n\t\t\tthis.untrackBranch(branch);\n\t\t\tthis.trimHistory();\n\t\t\toffBeforeRebase();\n\t\t\toffAfterRebase();\n\t\t\toffDispose();\n\t\t});\n\t}\n\n\tprivate trackBranch(b: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tconst main = this.getSharedBranch(\"main\");\n\t\tconst trunkCommit =\n\t\t\tfindCommonAncestor(main.trunk.getHead(), b.getHead()) ??\n\t\t\tfail(0xad2 /* Expected branch to be related to main */);\n\t\tconst sequenceId = main.getCommitSequenceId(trunkCommit.revision);\n\t\tconst branches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());\n\n\t\tassert(!branches.has(b), 0x670 /* Branch was registered more than once */);\n\t\tbranches.add(b);\n\t}\n\n\tprivate untrackBranch(b: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tconst main = this.getSharedBranch(\"main\");\n\t\tconst trunkCommit =\n\t\t\tfindCommonAncestor(main.trunk.getHead(), b.getHead()) ??\n\t\t\tfail(0xad3 /* Expected branch to be related to main */);\n\t\tconst sequenceId = main.getCommitSequenceId(trunkCommit.revision);\n\t\tconst branches =\n\t\t\tthis.trunkBranches.get(sequenceId) ?? fail(0xad4 /* Expected branch to be tracked */);\n\n\t\tassert(branches.delete(b), 0x671 /* Expected branch to be tracked */);\n\t\tif (branches.size === 0) {\n\t\t\tthis.trunkBranches.delete(sequenceId);\n\t\t}\n\t}\n\n\t/**\n\t * Return the sequenced number of the latest sequenced change.\n\t */\n\tpublic getLatestSequenceNumber(): SeqNumber | undefined {\n\t\tlet maxSequenceNumber: SeqNumber | undefined;\n\t\tfor (const branch of this.sharedBranches.values()) {\n\t\t\tconst branchMax = branch.getCommitSequenceId(\n\t\t\t\tbranch.trunk.getHead().revision,\n\t\t\t).sequenceNumber;\n\t\t\tif (maxSequenceNumber === undefined || maxSequenceNumber < branchMax) {\n\t\t\t\tmaxSequenceNumber = branchMax;\n\t\t\t}\n\t\t}\n\n\t\treturn maxSequenceNumber;\n\t}\n\n\t/**\n\t * Advances the minimum sequence number, and removes all commits from the trunk which lie outside the collaboration window,\n\t * if they are not retained by revertibles or local branches.\n\t * @param minimumSequenceNumber - the sequence number of the newest commit that all peers (including this one) have received and applied to their trunks.\n\t *\n\t * @remarks If there are more than one commit with the same sequence number we assume this refers to the last commit in the batch.\n\t */\n\tpublic advanceMinimumSequenceNumber(\n\t\tminimumSequenceNumber: SeqNumber,\n\t\ttrimHistory = true,\n\t): void {\n\t\tif (minimumSequenceNumber === this.minimumSequenceNumber) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(\n\t\t\tminimumSequenceNumber > this.minimumSequenceNumber,\n\t\t\t0x476 /* number must be larger or equal to current minimumSequenceNumber. */,\n\t\t);\n\n\t\tthis.minimumSequenceNumber = minimumSequenceNumber;\n\t\tif (trimHistory) {\n\t\t\tthis.trimHistory();\n\t\t}\n\t}\n\n\t/**\n\t * Examines the latest known minimum sequence number and the trunk bases of any registered branches to determine\n\t * if any commits on the trunk are unreferenced and unneeded for future computation; those found are evicted from the trunk.\n\t */\n\tprivate trimHistory(): void {\n\t\t/** The sequence id of the most recent commit on the trunk that will be trimmed */\n\t\tlet trunkTailSequenceId: SequenceId = {\n\t\t\tsequenceNumber: this.minimumSequenceNumber,\n\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t};\n\t\t// If there are any outstanding registered branches, get the one that is the oldest (has the \"most behind\" trunk base)\n\t\tconst minimumBranchBaseSequenceId = this.trunkBranches.minKey();\n\t\tif (minimumBranchBaseSequenceId !== undefined) {\n\t\t\t// If that branch is behind the minimum sequence id, we only want to evict commits older than it,\n\t\t\t// even if those commits are behind the minimum sequence id\n\t\t\tconst sequenceIdBeforeMinimumBranchBase = getUpperBoundOfPreviousSequenceId(\n\t\t\t\tminimumBranchBaseSequenceId,\n\t\t\t);\n\t\t\ttrunkTailSequenceId = minSequenceId(\n\t\t\t\ttrunkTailSequenceId,\n\t\t\t\tsequenceIdBeforeMinimumBranchBase,\n\t\t\t);\n\t\t}\n\n\t\tconst mainBranch = this.getSharedBranch(\"main\");\n\n\t\tconst [sequenceId, latestEvicted] = mainBranch.getClosestTrunkCommit(\n\t\t\tmaxSequenceId(\n\t\t\t\ttrunkTailSequenceId,\n\t\t\t\tmainBranch.sequenceIdToCommit.minKey() ?? minimumPossibleSequenceId,\n\t\t\t),\n\t\t);\n\n\t\t// Don't do any work if the commit found by the search is already the tail of the trunk\n\t\tif (latestEvicted === this.trunkBase) {\n\t\t\treturn;\n\t\t}\n\n\t\t// This mutation is a performance hack. If commits are truly immutable, then changing the trunk's tail requires\n\t\t// regenerating the entire commit graph. Instead, we can simply chop off the tail like this if we're certain\n\t\t// that there are no outstanding references to any of the commits being removed (other than the references via\n\t\t// the trunk). The peer branches have been rebased to the head of the trunk, the local branch is already rebased\n\t\t// to the head of the trunk, and all other branches are tracked by `trunkBranches` and known to be ahead of or at\n\t\t// `newTrunkBase`. Therefore, no branches should have unique references to any of the commits being evicted here.\n\t\t// We mutate the most recent of the evicted commits to become the new trunk base. That way, any other commits that\n\t\t// have parent pointers to the latest evicted commit will stay linked, even though that it is no longer part of the trunk.\n\t\tconst newTrunkBase = latestEvicted as Mutable<typeof latestEvicted>;\n\n\t\t// collect the revisions that will be trimmed to send as part of the branch trimmed event\n\t\tconst trimmedCommits = getPathFromBase(newTrunkBase, this.trunkBase);\n\t\tconst trimmedRevisions = trimmedCommits.map((c) => c.revision);\n\n\t\t// The minimum sequence number informs us that all peer branches are at least caught up to the tail commit,\n\t\t// so rebase them accordingly. This is necessary to prevent peer branches from referencing any evicted commits.\n\t\tmainBranch.trimHistory(latestEvicted, sequenceId);\n\n\t\t// Only the last trimmed commit, which is the new trunk base, should remain accessible.\n\t\tfor (const commit of trimmedCommits.slice(0, -1)) {\n\t\t\tReflect.defineProperty(commit, \"change\", {\n\t\t\t\tget: () =>\n\t\t\t\t\tassert(false, 0xa5e /* Should not access 'change' property of an evicted commit */),\n\t\t\t});\n\t\t\tReflect.defineProperty(commit, \"revision\", {\n\t\t\t\tget: () =>\n\t\t\t\t\tassert(\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t0xa5f /* Should not access 'revision' property of an evicted commit */,\n\t\t\t\t\t),\n\t\t\t});\n\t\t\tReflect.defineProperty(commit, \"parent\", {\n\t\t\t\tget: () =>\n\t\t\t\t\tassert(false, 0xa60 /* Should not access 'parent' property of an evicted commit */),\n\t\t\t});\n\t\t}\n\n\t\t// Dropping the parent field removes (transitively) all references to the evicted commits so they can be garbage collected.\n\t\tdelete newTrunkBase.parent;\n\t\tthis.trunkBase = newTrunkBase;\n\n\t\tthis._events.emit(\"ancestryTrimmed\", trimmedRevisions);\n\t}\n\n\tpublic isEmpty(): boolean {\n\t\tfor (const branch of this.sharedBranches.values()) {\n\t\t\tif (!branch.isEmpty(this.trunkBase)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn this.minimumSequenceNumber === minimumPossibleSequenceNumber;\n\t}\n\n\tpublic getSummaryData(): SummaryData<TChangeset> {\n\t\t// Trimming the trunk before serializing ensures that the trunk data in the summary is as minimal as possible.\n\t\tthis.trimHistory();\n\n\t\tconst minSeqNumberToSummarize: SequenceId = {\n\t\t\tsequenceNumber: brand(this.minimumSequenceNumber + 1),\n\t\t};\n\t\tlet minBaseSeqId: SequenceId = minSeqNumberToSummarize;\n\t\tconst mainBranch = this.getSharedBranch(\"main\");\n\t\tconst branches = new Map<BranchId, SharedBranchSummaryData<TChangeset>>();\n\t\tfor (const [branchId, branch] of this.sharedBranches) {\n\t\t\tif (branchId !== \"main\") {\n\t\t\t\tconst branchSummary = branch.getSummaryData(\n\t\t\t\t\tminSeqNumberToSummarize,\n\t\t\t\t\tthis.trunkBase.revision,\n\t\t\t\t);\n\t\t\t\tbranches.set(branchId, branchSummary);\n\t\t\t\tassert(branchSummary.base !== undefined, 0xc57 /* Branch summary must have a base */);\n\t\t\t\tconst baseSequenceId = mainBranch.getCommitSequenceId(branchSummary.base);\n\t\t\t\tminBaseSeqId = minSequenceId(minBaseSeqId, baseSequenceId);\n\t\t\t}\n\t\t}\n\t\tconst mainSummary = mainBranch.getSummaryData(minBaseSeqId, this.trunkBase.revision);\n\t\treturn { main: mainSummary, branches, originator: this.localSessionId };\n\t}\n\n\tpublic loadSummaryData(data: SummaryData<TChangeset>): void {\n\t\tassert(\n\t\t\tthis.isEmpty(),\n\t\t\t0x68a /* Attempted to load from summary after edit manager was already mutated */,\n\t\t);\n\t\t// Record the tags of each trunk commit as we generate the trunk so they can be looked up quickly\n\t\t// when hydrating the peer branches below\n\t\tconst trunkRevisionCache = new Map<RevisionTag, GraphCommit<TChangeset>>();\n\t\ttrunkRevisionCache.set(this.trunkBase.revision, this.trunkBase);\n\t\tconst mainBranch =\n\t\t\tthis.sharedBranches.get(\"main\") ?? fail(0xc58 /* Main branch must exist */);\n\t\tmainBranch.loadSummaryData(data.main, trunkRevisionCache);\n\t\tif (data.branches !== undefined) {\n\t\t\tfor (const [branchId, branchData] of data.branches) {\n\t\t\t\tconst branch = this.createSharedBranch(\n\t\t\t\t\tbranchId,\n\t\t\t\t\tbranchData.session,\n\t\t\t\t\tmainBranch,\n\t\t\t\t\tmainBranch.trunk.fork(),\n\t\t\t\t);\n\t\t\t\tbranch.loadSummaryData(branchData, trunkRevisionCache);\n\t\t\t\tthis.addSharedBranch(branchId, branch);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic getTrunkHead(branchId: BranchId): GraphCommit<TChangeset> {\n\t\treturn this.getSharedBranch(branchId).trunk.getHead();\n\t}\n\n\tpublic getTrunkChanges(branchId: BranchId): TChangeset[] {\n\t\treturn this.getTrunkCommits(branchId).map((c) => c.change);\n\t}\n\n\tpublic getTrunkCommits(branchId: BranchId): GraphCommit<TChangeset>[] {\n\t\treturn getPathFromBase(this.getTrunkHead(branchId), this.trunkBase);\n\t}\n\n\tpublic getLocalCommits(branchId: BranchId): readonly GraphCommit<TChangeset>[] {\n\t\tconst branch = this.getSharedBranch(branchId);\n\t\treturn branch.getLocalCommits();\n\t}\n\n\t/**\n\t * Gets the length of the longest branch maintained by this `EditManager`.\n\t * This may be the length of a peer branch or the local branch.\n\t *\n\t * @remarks\n\t * The length is counted from the lowest common ancestor with the trunk such that a fully sequenced branch would\n\t * have length zero.\n\t */\n\tpublic getLongestBranchLength(): number {\n\t\tlet max = 0;\n\t\tfor (const branch of this.sharedBranches.values()) {\n\t\t\tmax = Math.max(max, branch.getLongestBranchLength());\n\t\t}\n\t\treturn max;\n\t}\n\n\tpublic sequenceBranchCreation(\n\t\tsessionId: SessionId,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tbranchId: BranchId,\n\t): void {\n\t\tif (sessionId === this.localSessionId) {\n\t\t\tassert(this.sharedBranches.has(branchId), 0xc59 /* Expected branch to already exist */);\n\t\t\treturn;\n\t\t}\n\n\t\tconst mainBranch = this.getSharedBranch(\"main\");\n\t\tconst branchTrunk = mainBranch.rebasePeer(sessionId, referenceSequenceNumber).fork();\n\t\tthis.createAndAddSharedBranch(branchId, sessionId, mainBranch, branchTrunk);\n\t}\n\n\tpublic addNewBranch(branchId: BranchId): void {\n\t\tconst main = this.getSharedBranch(\"main\") ?? fail(0xc5a /* Main branch must exist */);\n\t\tthis.createAndAddSharedBranch(\n\t\t\tbranchId,\n\t\t\tthis.localSessionId,\n\t\t\tmain,\n\t\t\tthis.getLocalBranch(\"main\").fork(),\n\t\t);\n\t}\n\n\tpublic getSharedBranchIds(): BranchId[] {\n\t\treturn Array.from(this.sharedBranches.keys());\n\t}\n\n\tpublic removeBranch(branchId: BranchId): void {\n\t\tassert(branchId !== \"main\", 0xc5b /* Cannot remove main branch */);\n\t\tconst hadBranch = this.sharedBranches.delete(branchId);\n\t\tassert(hadBranch, 0xc5c /* Expected branch to exist */);\n\t}\n\n\tprivate createAndAddSharedBranch(\n\t\tbranchId: BranchId,\n\t\tsessionId: SessionId | undefined,\n\t\tparent: SharedBranch<TEditor, TChangeset> | undefined,\n\t\tbranch: SharedTreeBranch<TEditor, TChangeset>,\n\t\teditorOptions?: EditorOptions,\n\t): SharedBranch<TEditor, TChangeset> {\n\t\tconst sharedBranch = this.createSharedBranch(\n\t\t\tbranchId,\n\t\t\tsessionId,\n\t\t\tparent,\n\t\t\tbranch,\n\t\t\teditorOptions,\n\t\t);\n\t\tthis.addSharedBranch(branchId, sharedBranch);\n\t\treturn sharedBranch;\n\t}\n\n\tprivate addSharedBranch(\n\t\tbranchId: BranchId,\n\t\tbranch: SharedBranch<TEditor, TChangeset>,\n\t): void {\n\t\tassert(\n\t\t\t!this.sharedBranches.has(branchId),\n\t\t\t0xc5d /* A branch with this ID already exists */,\n\t\t);\n\t\tthis.sharedBranches.set(branchId, branch);\n\n\t\t// Track all forks of the local branch for purposes of trunk eviction. Unlike the local branch, they have\n\t\t// an unknown lifetime and rebase frequency, so we can not make any assumptions about which trunk commits\n\t\t// they require and therefore we monitor them explicitly.\n\t\tonForkTransitive(branch.localBranch, (fork) => this.registerBranch(fork));\n\n\t\tif (branchId !== \"main\") {\n\t\t\tthis.registerBranch(branch.localBranch);\n\t\t\tthis.onSharedBranchCreated?.(branchId);\n\t\t}\n\t}\n\n\tprivate createSharedBranch(\n\t\tbranchId: BranchId,\n\t\tsessionId: SessionId | undefined,\n\t\tparent: SharedBranch<TEditor, TChangeset> | undefined,\n\t\tbranch: SharedTreeBranch<TEditor, TChangeset>,\n\t\teditorOptions?: EditorOptions,\n\t): SharedBranch<TEditor, TChangeset> {\n\t\tconst sharedBranch = new SharedBranch(\n\t\t\tparent,\n\t\t\tbranch,\n\t\t\tbranchId,\n\t\t\tsessionId,\n\t\t\tminimumPossibleSequenceId,\n\t\t\tthis.changeFamily,\n\t\t\tthis.mintRevisionTag,\n\t\t\tthis._events,\n\t\t\tthis.telemetryEventBatcher,\n\t\t\teditorOptions,\n\t\t);\n\n\t\treturn sharedBranch;\n\t}\n\n\t/* eslint-disable jsdoc/check-indentation */\n\t/**\n\t * Add a bunch of sequenced changes. A bunch is a group of sequenced commits that have the following properties:\n\t * - They are not interleaved with messages from other DDSes in the container.\n\t * - They are all part of the same batch, which entails:\n\t * - They are contiguous in sequencing order.\n\t * - They are all from the same client.\n\t * - They are all based on the same reference sequence number.\n\t * - They are not interleaved with messages from other clients.\n\t */\n\t/* eslint-enable jsdoc/check-indentation */\n\tpublic addSequencedChanges(\n\t\tnewCommits: readonly GraphCommit<TChangeset>[],\n\t\tsessionId: SessionId,\n\t\tsequenceNumber: SeqNumber,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tbranchId: BranchId,\n\t): void {\n\t\tassert(newCommits.length > 0, 0xad8 /* Expected at least one sequenced change */);\n\t\tassert(\n\t\t\tsequenceNumber > this.minimumSequenceNumber,\n\t\t\t0x713 /* Expected change sequence number to exceed the last known minimum sequence number */,\n\t\t);\n\n\t\tconst branch = this.getSharedBranch(branchId);\n\n\t\tconst onSequenceLocalCommit = (\n\t\t\tcommit: GraphCommit<TChangeset>,\n\t\t\tsequenceId: SequenceId,\n\t\t\tpreviousSequenceId: SequenceId,\n\t\t): void => {\n\t\t\t// Next, we need to update the sequence IDs that our local branches (user's branches, not peer branches) are associated with.\n\t\t\t// In particular, if a local branch is based on the previous trunk head (the branch's first ancestor in the trunk is the commit that was the head before we pushed the new commit)\n\t\t\t// and also branches off of the local branch (it has an ancestor that is part of the local branch), it needs to have its sequence number advanced to be that of the new trunk head.\n\t\t\t// Intuitively, this makes sense because:\n\t\t\t// 1. The trunk's head just advanced forward by some (sequence) amount.\n\t\t\t// 2. The local branch is always rebased to be branching off of the head of the trunk (not literally in this case, because of the optimization, but in effect).\n\t\t\t// 3. Therefore, the entire local branch just advanced forward by some (sequence) amount, and any commits downstream of it which track the sequence numbers of their base commits on the trunk should also advance.\n\t\t\t// This update is not necessarily required for all local branches, since some may have fallen behind the local branch and are based on older trunk commits (such branches do not need updating).\n\t\t\tconst currentBranches = this.trunkBranches.get(previousSequenceId);\n\t\t\tif (currentBranches !== undefined) {\n\t\t\t\tconst newBranches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());\n\t\t\t\tfor (const forkedBranch of currentBranches) {\n\t\t\t\t\t// Check every branch associated with the old sequence ID and advance it if it is based on the local branch (specifically, on the local branch as it was before we pushed its first commit to the trunk).\n\t\t\t\t\t// We validate this by checking if the branch's head is a descendant of the local commit that we just pushed.\n\t\t\t\t\tif (findAncestor(forkedBranch.getHead(), (c) => c === commit) !== undefined) {\n\t\t\t\t\t\tnewBranches.add(forkedBranch);\n\t\t\t\t\t\tcurrentBranches.delete(forkedBranch);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Clean up our trunk branches map by removing any empty sets.\n\t\t\t\tif (currentBranches.size === 0) {\n\t\t\t\t\tthis.trunkBranches.delete(previousSequenceId);\n\t\t\t\t}\n\t\t\t\tif (newBranches.size === 0) {\n\t\t\t\t\tthis.trunkBranches.delete(sequenceId);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst areLocalCommits = sessionId === this.localSessionId;\n\t\tbranch.addSequencedChanges(\n\t\t\tnewCommits,\n\t\t\tsessionId,\n\t\t\tsequenceNumber,\n\t\t\tareLocalCommits,\n\t\t\treferenceSequenceNumber,\n\t\t\tonSequenceLocalCommit,\n\t\t);\n\t}\n\n\tpublic findLocalCommit(\n\t\tbranchId: BranchId,\n\t\trevision: RevisionTag,\n\t): [commit: GraphCommit<TChangeset>, commitsAfter: GraphCommit<TChangeset>[]] {\n\t\tconst commits: GraphCommit<TChangeset>[] = [];\n\t\tconst commit = findAncestor(\n\t\t\t[this.getSharedBranch(branchId).localBranch.getHead(), commits],\n\t\t\t(c) => c.revision === revision,\n\t\t);\n\t\tassert(commit !== undefined, 0x599 /* Expected local branch to contain revision */);\n\t\treturn [commit, commits];\n\t}\n}\n\n/**\n * The in-memory data that summaries contain\n */\nexport interface SummaryData<TChangeset> {\n\treadonly originator?: SessionId;\n\treadonly main: SharedBranchSummaryData<TChangeset>;\n\treadonly branches?: ReadonlyMap<BranchId, SharedBranchSummaryData<TChangeset>>;\n}\n\nexport interface SharedBranchSummaryData<TChangeset> {\n\treadonly id?: BranchId;\n\treadonly name?: string;\n\treadonly session?: SessionId;\n\treadonly author?: string;\n\treadonly base?: RevisionTag;\n\treadonly trunk: readonly SequencedCommit<TChangeset>[];\n\treadonly peerLocalBranches: ReadonlyMap<SessionId, SummarySessionBranch<TChangeset>>;\n}\n\n/**\n * Gets the path from the base of a branch to its head.\n */\nfunction getPathFromBase<TCommit extends { parent?: TCommit }>(\n\tbranchHead: TCommit,\n\tbaseBranchHead: TCommit,\n): TCommit[] {\n\tconst path: TCommit[] = [];\n\tassert(\n\t\tfindCommonAncestor([branchHead, path], baseBranchHead) !== undefined,\n\t\t0x573 /* Expected branches to be related */,\n\t);\n\treturn path;\n}\n\nclass SharedBranch<TEditor extends ChangeFamilyEditor, TChangeset> {\n\t/**\n\t * This branch holds the changes made by this client which have not yet been confirmed as sequenced changes.\n\t */\n\tpublic readonly localBranch: SharedTreeBranch<TEditor, TChangeset>;\n\n\t/**\n\t * Branches are maintained to represent the local change list that the issuing client had\n\t * at the time of submitting the latest known edit on the branch.\n\t * This means the head commit of each branch is always in its original (non-rebased) form.\n\t */\n\tprivate readonly peerLocalBranches: Map<SessionId, SharedTreeBranch<TEditor, TChangeset>> =\n\t\tnew Map();\n\n\t/**\n\t * A map from a sequence id to the commit which has that sequence id.\n\t * This also includes an entry for the {@link trunkBase} which always has the lowest key in the map.\n\t */\n\tpublic readonly sequenceIdToCommit = new BTree<SequenceId, GraphCommit<TChangeset>>(\n\t\tundefined,\n\t\tsequenceIdComparator,\n\t);\n\n\t/**\n\t * The list of commits (from oldest to most recent) that are on the local branch but not on the trunk.\n\t * When a local commit is sequenced, the first commit in this list shifted onto the tip of the trunk.\n\t */\n\tprivate readonly localCommits: GraphCommit<TChangeset>[] = [];\n\n\t/**\n\t * Records extra data associated with sequenced commits.\n\t * This does not include an entry for the {@link trunkBase}.\n\t */\n\tprivate readonly commitMetadata = new Map<\n\t\tRevisionTag,\n\t\t{ sequenceId: SequenceId; sessionId: SessionId }\n\t>();\n\n\tpublic constructor(\n\t\tpublic readonly parentBranch: SharedBranch<TEditor, TChangeset> | undefined,\n\t\tpublic readonly trunk: SharedTreeBranch<TEditor, TChangeset>,\n\t\tprivate readonly id: BranchId,\n\t\tprivate readonly sessionId: SessionId | undefined,\n\t\tbaseCommitSequenceId: SequenceId,\n\t\tprivate readonly changeFamily: ChangeFamily<TEditor, TChangeset>,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tbranchTrimmer: Listenable<BranchTrimmingEvents>,\n\t\ttelemetryEventBatcher: TelemetryEventBatcher<keyof RebaseStatsWithDuration> | undefined,\n\t\teditorOptions?: EditorOptions,\n\t) {\n\t\tthis.localBranch = new SharedTreeBranch(\n\t\t\tthis.trunk.getHead(),\n\t\t\tchangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tbranchTrimmer,\n\t\t\ttelemetryEventBatcher,\n\t\t\teditorOptions,\n\t\t);\n\n\t\tthis.sequenceIdToCommit.set(baseCommitSequenceId, this.trunk.getHead());\n\n\t\tthis.localBranch.events.on(\"afterChange\", (event) => {\n\t\t\tif (event.type === \"append\") {\n\t\t\t\tfor (const commit of event.newCommits) {\n\t\t\t\t\tthis.localCommits.push(commit);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.localCommits.length = 0;\n\t\t\t\tfindCommonAncestor(\n\t\t\t\t\t[this.localBranch.getHead(), this.localCommits],\n\t\t\t\t\tthis.trunk.getHead(),\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic addSequencedChanges(\n\t\tnewCommits: readonly GraphCommit<TChangeset>[],\n\t\tsessionId: SessionId,\n\t\tsequenceNumber: SeqNumber,\n\t\tareLocalCommits: boolean,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tonSequenceLocalCommit: OnSequenceCommit<TChangeset>,\n\t): void {\n\t\tassert(\n\t\t\tsequenceNumber >= // This is \">=\", not \">\" because changes in the same batch will have the same sequence number\n\t\t\t\t(this.sequenceIdToCommit.maxKey()?.sequenceNumber ?? minimumPossibleSequenceNumber),\n\t\t\t0xa64 /* Attempted to sequence change with an outdated sequence number */,\n\t\t);\n\n\t\tconst batchSize = this.getBatchSize(sequenceNumber);\n\t\t// The sequence id for the next commit to be processed in the bunch.\n\t\tlet nextSequenceId =\n\t\t\tbatchSize === 0\n\t\t\t\t? {\n\t\t\t\t\t\tsequenceNumber,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tsequenceNumber,\n\t\t\t\t\t\tindexInBatch: batchSize,\n\t\t\t\t\t};\n\n\t\t// Local changes, i.e., changes from this client are applied by fast forwarding the local branch commit onto\n\t\t// the trunk.\n\t\tif (areLocalCommits) {\n\t\t\tfor (const { revision } of newCommits) {\n\t\t\t\tthis.sequenceLocalCommit(revision, nextSequenceId, sessionId, onSequenceLocalCommit);\n\t\t\t\tnextSequenceId = getNextSequenceId(nextSequenceId);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Remote changes, i.e., changes from remote clients are applied in three steps.\n\t\t// Step 1 - Recreate the peer remote client's local environment.\n\t\t// Get the revision that the remote change is based on and rebase that peer local branch over the part of the\n\t\t// trunk up to the base revision. This will be a no-op if the sending client has not advanced since the last\n\t\t// time we received an edit from it\n\t\tconst peerLocalBranch = this.rebasePeer(sessionId, referenceSequenceNumber);\n\n\t\t// Step 2 - Append the changes to the peer branch and rebase the changes to the tip of the trunk.\n\t\tif (peerLocalBranch.getHead() === this.trunk.getHead()) {\n\t\t\t// If the peer local branch is fully caught up and empty (no changes relative to the trunk) after being\n\t\t\t// rebased, then push changes to the trunk directly and update the peer branch to the trunk's head.\n\t\t\tfor (const newCommit of newCommits) {\n\t\t\t\tthis.pushCommitToTrunk(nextSequenceId, { ...newCommit, sessionId });\n\t\t\t\tnextSequenceId = getNextSequenceId(nextSequenceId);\n\t\t\t}\n\t\t\tpeerLocalBranch.setHead(this.trunk.getHead());\n\t\t} else {\n\t\t\t// Otherwise, push the changes to the peer local branch and merge the branch into the trunk.\n\t\t\tfor (const newCommit of newCommits) {\n\t\t\t\tpeerLocalBranch.apply(tagChange(newCommit.change, newCommit.revision));\n\t\t\t}\n\t\t\tconst result = this.trunk.merge(peerLocalBranch);\n\t\t\tif (result !== undefined) {\n\t\t\t\t// If the merge resulted in any changes to the trunk, update the sequence map and trunk metadata\n\t\t\t\t// with the rebased commits.\n\t\t\t\tfor (const sourceCommit of result.sourceCommits) {\n\t\t\t\t\tthis.sequenceIdToCommit.set(nextSequenceId, sourceCommit);\n\t\t\t\t\tthis.commitMetadata.set(sourceCommit.revision, {\n\t\t\t\t\t\tsequenceId: nextSequenceId,\n\t\t\t\t\t\tsessionId,\n\t\t\t\t\t});\n\t\t\t\t\tnextSequenceId = getNextSequenceId(nextSequenceId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Step 3 - Rebase the local branch over the updated trunk.\n\t\tthis.localBranch.rebaseOnto(this.trunk);\n\t}\n\n\tpublic isEmpty(baseCommit: GraphCommit<TChangeset>): boolean {\n\t\treturn (\n\t\t\tthis.trunk.getHead() === baseCommit &&\n\t\t\tthis.peerLocalBranches.size === 0 &&\n\t\t\tthis.localBranch.getHead() === this.trunk.getHead()\n\t\t);\n\t}\n\n\tpublic rebasePeer(\n\t\tsessionId: SessionId,\n\t\treferenceSequenceNumber: SeqNumber,\n\t): SharedTreeBranch<TEditor, TChangeset> {\n\t\tconst [, baseRevisionInTrunk] = this.getClosestTrunkCommit(referenceSequenceNumber);\n\t\tconst peerLocalBranch = getOrCreate(\n\t\t\tthis.peerLocalBranches,\n\t\t\tsessionId,\n\t\t\t() => new SharedTreeBranch(baseRevisionInTrunk, this.changeFamily, this.mintRevisionTag),\n\t\t);\n\t\tpeerLocalBranch.rebaseOnto(this.trunk, baseRevisionInTrunk);\n\t\treturn peerLocalBranch;\n\t}\n\n\tpublic getPeerBranchOrTrunk(sessionId: SessionId): SharedTreeBranch<TEditor, TChangeset> {\n\t\treturn this.peerLocalBranches.get(sessionId) ?? this.trunk;\n\t}\n\n\t/**\n\t * Gets the length of the longest branch maintained by this `SharedBranch`.\n\t * This may be the length of a peer branch or the local branch.\n\t *\n\t * @remarks\n\t * The length is counted from the lowest common ancestor with the trunk such that a fully sequenced branch would\n\t * have length zero.\n\t */\n\tpublic getLongestBranchLength(): number {\n\t\tlet max = 0;\n\t\tconst trunkHead = this.trunk.getHead();\n\t\tfor (const branch of this.peerLocalBranches.values()) {\n\t\t\tconst branchPath = getPathFromBase(branch.getHead(), trunkHead);\n\t\t\tif (branchPath.length > max) {\n\t\t\t\tmax = branchPath.length;\n\t\t\t}\n\t\t}\n\t\tconst localPath = getPathFromBase(this.localBranch.getHead(), trunkHead);\n\t\treturn Math.max(max, localPath.length);\n\t}\n\n\tpublic trimHistory(newBase: GraphCommit<TChangeset>, sequenceId: SequenceId): void {\n\t\tthis.rebasePeers(newBase);\n\n\t\tthis.sequenceIdToCommit.editRange(\n\t\t\tminimumPossibleSequenceId,\n\t\t\tsequenceId,\n\t\t\ttrue,\n\t\t\t(s, commit) => {\n\t\t\t\t// Cleanup look-aside data for each evicted commit\n\t\t\t\tthis.commitMetadata.delete(commit.revision);\n\t\t\t\t// Delete all evicted commits from `sequenceMap` except for the latest one, which is the new `trunkBase`\n\t\t\t\tif (equalSequenceIds(s, sequenceId)) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcommit === newBase,\n\t\t\t\t\t\t0x729 /* Expected last evicted commit to be new trunk base */,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\treturn { delete: true };\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\n\t\tconst trunkSize = getPathFromBase(this.trunk.getHead(), newBase).length;\n\t\tassert(\n\t\t\tthis.sequenceIdToCommit.size === trunkSize + 1,\n\t\t\t0x744 /* The size of the sequenceMap must have one element more than the trunk */,\n\t\t);\n\t\tassert(\n\t\t\tthis.commitMetadata.size === trunkSize,\n\t\t\t0x745 /* The size of the trunkMetadata must be the same as the trunk */,\n\t\t);\n\t}\n\n\tprivate rebasePeers(commit: GraphCommit<TChangeset>): void {\n\t\tfor (const [, branch] of this.peerLocalBranches) {\n\t\t\tbranch.rebaseOnto(this.trunk, commit);\n\t\t}\n\n\t\t// The metadata for new trunk base revision needs to be deleted before modifying it.\n\t\tthis.commitMetadata.delete(commit.revision);\n\t}\n\n\tpublic getLocalCommits(): readonly GraphCommit<TChangeset>[] {\n\t\treturn this.localCommits;\n\t}\n\n\t/**\n\t * Promote the oldest un-sequenced commit on the local branch to the head of the trunk.\n\t * @param sequenceId - The sequence id of the new trunk commit\n\t * @remarks This method is a performance optimization for the scenario where this client receives its own change back after sequencing.\n\t * The normal (not optimized) process in this case would be to apply the new sequenced commit to the trunk and then rebase the local branch over the trunk.\n\t * The first commit will be \"the same\" (as in, it will have the same revision) as the commit that was just sequenced, so the rebase will be a no-op.\n\t * Because the rebase is a no-op, we can skip it entirely and simply remove the commit from the local branch and append it to the trunk.\n\t * Avoiding the overhead of the rebase process, even when it's a no-op, has real measured performance benefits and is worth the added complexity here.\n\t */\n\tprivate sequenceLocalCommit(\n\t\trevision: RevisionTag,\n\t\tsequenceId: SequenceId,\n\t\tsessionId: SessionId,\n\t\tonSequenceLocalCommit: OnSequenceCommit<TChangeset>,\n\t): void {\n\t\tif (this.commitMetadata.has(revision)) {\n\t\t\t// This can happen if the commit came from a shared branch and was concurrently merged by another client.\n\t\t\t// In this case, the newly sequenced commit is redundant and should therefore be ignored.\n\t\t\treturn;\n\t\t}\n\n\t\t// First, push the local commit to the trunk.\n\t\t// We are mutating our `localCommits` cache here,but there is no need to actually change the `localBranch` itself because it will simply catch up later if/when it next rebases.\n\t\tconst firstLocalCommit = this.localCommits.shift();\n\t\tassert(\n\t\t\tfirstLocalCommit !== undefined,\n\t\t\t0x6b5 /* Received a sequenced change from the local session despite having no local changes */,\n\t\t);\n\n\t\tconst prevSequenceId = this.getCommitSequenceId(this.trunk.getHead().revision);\n\t\tthis.pushGraphCommitToTrunk(sequenceId, firstLocalCommit, sessionId);\n\t\tonSequenceLocalCommit(firstLocalCommit, sequenceId, prevSequenceId);\n\t}\n\n\t/**\n\t * Finds the most recent trunk commit that was sequenced at or before the given point.\n\t * @param searchBy - the sequence number or the sequence id to search for\n\t * @remarks Fails if there is no eligible commit.\n\t * @returns the closest commit and its sequence id\n\t */\n\tpublic getClosestTrunkCommit(searchBy: SeqNumber): [SequenceId, GraphCommit<TChangeset>];\n\tpublic getClosestTrunkCommit(searchBy: SequenceId): [SequenceId, GraphCommit<TChangeset>];\n\tpublic getClosestTrunkCommit(\n\t\tsearchBy: SeqNumber | SequenceId,\n\t): [SequenceId, GraphCommit<TChangeset>] {\n\t\tconst sequenceId: SequenceId =\n\t\t\ttypeof searchBy === \"number\"\n\t\t\t\t? {\n\t\t\t\t\t\t// This is to make sure that the correct commit is selected in this 2 scenarios:\n\t\t\t\t\t\t// 1) The commit is unique for that sequence number\n\t\t\t\t\t\t// 2) There are more than one commit for the same sequence number, in this case we need to select the last one.\n\t\t\t\t\t\tsequenceNumber: searchBy,\n\t\t\t\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t\t\t\t}\n\t\t\t\t: searchBy;\n\n\t\tconst commit = this.sequenceIdToCommit.getPairOrNextLower(sequenceId);\n\t\tassert(commit !== undefined, 0x746 /* sequence id has been evicted */);\n\t\treturn commit;\n\t}\n\n\tprivate pushGraphCommitToTrunk(\n\t\tsequenceId: SequenceId,\n\t\tgraphCommit: GraphCommit<TChangeset>,\n\t\tsessionId: SessionId,\n\t): void {\n\t\tthis.trunk.setHead(graphCommit);\n\t\tthis.registerSequencedCommit(sequenceId, sessionId, graphCommit);\n\t}\n\n\tprivate pushCommitToTrunk(sequenceId: SequenceId, commit: Commit<TChangeset>): void {\n\t\tconst mintedCommit = mintCommit(this.trunk.getHead(), commit);\n\t\tthis.pushGraphCommitToTrunk(sequenceId, mintedCommit, commit.sessionId);\n\t}\n\n\tprivate registerSequencedCommit(\n\t\tsequenceId: SequenceId,\n\t\tsessionId: SessionId,\n\t\tcommit: GraphCommit<TChangeset>,\n\t): void {\n\t\tthis.sequenceIdToCommit.set(sequenceId, commit);\n\t\tthis.commitMetadata.set(commit.revision, { sequenceId, sessionId });\n\t}\n\n\tpublic getCommitSequenceId(commitRevision: RevisionTag): SequenceId {\n\t\tconst id = this.commitMetadata.get(commitRevision)?.sequenceId;\n\t\tif (id === undefined) {\n\t\t\treturn minimumPossibleSequenceId;\n\t\t}\n\t\treturn id;\n\t}\n\n\t// TODO: Document that this is to handle receiving separate commits with the same sequence ID,\n\t// as a batch of changes are not guaranteed to be processed as one bunch.\n\tprivate getBatchSize(sequenceNumber: SeqNumber): number {\n\t\tconst startSequenceId: SequenceId = {\n\t\t\tsequenceNumber,\n\t\t};\n\t\tconst endSequenceId: SequenceId = {\n\t\t\tsequenceNumber: brand((sequenceNumber as number) + 1),\n\t\t};\n\n\t\treturn this.sequenceIdToCommit.getRange(startSequenceId, endSequenceId, false).length;\n\t}\n\n\tpublic getSummaryData(\n\t\tminSeqNumberToSummarize: SequenceId,\n\t\ttrunkBaseRevision: RevisionTag,\n\t): SharedBranchSummaryData<TChangeset> {\n\t\t// The assert below is acceptable at present because summarization only ever occurs on a client with no\n\t\t// local/in-flight changes.\n\t\t// In the future we may wish to relax this constraint. For that to work, the current implementation of\n\t\t// `EditManager` would have to be amended in one of two ways:\n\t\t// A) Changes made by the local session should be represented by a branch in `EditManager.branches`.\n\t\t// B) The contents of such a branch should be computed on demand based on the trunk.\n\t\t// Note that option (A) would be a simple change to `addSequencedChanges` whereas (B) would likely require\n\t\t// rebasing trunk changes over the inverse of trunk changes.\n\t\tassert(\n\t\t\tthis.localBranch.getHead() === this.trunk.getHead(),\n\t\t\t0xc5e /* Clients with local changes cannot be used to generate summaries */,\n\t\t);\n\n\t\tlet parentHead: GraphCommit<TChangeset>;\n\t\tif (this.parentBranch === undefined) {\n\t\t\tconst oldestCommitInCollabWindow =\n\t\t\t\tthis.getClosestTrunkCommit(minSeqNumberToSummarize)[1];\n\t\t\t// Path construction is exclusive, so we need to use the parent of the oldest commit in the window if it exists\n\t\t\tparentHead = oldestCommitInCollabWindow.parent ?? oldestCommitInCollabWindow;\n\t\t} else {\n\t\t\tparentHead = this.parentBranch.trunk.getHead();\n\t\t}\n\n\t\tconst childBranchTrunkCommits: GraphCommit<TChangeset>[] = [];\n\t\tconst forkPointFromMainTrunk = findCommonAncestor(\n\t\t\t[this.trunk.getHead(), childBranchTrunkCommits],\n\t\t\tparentHead,\n\t\t);\n\t\tassert(\n\t\t\tforkPointFromMainTrunk !== undefined,\n\t\t\t0xc5f /* Expected child branch to be based on main branch */,\n\t\t);\n\n\t\tconst trunk = childBranchTrunkCommits.map((c) => {\n\t\t\tconst metadata =\n\t\t\t\tthis.commitMetadata.get(c.revision) ??\n\t\t\t\tfail(0xad5 /* Expected metadata for trunk commit */);\n\t\t\tconst commit: SequencedCommit<TChangeset> = {\n\t\t\t\tchange: c.change,\n\t\t\t\trevision: c.revision,\n\t\t\t\tsequenceNumber: metadata.sequenceId.sequenceNumber,\n\t\t\t\tsessionId: metadata.sessionId,\n\t\t\t};\n\t\t\tif (metadata.sequenceId.indexInBatch !== undefined) {\n\t\t\t\tcommit.indexInBatch = metadata.sequenceId.indexInBatch;\n\t\t\t}\n\t\t\treturn commit;\n\t\t});\n\n\t\tconst peerLocalBranches = new Map<SessionId, SummarySessionBranch<TChangeset>>(\n\t\t\tmapIterable(this.peerLocalBranches.entries(), ([sessionId, branch]) => {\n\t\t\t\tconst branchPath: GraphCommit<TChangeset>[] = [];\n\t\t\t\tconst ancestor =\n\t\t\t\t\tfindCommonAncestor([branch.getHead(), branchPath], this.trunk.getHead()) ??\n\t\t\t\t\tfail(0xad6 /* Expected branch to be based on trunk */);\n\n\t\t\t\tconst base =\n\t\t\t\t\tancestor.revision === trunkBaseRevision ? rootRevision : ancestor.revision;\n\t\t\t\treturn [\n\t\t\t\t\tsessionId,\n\t\t\t\t\t{\n\t\t\t\t\t\tbase,\n\t\t\t\t\t\tcommits: branchPath.map((c) => {\n\t\t\t\t\t\t\tconst commit: Commit<TChangeset> = {\n\t\t\t\t\t\t\t\tchange: c.change,\n\t\t\t\t\t\t\t\trevision: c.revision,\n\t\t\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\treturn commit;\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}),\n\t\t);\n\n\t\tconst trunkBase =\n\t\t\tthis.parentBranch === undefined ? undefined : forkPointFromMainTrunk.revision;\n\t\treturn { trunk, peerLocalBranches, base: trunkBase, id: this.id, session: this.sessionId };\n\t}\n\n\tpublic loadSummaryData(\n\t\tdata: SharedBranchSummaryData<TChangeset>,\n\t\ttrunkRevisionCache: Map<RevisionTag, GraphCommit<TChangeset>>,\n\t): void {\n\t\tassert(\n\t\t\t(this.parentBranch === undefined) === (data.base === undefined),\n\t\t\t0xc60 /* Expected branch base to match presence of parent branch */,\n\t\t);\n\t\tconst parentTrunkBase =\n\t\t\ttrunkRevisionCache.get(data.base ?? rootRevision) ??\n\t\t\tfail(0xc61 /* Expected base revision to be in trunk cache */);\n\t\tthis.trunk.setHead(\n\t\t\tdata.trunk.reduce((base, c) => {\n\t\t\t\tconst sequenceId: SequenceId =\n\t\t\t\t\tc.indexInBatch === undefined\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tsequenceNumber: c.sequenceNumber,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tsequenceNumber: c.sequenceNumber,\n\t\t\t\t\t\t\t\tindexInBatch: c.indexInBatch,\n\t\t\t\t\t\t\t};\n\t\t\t\tconst commit = mintCommit(base, c);\n\t\t\t\tthis.sequenceIdToCommit.set(sequenceId, commit);\n\t\t\t\tthis.commitMetadata.set(c.revision, {\n\t\t\t\t\tsequenceId,\n\t\t\t\t\tsessionId: c.sessionId,\n\t\t\t\t});\n\t\t\t\ttrunkRevisionCache.set(c.revision, commit);\n\t\t\t\treturn commit;\n\t\t\t}, parentTrunkBase),\n\t\t);\n\n\t\tthis.localBranch.setHead(this.trunk.getHead());\n\n\t\tfor (const [sessionId, branch] of data.peerLocalBranches) {\n\t\t\tconst commit =\n\t\t\t\ttrunkRevisionCache.get(branch.base) ??\n\t\t\t\tfail(0xad7 /* Expected summary branch to be based off of a revision in the trunk */);\n\n\t\t\tthis.peerLocalBranches.set(\n\t\t\t\tsessionId,\n\t\t\t\tnew SharedTreeBranch(\n\t\t\t\t\tbranch.commits.reduce(mintCommit, commit),\n\t\t\t\t\tthis.changeFamily,\n\t\t\t\t\tthis.mintRevisionTag,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n}\n\n// Returns the sequence id for the next commit to be processed in the bunch. Since all the commits have the\n// same sequence number, only the index in the batch needs to be incremented.\nfunction getNextSequenceId(sequenceId: SequenceId): SequenceId {\n\treturn {\n\t\tsequenceNumber: sequenceId.sequenceNumber,\n\t\tindexInBatch: (sequenceId.indexInBatch ?? 0) + 1,\n\t};\n}\n\ntype OnSequenceCommit<TChangeset> = (\n\tcommit: GraphCommit<TChangeset>,\n\tsequenceId: SequenceId,\n\tprevSequenceId: SequenceId,\n) => void;\n"]}
@@ -23,6 +23,10 @@ export declare function clientVersionToEditManagerFormatVersion(clientVersion: M
23
23
  * Returns the version that should be used for testing shared branches.
24
24
  */
25
25
  export declare function editManagerFormatVersionSelectorForSharedBranches(clientVersion: MinimumVersionForCollab): EditManagerFormatVersion;
26
+ /**
27
+ * Returns the version that should be used for testing shared branches.
28
+ */
29
+ export declare function editManagerFormatVersionSelectorForDetachedRootEditing(clientVersion: MinimumVersionForCollab): EditManagerFormatVersion;
26
30
  export interface EditManagerCodecOptions {
27
31
  readonly editManagerFormatSelector?: (minVersionForCollab: MinimumVersionForCollab) => EditManagerFormatVersion;
28
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerCodecs.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAOnE,OAAO,EACN,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAG3B,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,UAAU,EAGf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAS,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EACN,wBAAwB,EAExB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,WAAW,0BAA0B;IAC1C,YAAY,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;CAClC;AAED;;;;GAIG;AACH,wBAAgB,uCAAuC,CACtD,aAAa,EAAE,uBAAuB,EACtC,oBAAoB,CAAC,EAAE,wBAAwB,GAC7C,wBAAwB,CAS1B;AAED;;GAEG;AACH,wBAAgB,iDAAiD,CAChE,aAAa,EAAE,uBAAuB,GACpC,wBAAwB,CAE1B;AAED,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CACpC,mBAAmB,EAAE,uBAAuB,KACxC,wBAAwB,CAAC;CAC9B;AAUD,wBAAgB,oBAAoB,CAAC,UAAU,EAC9C,YAAY,EAAE,YAAY,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAC7D,4BAA4B,EAAE,sBAAsB,CAAC,wBAAwB,CAAC,EAC9E,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,uBAAuB,GAAG,iBAAiB,GAClD,UAAU,CACZ,WAAW,CAAC,UAAU,CAAC,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,CAC1B,CASA;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAC/C,YAAY,EAAE,YAAY,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAC7D,4BAA4B,EAAE,sBAAsB,CAAC,wBAAwB,CAAC,EAC9E,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,aAAa,GACpB,YAAY,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,0BAA0B,CAAC,CAkCnE;AAED,wBAAgB,0CAA0C,CACzD,aAAa,EAAE,uBAAuB,EACtC,YAAY,EAAE,SAAS,GACrB,SAAS,CAMX"}
1
+ {"version":3,"file":"editManagerCodecs.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,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AkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,uBAAuB,GAAG,iBAAiB,GAClD,UAAU,CACZ,WAAW,CAAC,UAAU,CAAC,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,CAC1B,CASA;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAC/C,YAAY,EAAE,YAAY,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAC7D,4BAA4B,EAAE,sBAAsB,CAAC,wBAAwB,CAAC,EAC9E,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,aAAa,GACpB,YAAY,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,0BAA0B,CAAC,CAqCnE;AAED,wBAAgB,0CAA0C,CACzD,aAAa,EAAE,uBAAuB,EACtC,YAAY,EAAE,SAAS,GACrB,SAAS,CAMX"}
@@ -4,14 +4,14 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.getCodecTreeForEditManagerFormatWithChange = exports.makeEditManagerCodecs = exports.makeEditManagerCodec = exports.editManagerFormatVersionSelectorForSharedBranches = exports.clientVersionToEditManagerFormatVersion = void 0;
7
+ exports.getCodecTreeForEditManagerFormatWithChange = exports.makeEditManagerCodecs = exports.makeEditManagerCodec = exports.editManagerFormatVersionSelectorForDetachedRootEditing = exports.editManagerFormatVersionSelectorForSharedBranches = exports.clientVersionToEditManagerFormatVersion = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const internal_2 = require("@fluidframework/runtime-utils/internal");
10
10
  const index_js_1 = require("../codec/index.js");
11
11
  const index_js_2 = require("../codec/index.js");
12
12
  const index_js_3 = require("../util/index.js");
13
13
  const editManagerCodecsV1toV4_js_1 = require("./editManagerCodecsV1toV4.js");
14
- const editManagerCodecsV5_js_1 = require("./editManagerCodecsV5.js");
14
+ const editManagerCodecsVSharedBranches_js_1 = require("./editManagerCodecsVSharedBranches.js");
15
15
  const editManagerFormatCommons_js_1 = require("./editManagerFormatCommons.js");
16
16
  /**
17
17
  * Convert a MinimumVersionForCollab to an EditManagerFormatVersion.
@@ -30,9 +30,16 @@ exports.clientVersionToEditManagerFormatVersion = clientVersionToEditManagerForm
30
30
  * Returns the version that should be used for testing shared branches.
31
31
  */
32
32
  function editManagerFormatVersionSelectorForSharedBranches(clientVersion) {
33
- return (0, index_js_3.brand)(editManagerFormatCommons_js_1.EditManagerFormatVersion.v5);
33
+ return (0, index_js_3.brand)(editManagerFormatCommons_js_1.EditManagerFormatVersion.vSharedBranches);
34
34
  }
35
35
  exports.editManagerFormatVersionSelectorForSharedBranches = editManagerFormatVersionSelectorForSharedBranches;
36
+ /**
37
+ * Returns the version that should be used for testing shared branches.
38
+ */
39
+ function editManagerFormatVersionSelectorForDetachedRootEditing(clientVersion) {
40
+ return (0, index_js_3.brand)(editManagerFormatCommons_js_1.EditManagerFormatVersion.vDetachedRoots);
41
+ }
42
+ exports.editManagerFormatVersionSelectorForDetachedRootEditing = editManagerFormatVersionSelectorForDetachedRootEditing;
36
43
  function editManagerFormatVersionFromOptions(options) {
37
44
  const selector = options.editManagerFormatSelector ?? clientVersionToEditManagerFormatVersion;
38
45
  return selector(options.minVersionForCollab);
@@ -50,18 +57,21 @@ function makeEditManagerCodecs(changeCodecs, dependentChangeFormatVersion, revis
50
57
  case editManagerFormatCommons_js_1.EditManagerFormatVersion.v2:
51
58
  return [version, (0, index_js_1.makeDiscontinuedCodecVersion)(options, version, "2.73.0")];
52
59
  case editManagerFormatCommons_js_1.EditManagerFormatVersion.v3:
53
- case editManagerFormatCommons_js_1.EditManagerFormatVersion.v4: {
60
+ case editManagerFormatCommons_js_1.EditManagerFormatVersion.v4:
61
+ case editManagerFormatCommons_js_1.EditManagerFormatVersion.vDetachedRoots: {
54
62
  const changeCodec = changeCodecs.resolve(dependentChangeFormatVersion.lookup(version));
55
63
  return [
56
64
  version,
57
65
  (0, editManagerCodecsV1toV4_js_1.makeV1CodecWithVersion)(changeCodec, revisionTagCodec, options, version),
58
66
  ];
59
67
  }
60
- case editManagerFormatCommons_js_1.EditManagerFormatVersion.v5: {
68
+ case editManagerFormatCommons_js_1.EditManagerFormatVersion.v5:
69
+ return [version, (0, index_js_1.makeDiscontinuedCodecVersion)(options, version, "2.74.0")];
70
+ case editManagerFormatCommons_js_1.EditManagerFormatVersion.vSharedBranches: {
61
71
  const changeCodec = changeCodecs.resolve(dependentChangeFormatVersion.lookup(version));
62
72
  return [
63
73
  version,
64
- (0, editManagerCodecsV5_js_1.makeV5CodecWithVersion)(changeCodec, revisionTagCodec, options, version),
74
+ (0, editManagerCodecsVSharedBranches_js_1.makeSharedBranchesCodecWithVersion)(changeCodec, revisionTagCodec, options, version),
65
75
  ];
66
76
  }
67
77
  default:
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerCodecs.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAAsE;AACtE,qEAGgD;AAEhD,gDAW2B;AAC3B,gDAAgE;AAOhE,+CAAsE;AAGtE,6EAAsE;AACtE,qEAAkE;AAElE,+EAGuC;AAOvC;;;;GAIG;AACH,SAAgB,uCAAuC,CACtD,aAAsC,EACtC,oBAA+C;IAE/C,MAAM,iBAAiB,GAA6B,IAAA,gBAAK,EACxD,IAAA,0CAA+B,EAAC,aAAa,EAAE;QAC9C,CAAC,oCAAyB,CAAC,EAAE,sDAAwB,CAAC,EAAE;QACxD,CAAC,6BAAkB,CAAC,KAAK,CAAC,EAAE,sDAAwB,CAAC,EAAE;KACvD,CAAC,CACF,CAAC;IAEF,OAAO,oBAAoB,IAAI,iBAAiB,CAAC;AAClD,CAAC;AAZD,0FAYC;AAED;;GAEG;AACH,SAAgB,iDAAiD,CAChE,aAAsC;IAEtC,OAAO,IAAA,gBAAK,EAAC,sDAAwB,CAAC,EAAE,CAAC,C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ACH,CAAC;YACD,KAAK,sDAAwB,CAAC,EAAE,CAAC,CAAC,CAAC;gBAClC,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,4BAA4B,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;gBACvF,OAAO;oBACN,OAAO;oBACP,IAAA,+CAAsB,EAAC,WAAW,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,CAAC;iBACvE,CAAC;YACH,CAAC;YACD;gBACC,IAAA,0BAAe,EAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACF,CAAC,CAAC,CAAC;IACH,OAAO,IAAA,0BAAe,EAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AA5CD,sDA4CC;AAED,SAAgB,0CAA0C,CACzD,aAAsC,EACtC,YAAuB;IAEvB,OAAO;QACN,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,uCAAuC,CAAC,aAAa,CAAC;QAC/D,QAAQ,EAAE,CAAC,YAAY,CAAC;KACxB,CAAC;AACH,CAAC;AATD,gGASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\tgetConfigForMinVersionForCollab,\n\tlowestMinVersionForCollab,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\ttype DependentFormatVersion,\n\tFluidClientVersion,\n\ttype FormatVersion,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\tmakeDiscontinuedCodecVersion,\n} from \"../codec/index.js\";\nimport { makeVersionDispatchingCodec } from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport { brand, type JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport type { SummaryData } from \"./editManager.js\";\nimport { makeV1CodecWithVersion } from \"./editManagerCodecsV1toV4.js\";\nimport { makeV5CodecWithVersion } from \"./editManagerCodecsV5.js\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tEditManagerFormatVersion,\n\teditManagerFormatVersions,\n} from \"./editManagerFormatCommons.js\";\n\nexport interface EditManagerEncodingContext {\n\tidCompressor: IIdCompressor;\n\treadonly schema?: SchemaAndPolicy;\n}\n\n/**\n * Convert a MinimumVersionForCollab to an EditManagerFormatVersion.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n * @returns The EditManagerFormatVersion that corresponds to the provided MinimumVersionForCollab.\n */\nexport function clientVersionToEditManagerFormatVersion(\n\tclientVersion: MinimumVersionForCollab,\n\twriteVersionOverride?: EditManagerFormatVersion,\n): EditManagerFormatVersion {\n\tconst compatibleVersion: EditManagerFormatVersion = brand(\n\t\tgetConfigForMinVersionForCollab(clientVersion, {\n\t\t\t[lowestMinVersionForCollab]: EditManagerFormatVersion.v3,\n\t\t\t[FluidClientVersion.v2_43]: EditManagerFormatVersion.v4,\n\t\t}),\n\t);\n\n\treturn writeVersionOverride ?? compatibleVersion;\n}\n\n/**\n * Returns the version that should be used for testing shared branches.\n */\nexport function editManagerFormatVersionSelectorForSharedBranches(\n\tclientVersion: MinimumVersionForCollab,\n): EditManagerFormatVersion {\n\treturn brand(EditManagerFormatVersion.v5);\n}\n\nexport interface EditManagerCodecOptions {\n\treadonly editManagerFormatSelector?: (\n\t\tminVersionForCollab: MinimumVersionForCollab,\n\t) => EditManagerFormatVersion;\n}\n\nfunction editManagerFormatVersionFromOptions(\n\toptions: EditManagerCodecOptions & CodecWriteOptions,\n): EditManagerFormatVersion {\n\tconst selector =\n\t\toptions.editManagerFormatSelector ?? clientVersionToEditManagerFormatVersion;\n\treturn selector(options.minVersionForCollab);\n}\n\nexport function makeEditManagerCodec<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\tdependentChangeFormatVersion: DependentFormatVersion<EditManagerFormatVersion>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: EditManagerCodecOptions & CodecWriteOptions,\n): IJsonCodec<\n\tSummaryData<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tEditManagerEncodingContext\n> {\n\tconst family = makeEditManagerCodecs(\n\t\tchangeCodecs,\n\t\tdependentChangeFormatVersion,\n\t\trevisionTagCodec,\n\t\toptions,\n\t);\n\tconst writeVersion = editManagerFormatVersionFromOptions(options);\n\treturn makeVersionDispatchingCodec(family, { ...options, writeVersion });\n}\n\nexport function makeEditManagerCodecs<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\tdependentChangeFormatVersion: DependentFormatVersion<EditManagerFormatVersion>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n): ICodecFamily<SummaryData<TChangeset>, EditManagerEncodingContext> {\n\tconst registry: [\n\t\tFormatVersion,\n\t\tIJsonCodec<\n\t\t\tSummaryData<TChangeset>,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tEditManagerEncodingContext\n\t\t>,\n\t][] = Array.from(editManagerFormatVersions, (version) => {\n\t\tswitch (version) {\n\t\t\tcase EditManagerFormatVersion.v1:\n\t\t\tcase EditManagerFormatVersion.v2:\n\t\t\t\treturn [version, makeDiscontinuedCodecVersion(options, version, \"2.73.0\")];\n\t\t\tcase EditManagerFormatVersion.v3:\n\t\t\tcase EditManagerFormatVersion.v4: {\n\t\t\t\tconst changeCodec = changeCodecs.resolve(dependentChangeFormatVersion.lookup(version));\n\t\t\t\treturn [\n\t\t\t\t\tversion,\n\t\t\t\t\tmakeV1CodecWithVersion(changeCodec, revisionTagCodec, options, version),\n\t\t\t\t];\n\t\t\t}\n\t\t\tcase EditManagerFormatVersion.v5: {\n\t\t\t\tconst changeCodec = changeCodecs.resolve(dependentChangeFormatVersion.lookup(version));\n\t\t\t\treturn [\n\t\t\t\t\tversion,\n\t\t\t\t\tmakeV5CodecWithVersion(changeCodec, revisionTagCodec, options, version),\n\t\t\t\t];\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(version);\n\t\t}\n\t});\n\treturn makeCodecFamily(registry);\n}\n\nexport function getCodecTreeForEditManagerFormatWithChange(\n\tclientVersion: MinimumVersionForCollab,\n\tchangeFormat: CodecTree,\n): CodecTree {\n\treturn {\n\t\tname: \"EditManager\",\n\t\tversion: clientVersionToEditManagerFormatVersion(clientVersion),\n\t\tchildren: [changeFormat],\n\t};\n}\n"]}
1
+ {"version":3,"file":"editManagerCodecs.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAAsE;AACtE,qEAGgD;AAEhD,gDAW2B;AAC3B,gDAAgE;AAOhE,+CAAsE;AAGtE,6EAAsE;AACtE,+FAA2F;AAE3F,+EAGuC;AAOvC;;;;GAIG;AACH,SAAgB,uCAAuC,CACtD,aAAsC,EACtC,oBAA+C;IAE/C,MAAM,iBAAiB,GAA6B,IAAA,gBAAK,EACxD,IAAA,0CAA+B,EAAC,aAAa,EAAE;QAC9C,CAAC,oCAAyB,CAAC,EAAE,sDAAwB,CAAC,EAAE;QACxD,CAAC,6BAAkB,CAAC,KAAK,CAAC,EAAE,sDAAwB,CAAC,EAAE;KACvD,CAAC,CACF,CAAC;IAEF,OAAO,oBAAoB,IAAI,iBAAiB,CAAC;AAClD,CAAC;AAZD,0FAYC;AAED;;GAEG;AACH,SAAgB,iDAAiD,CAChE,aAAsC;IAEtC,OAAO,IAA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gBAC9C,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,4BAA4B,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;gBACvF,OAAO;oBACN,OAAO;oBACP,IAAA,mDAAsB,EAAC,WAAW,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,CAAC;iBACvE,CAAC;YACH,CAAC;YACD,KAAK,sDAAwB,CAAC,EAAE;gBAC/B,OAAO,CAAC,OAAO,EAAE,IAAA,uCAA4B,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC5E,KAAK,sDAAwB,CAAC,eAAe,CAAC,CAAC,CAAC;gBAC/C,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,4BAA4B,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;gBACvF,OAAO;oBACN,OAAO;oBACP,IAAA,wEAAkC,EAAC,WAAW,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,CAAC;iBACnF,CAAC;YACH,CAAC;YACD;gBACC,IAAA,0BAAe,EAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACF,CAAC,CAAC,CAAC;IACH,OAAO,IAAA,0BAAe,EAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AA/CD,sDA+CC;AAED,SAAgB,0CAA0C,CACzD,aAAsC,EACtC,YAAuB;IAEvB,OAAO;QACN,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,uCAAuC,CAAC,aAAa,CAAC;QAC/D,QAAQ,EAAE,CAAC,YAAY,CAAC;KACxB,CAAC;AACH,CAAC;AATD,gGASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\tgetConfigForMinVersionForCollab,\n\tlowestMinVersionForCollab,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\ttype DependentFormatVersion,\n\tFluidClientVersion,\n\ttype FormatVersion,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\tmakeDiscontinuedCodecVersion,\n} from \"../codec/index.js\";\nimport { makeVersionDispatchingCodec } from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport { brand, type JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport type { SummaryData } from \"./editManager.js\";\nimport { makeV1CodecWithVersion } from \"./editManagerCodecsV1toV4.js\";\nimport { makeSharedBranchesCodecWithVersion } from \"./editManagerCodecsVSharedBranches.js\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tEditManagerFormatVersion,\n\teditManagerFormatVersions,\n} from \"./editManagerFormatCommons.js\";\n\nexport interface EditManagerEncodingContext {\n\tidCompressor: IIdCompressor;\n\treadonly schema?: SchemaAndPolicy;\n}\n\n/**\n * Convert a MinimumVersionForCollab to an EditManagerFormatVersion.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n * @returns The EditManagerFormatVersion that corresponds to the provided MinimumVersionForCollab.\n */\nexport function clientVersionToEditManagerFormatVersion(\n\tclientVersion: MinimumVersionForCollab,\n\twriteVersionOverride?: EditManagerFormatVersion,\n): EditManagerFormatVersion {\n\tconst compatibleVersion: EditManagerFormatVersion = brand(\n\t\tgetConfigForMinVersionForCollab(clientVersion, {\n\t\t\t[lowestMinVersionForCollab]: EditManagerFormatVersion.v3,\n\t\t\t[FluidClientVersion.v2_43]: EditManagerFormatVersion.v4,\n\t\t}),\n\t);\n\n\treturn writeVersionOverride ?? compatibleVersion;\n}\n\n/**\n * Returns the version that should be used for testing shared branches.\n */\nexport function editManagerFormatVersionSelectorForSharedBranches(\n\tclientVersion: MinimumVersionForCollab,\n): EditManagerFormatVersion {\n\treturn brand(EditManagerFormatVersion.vSharedBranches);\n}\n\n/**\n * Returns the version that should be used for testing shared branches.\n */\nexport function editManagerFormatVersionSelectorForDetachedRootEditing(\n\tclientVersion: MinimumVersionForCollab,\n): EditManagerFormatVersion {\n\treturn brand(EditManagerFormatVersion.vDetachedRoots);\n}\n\nexport interface EditManagerCodecOptions {\n\treadonly editManagerFormatSelector?: (\n\t\tminVersionForCollab: MinimumVersionForCollab,\n\t) => EditManagerFormatVersion;\n}\n\nfunction editManagerFormatVersionFromOptions(\n\toptions: EditManagerCodecOptions & CodecWriteOptions,\n): EditManagerFormatVersion {\n\tconst selector =\n\t\toptions.editManagerFormatSelector ?? clientVersionToEditManagerFormatVersion;\n\treturn selector(options.minVersionForCollab);\n}\n\nexport function makeEditManagerCodec<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\tdependentChangeFormatVersion: DependentFormatVersion<EditManagerFormatVersion>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: EditManagerCodecOptions & CodecWriteOptions,\n): IJsonCodec<\n\tSummaryData<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tEditManagerEncodingContext\n> {\n\tconst family = makeEditManagerCodecs(\n\t\tchangeCodecs,\n\t\tdependentChangeFormatVersion,\n\t\trevisionTagCodec,\n\t\toptions,\n\t);\n\tconst writeVersion = editManagerFormatVersionFromOptions(options);\n\treturn makeVersionDispatchingCodec(family, { ...options, writeVersion });\n}\n\nexport function makeEditManagerCodecs<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\tdependentChangeFormatVersion: DependentFormatVersion<EditManagerFormatVersion>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n): ICodecFamily<SummaryData<TChangeset>, EditManagerEncodingContext> {\n\tconst registry: [\n\t\tFormatVersion,\n\t\tIJsonCodec<\n\t\t\tSummaryData<TChangeset>,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tEditManagerEncodingContext\n\t\t>,\n\t][] = Array.from(editManagerFormatVersions, (version) => {\n\t\tswitch (version) {\n\t\t\tcase EditManagerFormatVersion.v1:\n\t\t\tcase EditManagerFormatVersion.v2:\n\t\t\t\treturn [version, makeDiscontinuedCodecVersion(options, version, \"2.73.0\")];\n\t\t\tcase EditManagerFormatVersion.v3:\n\t\t\tcase EditManagerFormatVersion.v4:\n\t\t\tcase EditManagerFormatVersion.vDetachedRoots: {\n\t\t\t\tconst changeCodec = changeCodecs.resolve(dependentChangeFormatVersion.lookup(version));\n\t\t\t\treturn [\n\t\t\t\t\tversion,\n\t\t\t\t\tmakeV1CodecWithVersion(changeCodec, revisionTagCodec, options, version),\n\t\t\t\t];\n\t\t\t}\n\t\t\tcase EditManagerFormatVersion.v5:\n\t\t\t\treturn [version, makeDiscontinuedCodecVersion(options, version, \"2.74.0\")];\n\t\t\tcase EditManagerFormatVersion.vSharedBranches: {\n\t\t\t\tconst changeCodec = changeCodecs.resolve(dependentChangeFormatVersion.lookup(version));\n\t\t\t\treturn [\n\t\t\t\t\tversion,\n\t\t\t\t\tmakeSharedBranchesCodecWithVersion(changeCodec, revisionTagCodec, options, version),\n\t\t\t\t];\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(version);\n\t\t}\n\t});\n\treturn makeCodecFamily(registry);\n}\n\nexport function getCodecTreeForEditManagerFormatWithChange(\n\tclientVersion: MinimumVersionForCollab,\n\tchangeFormat: CodecTree,\n): CodecTree {\n\treturn {\n\t\tname: \"EditManager\",\n\t\tversion: clientVersionToEditManagerFormatVersion(clientVersion),\n\t\tchildren: [changeFormat],\n\t};\n}\n"]}
@@ -7,10 +7,10 @@ import { type ICodecOptions, type IJsonCodec, type IMultiFormatCodec } from "../
7
7
  import type { ChangeEncodingContext, EncodedRevisionTag, RevisionTag, SchemaAndPolicy } from "../core/index.js";
8
8
  import { type JsonCompatibleReadOnly } from "../util/index.js";
9
9
  import type { SummaryData } from "./editManager.js";
10
- import { EncodedEditManager } from "./editManagerFormatV5.js";
10
+ import { EncodedEditManager } from "./editManagerFormatVSharedBranches.js";
11
11
  export interface EditManagerEncodingContext {
12
12
  idCompressor: IIdCompressor;
13
13
  readonly schema?: SchemaAndPolicy;
14
14
  }
15
- export declare function makeV5CodecWithVersion<TChangeset>(changeCodec: IMultiFormatCodec<TChangeset, JsonCompatibleReadOnly, JsonCompatibleReadOnly, ChangeEncodingContext>, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>, options: ICodecOptions, version: EncodedEditManager<TChangeset>["version"]): IJsonCodec<SummaryData<TChangeset>, JsonCompatibleReadOnly, JsonCompatibleReadOnly, EditManagerEncodingContext>;
16
- //# sourceMappingURL=editManagerCodecsV5.d.ts.map
15
+ export declare function makeSharedBranchesCodecWithVersion<TChangeset>(changeCodec: IMultiFormatCodec<TChangeset, JsonCompatibleReadOnly, JsonCompatibleReadOnly, ChangeEncodingContext>, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>, options: ICodecOptions, version: EncodedEditManager<TChangeset>["version"]): IJsonCodec<SummaryData<TChangeset>, JsonCompatibleReadOnly, JsonCompatibleReadOnly, EditManagerEncodingContext>;
16
+ //# sourceMappingURL=editManagerCodecsVSharedBranches.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editManagerCodecsVSharedBranches.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecsVSharedBranches.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,iBAAiB,EAEtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,sBAAsB,EAG3B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAA2B,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAK3E,MAAM,WAAW,0BAA0B;IAC1C,YAAY,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;CAClC;AAED,wBAAgB,kCAAkC,CAAC,UAAU,EAC5D,WAAW,EAAE,iBAAiB,CAC7B,UAAU,EACV,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,CACrB,EACD,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,GAChD,UAAU,CACZ,WAAW,CAAC,UAAU,CAAC,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,CAC1B,CAkGA"}
@@ -4,18 +4,18 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.makeV5CodecWithVersion = void 0;
7
+ exports.makeSharedBranchesCodecWithVersion = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const index_js_1 = require("../codec/index.js");
10
10
  const index_js_2 = require("../util/index.js");
11
- const editManagerFormatV5_js_1 = require("./editManagerFormatV5.js");
11
+ const editManagerFormatVSharedBranches_js_1 = require("./editManagerFormatVSharedBranches.js");
12
12
  const editManagerCodecsCommons_js_1 = require("./editManagerCodecsCommons.js");
13
- function makeV5CodecWithVersion(changeCodec, revisionTagCodec, options, version) {
14
- const format = (0, editManagerFormatV5_js_1.EncodedEditManager)(changeCodec.json.encodedSchema ?? index_js_2.JsonCompatibleReadOnlySchema);
13
+ function makeSharedBranchesCodecWithVersion(changeCodec, revisionTagCodec, options, version) {
14
+ const format = (0, editManagerFormatVSharedBranches_js_1.EncodedEditManager)(changeCodec.json.encodedSchema ?? index_js_2.JsonCompatibleReadOnlySchema);
15
15
  const codec = (0, index_js_1.withSchemaValidation)(format, {
16
16
  encode: (data, context) => {
17
17
  const mainBranch = (0, editManagerCodecsCommons_js_1.encodeSharedBranch)(changeCodec, revisionTagCodec, data.main, context, data.originator);
18
- (0, internal_1.assert)(data.originator !== undefined, 0xc65 /* Cannot encode V5 summary without originator */);
18
+ (0, internal_1.assert)(data.originator !== undefined, "Cannot encode vSharedBranches summary without originator");
19
19
  const json = {
20
20
  main: mainBranch,
21
21
  originator: data.originator,
@@ -54,5 +54,5 @@ function makeV5CodecWithVersion(changeCodec, revisionTagCodec, options, version)
54
54
  // Fixing that would remove the need for this cast.
55
55
  return codec;
56
56
  }
57
- exports.makeV5CodecWithVersion = makeV5CodecWithVersion;
58
- //# sourceMappingURL=editManagerCodecsV5.js.map
57
+ exports.makeSharedBranchesCodecWithVersion = makeSharedBranchesCodecWithVersion;
58
+ //# sourceMappingURL=editManagerCodecsVSharedBranches.js.map