@fluidframework/tree 2.74.0-365691 → 2.74.0-370705

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 (1268) hide show
  1. package/.vscode/settings.json +2 -2
  2. package/api-report/tree.alpha.api.md +119 -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 +3 -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/incrementalEncodingPolicy.d.ts +14 -6
  62. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +7 -2
  65. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  66. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +91 -42
  67. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  68. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +238 -69
  69. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  70. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +4 -4
  71. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  72. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +33 -28
  73. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  74. package/dist/feature-libraries/default-schema/index.d.ts +2 -1
  75. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  76. package/dist/feature-libraries/default-schema/index.js +5 -2
  77. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  78. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +36 -0
  79. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
  80. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js +126 -0
  81. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
  82. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +7 -6
  83. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  84. package/dist/feature-libraries/default-schema/mappedEditBuilder.js +15 -0
  85. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  86. package/dist/feature-libraries/deltaUtils.d.ts +1 -0
  87. package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
  88. package/dist/feature-libraries/deltaUtils.js +6 -1
  89. package/dist/feature-libraries/deltaUtils.js.map +1 -1
  90. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +30 -8
  91. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  92. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +41 -11
  93. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  94. package/dist/feature-libraries/flex-tree/context.d.ts +9 -0
  95. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  96. package/dist/feature-libraries/flex-tree/context.js +6 -0
  97. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  98. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
  99. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  100. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  101. package/dist/feature-libraries/flex-tree/lazyField.d.ts +8 -7
  102. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  103. package/dist/feature-libraries/flex-tree/lazyField.js +37 -8
  104. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  105. package/dist/feature-libraries/forest-summary/codec.d.ts +2 -2
  106. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  107. package/dist/feature-libraries/forest-summary/codec.js +4 -4
  108. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  109. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +9 -13
  110. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  111. package/dist/feature-libraries/forest-summary/forestSummarizer.js +21 -26
  112. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  113. package/dist/feature-libraries/forest-summary/format.d.ts +41 -5
  114. package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
  115. package/dist/feature-libraries/forest-summary/format.js +7 -7
  116. package/dist/feature-libraries/forest-summary/format.js.map +1 -1
  117. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +11 -9
  118. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  119. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +16 -29
  120. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  121. package/dist/feature-libraries/forest-summary/index.d.ts +2 -1
  122. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  123. package/dist/feature-libraries/forest-summary/index.js +3 -2
  124. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  125. package/dist/feature-libraries/forest-summary/summaryTypes.d.ts +47 -0
  126. package/dist/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -0
  127. package/dist/feature-libraries/forest-summary/summaryTypes.js +57 -0
  128. package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -0
  129. package/dist/feature-libraries/index.d.ts +4 -4
  130. package/dist/feature-libraries/index.d.ts.map +1 -1
  131. package/dist/feature-libraries/index.js +8 -3
  132. package/dist/feature-libraries/index.js.map +1 -1
  133. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  134. package/dist/feature-libraries/mapTreeCursor.js +1 -0
  135. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  136. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  137. package/dist/feature-libraries/mitigatedChangeFamily.js +2 -2
  138. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  139. package/dist/feature-libraries/modular-schema/comparison.d.ts +18 -2
  140. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  141. package/dist/feature-libraries/modular-schema/comparison.js +54 -3
  142. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  143. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +97 -21
  144. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  145. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +4 -7
  146. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  147. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +20 -52
  148. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  149. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  150. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +25 -13
  151. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  152. package/dist/feature-libraries/modular-schema/fieldKind.js +0 -21
  153. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  154. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  155. package/dist/feature-libraries/modular-schema/genericFieldKind.js +7 -10
  156. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  157. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +2 -2
  158. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  159. package/dist/feature-libraries/modular-schema/index.d.ts +6 -6
  160. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  161. package/dist/feature-libraries/modular-schema/index.js +13 -8
  162. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  163. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +17 -0
  164. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -0
  165. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +388 -0
  166. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -0
  167. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +17 -0
  168. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -0
  169. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +413 -0
  170. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -0
  171. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  172. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  173. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +8 -284
  174. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  175. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +49 -15
  176. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  177. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1306 -465
  178. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  179. package/dist/feature-libraries/modular-schema/{modularChangeFormat.d.ts → modularChangeFormatV1.d.ts} +2 -2
  180. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -0
  181. package/dist/feature-libraries/modular-schema/{modularChangeFormat.js → modularChangeFormatV1.js} +5 -5
  182. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -0
  183. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +146 -0
  184. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -0
  185. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +32 -0
  186. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -0
  187. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +50 -10
  188. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  189. package/dist/feature-libraries/modular-schema/modularChangeTypes.js +24 -3
  190. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  191. package/dist/feature-libraries/optional-field/index.d.ts +2 -2
  192. package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
  193. package/dist/feature-libraries/optional-field/index.js +1 -2
  194. package/dist/feature-libraries/optional-field/index.js.map +1 -1
  195. package/dist/feature-libraries/optional-field/optionalField.d.ts +5 -26
  196. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  197. package/dist/feature-libraries/optional-field/optionalField.js +217 -451
  198. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  199. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +23 -0
  200. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +1 -0
  201. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +31 -0
  202. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +1 -0
  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/optional-field/optionalFieldCodecV3.d.ts +12 -0
  211. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +1 -0
  212. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js +57 -0
  213. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js.map +1 -0
  214. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  215. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +5 -1
  216. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  217. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +27 -8
  218. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  219. package/dist/feature-libraries/schema-index/schemaSummarizer.js +42 -16
  220. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  221. package/dist/feature-libraries/sequence-field/compose.d.ts +6 -7
  222. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  223. package/dist/feature-libraries/sequence-field/compose.js +80 -256
  224. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  225. package/dist/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
  226. package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  227. package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  228. package/dist/feature-libraries/sequence-field/index.d.ts +2 -3
  229. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  230. package/dist/feature-libraries/sequence-field/index.js +1 -3
  231. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  232. package/dist/feature-libraries/sequence-field/invert.d.ts +3 -3
  233. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  234. package/dist/feature-libraries/sequence-field/invert.js +65 -167
  235. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  236. package/dist/feature-libraries/sequence-field/markQueue.d.ts +2 -2
  237. package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  238. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  239. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
  240. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  241. package/dist/feature-libraries/sequence-field/moveEffectTable.js +7 -86
  242. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  243. package/dist/feature-libraries/sequence-field/rebase.d.ts +3 -3
  244. package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  245. package/dist/feature-libraries/sequence-field/rebase.js +106 -112
  246. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  247. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  248. package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -33
  249. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  250. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  251. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +0 -2
  252. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  253. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
  254. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  255. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +358 -179
  256. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  257. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  258. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +20 -60
  259. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  260. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
  261. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  262. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
  263. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  264. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
  265. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  266. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +14 -109
  267. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  268. package/dist/feature-libraries/sequence-field/types.d.ts +30 -59
  269. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  270. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  271. package/dist/feature-libraries/sequence-field/utils.d.ts +15 -24
  272. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  273. package/dist/feature-libraries/sequence-field/utils.js +111 -299
  274. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  275. package/dist/index.d.ts +1 -1
  276. package/dist/index.d.ts.map +1 -1
  277. package/dist/index.js +3 -3
  278. package/dist/index.js.map +1 -1
  279. package/dist/packageVersion.d.ts +1 -1
  280. package/dist/packageVersion.js +1 -1
  281. package/dist/packageVersion.js.map +1 -1
  282. package/dist/shared-tree/independentView.d.ts +1 -1
  283. package/dist/shared-tree/independentView.d.ts.map +1 -1
  284. package/dist/shared-tree/independentView.js.map +1 -1
  285. package/dist/shared-tree/index.d.ts +1 -1
  286. package/dist/shared-tree/index.d.ts.map +1 -1
  287. package/dist/shared-tree/index.js.map +1 -1
  288. package/dist/shared-tree/schematizeTree.d.ts +4 -4
  289. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  290. package/dist/shared-tree/schematizeTree.js +2 -1
  291. package/dist/shared-tree/schematizeTree.js.map +1 -1
  292. package/dist/shared-tree/schematizingTreeView.d.ts +1 -5
  293. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  294. package/dist/shared-tree/schematizingTreeView.js +32 -33
  295. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  296. package/dist/shared-tree/sharedTree.d.ts +11 -5
  297. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  298. package/dist/shared-tree/sharedTree.js +14 -4
  299. package/dist/shared-tree/sharedTree.js.map +1 -1
  300. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  301. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  302. package/dist/shared-tree/sharedTreeChangeCodecs.js +1 -0
  303. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  304. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +20 -8
  305. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  306. package/dist/shared-tree/sharedTreeChangeEnricher.js +26 -12
  307. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  308. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +5 -5
  309. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  310. package/dist/shared-tree/sharedTreeChangeFamily.js +10 -4
  311. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  312. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
  313. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  314. package/dist/shared-tree/sharedTreeEditBuilder.js +14 -7
  315. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  316. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  317. package/dist/shared-tree/treeAlpha.js +1 -1
  318. package/dist/shared-tree/treeAlpha.js.map +1 -1
  319. package/dist/shared-tree/treeCheckout.d.ts +12 -10
  320. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  321. package/dist/shared-tree/treeCheckout.js +66 -17
  322. package/dist/shared-tree/treeCheckout.js.map +1 -1
  323. package/dist/shared-tree-core/branch.d.ts +3 -2
  324. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  325. package/dist/shared-tree-core/branch.js +4 -3
  326. package/dist/shared-tree-core/branch.js.map +1 -1
  327. package/dist/shared-tree-core/editManager.d.ts +2 -2
  328. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  329. package/dist/shared-tree-core/editManager.js +9 -9
  330. package/dist/shared-tree-core/editManager.js.map +1 -1
  331. package/dist/shared-tree-core/editManagerCodecs.d.ts +4 -0
  332. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  333. package/dist/shared-tree-core/editManagerCodecs.js +16 -6
  334. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  335. package/{lib/shared-tree-core/editManagerCodecsV5.d.ts → dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts} +3 -3
  336. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -0
  337. package/dist/shared-tree-core/{editManagerCodecsV5.js → editManagerCodecsVSharedBranches.js} +7 -7
  338. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -0
  339. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +20 -6
  340. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  341. package/dist/shared-tree-core/editManagerFormatCommons.js +22 -7
  342. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  343. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  344. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  345. package/dist/shared-tree-core/editManagerFormatV1toV4.js +1 -0
  346. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  347. package/dist/shared-tree-core/{editManagerFormatV5.d.ts → editManagerFormatVSharedBranches.d.ts} +3 -3
  348. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -0
  349. package/dist/shared-tree-core/{editManagerFormatV5.js → editManagerFormatVSharedBranches.js} +2 -2
  350. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -0
  351. package/dist/shared-tree-core/editManagerSummarizer.d.ts +29 -9
  352. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  353. package/dist/shared-tree-core/editManagerSummarizer.js +41 -13
  354. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  355. package/dist/shared-tree-core/index.d.ts +5 -3
  356. package/dist/shared-tree-core/index.d.ts.map +1 -1
  357. package/dist/shared-tree-core/index.js +8 -1
  358. package/dist/shared-tree-core/index.js.map +1 -1
  359. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  360. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  361. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  362. package/{lib/shared-tree-core/messageCodecV5.d.ts → dist/shared-tree-core/messageCodecVSharedBranches.d.ts} +2 -2
  363. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -0
  364. package/dist/shared-tree-core/{messageCodecV5.js → messageCodecVSharedBranches.js} +6 -6
  365. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -0
  366. package/dist/shared-tree-core/messageCodecs.d.ts +4 -0
  367. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  368. package/dist/shared-tree-core/messageCodecs.js +16 -6
  369. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  370. package/dist/shared-tree-core/messageFormat.d.ts +20 -6
  371. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  372. package/dist/shared-tree-core/messageFormat.js +22 -7
  373. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  374. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
  375. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  376. package/dist/shared-tree-core/messageFormatV1ToV4.js +8 -1
  377. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  378. package/dist/shared-tree-core/{messageFormatV5.d.ts → messageFormatVSharedBranches.d.ts} +5 -7
  379. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -0
  380. package/dist/shared-tree-core/{messageFormatV5.js → messageFormatVSharedBranches.js} +3 -2
  381. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -0
  382. package/dist/shared-tree-core/sharedTreeCore.d.ts +14 -47
  383. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  384. package/dist/shared-tree-core/sharedTreeCore.js +30 -18
  385. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  386. package/dist/shared-tree-core/summaryTypes.d.ts +94 -0
  387. package/dist/shared-tree-core/summaryTypes.d.ts.map +1 -0
  388. package/dist/shared-tree-core/summaryTypes.js +47 -0
  389. package/dist/shared-tree-core/summaryTypes.js.map +1 -0
  390. package/dist/shared-tree-core/versionedSummarizer.d.ts +67 -0
  391. package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -0
  392. package/dist/shared-tree-core/versionedSummarizer.js +63 -0
  393. package/dist/shared-tree-core/versionedSummarizer.js.map +1 -0
  394. package/dist/simple-tree/api/configuration.d.ts +3 -26
  395. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  396. package/dist/simple-tree/api/configuration.js +10 -21
  397. package/dist/simple-tree/api/configuration.js.map +1 -1
  398. package/dist/simple-tree/api/dirtyIndex.d.ts +11 -0
  399. package/dist/simple-tree/api/dirtyIndex.d.ts.map +1 -1
  400. package/dist/simple-tree/api/dirtyIndex.js +7 -0
  401. package/dist/simple-tree/api/dirtyIndex.js.map +1 -1
  402. package/dist/simple-tree/api/discrepancies.d.ts +1 -1
  403. package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
  404. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  405. package/dist/simple-tree/api/getSimpleSchema.d.ts +3 -3
  406. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  407. package/dist/simple-tree/api/getSimpleSchema.js +9 -3
  408. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  409. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  410. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
  411. package/dist/simple-tree/api/incrementalAllowedTypes.js +7 -0
  412. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  413. package/dist/simple-tree/api/index.d.ts +3 -4
  414. package/dist/simple-tree/api/index.d.ts.map +1 -1
  415. package/dist/simple-tree/api/index.js +4 -5
  416. package/dist/simple-tree/api/index.js.map +1 -1
  417. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
  418. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  419. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  420. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +5 -5
  421. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  422. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  423. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  424. package/dist/simple-tree/api/schemaFactoryRecursive.js +0 -1
  425. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  426. package/dist/simple-tree/api/schemaFromSimple.d.ts +6 -1
  427. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  428. package/dist/simple-tree/api/schemaFromSimple.js +5 -0
  429. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  430. package/dist/simple-tree/api/schemaStatics.d.ts +12 -12
  431. package/dist/simple-tree/api/simpleSchemaCodec.d.ts +15 -3
  432. package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
  433. package/dist/simple-tree/api/simpleSchemaCodec.js +18 -6
  434. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  435. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
  436. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  437. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  438. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +8 -1
  439. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  440. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +13 -8
  441. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  442. package/dist/simple-tree/api/typesUnsafe.d.ts +3 -3
  443. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  444. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  445. package/dist/simple-tree/core/allowedTypes.d.ts +2 -2
  446. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
  447. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  448. package/dist/simple-tree/core/index.d.ts +1 -1
  449. package/dist/simple-tree/core/index.d.ts.map +1 -1
  450. package/dist/simple-tree/core/index.js +2 -3
  451. package/dist/simple-tree/core/index.js.map +1 -1
  452. package/dist/simple-tree/core/toStored.d.ts +17 -15
  453. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  454. package/dist/simple-tree/core/toStored.js +5 -40
  455. package/dist/simple-tree/core/toStored.js.map +1 -1
  456. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
  457. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  458. package/dist/simple-tree/core/unhydratedFlexTree.js +59 -8
  459. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  460. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
  461. package/dist/simple-tree/core/walkSchema.js +4 -0
  462. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  463. package/dist/simple-tree/createContext.d.ts.map +1 -1
  464. package/dist/simple-tree/createContext.js +20 -5
  465. package/dist/simple-tree/createContext.js.map +1 -1
  466. package/dist/simple-tree/fieldSchema.d.ts +7 -7
  467. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  468. package/dist/simple-tree/fieldSchema.js.map +1 -1
  469. package/dist/simple-tree/index.d.ts +8 -7
  470. package/dist/simple-tree/index.d.ts.map +1 -1
  471. package/dist/simple-tree/index.js +15 -12
  472. package/dist/simple-tree/index.js.map +1 -1
  473. package/dist/simple-tree/leafNodeSchema.d.ts +5 -5
  474. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  475. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  476. package/dist/simple-tree/node-kinds/array/arrayNode.js +5 -3
  477. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  478. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +3 -3
  479. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  480. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  481. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
  482. package/dist/simple-tree/node-kinds/common.js +1 -1
  483. package/dist/simple-tree/node-kinds/common.js.map +1 -1
  484. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  485. package/dist/simple-tree/node-kinds/map/mapNode.js +2 -2
  486. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  487. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +3 -3
  488. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  489. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  490. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  491. package/dist/simple-tree/node-kinds/object/objectNode.js +18 -18
  492. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  493. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +2 -2
  494. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  495. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  496. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  497. package/dist/simple-tree/node-kinds/record/recordNode.js +4 -2
  498. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  499. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -3
  500. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  501. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  502. package/dist/simple-tree/prepareForInsertion.d.ts +54 -47
  503. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  504. package/dist/simple-tree/prepareForInsertion.js +183 -125
  505. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  506. package/dist/simple-tree/simpleSchema.d.ts +55 -23
  507. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  508. package/dist/simple-tree/simpleSchema.js +17 -0
  509. package/dist/simple-tree/simpleSchema.js.map +1 -1
  510. package/dist/simple-tree/simpleSchemaFormatV1.d.ts +1 -1
  511. package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
  512. package/dist/simple-tree/simpleSchemaFormatV1.js +8 -1
  513. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  514. package/dist/simple-tree/toStoredSchema.d.ts +58 -11
  515. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  516. package/dist/simple-tree/toStoredSchema.js +205 -30
  517. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  518. package/dist/simple-tree/treeSchema.d.ts +23 -0
  519. package/dist/simple-tree/treeSchema.d.ts.map +1 -0
  520. package/dist/simple-tree/treeSchema.js +25 -0
  521. package/dist/simple-tree/treeSchema.js.map +1 -0
  522. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +13 -4
  523. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  524. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +29 -11
  525. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  526. package/dist/tableSchema.d.ts +117 -63
  527. package/dist/tableSchema.d.ts.map +1 -1
  528. package/dist/tableSchema.js +159 -58
  529. package/dist/tableSchema.js.map +1 -1
  530. package/dist/treeFactory.d.ts.map +1 -1
  531. package/dist/treeFactory.js +17 -3
  532. package/dist/treeFactory.js.map +1 -1
  533. package/dist/util/index.d.ts +2 -1
  534. package/dist/util/index.d.ts.map +1 -1
  535. package/dist/util/index.js +4 -1
  536. package/dist/util/index.js.map +1 -1
  537. package/dist/util/rangeMap.d.ts +24 -12
  538. package/dist/util/rangeMap.d.ts.map +1 -1
  539. package/dist/util/rangeMap.js +46 -6
  540. package/dist/util/rangeMap.js.map +1 -1
  541. package/dist/util/readSnapshotBlob.d.ts +13 -0
  542. package/dist/util/readSnapshotBlob.d.ts.map +1 -0
  543. package/dist/util/readSnapshotBlob.js +18 -0
  544. package/dist/util/readSnapshotBlob.js.map +1 -0
  545. package/lib/alpha.d.ts +3 -2
  546. package/lib/codec/codec.d.ts +14 -1
  547. package/lib/codec/codec.d.ts.map +1 -1
  548. package/lib/codec/codec.js +11 -0
  549. package/lib/codec/codec.js.map +1 -1
  550. package/lib/codec/versioned/codec.d.ts +1 -1
  551. package/lib/codec/versioned/codec.d.ts.map +1 -1
  552. package/lib/codec/versioned/codec.js.map +1 -1
  553. package/lib/codec/versioned/format.d.ts +4 -1
  554. package/lib/codec/versioned/format.d.ts.map +1 -1
  555. package/lib/codec/versioned/format.js +4 -1
  556. package/lib/codec/versioned/format.js.map +1 -1
  557. package/lib/core/change-family/changeFamily.d.ts +4 -1
  558. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  559. package/lib/core/change-family/changeFamily.js.map +1 -1
  560. package/lib/core/change-family/index.d.ts +1 -1
  561. package/lib/core/change-family/index.d.ts.map +1 -1
  562. package/lib/core/change-family/index.js.map +1 -1
  563. package/lib/core/index.d.ts +3 -3
  564. package/lib/core/index.d.ts.map +1 -1
  565. package/lib/core/index.js +2 -2
  566. package/lib/core/index.js.map +1 -1
  567. package/lib/core/rebase/changeRebaser.d.ts +6 -1
  568. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  569. package/lib/core/rebase/changeRebaser.js.map +1 -1
  570. package/lib/core/rebase/index.d.ts +1 -1
  571. package/lib/core/rebase/index.d.ts.map +1 -1
  572. package/lib/core/rebase/index.js +1 -1
  573. package/lib/core/rebase/index.js.map +1 -1
  574. package/lib/core/rebase/types.d.ts +2 -1
  575. package/lib/core/rebase/types.d.ts.map +1 -1
  576. package/lib/core/rebase/types.js +3 -0
  577. package/lib/core/rebase/types.js.map +1 -1
  578. package/lib/core/rebase/utils.d.ts.map +1 -1
  579. package/lib/core/rebase/utils.js +25 -7
  580. package/lib/core/rebase/utils.js.map +1 -1
  581. package/lib/core/tree/detachedFieldIndex.d.ts +40 -13
  582. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  583. package/lib/core/tree/detachedFieldIndex.js +22 -13
  584. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  585. package/lib/core/tree/index.d.ts +4 -3
  586. package/lib/core/tree/index.d.ts.map +1 -1
  587. package/lib/core/tree/index.js +3 -2
  588. package/lib/core/tree/index.js.map +1 -1
  589. package/lib/core/tree/pathTree.d.ts +11 -3
  590. package/lib/core/tree/pathTree.d.ts.map +1 -1
  591. package/lib/core/tree/pathTree.js +12 -1
  592. package/lib/core/tree/pathTree.js.map +1 -1
  593. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  594. package/lib/feature-libraries/chunked-forest/basicChunk.js +8 -1
  595. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  596. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  597. package/lib/feature-libraries/chunked-forest/chunkTree.js +4 -1
  598. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  599. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +14 -6
  600. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
  601. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
  602. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +7 -2
  603. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  604. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +91 -42
  605. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  606. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +236 -70
  607. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  608. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +4 -4
  609. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  610. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +34 -29
  611. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  612. package/lib/feature-libraries/default-schema/index.d.ts +2 -1
  613. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  614. package/lib/feature-libraries/default-schema/index.js +2 -1
  615. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  616. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +36 -0
  617. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
  618. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js +122 -0
  619. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
  620. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +7 -6
  621. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  622. package/lib/feature-libraries/default-schema/mappedEditBuilder.js +15 -0
  623. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  624. package/lib/feature-libraries/deltaUtils.d.ts +1 -0
  625. package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
  626. package/lib/feature-libraries/deltaUtils.js +5 -1
  627. package/lib/feature-libraries/deltaUtils.js.map +1 -1
  628. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +30 -8
  629. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  630. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +38 -8
  631. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  632. package/lib/feature-libraries/flex-tree/context.d.ts +9 -0
  633. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  634. package/lib/feature-libraries/flex-tree/context.js +6 -0
  635. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  636. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
  637. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  638. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  639. package/lib/feature-libraries/flex-tree/lazyField.d.ts +8 -7
  640. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  641. package/lib/feature-libraries/flex-tree/lazyField.js +38 -9
  642. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  643. package/lib/feature-libraries/forest-summary/codec.d.ts +2 -2
  644. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  645. package/lib/feature-libraries/forest-summary/codec.js +5 -5
  646. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  647. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +9 -13
  648. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  649. package/lib/feature-libraries/forest-summary/forestSummarizer.js +17 -22
  650. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  651. package/lib/feature-libraries/forest-summary/format.d.ts +41 -5
  652. package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
  653. package/lib/feature-libraries/forest-summary/format.js +3 -3
  654. package/lib/feature-libraries/forest-summary/format.js.map +1 -1
  655. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +11 -9
  656. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  657. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +13 -26
  658. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  659. package/lib/feature-libraries/forest-summary/index.d.ts +2 -1
  660. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  661. package/lib/feature-libraries/forest-summary/index.js +2 -1
  662. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  663. package/lib/feature-libraries/forest-summary/summaryTypes.d.ts +47 -0
  664. package/lib/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -0
  665. package/lib/feature-libraries/forest-summary/summaryTypes.js +53 -0
  666. package/lib/feature-libraries/forest-summary/summaryTypes.js.map +1 -0
  667. package/lib/feature-libraries/index.d.ts +4 -4
  668. package/lib/feature-libraries/index.d.ts.map +1 -1
  669. package/lib/feature-libraries/index.js +3 -3
  670. package/lib/feature-libraries/index.js.map +1 -1
  671. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  672. package/lib/feature-libraries/mapTreeCursor.js +2 -1
  673. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  674. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  675. package/lib/feature-libraries/mitigatedChangeFamily.js +2 -2
  676. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  677. package/lib/feature-libraries/modular-schema/comparison.d.ts +18 -2
  678. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  679. package/lib/feature-libraries/modular-schema/comparison.js +55 -5
  680. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  681. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +97 -21
  682. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  683. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +3 -5
  684. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  685. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +20 -52
  686. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  687. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  688. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +25 -13
  689. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  690. package/lib/feature-libraries/modular-schema/fieldKind.js +0 -21
  691. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  692. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  693. package/lib/feature-libraries/modular-schema/genericFieldKind.js +7 -10
  694. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  695. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +1 -1
  696. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  697. package/lib/feature-libraries/modular-schema/index.d.ts +6 -6
  698. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  699. package/lib/feature-libraries/modular-schema/index.js +5 -4
  700. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  701. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +17 -0
  702. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -0
  703. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +384 -0
  704. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -0
  705. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +17 -0
  706. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -0
  707. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js +409 -0
  708. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -0
  709. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  710. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  711. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +9 -285
  712. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  713. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +49 -15
  714. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  715. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1291 -458
  716. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  717. package/lib/feature-libraries/modular-schema/{modularChangeFormat.d.ts → modularChangeFormatV1.d.ts} +2 -2
  718. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -0
  719. package/lib/feature-libraries/modular-schema/{modularChangeFormat.js → modularChangeFormatV1.js} +2 -2
  720. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -0
  721. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +146 -0
  722. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -0
  723. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +29 -0
  724. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -0
  725. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +50 -10
  726. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  727. package/lib/feature-libraries/modular-schema/modularChangeTypes.js +20 -2
  728. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  729. package/lib/feature-libraries/optional-field/index.d.ts +2 -2
  730. package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
  731. package/lib/feature-libraries/optional-field/index.js +1 -1
  732. package/lib/feature-libraries/optional-field/index.js.map +1 -1
  733. package/lib/feature-libraries/optional-field/optionalField.d.ts +5 -26
  734. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  735. package/lib/feature-libraries/optional-field/optionalField.js +217 -449
  736. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  737. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +23 -0
  738. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +1 -0
  739. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +27 -0
  740. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +1 -0
  741. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +24 -33
  742. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
  743. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
  744. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
  745. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  746. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +55 -26
  747. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  748. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +12 -0
  749. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +1 -0
  750. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js +53 -0
  751. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js.map +1 -0
  752. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  753. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +5 -1
  754. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  755. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +27 -8
  756. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  757. package/lib/feature-libraries/schema-index/schemaSummarizer.js +38 -12
  758. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  759. package/lib/feature-libraries/sequence-field/compose.d.ts +6 -7
  760. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  761. package/lib/feature-libraries/sequence-field/compose.js +82 -258
  762. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  763. package/lib/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
  764. package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  765. package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  766. package/lib/feature-libraries/sequence-field/index.d.ts +2 -3
  767. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  768. package/lib/feature-libraries/sequence-field/index.js +0 -1
  769. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  770. package/lib/feature-libraries/sequence-field/invert.d.ts +3 -3
  771. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  772. package/lib/feature-libraries/sequence-field/invert.js +67 -169
  773. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  774. package/lib/feature-libraries/sequence-field/markQueue.d.ts +2 -2
  775. package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  776. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  777. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
  778. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  779. package/lib/feature-libraries/sequence-field/moveEffectTable.js +6 -80
  780. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  781. package/lib/feature-libraries/sequence-field/rebase.d.ts +3 -3
  782. package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  783. package/lib/feature-libraries/sequence-field/rebase.js +108 -114
  784. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  785. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  786. package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -33
  787. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  788. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  789. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +0 -2
  790. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  791. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
  792. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  793. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +350 -175
  794. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  795. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  796. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +21 -61
  797. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  798. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
  799. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  800. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
  801. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  802. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
  803. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  804. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +14 -109
  805. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  806. package/lib/feature-libraries/sequence-field/types.d.ts +30 -59
  807. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  808. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  809. package/lib/feature-libraries/sequence-field/utils.d.ts +15 -24
  810. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  811. package/lib/feature-libraries/sequence-field/utils.js +107 -292
  812. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  813. package/lib/index.d.ts +1 -1
  814. package/lib/index.d.ts.map +1 -1
  815. package/lib/index.js +1 -1
  816. package/lib/index.js.map +1 -1
  817. package/lib/packageVersion.d.ts +1 -1
  818. package/lib/packageVersion.js +1 -1
  819. package/lib/packageVersion.js.map +1 -1
  820. package/lib/shared-tree/independentView.d.ts +1 -1
  821. package/lib/shared-tree/independentView.d.ts.map +1 -1
  822. package/lib/shared-tree/independentView.js.map +1 -1
  823. package/lib/shared-tree/index.d.ts +1 -1
  824. package/lib/shared-tree/index.d.ts.map +1 -1
  825. package/lib/shared-tree/index.js.map +1 -1
  826. package/lib/shared-tree/schematizeTree.d.ts +4 -4
  827. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  828. package/lib/shared-tree/schematizeTree.js +3 -2
  829. package/lib/shared-tree/schematizeTree.js.map +1 -1
  830. package/lib/shared-tree/schematizingTreeView.d.ts +1 -5
  831. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  832. package/lib/shared-tree/schematizingTreeView.js +35 -36
  833. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  834. package/lib/shared-tree/sharedTree.d.ts +11 -5
  835. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  836. package/lib/shared-tree/sharedTree.js +14 -4
  837. package/lib/shared-tree/sharedTree.js.map +1 -1
  838. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  839. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  840. package/lib/shared-tree/sharedTreeChangeCodecs.js +1 -0
  841. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  842. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +20 -8
  843. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  844. package/lib/shared-tree/sharedTreeChangeEnricher.js +27 -13
  845. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  846. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +5 -5
  847. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  848. package/lib/shared-tree/sharedTreeChangeFamily.js +11 -5
  849. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  850. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
  851. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  852. package/lib/shared-tree/sharedTreeEditBuilder.js +12 -6
  853. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  854. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  855. package/lib/shared-tree/treeAlpha.js +2 -2
  856. package/lib/shared-tree/treeAlpha.js.map +1 -1
  857. package/lib/shared-tree/treeCheckout.d.ts +12 -10
  858. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  859. package/lib/shared-tree/treeCheckout.js +69 -20
  860. package/lib/shared-tree/treeCheckout.js.map +1 -1
  861. package/lib/shared-tree-core/branch.d.ts +3 -2
  862. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  863. package/lib/shared-tree-core/branch.js +4 -3
  864. package/lib/shared-tree-core/branch.js.map +1 -1
  865. package/lib/shared-tree-core/editManager.d.ts +2 -2
  866. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  867. package/lib/shared-tree-core/editManager.js +9 -9
  868. package/lib/shared-tree-core/editManager.js.map +1 -1
  869. package/lib/shared-tree-core/editManagerCodecs.d.ts +4 -0
  870. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  871. package/lib/shared-tree-core/editManagerCodecs.js +14 -5
  872. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  873. package/{dist/shared-tree-core/editManagerCodecsV5.d.ts → lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts} +3 -3
  874. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -0
  875. package/lib/shared-tree-core/{editManagerCodecsV5.js → editManagerCodecsVSharedBranches.js} +4 -4
  876. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -0
  877. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +20 -6
  878. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  879. package/lib/shared-tree-core/editManagerFormatCommons.js +22 -7
  880. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  881. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  882. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  883. package/lib/shared-tree-core/editManagerFormatV1toV4.js +1 -0
  884. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  885. package/lib/shared-tree-core/{editManagerFormatV5.d.ts → editManagerFormatVSharedBranches.d.ts} +3 -3
  886. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -0
  887. package/lib/shared-tree-core/{editManagerFormatV5.js → editManagerFormatVSharedBranches.js} +2 -2
  888. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -0
  889. package/lib/shared-tree-core/editManagerSummarizer.d.ts +29 -9
  890. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  891. package/lib/shared-tree-core/editManagerSummarizer.js +39 -11
  892. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  893. package/lib/shared-tree-core/index.d.ts +5 -3
  894. package/lib/shared-tree-core/index.d.ts.map +1 -1
  895. package/lib/shared-tree-core/index.js +4 -2
  896. package/lib/shared-tree-core/index.js.map +1 -1
  897. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  898. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  899. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  900. package/{dist/shared-tree-core/messageCodecV5.d.ts → lib/shared-tree-core/messageCodecVSharedBranches.d.ts} +2 -2
  901. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -0
  902. package/lib/shared-tree-core/{messageCodecV5.js → messageCodecVSharedBranches.js} +3 -3
  903. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -0
  904. package/lib/shared-tree-core/messageCodecs.d.ts +4 -0
  905. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  906. package/lib/shared-tree-core/messageCodecs.js +14 -5
  907. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  908. package/lib/shared-tree-core/messageFormat.d.ts +20 -6
  909. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  910. package/lib/shared-tree-core/messageFormat.js +22 -7
  911. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  912. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
  913. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  914. package/lib/shared-tree-core/messageFormatV1ToV4.js +8 -1
  915. package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  916. package/lib/shared-tree-core/{messageFormatV5.d.ts → messageFormatVSharedBranches.d.ts} +5 -7
  917. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -0
  918. package/lib/shared-tree-core/{messageFormatV5.js → messageFormatVSharedBranches.js} +3 -2
  919. package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -0
  920. package/lib/shared-tree-core/sharedTreeCore.d.ts +14 -47
  921. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  922. package/lib/shared-tree-core/sharedTreeCore.js +28 -16
  923. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  924. package/lib/shared-tree-core/summaryTypes.d.ts +94 -0
  925. package/lib/shared-tree-core/summaryTypes.d.ts.map +1 -0
  926. package/lib/shared-tree-core/summaryTypes.js +43 -0
  927. package/lib/shared-tree-core/summaryTypes.js.map +1 -0
  928. package/lib/shared-tree-core/versionedSummarizer.d.ts +67 -0
  929. package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -0
  930. package/lib/shared-tree-core/versionedSummarizer.js +59 -0
  931. package/lib/shared-tree-core/versionedSummarizer.js.map +1 -0
  932. package/lib/simple-tree/api/configuration.d.ts +3 -26
  933. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  934. package/lib/simple-tree/api/configuration.js +14 -25
  935. package/lib/simple-tree/api/configuration.js.map +1 -1
  936. package/lib/simple-tree/api/dirtyIndex.d.ts +11 -0
  937. package/lib/simple-tree/api/dirtyIndex.d.ts.map +1 -1
  938. package/lib/simple-tree/api/dirtyIndex.js +7 -0
  939. package/lib/simple-tree/api/dirtyIndex.js.map +1 -1
  940. package/lib/simple-tree/api/discrepancies.d.ts +1 -1
  941. package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
  942. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  943. package/lib/simple-tree/api/getSimpleSchema.d.ts +3 -3
  944. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  945. package/lib/simple-tree/api/getSimpleSchema.js +9 -3
  946. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  947. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  948. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
  949. package/lib/simple-tree/api/incrementalAllowedTypes.js +8 -1
  950. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  951. package/lib/simple-tree/api/index.d.ts +3 -4
  952. package/lib/simple-tree/api/index.d.ts.map +1 -1
  953. package/lib/simple-tree/api/index.js +2 -3
  954. package/lib/simple-tree/api/index.js.map +1 -1
  955. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
  956. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  957. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  958. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +5 -5
  959. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  960. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  961. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  962. package/lib/simple-tree/api/schemaFactoryRecursive.js +0 -1
  963. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  964. package/lib/simple-tree/api/schemaFromSimple.d.ts +6 -1
  965. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  966. package/lib/simple-tree/api/schemaFromSimple.js +5 -0
  967. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  968. package/lib/simple-tree/api/schemaStatics.d.ts +12 -12
  969. package/lib/simple-tree/api/simpleSchemaCodec.d.ts +15 -3
  970. package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
  971. package/lib/simple-tree/api/simpleSchemaCodec.js +15 -3
  972. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  973. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
  974. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  975. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  976. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +8 -1
  977. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  978. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +15 -10
  979. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  980. package/lib/simple-tree/api/typesUnsafe.d.ts +3 -3
  981. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  982. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  983. package/lib/simple-tree/core/allowedTypes.d.ts +2 -2
  984. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
  985. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  986. package/lib/simple-tree/core/index.d.ts +1 -1
  987. package/lib/simple-tree/core/index.d.ts.map +1 -1
  988. package/lib/simple-tree/core/index.js +1 -1
  989. package/lib/simple-tree/core/index.js.map +1 -1
  990. package/lib/simple-tree/core/toStored.d.ts +17 -15
  991. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  992. package/lib/simple-tree/core/toStored.js +4 -37
  993. package/lib/simple-tree/core/toStored.js.map +1 -1
  994. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
  995. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  996. package/lib/simple-tree/core/unhydratedFlexTree.js +58 -8
  997. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  998. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
  999. package/lib/simple-tree/core/walkSchema.js +5 -1
  1000. package/lib/simple-tree/core/walkSchema.js.map +1 -1
  1001. package/lib/simple-tree/createContext.d.ts.map +1 -1
  1002. package/lib/simple-tree/createContext.js +20 -5
  1003. package/lib/simple-tree/createContext.js.map +1 -1
  1004. package/lib/simple-tree/fieldSchema.d.ts +7 -7
  1005. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  1006. package/lib/simple-tree/fieldSchema.js.map +1 -1
  1007. package/lib/simple-tree/index.d.ts +8 -7
  1008. package/lib/simple-tree/index.d.ts.map +1 -1
  1009. package/lib/simple-tree/index.js +6 -5
  1010. package/lib/simple-tree/index.js.map +1 -1
  1011. package/lib/simple-tree/leafNodeSchema.d.ts +5 -5
  1012. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  1013. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  1014. package/lib/simple-tree/node-kinds/array/arrayNode.js +6 -4
  1015. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  1016. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +3 -3
  1017. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  1018. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  1019. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
  1020. package/lib/simple-tree/node-kinds/common.js +2 -2
  1021. package/lib/simple-tree/node-kinds/common.js.map +1 -1
  1022. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  1023. package/lib/simple-tree/node-kinds/map/mapNode.js +2 -2
  1024. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  1025. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +3 -3
  1026. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  1027. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  1028. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  1029. package/lib/simple-tree/node-kinds/object/objectNode.js +19 -19
  1030. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  1031. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +2 -2
  1032. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  1033. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  1034. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  1035. package/lib/simple-tree/node-kinds/record/recordNode.js +4 -2
  1036. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  1037. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -3
  1038. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  1039. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  1040. package/lib/simple-tree/prepareForInsertion.d.ts +54 -47
  1041. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  1042. package/lib/simple-tree/prepareForInsertion.js +183 -124
  1043. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  1044. package/lib/simple-tree/simpleSchema.d.ts +55 -23
  1045. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  1046. package/lib/simple-tree/simpleSchema.js +16 -1
  1047. package/lib/simple-tree/simpleSchema.js.map +1 -1
  1048. package/lib/simple-tree/simpleSchemaFormatV1.d.ts +1 -1
  1049. package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
  1050. package/lib/simple-tree/simpleSchemaFormatV1.js +8 -1
  1051. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  1052. package/lib/simple-tree/toStoredSchema.d.ts +58 -11
  1053. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  1054. package/lib/simple-tree/toStoredSchema.js +204 -31
  1055. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  1056. package/lib/simple-tree/treeSchema.d.ts +23 -0
  1057. package/lib/simple-tree/treeSchema.d.ts.map +1 -0
  1058. package/lib/simple-tree/treeSchema.js +21 -0
  1059. package/lib/simple-tree/treeSchema.js.map +1 -0
  1060. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +13 -4
  1061. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  1062. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +26 -9
  1063. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  1064. package/lib/tableSchema.d.ts +117 -63
  1065. package/lib/tableSchema.d.ts.map +1 -1
  1066. package/lib/tableSchema.js +160 -59
  1067. package/lib/tableSchema.js.map +1 -1
  1068. package/lib/treeFactory.d.ts.map +1 -1
  1069. package/lib/treeFactory.js +18 -4
  1070. package/lib/treeFactory.js.map +1 -1
  1071. package/lib/util/index.d.ts +2 -1
  1072. package/lib/util/index.d.ts.map +1 -1
  1073. package/lib/util/index.js +2 -1
  1074. package/lib/util/index.js.map +1 -1
  1075. package/lib/util/rangeMap.d.ts +24 -12
  1076. package/lib/util/rangeMap.d.ts.map +1 -1
  1077. package/lib/util/rangeMap.js +44 -5
  1078. package/lib/util/rangeMap.js.map +1 -1
  1079. package/lib/util/readSnapshotBlob.d.ts +13 -0
  1080. package/lib/util/readSnapshotBlob.d.ts.map +1 -0
  1081. package/lib/util/readSnapshotBlob.js +14 -0
  1082. package/lib/util/readSnapshotBlob.js.map +1 -0
  1083. package/package.json +21 -21
  1084. package/src/codec/codec.ts +15 -1
  1085. package/src/codec/versioned/codec.ts +1 -1
  1086. package/src/codec/versioned/format.ts +4 -1
  1087. package/src/core/change-family/changeFamily.ts +5 -0
  1088. package/src/core/change-family/index.ts +1 -0
  1089. package/src/core/index.ts +7 -2
  1090. package/src/core/rebase/changeRebaser.ts +6 -1
  1091. package/src/core/rebase/index.ts +1 -0
  1092. package/src/core/rebase/types.ts +8 -1
  1093. package/src/core/rebase/utils.ts +31 -7
  1094. package/src/core/tree/detachedFieldIndex.ts +71 -14
  1095. package/src/core/tree/index.ts +9 -3
  1096. package/src/core/tree/pathTree.ts +16 -4
  1097. package/src/feature-libraries/chunked-forest/basicChunk.ts +7 -1
  1098. package/src/feature-libraries/chunked-forest/chunkTree.ts +6 -1
  1099. package/src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts +15 -7
  1100. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +9 -9
  1101. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +398 -127
  1102. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +35 -38
  1103. package/src/feature-libraries/default-schema/index.ts +17 -5
  1104. package/src/feature-libraries/default-schema/locationBasedEditBuilder.ts +180 -0
  1105. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +35 -9
  1106. package/src/feature-libraries/deltaUtils.ts +6 -1
  1107. package/src/feature-libraries/detachedFieldIndexSummarizer.ts +62 -15
  1108. package/src/feature-libraries/flex-tree/context.ts +17 -0
  1109. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +7 -8
  1110. package/src/feature-libraries/flex-tree/lazyField.ts +66 -24
  1111. package/src/feature-libraries/forest-summary/codec.ts +8 -8
  1112. package/src/feature-libraries/forest-summary/forestSummarizer.ts +45 -37
  1113. package/src/feature-libraries/forest-summary/format.ts +4 -4
  1114. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +23 -39
  1115. package/src/feature-libraries/forest-summary/index.ts +2 -1
  1116. package/src/feature-libraries/forest-summary/summaryTypes.ts +61 -0
  1117. package/src/feature-libraries/index.ts +23 -9
  1118. package/src/feature-libraries/mapTreeCursor.ts +2 -1
  1119. package/src/feature-libraries/mitigatedChangeFamily.ts +3 -1
  1120. package/src/feature-libraries/modular-schema/comparison.ts +63 -5
  1121. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +142 -44
  1122. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +36 -57
  1123. package/src/feature-libraries/modular-schema/fieldKind.ts +24 -40
  1124. package/src/feature-libraries/modular-schema/genericFieldKind.ts +10 -19
  1125. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +1 -1
  1126. package/src/feature-libraries/modular-schema/index.ts +22 -15
  1127. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +732 -0
  1128. package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +790 -0
  1129. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +29 -499
  1130. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2547 -739
  1131. package/src/feature-libraries/modular-schema/{modularChangeFormat.ts → modularChangeFormatV1.ts} +2 -1
  1132. package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +62 -0
  1133. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +98 -10
  1134. package/src/feature-libraries/optional-field/index.ts +1 -3
  1135. package/src/feature-libraries/optional-field/optionalField.ts +317 -574
  1136. package/src/feature-libraries/optional-field/optionalFieldChangeFormatV3.ts +45 -0
  1137. package/src/feature-libraries/optional-field/optionalFieldChangeTypes.ts +24 -38
  1138. package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +89 -35
  1139. package/src/feature-libraries/optional-field/optionalFieldCodecV3.ts +94 -0
  1140. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +5 -1
  1141. package/src/feature-libraries/schema-index/schemaSummarizer.ts +59 -18
  1142. package/src/feature-libraries/sequence-field/compose.ts +134 -519
  1143. package/src/feature-libraries/sequence-field/helperTypes.ts +34 -19
  1144. package/src/feature-libraries/sequence-field/index.ts +0 -9
  1145. package/src/feature-libraries/sequence-field/invert.ts +103 -228
  1146. package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
  1147. package/src/feature-libraries/sequence-field/moveEffectTable.ts +8 -191
  1148. package/src/feature-libraries/sequence-field/rebase.ts +168 -203
  1149. package/src/feature-libraries/sequence-field/replaceRevisions.ts +31 -52
  1150. package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +0 -2
  1151. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +643 -220
  1152. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +56 -68
  1153. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +25 -27
  1154. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +19 -129
  1155. package/src/feature-libraries/sequence-field/types.ts +34 -64
  1156. package/src/feature-libraries/sequence-field/utils.ts +133 -346
  1157. package/src/index.ts +3 -2
  1158. package/src/packageVersion.ts +1 -1
  1159. package/src/shared-tree/independentView.ts +1 -1
  1160. package/src/shared-tree/index.ts +3 -2
  1161. package/src/shared-tree/schematizeTree.ts +21 -8
  1162. package/src/shared-tree/schematizingTreeView.ts +50 -68
  1163. package/src/shared-tree/sharedTree.ts +39 -12
  1164. package/src/shared-tree/sharedTreeChangeCodecs.ts +5 -1
  1165. package/src/shared-tree/sharedTreeChangeEnricher.ts +33 -11
  1166. package/src/shared-tree/sharedTreeChangeFamily.ts +15 -5
  1167. package/src/shared-tree/sharedTreeEditBuilder.ts +47 -13
  1168. package/src/shared-tree/treeAlpha.ts +2 -3
  1169. package/src/shared-tree/treeCheckout.ts +104 -31
  1170. package/src/shared-tree-core/branch.ts +8 -2
  1171. package/src/shared-tree-core/editManager.ts +16 -2
  1172. package/src/shared-tree-core/editManagerCodecs.ts +17 -5
  1173. package/src/shared-tree-core/{editManagerCodecsV5.ts → editManagerCodecsVSharedBranches.ts} +3 -3
  1174. package/src/shared-tree-core/editManagerFormatCommons.ts +22 -7
  1175. package/src/shared-tree-core/editManagerFormatV1toV4.ts +3 -1
  1176. package/src/shared-tree-core/{editManagerFormatV5.ts → editManagerFormatVSharedBranches.ts} +2 -2
  1177. package/src/shared-tree-core/editManagerSummarizer.ts +58 -16
  1178. package/src/shared-tree-core/index.ts +11 -3
  1179. package/src/shared-tree-core/messageCodecV1ToV4.ts +2 -1
  1180. package/src/shared-tree-core/{messageCodecV5.ts → messageCodecVSharedBranches.ts} +3 -3
  1181. package/src/shared-tree-core/messageCodecs.ts +17 -5
  1182. package/src/shared-tree-core/messageFormat.ts +22 -7
  1183. package/src/shared-tree-core/messageFormatV1ToV4.ts +16 -2
  1184. package/src/shared-tree-core/{messageFormatV5.ts → messageFormatVSharedBranches.ts} +4 -6
  1185. package/src/shared-tree-core/sharedTreeCore.ts +67 -76
  1186. package/src/shared-tree-core/summaryTypes.ts +122 -0
  1187. package/src/shared-tree-core/versionedSummarizer.ts +107 -0
  1188. package/src/simple-tree/api/configuration.ts +21 -68
  1189. package/src/simple-tree/api/dirtyIndex.ts +11 -0
  1190. package/src/simple-tree/api/discrepancies.ts +1 -1
  1191. package/src/simple-tree/api/getSimpleSchema.ts +13 -6
  1192. package/src/simple-tree/api/incrementalAllowedTypes.ts +15 -3
  1193. package/src/simple-tree/api/index.ts +3 -4
  1194. package/src/simple-tree/api/schemaCompatibilityTester.ts +1 -1
  1195. package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -2
  1196. package/src/simple-tree/api/schemaFactoryRecursive.ts +0 -2
  1197. package/src/simple-tree/api/schemaFromSimple.ts +11 -5
  1198. package/src/simple-tree/api/simpleSchemaCodec.ts +17 -3
  1199. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -1
  1200. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +18 -10
  1201. package/src/simple-tree/api/typesUnsafe.ts +7 -3
  1202. package/src/simple-tree/core/allowedTypes.ts +3 -3
  1203. package/src/simple-tree/core/index.ts +2 -2
  1204. package/src/simple-tree/core/toStored.ts +22 -55
  1205. package/src/simple-tree/core/unhydratedFlexTree.ts +87 -36
  1206. package/src/simple-tree/core/walkSchema.ts +6 -0
  1207. package/src/simple-tree/createContext.ts +26 -11
  1208. package/src/simple-tree/fieldSchema.ts +16 -7
  1209. package/src/simple-tree/index.ts +12 -11
  1210. package/src/simple-tree/node-kinds/array/arrayNode.ts +12 -7
  1211. package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +3 -3
  1212. package/src/simple-tree/node-kinds/common.ts +2 -5
  1213. package/src/simple-tree/node-kinds/map/mapNode.ts +9 -6
  1214. package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +3 -3
  1215. package/src/simple-tree/node-kinds/object/objectNode.ts +26 -26
  1216. package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +6 -2
  1217. package/src/simple-tree/node-kinds/record/recordNode.ts +15 -11
  1218. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +3 -3
  1219. package/src/simple-tree/prepareForInsertion.ts +343 -200
  1220. package/src/simple-tree/simpleSchema.ts +79 -32
  1221. package/src/simple-tree/simpleSchemaFormatV1.ts +9 -1
  1222. package/src/simple-tree/toStoredSchema.ts +319 -61
  1223. package/src/simple-tree/treeSchema.ts +54 -0
  1224. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +42 -14
  1225. package/src/tableSchema.ts +485 -166
  1226. package/src/treeFactory.ts +19 -5
  1227. package/src/util/index.ts +5 -0
  1228. package/src/util/rangeMap.ts +72 -18
  1229. package/src/util/readSnapshotBlob.ts +23 -0
  1230. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +0 -1
  1231. package/dist/feature-libraries/modular-schema/modularChangeFormat.js.map +0 -1
  1232. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
  1233. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
  1234. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -50
  1235. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
  1236. package/dist/shared-tree-core/editManagerCodecsV5.d.ts.map +0 -1
  1237. package/dist/shared-tree-core/editManagerCodecsV5.js.map +0 -1
  1238. package/dist/shared-tree-core/editManagerFormatV5.d.ts.map +0 -1
  1239. package/dist/shared-tree-core/editManagerFormatV5.js.map +0 -1
  1240. package/dist/shared-tree-core/messageCodecV5.d.ts.map +0 -1
  1241. package/dist/shared-tree-core/messageCodecV5.js.map +0 -1
  1242. package/dist/shared-tree-core/messageFormatV5.d.ts.map +0 -1
  1243. package/dist/shared-tree-core/messageFormatV5.js.map +0 -1
  1244. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +0 -40
  1245. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +0 -1
  1246. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +0 -177
  1247. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +0 -1
  1248. package/docs/main/sequence-field/move-composition.md +0 -46
  1249. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +0 -1
  1250. package/lib/feature-libraries/modular-schema/modularChangeFormat.js.map +0 -1
  1251. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
  1252. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
  1253. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -46
  1254. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
  1255. package/lib/shared-tree-core/editManagerCodecsV5.d.ts.map +0 -1
  1256. package/lib/shared-tree-core/editManagerCodecsV5.js.map +0 -1
  1257. package/lib/shared-tree-core/editManagerFormatV5.d.ts.map +0 -1
  1258. package/lib/shared-tree-core/editManagerFormatV5.js.map +0 -1
  1259. package/lib/shared-tree-core/messageCodecV5.d.ts.map +0 -1
  1260. package/lib/shared-tree-core/messageCodecV5.js.map +0 -1
  1261. package/lib/shared-tree-core/messageFormatV5.d.ts.map +0 -1
  1262. package/lib/shared-tree-core/messageFormatV5.js.map +0 -1
  1263. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +0 -40
  1264. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +0 -1
  1265. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +0 -171
  1266. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +0 -1
  1267. package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +0 -57
  1268. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +0 -209
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/rebase/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAGN,QAAQ,EACR,KAAK,EACL,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,EAAa,CAAC;AAW9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC;IAC3C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IACpB,iBAAiB,EAAuC;CACxD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;AA+B5C;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,CAAe,EAAE,CAAe;IACrE,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,wBAAwB,CACvC,CAA2B,EAC3B,CAA2B;IAE3B,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QACxC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChB,CA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,CAAC,CAAC,CAAC;IACjC,CAAC;SAAM,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,CAAC,CAAC;IACV,CAAC;SAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO,CAAC,CAAC,CAAC;IACX,CAAC;SAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO,CAAC,CAAC;IACV,CAAC;IAED,OAAO,CAAC,CAAC;AACV,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tOpSpaceCompressedId,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"@fluidframework/id-compressor\";\nimport { Type } from \"@sinclair/typebox\";\n\nimport {\n\ttype Brand,\n\ttype NestedMap,\n\tRangeMap,\n\tbrand,\n\tbrandedNumberType,\n\tbrandedStringType,\n} from \"../../util/index.js\";\n\n/**\n * The identifier for a particular session/user/client that can generate `GraphCommit`s\n */\nexport const SessionIdSchema = brandedStringType<SessionId>();\n\n/**\n * A unique identifier for a commit. Commits that have been rebased, but are semantically\n * the same, will share the same revision tag.\n *\n * The constant 'root' is reserved for the trunk base: minting a SessionSpaceCompressedId is not\n * possible on readonly clients. These clients generally don't need ids, but must be done at tree initialization time.\n */\nexport type RevisionTag = SessionSpaceCompressedId | \"root\";\nexport type EncodedRevisionTag = Brand<OpSpaceCompressedId, \"EncodedRevisionTag\"> | \"root\";\nexport const RevisionTagSchema = Type.Union([\n\tType.Literal(\"root\"),\n\tbrandedNumberType<Exclude<EncodedRevisionTag, string>>(),\n]);\n\nexport type EncodedStableId = Brand<StableId, \"EncodedStableId\">;\nexport const StableIdSchema = Type.String();\n\n/**\n * An ID which is unique within a revision of a `ModularChangeset`.\n * A `ModularChangeset` which is a composition of multiple revisions may contain duplicate `ChangesetLocalId`s,\n * but they are unique when qualified by the revision of the change they are used in.\n */\nexport type ChangesetLocalId = Brand<number, \"ChangesetLocalId\">;\n\n/**\n * A globally unique ID for an atom of change, or a node associated with the atom of change.\n * *\n * @privateRemarks\n * TODO: Rename this to be more general.\n */\nexport interface ChangeAtomId {\n\t/**\n\t * Uniquely identifies the changeset within which the change was made.\n\t * Only undefined when referring to an anonymous changesets.\n\t */\n\treadonly revision?: RevisionTag;\n\t/**\n\t * Uniquely identifies, in the scope of the changeset, the change made to the field.\n\t */\n\treadonly localId: ChangesetLocalId;\n}\n\nexport type EncodedChangeAtomId = [ChangesetLocalId, EncodedRevisionTag] | ChangesetLocalId;\n\nexport type ChangeAtomIdMap<T> = NestedMap<RevisionTag | undefined, ChangesetLocalId, T>;\n\n/**\n * Returns true iff `a` and `b` are the same.\n */\nexport function areEqualChangeAtomIds(a: ChangeAtomId, b: ChangeAtomId): boolean {\n\treturn a.localId === b.localId && a.revision === b.revision;\n}\n\nexport function areEqualChangeAtomIdOpts(\n\ta: ChangeAtomId | undefined,\n\tb: ChangeAtomId | undefined,\n): boolean {\n\tif (a === undefined || b === undefined) {\n\t\treturn a === b;\n\t}\n\n\treturn areEqualChangeAtomIds(a, b);\n}\n\n/**\n * Returns a ChangeAtomId with the given revision and local ID.\n */\nexport function makeChangeAtomId(\n\tlocalId: ChangesetLocalId,\n\trevision?: RevisionTag,\n): ChangeAtomId {\n\treturn revision === undefined ? { localId } : { localId, revision };\n}\n\nexport function asChangeAtomId(id: ChangesetLocalId | ChangeAtomId): ChangeAtomId {\n\treturn typeof id === \"object\" ? id : { localId: id };\n}\n\nexport function taggedAtomId(\n\tid: ChangeAtomId,\n\trevision: RevisionTag | undefined,\n): ChangeAtomId {\n\treturn makeChangeAtomId(id.localId, id.revision ?? revision);\n}\n\nexport function taggedOptAtomId(\n\tid: ChangeAtomId | undefined,\n\trevision: RevisionTag | undefined,\n): ChangeAtomId | undefined {\n\tif (id === undefined) {\n\t\treturn undefined;\n\t}\n\treturn taggedAtomId(id, revision);\n}\n\nexport function offsetChangeAtomId(id: ChangeAtomId, offset: number): ChangeAtomId {\n\treturn { ...id, localId: brand(id.localId + offset) };\n}\n\nexport function replaceAtomRevisions(\n\tid: ChangeAtomId,\n\toldRevisions: Set<RevisionTag | undefined>,\n\tnewRevision: RevisionTag | undefined,\n): ChangeAtomId {\n\treturn oldRevisions.has(id.revision) ? atomWithRevision(id, newRevision) : id;\n}\n\nfunction atomWithRevision(id: ChangeAtomId, revision: RevisionTag | undefined): ChangeAtomId {\n\tconst updated = { ...id, revision };\n\tif (revision === undefined) {\n\t\tdelete updated.revision;\n\t}\n\n\treturn updated;\n}\n\n/**\n * A node in a graph of commits. A commit's parent is the commit on which it was based.\n */\nexport interface GraphCommit<TChange> {\n\t/** The tag for this commit. If this commit is rebased, the corresponding rebased commit will retain this tag. */\n\treadonly revision: RevisionTag;\n\t/** The change that will result from applying this commit */\n\treadonly change: TChange;\n\t/** The parent of this commit, on whose change this commit's change is based */\n\treadonly parent?: GraphCommit<TChange>;\n}\n\n/**\n * The type of a commit. This is used to describe the context in which the commit was created.\n *\n * @public\n */\nexport enum CommitKind {\n\t/** A commit corresponding to a change that is not the result of an undo/redo from this client. */\n\tDefault,\n\t/** A commit that is the result of an undo from this client. */\n\tUndo,\n\t/** A commit that is the result of a redo from this client. */\n\tRedo,\n}\n\n/**\n * Information about a commit that has been applied.\n *\n * @sealed @public\n */\nexport interface CommitMetadata {\n\t/**\n\t * A {@link CommitKind} enum value describing whether the commit represents an Edit, an Undo, or a Redo.\n\t */\n\treadonly kind: CommitKind;\n\t/**\n\t * Indicates whether the commit is a local edit\n\t */\n\treadonly isLocal: boolean;\n}\n\n/**\n * Creates a new graph commit object. This is useful for creating copies of commits with different parentage.\n * @param parent - the parent of the new commit\n * @param commit - the contents of the new commit object\n * @returns the new commit object\n */\n// Note that this function is synchronous, and therefore it is not a Promise.\n// However, it is still a strong commit-mint.\nexport function mintCommit<TChange>(\n\tparent: GraphCommit<TChange>,\n\tcommit: Omit<GraphCommit<TChange>, \"parent\">,\n): GraphCommit<TChange> {\n\tconst { revision, change } = commit;\n\treturn {\n\t\trevision,\n\t\tchange,\n\t\tparent,\n\t};\n}\n\nexport type ChangeAtomIdRangeMap<V> = RangeMap<ChangeAtomId, V>;\n\nexport function newChangeAtomIdRangeMap<V>(): ChangeAtomIdRangeMap<V> {\n\treturn new RangeMap(offsetChangeAtomId, subtractChangeAtomIds);\n}\n\nexport function subtractChangeAtomIds(a: ChangeAtomId, b: ChangeAtomId): number {\n\tconst cmp = compareRevisions(a.revision, b.revision);\n\tif (cmp !== 0) {\n\t\treturn cmp * Number.POSITIVE_INFINITY;\n\t}\n\n\treturn a.localId - b.localId;\n}\n\nexport function compareRevisions(\n\ta: RevisionTag | undefined,\n\tb: RevisionTag | undefined,\n): number {\n\tif (a === undefined) {\n\t\treturn b === undefined ? 0 : -1;\n\t} else if (b === undefined) {\n\t\treturn 1;\n\t} else if (a < b) {\n\t\treturn -1;\n\t} else if (a > b) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/rebase/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAGN,QAAQ,EACR,KAAK,EACL,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,EAAa,CAAC;AAW9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC;IAC3C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IACpB,iBAAiB,EAAuC;CACxD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;AA+B5C;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,CAAe,EAAE,CAAe;IACrE,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC,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AAQ,CAAC,CAAC;IACrD,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;QACf,OAAO,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;IACvC,CAAC;IAED,OAAO,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC/B,CAA0B,EAC1B,CAA0B;IAE1B,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QACrB,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;SAAM,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,CAAC,CAAC;IACV,CAAC;SAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO,CAAC,CAAC,CAAC;IACX,CAAC;SAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO,CAAC,CAAC;IACV,CAAC;IAED,OAAO,CAAC,CAAC;AACV,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tOpSpaceCompressedId,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"@fluidframework/id-compressor\";\nimport { Type } from \"@sinclair/typebox\";\n\nimport {\n\ttype Brand,\n\ttype NestedMap,\n\tRangeMap,\n\tbrand,\n\tbrandedNumberType,\n\tbrandedStringType,\n} from \"../../util/index.js\";\n\n/**\n * The identifier for a particular session/user/client that can generate `GraphCommit`s\n */\nexport const SessionIdSchema = brandedStringType<SessionId>();\n\n/**\n * A unique identifier for a commit. Commits that have been rebased, but are semantically\n * the same, will share the same revision tag.\n *\n * The constant 'root' is reserved for the trunk base: minting a SessionSpaceCompressedId is not\n * possible on readonly clients. These clients generally don't need ids, but must be done at tree initialization time.\n */\nexport type RevisionTag = SessionSpaceCompressedId | \"root\";\nexport type EncodedRevisionTag = Brand<OpSpaceCompressedId, \"EncodedRevisionTag\"> | \"root\";\nexport const RevisionTagSchema = Type.Union([\n\tType.Literal(\"root\"),\n\tbrandedNumberType<Exclude<EncodedRevisionTag, string>>(),\n]);\n\nexport type EncodedStableId = Brand<StableId, \"EncodedStableId\">;\nexport const StableIdSchema = Type.String();\n\n/**\n * An ID which is unique within a revision of a `ModularChangeset`.\n * A `ModularChangeset` which is a composition of multiple revisions may contain duplicate `ChangesetLocalId`s,\n * but they are unique when qualified by the revision of the change they are used in.\n */\nexport type ChangesetLocalId = Brand<number, \"ChangesetLocalId\">;\n\n/**\n * A globally unique ID for an atom of change, or a node associated with the atom of change.\n * *\n * @privateRemarks\n * TODO: Rename this to be more general.\n */\nexport interface ChangeAtomId {\n\t/**\n\t * Uniquely identifies the changeset within which the change was made.\n\t * Only undefined when referring to an anonymous changesets.\n\t */\n\treadonly revision?: RevisionTag;\n\t/**\n\t * Uniquely identifies, in the scope of the changeset, the change made to the field.\n\t */\n\treadonly localId: ChangesetLocalId;\n}\n\nexport type EncodedChangeAtomId = [ChangesetLocalId, EncodedRevisionTag] | ChangesetLocalId;\n\nexport type ChangeAtomIdMap<T> = NestedMap<RevisionTag | undefined, ChangesetLocalId, T>;\n\n/**\n * Returns true iff `a` and `b` are the same.\n */\nexport function areEqualChangeAtomIds(a: ChangeAtomId, b: ChangeAtomId): boolean {\n\treturn a.localId === b.localId && a.revision === b.revision;\n}\n\nexport function areEqualChangeAtomIdOpts(\n\ta: ChangeAtomId | undefined,\n\tb: ChangeAtomId | undefined,\n): boolean {\n\tif (a === undefined || b === undefined) {\n\t\treturn a === b;\n\t}\n\n\treturn areEqualChangeAtomIds(a, b);\n}\n\n/**\n * Returns a ChangeAtomId with the given revision and local ID.\n */\nexport function makeChangeAtomId(\n\tlocalId: ChangesetLocalId,\n\trevision?: RevisionTag,\n): ChangeAtomId {\n\treturn revision === undefined ? { localId } : { localId, revision };\n}\n\nexport function asChangeAtomId(id: ChangesetLocalId | ChangeAtomId): ChangeAtomId {\n\treturn typeof id === \"object\" ? id : { localId: id };\n}\n\nexport function taggedAtomId(\n\tid: ChangeAtomId,\n\trevision: RevisionTag | undefined,\n): ChangeAtomId {\n\treturn makeChangeAtomId(id.localId, id.revision ?? revision);\n}\n\nexport function taggedOptAtomId(\n\tid: ChangeAtomId | undefined,\n\trevision: RevisionTag | undefined,\n): ChangeAtomId | undefined {\n\tif (id === undefined) {\n\t\treturn undefined;\n\t}\n\treturn taggedAtomId(id, revision);\n}\n\nexport function offsetChangeAtomId<T extends ChangeAtomId = ChangeAtomId>(\n\tid: T,\n\toffset: number,\n): T {\n\treturn { ...id, localId: brand(id.localId + offset) };\n}\n\nexport function replaceAtomRevisions(\n\tid: ChangeAtomId,\n\toldRevisions: Set<RevisionTag | undefined>,\n\tnewRevision: RevisionTag | undefined,\n): ChangeAtomId {\n\treturn oldRevisions.has(id.revision) ? atomWithRevision(id, newRevision) : id;\n}\n\nfunction atomWithRevision(id: ChangeAtomId, revision: RevisionTag | undefined): ChangeAtomId {\n\tconst updated = { ...id, revision };\n\tif (revision === undefined) {\n\t\tdelete updated.revision;\n\t}\n\n\treturn updated;\n}\n\n/**\n * A node in a graph of commits. A commit's parent is the commit on which it was based.\n */\nexport interface GraphCommit<TChange> {\n\t/** The tag for this commit. If this commit is rebased, the corresponding rebased commit will retain this tag. */\n\treadonly revision: RevisionTag;\n\t/** The change that will result from applying this commit */\n\treadonly change: TChange;\n\t/** The parent of this commit, on whose change this commit's change is based */\n\treadonly parent?: GraphCommit<TChange>;\n}\n\n/**\n * The type of a commit. This is used to describe the context in which the commit was created.\n *\n * @public\n */\nexport enum CommitKind {\n\t/** A commit corresponding to a change that is not the result of an undo/redo from this client. */\n\tDefault,\n\t/** A commit that is the result of an undo from this client. */\n\tUndo,\n\t/** A commit that is the result of a redo from this client. */\n\tRedo,\n}\n\n/**\n * Information about a commit that has been applied.\n *\n * @sealed @public\n */\nexport interface CommitMetadata {\n\t/**\n\t * A {@link CommitKind} enum value describing whether the commit represents an Edit, an Undo, or a Redo.\n\t */\n\treadonly kind: CommitKind;\n\t/**\n\t * Indicates whether the commit is a local edit\n\t */\n\treadonly isLocal: boolean;\n}\n\n/**\n * Creates a new graph commit object. This is useful for creating copies of commits with different parentage.\n * @param parent - the parent of the new commit\n * @param commit - the contents of the new commit object\n * @returns the new commit object\n */\n// Note that this function is synchronous, and therefore it is not a Promise.\n// However, it is still a strong commit-mint.\nexport function mintCommit<TChange>(\n\tparent: GraphCommit<TChange>,\n\tcommit: Omit<GraphCommit<TChange>, \"parent\">,\n): GraphCommit<TChange> {\n\tconst { revision, change } = commit;\n\treturn {\n\t\trevision,\n\t\tchange,\n\t\tparent,\n\t};\n}\n\nexport type ChangeAtomIdRangeMap<V> = RangeMap<ChangeAtomId, V>;\n\nexport function newChangeAtomIdRangeMap<V>(): ChangeAtomIdRangeMap<V> {\n\treturn new RangeMap(offsetChangeAtomId, subtractChangeAtomIds);\n}\n\nexport function newChangeAtomIdTransform(): ChangeAtomIdRangeMap<ChangeAtomId> {\n\treturn new RangeMap(offsetChangeAtomId, subtractChangeAtomIds, offsetChangeAtomId);\n}\n\nexport function subtractChangeAtomIds(a: ChangeAtomId, b: ChangeAtomId): number {\n\tconst cmp = compareRevisions(a.revision, b.revision);\n\tif (cmp !== 0) {\n\t\treturn cmp * Number.POSITIVE_INFINITY;\n\t}\n\n\treturn a.localId - b.localId;\n}\n\nexport function compareRevisions(\n\ta: RevisionTag | undefined,\n\tb: RevisionTag | undefined,\n): number {\n\tif (a === undefined) {\n\t\treturn b === undefined ? 0 : -1;\n\t} else if (b === undefined) {\n\t\treturn 1;\n\t} else if (a < b) {\n\t\treturn -1;\n\t} else if (a > b) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/core/rebase/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,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;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS;IAAE,MAAM,CAAC,EAAE,CAAC,CAAA;CAAE,EAC1D,WAAW,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,SAAS,EACzD,WAAW,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,SAAS,GACvD,CAAC,GAAG,SAAS,CA+Df;AAED,wBAAgB,aAAa,CAAC,OAAO,EACpC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,EAC5B,MAAM,EAAE,OAAO,GACb,WAAW,CAAC,OAAO,CAAC,CAItB;AAwBD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,SAAS;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAA;CAAE,EACnE,QAAQ,EAAE,KAAK,EACf,UAAU,EAAE,KAAK,EACjB,UAAU,EAAE,OAAO,GACjB,OAAO,CAcT;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EACpC,aAAa,EAAE,aAAa,CAAC,OAAO,CAAC,EACrC,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC,EAClC,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC,EAClC,eAAe,EAAE,MAAM,WAAW,GAChC,OAAO,CAWT"}
@@ -131,7 +131,9 @@ export function rebaseBranch(mintRevisionTag, changeRebaser, sourceHead, targetC
131
131
  rebaseDistance: targetCommits.length,
132
132
  countDropped: sourceBranchLength - sourceSet.size,
133
133
  },
134
- }, "sourceChange", () => changeRebaser.compose(editsToCompose));
134
+ }, "sourceChange", () => {
135
+ return changeRebaser.compose(editsToCompose);
136
+ });
135
137
  }
136
138
  /**
137
139
  * "Sandwich/Horseshoe Rebase" a change over the given source and target branches
@@ -160,21 +162,37 @@ export function rebaseChange(changeRebaser, change, sourceHead, targetHead, mint
160
162
  };
161
163
  }
162
164
  export function revisionMetadataSourceFromInfo(revInfos) {
163
- const getIndex = (revision) => {
164
- const index = revInfos.findIndex((revInfo) => revInfo.revision === revision);
165
- return index >= 0 ? index : undefined;
165
+ const compareRevisions = (revision1, revision2) => {
166
+ const index1 = getIndex(revision1);
167
+ const index2 = getIndex(revision2);
168
+ if (index1 !== undefined) {
169
+ return index2 !== undefined ? index2 - index1 : -1;
170
+ }
171
+ return index2 !== undefined ? 1 : 0;
166
172
  };
167
173
  const tryGetInfo = (revision) => {
168
174
  if (revision === undefined) {
169
175
  return undefined;
170
176
  }
171
- const index = getIndex(revision);
172
- return index === undefined ? undefined : revInfos[index];
177
+ return revInfos.find((info) => info.revision === revision);
173
178
  };
174
179
  const hasRollback = (revision) => {
175
180
  return revInfos.find((info) => info.rollbackOf === revision) !== undefined;
176
181
  };
177
- return { getIndex, tryGetInfo, hasRollback };
182
+ const getIndex = (revision) => {
183
+ const index = revInfos.findIndex((revInfo) => revInfo.revision === revision);
184
+ if (index >= 0) {
185
+ return index;
186
+ }
187
+ const rollbackIndex = revInfos.findIndex((revInfo) => revInfo.rollbackOf === revision);
188
+ if (rollbackIndex >= 0) {
189
+ // This change is the forward revision of a rollback included in revInfos, so it comes after
190
+ // all revisions in revInfos. Earlier rollbacks have later forward revisions.
191
+ return 2 * revInfos.length - rollbackIndex;
192
+ }
193
+ return undefined;
194
+ };
195
+ return { compareRevisions, tryGetInfo, hasRollback };
178
196
  }
179
197
  export function rebaseChangeOverChanges(changeRebaser, changeToRebase, changesToRebaseOver) {
180
198
  const revisionMetadata = revisionMetadataSourceFromInfo(getRevInfoFromTaggedChanges([...changesToRebaseOver, changeToRebase]));
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/core/rebase/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,q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;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACzB,QAAe,EACf,UAAiB,EACjB,UAAmB;IAEnB,IAAI,UAAU,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC;IAChC,OAAO,OAAO,KAAK,SAAS,EAAE,CAAC;QAC9B,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAC5B,aAAqC,EACrC,YAAkC,EAClC,YAAkC,EAClC,eAAkC;IAElC,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,kBAAkB,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;IAC5F,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC1C,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,CAAC,CAC1D,CAAC;IAEF,QAAQ,CAAC,OAAO,EAAE,CAAC;IACnB,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,QAAQ,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\n\nimport { defineLazyCachedProperty, hasSome, type Mutable } from \"../../util/index.js\";\n\nimport {\n\ttype ChangeRebaser,\n\ttype RevisionInfo,\n\ttype RevisionMetadataSource,\n\ttype TaggedChange,\n\tmakeAnonChange,\n\tmapTaggedChange,\n\ttagChange,\n\ttagRollbackInverse,\n} from \"./changeRebaser.js\";\nimport { type GraphCommit, type RevisionTag, mintCommit } from \"./types.js\";\n\n/**\n * Contains information about how the commit graph changed as the result of rebasing a source branch onto another target branch.\n * @remarks\n * ```text\n * Consider the commit graph below containing two branches, X and Y, with head commits C and E, respectively.\n * Branch Y branches off of Branch X at their common ancestor commit A, i.e. \"Y is based off of X at commit A\".\n *\n * A ─ B ─ C ← Branch X\n * └─ D ─ E ← Branch Y\n *\n * Branch Y is then rebased onto Branch X. This results in the following commit graph:\n *\n * A ─ B ─ C ← Branch X\n * └─ D'─ E'← Branch Y\n *\n * Commits D' and E' are the rebased versions of commits D and E, respectively. This results in:\n * deletedSourceCommits: [D, E],\n * targetCommits: [B, C],\n * sourceCommits: [D', E']\n * ```\n */\nexport interface RebasedCommits<TChange> {\n\t/**\n\t * The commits on the original source branch that were rebased. These are no longer referenced by the source branch and have\n\t * been replaced with new versions on the new source branch, see {@link sourceCommits}. In the case that the source\n\t * branch was already ahead of the target branch before the rebase, this list will be empty.\n\t */\n\tdeletedSourceCommits: GraphCommit<TChange>[];\n\t/**\n\t * All commits on the target branch that the source branch's commits were rebased over. These are now the direct\n\t * ancestors of {@link sourceCommits}. In the case that the source branch was already ahead of the target branch\n\t * before the rebase, this list will be empty.\n\t */\n\ttargetCommits: GraphCommit<TChange>[];\n\t/**\n\t * All commits on the source branch that are not also on the target branch after the rebase operation. In the case that the\n\t * source branch was already ahead of the target branch before the rebase, these are the same commits that were already on\n\t * the source branch before the rebase, otherwise these are the new, rebased versions of {@link deletedSourceCommits}.\n\t */\n\tsourceCommits: GraphCommit<TChange>[];\n}\n\n/**\n * Telemetry metrics for a rebase operation.\n */\nexport interface RebaseStats {\n\t/**\n\t * The length of the source branch before the rebase.\n\t */\n\treadonly sourceBranchLength: number;\n\t/**\n\t * Number of commits rebased over on the target branch.\n\t */\n\treadonly rebaseDistance: number;\n\t/**\n\t * The number of commits that are dropped from the source branch when rebased to the target branch.\n\t */\n\treadonly countDropped: number;\n}\n\nexport interface RebaseStatsWithDuration extends RebaseStats {\n\treadonly duration: number;\n}\n\nexport interface BranchRebaseResult<TChange> {\n\t/**\n\t * The head of a rebased source branch.\n\t */\n\treadonly newSourceHead: GraphCommit<TChange>;\n\t/**\n\t * A thunk that computes the cumulative change to the source branch (undefined if no change occurred)\n\t */\n\treadonly sourceChange: TChange | undefined;\n\t/**\n\t * Details about how the commits on the source branch changed\n\t */\n\treadonly commits: RebasedCommits<TChange>;\n\t/**\n\t * Telemetry properties for the rebase operation.\n\t */\n\treadonly telemetryProperties: RebaseStats;\n}\n\ninterface RebaseChangeResult<TChange> {\n\treadonly change: TChange;\n\t/**\n\t * Telemetry properties for the rebase operation.\n\t */\n\treadonly telemetryProperties: RebaseStats;\n}\n\n/**\n * Rebases a source branch onto another commit in a target branch.\n *\n * A \"branch\" is defined as a \"head\" commit and all ancestors of that commit, i.e. one linked list in a graph of commits.\n *\n * The source and target branch must share an ancestor.\n * @param changeRebaser - the change rebaser responsible for rebasing the changes in the commits of each branch\n * @param sourceHead - the head of the source branch, which will be rebased onto `targetHead`\n * @param targetHead - the commit to rebase the source branch onto\n * @returns a {@link BranchRebaseResult}\n * @remarks While a single branch must not have multiple commits with the same revision tag (that will result in undefined\n * behavior), there may be a commit on the source branch with the same revision tag as a commit on the target branch. If such\n * a pair is encountered while rebasing, it will be \"cancelled out\" in the new branch. For example:\n * ```\n * // (A)-(B)-(C) <- Branch X\n * // \\\n * // (B')-(D) <- Branch Y\n * //\n * // As Branch Y is rebased onto Branch X, commits B and B' cancel out so there is no version of B on the new rebased source branch\n * //\n * // (A)-(B)-(C) <- Branch X\n * // \\\n * // (D') <- Branch Y'\n * //\n * ```\n */\nexport function rebaseBranch<TChange>(\n\tmintRevisionTag: () => RevisionTag,\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetHead: GraphCommit<TChange>,\n): BranchRebaseResult<TChange>;\n\n/**\n * Rebases a source branch onto another commit in a target branch.\n *\n * A \"branch\" is defined as a \"head\" commit and all ancestors of that commit, i.e. one linked list in a graph of commits.\n *\n * The source and target branch must share an ancestor.\n * @param changeRebaser - the change rebaser responsible for rebasing the changes in the commits of each branch\n * @param sourceHead - the head of the source branch, which will be rebased onto `newBase`\n * @param targetCommit - the commit on the target branch to rebase the source branch onto.\n * @param targetHead - the head of the branch that `newBase` belongs to. Must be `newBase` or a descendent of `newBase`.\n * @returns a {@link BranchRebaseResult}\n * @remarks While a single branch must not have multiple commits with the same revision tag (that will result in undefined\n * behavior), there may be a commit on the source branch with the same revision tag as a commit on the target branch. If such\n * a pair is encountered while rebasing, it will be \"cancelled out\" in the new branch. Additionally, this function will rebase\n * the source branch _farther_ than `newBase` if the source branch's next commits after `newBase` match those on the target branch.\n * For example:\n * ```\n * // (A)-(B)-(C)-(D)-(E) <- Branch X\n * // \\\n * // (B')-(D')-(F) <- Branch Y\n * //\n * // If Branch Y is rebased onto commit C of Branch X, the branches must at least look like this afterwards (B was cancelled out):\n * //\n * // (A)-(B)-(C)-(D)-(E) <- Branch X\n * // \\\n * // (D'')-(F') <- Branch Y'\n * //\n * // But this function will recognize that B is equivalent to B' and D is equivalent to D', and instead produce:\n * //\n * // (A)-(B)-(C)-(D)-(E) <- Branch X\n * // \\\n * // (F') <- Branch Y'\n * ```\n */\nexport function rebaseBranch<TChange>(\n\tmintRevisionTag: () => RevisionTag,\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetCommit: GraphCommit<TChange>,\n\ttargetHead: GraphCommit<TChange>,\n): BranchRebaseResult<TChange>;\nexport function rebaseBranch<TChange>(\n\tmintRevisionTag: () => RevisionTag,\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetCommit: GraphCommit<TChange>,\n\ttargetHead = targetCommit,\n): BranchRebaseResult<TChange> {\n\t// Get both source and target as path arrays\n\tconst sourcePath: GraphCommit<TChange>[] = [];\n\tconst targetPath: GraphCommit<TChange>[] = [];\n\tconst ancestor = findCommonAncestor([sourceHead, sourcePath], [targetHead, targetPath]);\n\tassert(ancestor !== undefined, 0x675 /* branches must be related */);\n\n\tconst sourceBranchLength = sourcePath.length;\n\n\t// Find where `targetCommit` is in the target branch\n\tconst targetCommitIndex = targetPath.findIndex((r) => r === targetCommit);\n\tif (targetCommitIndex === -1) {\n\t\t// If the targetCommit is not in the target path, then it is either disjoint from `target` or it is behind/at\n\t\t// the commit where source and target diverge (ancestor), in which case there is nothing more to rebase\n\t\t// TODO: Ideally, this would be an \"assertExpensive\". It is commented out because it causes O(N²) behavior when\n\t\t// processing N inbound commits from the same client whose ref seq# is not advancing (which is a common case).\n\t\t// N can be large when the client is sending a burst of changes (potentially on reconnection).\n\t\t// assert(\n\t\t// \tfindCommonAncestor(targetCommit, targetHead) !== undefined,\n\t\t// \t0x676 /* target commit is not in target branch */,\n\t\t// );\n\t\treturn {\n\t\t\tnewSourceHead: sourceHead,\n\t\t\tsourceChange: undefined,\n\t\t\tcommits: { deletedSourceCommits: [], targetCommits: [], sourceCommits: sourcePath },\n\t\t\ttelemetryProperties: {\n\t\t\t\tsourceBranchLength,\n\t\t\t\trebaseDistance: targetCommitIndex + 1,\n\t\t\t\tcountDropped: 0,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Iterate through the target path and look for commits that are also present on the source branch (i.e. they\n\t// have matching tags). Each commit found in the target branch can be skipped when processing the source branch\n\t// because it has already been rebased onto the target. In the case that one or more of these commits are present\n\t// directly after `targetCommit`, then the new base can be advanced further without having to do any work.\n\tconst sourceSet = new Set(sourcePath.map((r) => r.revision));\n\tlet newBaseIndex = targetCommitIndex;\n\n\tfor (const [i, { revision }] of targetPath.entries()) {\n\t\tif (sourceSet.has(revision)) {\n\t\t\tsourceSet.delete(revision);\n\t\t\tnewBaseIndex = Math.max(newBaseIndex, i);\n\t\t} else if (i > targetCommitIndex) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/** The commit on the target branch that the new source branch branches off of (i.e. the new common ancestor) */\n\tconst newBase = targetPath[newBaseIndex] ?? oob();\n\t// Figure out how much of the trunk to start rebasing over.\n\tconst targetCommits = targetPath.slice(0, newBaseIndex + 1);\n\tconst deletedSourceCommits = [...sourcePath];\n\n\t// If the source and target rebase path begin with a range that has all the same revisions, remove it; it is\n\t// equivalent on both branches and doesn't need to be rebased.\n\tconst targetRebasePath = [...targetCommits];\n\tif (hasSome(sourcePath) && hasSome(targetRebasePath)) {\n\t\tconst minLength = Math.min(sourcePath.length, targetRebasePath.length);\n\t\tfor (let i = 0; i < minLength; i++) {\n\t\t\tconst firstSourcePath = sourcePath[0];\n\t\t\tconst firstTargetRebasePath = targetRebasePath[0];\n\t\t\tif (firstSourcePath.revision === firstTargetRebasePath.revision) {\n\t\t\t\tsourcePath.shift();\n\t\t\t\ttargetRebasePath.shift();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst sourceCommits: GraphCommit<TChange>[] = [];\n\n\t// If all commits that are about to be rebased over on the target branch already comprise the start of the source branch,\n\t// are in the same order, and have no other commits interleaving them, then no rebasing needs to occur. Those commits can\n\t// simply be removed from the source branch, and the remaining commits on the source branch are reparented off of the new\n\t// base commit.\n\tif (!hasSome(targetRebasePath)) {\n\t\tfor (const c of sourcePath) {\n\t\t\tsourceCommits.push(mintCommit(sourceCommits[sourceCommits.length - 1] ?? newBase, c));\n\t\t}\n\t\treturn {\n\t\t\tnewSourceHead: sourceCommits[sourceCommits.length - 1] ?? newBase,\n\t\t\tsourceChange: undefined,\n\t\t\tcommits: {\n\t\t\t\tdeletedSourceCommits,\n\t\t\t\ttargetCommits,\n\t\t\t\tsourceCommits,\n\t\t\t},\n\t\t\ttelemetryProperties: {\n\t\t\t\tsourceBranchLength,\n\t\t\t\trebaseDistance: targetCommits.length,\n\t\t\t\tcountDropped: sourceBranchLength - sourceSet.size,\n\t\t\t},\n\t\t};\n\t}\n\n\t// For each source commit, rebase backwards over the inverses of any commits already rebased, and then\n\t// rebase forwards over the rest of the commits up to the new base before advancing the new base.\n\tlet newHead = newBase;\n\tconst revInfos = getRevInfoFromTaggedChanges([...targetRebasePath, ...sourcePath]);\n\t// Note that the `revisionMetadata` gets updated as `revInfos` gets updated.\n\tconst revisionMetadata = revisionMetadataSourceFromInfo(revInfos);\n\tlet editsToCompose: TaggedChange<TChange>[] = targetRebasePath.slice();\n\tfor (const c of sourcePath) {\n\t\tconst rollback = rollbackFromCommit(changeRebaser, c, mintRevisionTag, true /* cache */);\n\t\tif (sourceSet.has(c.revision)) {\n\t\t\tconst currentComposedEdit = makeAnonChange(changeRebaser.compose(editsToCompose));\n\t\t\teditsToCompose = [currentComposedEdit];\n\t\t\tconst change = changeRebaser.rebase(c, currentComposedEdit, revisionMetadata);\n\t\t\tnewHead = {\n\t\t\t\trevision: c.revision,\n\t\t\t\tchange,\n\t\t\t\tparent: newHead,\n\t\t\t};\n\t\t\tsourceCommits.push(newHead);\n\t\t\teditsToCompose.push(tagChange(change, c.revision));\n\t\t}\n\t\trevInfos.push({ revision: c.revision });\n\t\teditsToCompose.unshift(rollback);\n\t\trevInfos.unshift({ revision: rollback.revision, rollbackOf: rollback.rollbackOf });\n\t}\n\n\treturn defineLazyCachedProperty(\n\t\t{\n\t\t\tnewSourceHead: newHead,\n\t\t\tcommits: {\n\t\t\t\tdeletedSourceCommits,\n\t\t\t\ttargetCommits,\n\t\t\t\tsourceCommits,\n\t\t\t},\n\t\t\ttelemetryProperties: {\n\t\t\t\tsourceBranchLength,\n\t\t\t\trebaseDistance: targetCommits.length,\n\t\t\t\tcountDropped: sourceBranchLength - sourceSet.size,\n\t\t\t},\n\t\t},\n\t\t\"sourceChange\",\n\t\t() => changeRebaser.compose(editsToCompose),\n\t);\n}\n\n/**\n * \"Sandwich/Horseshoe Rebase\" a change over the given source and target branches\n * @param changeRebaser - the change rebaser responsible for rebasing the change over the commits in each branch\n * @param change - the change to rebase\n * @param sourceHead - the head of the branch that `change` is based on\n * @param targetHead - the branch to rebase `change` onto\n * @returns the rebased change\n *\n * @remarks inverses will be cached.\n */\nexport function rebaseChange<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tchange: TaggedChange<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetHead: GraphCommit<TChange>,\n\tmintRevisionTag: () => RevisionTag,\n): RebaseChangeResult<TChange> {\n\tconst sourcePath: GraphCommit<TChange>[] = [];\n\tconst targetPath: GraphCommit<TChange>[] = [];\n\tassert(\n\t\tfindCommonAncestor([sourceHead, sourcePath], [targetHead, targetPath]) !== undefined,\n\t\t0x576 /* branch A and branch B must be related */,\n\t);\n\n\tconst inverses = sourcePath.map((commit) =>\n\t\trollbackFromCommit(changeRebaser, commit, mintRevisionTag, true),\n\t);\n\tinverses.reverse();\n\n\tconst telemetryProperties = {\n\t\tsourceBranchLength: 1,\n\t\trebaseDistance: sourcePath.length + targetPath.length,\n\t\tcountDropped: 0,\n\t};\n\n\treturn {\n\t\tchange: rebaseChangeOverChanges(changeRebaser, change, [...inverses, ...targetPath]),\n\t\ttelemetryProperties,\n\t};\n}\n\nexport function revisionMetadataSourceFromInfo(\n\trevInfos: readonly RevisionInfo[],\n): RevisionMetadataSource {\n\tconst getIndex = (revision: RevisionTag): number | undefined => {\n\t\tconst index = revInfos.findIndex((revInfo) => revInfo.revision === revision);\n\t\treturn index >= 0 ? index : undefined;\n\t};\n\tconst tryGetInfo = (revision: RevisionTag | undefined): RevisionInfo | undefined => {\n\t\tif (revision === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst index = getIndex(revision);\n\t\treturn index === undefined ? undefined : revInfos[index];\n\t};\n\n\tconst hasRollback = (revision: RevisionTag): boolean => {\n\t\treturn revInfos.find((info) => info.rollbackOf === revision) !== undefined;\n\t};\n\n\treturn { getIndex, tryGetInfo, hasRollback };\n}\n\nexport function rebaseChangeOverChanges<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tchangeToRebase: TaggedChange<TChange>,\n\tchangesToRebaseOver: TaggedChange<TChange>[],\n): TChange {\n\tconst revisionMetadata = revisionMetadataSourceFromInfo(\n\t\tgetRevInfoFromTaggedChanges([...changesToRebaseOver, changeToRebase]),\n\t);\n\n\treturn changesToRebaseOver.reduce(\n\t\t(a, b) => mapTaggedChange(changeToRebase, changeRebaser.rebase(a, b, revisionMetadata)),\n\t\tchangeToRebase,\n\t).change;\n}\n\n// TODO: Deduplicate\nfunction getRevInfoFromTaggedChanges(changes: TaggedChange<unknown>[]): RevisionInfo[] {\n\tconst revInfos: RevisionInfo[] = [];\n\tfor (const taggedChange of changes) {\n\t\trevInfos.push(...revisionInfoFromTaggedChange(taggedChange));\n\t}\n\n\treturn revInfos;\n}\n\n// TODO: Deduplicate\nfunction revisionInfoFromTaggedChange(taggedChange: TaggedChange<unknown>): RevisionInfo[] {\n\tconst revInfos: RevisionInfo[] = [];\n\tif (taggedChange.revision !== undefined) {\n\t\tconst info: Mutable<RevisionInfo> = { revision: taggedChange.revision };\n\t\tif (taggedChange.rollbackOf !== undefined) {\n\t\t\tinfo.rollbackOf = taggedChange.rollbackOf;\n\t\t}\n\t\trevInfos.push(info);\n\t}\n\treturn revInfos;\n}\n\nfunction rollbackFromCommit<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tcommit: GraphCommit<TChange>,\n\tmintRevisionTag: () => RevisionTag,\n\tcache?: boolean,\n): TaggedChange<TChange, RevisionTag> {\n\tconst cachedRollback = Rollback.get(commit);\n\tif (cachedRollback !== undefined) {\n\t\treturn cachedRollback;\n\t}\n\tconst tag = mintRevisionTag();\n\tconst rollback = tagRollbackInverse(\n\t\tchangeRebaser.invert(commit, true, tag),\n\t\ttag,\n\t\tcommit.revision,\n\t);\n\n\tif (cache === true) {\n\t\tRollback.set(commit, rollback);\n\t}\n\treturn rollback;\n}\n\n/**\n * Find the furthest ancestor of some descendant.\n * @param descendant - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of ancestry for `descendant` from most distant to closest (not including the furthest ancestor,\n * but otherwise including `descendant`).\n * @returns the furthest ancestor of `descendant`, or `descendant` itself if `descendant` has no ancestors.\n */\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T, path?: T[]],\n): T;\n/**\n * Find the furthest ancestor of some descendant.\n * @param descendant - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of ancestry for `descendant` from most distant to closest (not including the furthest ancestor,\n * but otherwise including `descendant`).\n * @returns the furthest ancestor of `descendant`, or `descendant` itself if `descendant` has no ancestors. Returns\n * `undefined` if `descendant` is undefined.\n */\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T | undefined, path?: T[]] | undefined,\n): T | undefined;\n/**\n * Find an ancestor of some descendant.\n * @param descendant - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of ancestry for `descendant` from most distant to closest (not including the ancestor found by `predicate`,\n * but otherwise including `descendant`).\n * @param predicate - a function which will be evaluated on `descendant` and then ancestor of `descendant` (in ascending order) until it returns true.\n * @returns the closest ancestor of `descendant` that satisfies `predicate`, or `undefined` if no such ancestor exists.\n *\n * @example\n *\n * ```typescript\n * interface Parented {\n * id: string;\n * parent?: Parented;\n * }\n * const g = { id: \"g\" }; // Grandparent\n * const p = { parent: g, id: \"p\" }; // Parent\n * const c = { parent: p, id: \"c\" }; // Child\n * const path: Parented[] = [];\n * const ancestor = findAncestor<Parented>([c, path], (n) => n.id === \"g\");\n * // ancestor === g\n * // path === [p, c]\n * ```\n */\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T | undefined, path?: T[]] | undefined,\n\tpredicate: (t: T) => boolean,\n): T | undefined;\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T | undefined, path?: T[]] | undefined,\n\tpredicate: (t: T) => boolean = (t): boolean => t.parent === undefined,\n): T | undefined {\n\tlet d: T | undefined;\n\tlet path: T[] | undefined;\n\tif (Array.isArray(descendant)) {\n\t\t[d, path] = descendant;\n\t} else {\n\t\td = descendant;\n\t}\n\tfor (let cur = d; cur !== undefined; cur = cur.parent) {\n\t\tif (predicate(cur)) {\n\t\t\tpath?.reverse();\n\t\t\treturn cur;\n\t\t}\n\t\tpath?.push(cur);\n\t}\n\n\tif (path !== undefined) {\n\t\tpath.length = 0;\n\t}\n\treturn undefined;\n}\n\n/**\n * Find a common ancestor between two descendants that are linked by parent pointers.\n * @param descendantA - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of commits from the ancestor to `descendantA` (not including the ancestor).\n * @param descendantB - another descendant. If an empty `path` array is included, it will be populated\n * with the chain of commits from the ancestor to `descendantB` (not including the ancestor).\n * @returns the common ancestor of `descendantA` and `descendantB`, or `undefined` if no such ancestor exists.\n *\n * @example\n *\n * ```typescript\n * interface Parented {\n * parent?: Parented;\n * }\n * const shared = {};\n * const a = { parent: shared };\n * const b1 = { parent: shared };\n * const b2 = { parent: b1 };\n * const pathB: Parented[] = []\n * const ancestor = findCommonAncestor<Parented>(a, [b2, pathB]);\n * // ancestor === shared\n * // pathB === [b1, b2]\n * ```\n */\nexport function findCommonAncestor<T extends { parent?: T }>(\n\tdescendantA: T | [descendantA: T, path?: T[]] | undefined,\n\tdescendantB: T | [descendantB: T, path?: T[]] | undefined,\n): T | undefined {\n\tlet a: T | undefined;\n\tlet b: T | undefined;\n\tlet pathA: T[] | undefined;\n\tlet pathB: T[] | undefined;\n\tif (Array.isArray(descendantA)) {\n\t\t[a, pathA] = descendantA;\n\t\tassert(pathA === undefined || pathA.length === 0, 0x578 /* Path A must be empty */);\n\t} else {\n\t\ta = descendantA;\n\t}\n\tif (Array.isArray(descendantB)) {\n\t\t[b, pathB] = descendantB;\n\t\tassert(pathB === undefined || pathB.length === 0, 0x579 /* Path B must be empty */);\n\t} else {\n\t\tb = descendantB;\n\t}\n\n\tif (a === b) {\n\t\treturn a;\n\t}\n\n\tconst reversePaths = (): void => {\n\t\tpathA?.reverse();\n\t\tpathB?.reverse();\n\t};\n\n\tconst visited = new Set();\n\twhile (a !== undefined || b !== undefined) {\n\t\tif (a !== undefined) {\n\t\t\tif (visited.has(a)) {\n\t\t\t\tif (pathB !== undefined) {\n\t\t\t\t\tpathB.length = pathB.findIndex((r) => Object.is(r, a));\n\t\t\t\t}\n\t\t\t\treversePaths();\n\t\t\t\treturn a;\n\t\t\t}\n\t\t\tvisited.add(a);\n\t\t\tpathA?.push(a);\n\t\t\ta = a.parent;\n\t\t}\n\n\t\tif (b !== undefined) {\n\t\t\tif (visited.has(b)) {\n\t\t\t\tif (pathA !== undefined) {\n\t\t\t\t\tpathA.length = pathA.findIndex((r) => Object.is(r, b));\n\t\t\t\t}\n\t\t\t\treversePaths();\n\t\t\t\treturn b;\n\t\t\t}\n\t\t\tvisited.add(b);\n\t\t\tpathB?.push(b);\n\t\t\tb = b.parent;\n\t\t}\n\t}\n\n\tif (pathA !== undefined) {\n\t\tpathA.length = 0;\n\t}\n\tif (pathB !== undefined) {\n\t\tpathB.length = 0;\n\t}\n\treturn undefined;\n}\n\nexport function replaceChange<TChange>(\n\tcommit: GraphCommit<TChange>,\n\tchange: TChange,\n): GraphCommit<TChange> {\n\tconst output = { ...commit, change };\n\tRollback.set(output, undefined);\n\treturn output;\n}\n\n/** Associates rollback data with commits */\nnamespace Rollback {\n\tconst map = new WeakMap<GraphCommit<unknown>, TaggedChange<unknown, RevisionTag>>();\n\n\texport function get<TChange>(\n\t\tcommit: GraphCommit<TChange>,\n\t): TaggedChange<TChange, RevisionTag> | undefined {\n\t\treturn map.get(commit) as TaggedChange<TChange, RevisionTag> | undefined;\n\t}\n\n\texport function set<TChange>(\n\t\tcommit: GraphCommit<TChange>,\n\t\trollback: TaggedChange<TChange, RevisionTag> | undefined,\n\t): void {\n\t\tif (rollback === undefined) {\n\t\t\tmap.delete(commit);\n\t\t} else {\n\t\t\tmap.set(commit, rollback);\n\t\t}\n\t}\n}\n\n/**\n * Checks if one node is an ancestor of another in a parent-linked tree structure.\n * @param ancestor - The potential ancestor node\n * @param descendant - The potential descendant node\n * @param allowEqual - If true, returns true when ancestor === descendant\n * @returns true if ancestor is an ancestor of descendant (or equal if allowEqual is true)\n */\nexport function isAncestor<TNode extends { readonly parent?: TNode }>(\n\tancestor: TNode,\n\tdescendant: TNode,\n\tallowEqual: boolean,\n): boolean {\n\tif (allowEqual && ancestor === descendant) {\n\t\treturn true;\n\t}\n\n\tlet current = descendant.parent;\n\twhile (current !== undefined) {\n\t\tif (current === ancestor) {\n\t\t\treturn true;\n\t\t}\n\t\tcurrent = current.parent;\n\t}\n\n\treturn false;\n}\n\n/**\n * Returns a change that represents the different between two places in a commit graph.\n * Applying this change to the state at `sourceCommit` will yield the state at `targetCommit`.\n * @param changeRebaser - the change rebaser responsible for providing inverses to the changes in the commits.\n * @param sourceCommit - the commit representing the initial state.\n * @param targetCommit - the commit representing the final state.\n * @param mintRevisionTag - a function which can be called to create revision tags for any rollback changes that need to be generated.\n * @returns a change representing the difference between `sourceCommit` and `targetCommit`.\n */\nexport function diffHistories<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceCommit: GraphCommit<TChange>,\n\ttargetCommit: GraphCommit<TChange>,\n\tmintRevisionTag: () => RevisionTag,\n): TChange {\n\tconst sourcePath: GraphCommit<TChange>[] = [];\n\tconst targetPath: GraphCommit<TChange>[] = [];\n\tconst ancestor = findCommonAncestor([sourceCommit, sourcePath], [targetCommit, targetPath]);\n\tassert(ancestor !== undefined, 0xc6f /* Branches must be related */);\n\tconst inverses = sourcePath.map((commit) =>\n\t\trollbackFromCommit(changeRebaser, commit, mintRevisionTag),\n\t);\n\n\tinverses.reverse();\n\treturn changeRebaser.compose([...inverses, ...targetPath]);\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/core/rebase/utils.ts"],"names":[],"mappings":"A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C5B,aAAqC,EACrC,YAAkC,EAClC,YAAkC,EAClC,eAAkC;IAElC,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,kBAAkB,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;IAC5F,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC1C,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,CAAC,CAC1D,CAAC;IAEF,QAAQ,CAAC,OAAO,EAAE,CAAC;IACnB,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,QAAQ,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\n\nimport { defineLazyCachedProperty, hasSome, type Mutable } from \"../../util/index.js\";\n\nimport {\n\ttype ChangeRebaser,\n\ttype RevisionInfo,\n\ttype RevisionMetadataSource,\n\ttype TaggedChange,\n\tmakeAnonChange,\n\tmapTaggedChange,\n\ttagChange,\n\ttagRollbackInverse,\n} from \"./changeRebaser.js\";\nimport { type GraphCommit, type RevisionTag, mintCommit } from \"./types.js\";\n\n/**\n * Contains information about how the commit graph changed as the result of rebasing a source branch onto another target branch.\n * @remarks\n * ```text\n * Consider the commit graph below containing two branches, X and Y, with head commits C and E, respectively.\n * Branch Y branches off of Branch X at their common ancestor commit A, i.e. \"Y is based off of X at commit A\".\n *\n * A ─ B ─ C ← Branch X\n * └─ D ─ E ← Branch Y\n *\n * Branch Y is then rebased onto Branch X. This results in the following commit graph:\n *\n * A ─ B ─ C ← Branch X\n * └─ D'─ E'← Branch Y\n *\n * Commits D' and E' are the rebased versions of commits D and E, respectively. This results in:\n * deletedSourceCommits: [D, E],\n * targetCommits: [B, C],\n * sourceCommits: [D', E']\n * ```\n */\nexport interface RebasedCommits<TChange> {\n\t/**\n\t * The commits on the original source branch that were rebased. These are no longer referenced by the source branch and have\n\t * been replaced with new versions on the new source branch, see {@link sourceCommits}. In the case that the source\n\t * branch was already ahead of the target branch before the rebase, this list will be empty.\n\t */\n\tdeletedSourceCommits: GraphCommit<TChange>[];\n\t/**\n\t * All commits on the target branch that the source branch's commits were rebased over. These are now the direct\n\t * ancestors of {@link sourceCommits}. In the case that the source branch was already ahead of the target branch\n\t * before the rebase, this list will be empty.\n\t */\n\ttargetCommits: GraphCommit<TChange>[];\n\t/**\n\t * All commits on the source branch that are not also on the target branch after the rebase operation. In the case that the\n\t * source branch was already ahead of the target branch before the rebase, these are the same commits that were already on\n\t * the source branch before the rebase, otherwise these are the new, rebased versions of {@link deletedSourceCommits}.\n\t */\n\tsourceCommits: GraphCommit<TChange>[];\n}\n\n/**\n * Telemetry metrics for a rebase operation.\n */\nexport interface RebaseStats {\n\t/**\n\t * The length of the source branch before the rebase.\n\t */\n\treadonly sourceBranchLength: number;\n\t/**\n\t * Number of commits rebased over on the target branch.\n\t */\n\treadonly rebaseDistance: number;\n\t/**\n\t * The number of commits that are dropped from the source branch when rebased to the target branch.\n\t */\n\treadonly countDropped: number;\n}\n\nexport interface RebaseStatsWithDuration extends RebaseStats {\n\treadonly duration: number;\n}\n\nexport interface BranchRebaseResult<TChange> {\n\t/**\n\t * The head of a rebased source branch.\n\t */\n\treadonly newSourceHead: GraphCommit<TChange>;\n\t/**\n\t * A thunk that computes the cumulative change to the source branch (undefined if no change occurred)\n\t */\n\treadonly sourceChange: TChange | undefined;\n\t/**\n\t * Details about how the commits on the source branch changed\n\t */\n\treadonly commits: RebasedCommits<TChange>;\n\t/**\n\t * Telemetry properties for the rebase operation.\n\t */\n\treadonly telemetryProperties: RebaseStats;\n}\n\ninterface RebaseChangeResult<TChange> {\n\treadonly change: TChange;\n\t/**\n\t * Telemetry properties for the rebase operation.\n\t */\n\treadonly telemetryProperties: RebaseStats;\n}\n\n/**\n * Rebases a source branch onto another commit in a target branch.\n *\n * A \"branch\" is defined as a \"head\" commit and all ancestors of that commit, i.e. one linked list in a graph of commits.\n *\n * The source and target branch must share an ancestor.\n * @param changeRebaser - the change rebaser responsible for rebasing the changes in the commits of each branch\n * @param sourceHead - the head of the source branch, which will be rebased onto `targetHead`\n * @param targetHead - the commit to rebase the source branch onto\n * @returns a {@link BranchRebaseResult}\n * @remarks While a single branch must not have multiple commits with the same revision tag (that will result in undefined\n * behavior), there may be a commit on the source branch with the same revision tag as a commit on the target branch. If such\n * a pair is encountered while rebasing, it will be \"cancelled out\" in the new branch. For example:\n * ```\n * // (A)-(B)-(C) <- Branch X\n * // \\\n * // (B')-(D) <- Branch Y\n * //\n * // As Branch Y is rebased onto Branch X, commits B and B' cancel out so there is no version of B on the new rebased source branch\n * //\n * // (A)-(B)-(C) <- Branch X\n * // \\\n * // (D') <- Branch Y'\n * //\n * ```\n */\nexport function rebaseBranch<TChange>(\n\tmintRevisionTag: () => RevisionTag,\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetHead: GraphCommit<TChange>,\n): BranchRebaseResult<TChange>;\n\n/**\n * Rebases a source branch onto another commit in a target branch.\n *\n * A \"branch\" is defined as a \"head\" commit and all ancestors of that commit, i.e. one linked list in a graph of commits.\n *\n * The source and target branch must share an ancestor.\n * @param changeRebaser - the change rebaser responsible for rebasing the changes in the commits of each branch\n * @param sourceHead - the head of the source branch, which will be rebased onto `newBase`\n * @param targetCommit - the commit on the target branch to rebase the source branch onto.\n * @param targetHead - the head of the branch that `newBase` belongs to. Must be `newBase` or a descendent of `newBase`.\n * @returns a {@link BranchRebaseResult}\n * @remarks While a single branch must not have multiple commits with the same revision tag (that will result in undefined\n * behavior), there may be a commit on the source branch with the same revision tag as a commit on the target branch. If such\n * a pair is encountered while rebasing, it will be \"cancelled out\" in the new branch. Additionally, this function will rebase\n * the source branch _farther_ than `newBase` if the source branch's next commits after `newBase` match those on the target branch.\n * For example:\n * ```\n * // (A)-(B)-(C)-(D)-(E) <- Branch X\n * // \\\n * // (B')-(D')-(F) <- Branch Y\n * //\n * // If Branch Y is rebased onto commit C of Branch X, the branches must at least look like this afterwards (B was cancelled out):\n * //\n * // (A)-(B)-(C)-(D)-(E) <- Branch X\n * // \\\n * // (D'')-(F') <- Branch Y'\n * //\n * // But this function will recognize that B is equivalent to B' and D is equivalent to D', and instead produce:\n * //\n * // (A)-(B)-(C)-(D)-(E) <- Branch X\n * // \\\n * // (F') <- Branch Y'\n * ```\n */\nexport function rebaseBranch<TChange>(\n\tmintRevisionTag: () => RevisionTag,\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetCommit: GraphCommit<TChange>,\n\ttargetHead: GraphCommit<TChange>,\n): BranchRebaseResult<TChange>;\nexport function rebaseBranch<TChange>(\n\tmintRevisionTag: () => RevisionTag,\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetCommit: GraphCommit<TChange>,\n\ttargetHead = targetCommit,\n): BranchRebaseResult<TChange> {\n\t// Get both source and target as path arrays\n\tconst sourcePath: GraphCommit<TChange>[] = [];\n\tconst targetPath: GraphCommit<TChange>[] = [];\n\tconst ancestor = findCommonAncestor([sourceHead, sourcePath], [targetHead, targetPath]);\n\tassert(ancestor !== undefined, 0x675 /* branches must be related */);\n\n\tconst sourceBranchLength = sourcePath.length;\n\n\t// Find where `targetCommit` is in the target branch\n\tconst targetCommitIndex = targetPath.findIndex((r) => r === targetCommit);\n\tif (targetCommitIndex === -1) {\n\t\t// If the targetCommit is not in the target path, then it is either disjoint from `target` or it is behind/at\n\t\t// the commit where source and target diverge (ancestor), in which case there is nothing more to rebase\n\t\t// TODO: Ideally, this would be an \"assertExpensive\". It is commented out because it causes O(N²) behavior when\n\t\t// processing N inbound commits from the same client whose ref seq# is not advancing (which is a common case).\n\t\t// N can be large when the client is sending a burst of changes (potentially on reconnection).\n\t\t// assert(\n\t\t// \tfindCommonAncestor(targetCommit, targetHead) !== undefined,\n\t\t// \t0x676 /* target commit is not in target branch */,\n\t\t// );\n\t\treturn {\n\t\t\tnewSourceHead: sourceHead,\n\t\t\tsourceChange: undefined,\n\t\t\tcommits: { deletedSourceCommits: [], targetCommits: [], sourceCommits: sourcePath },\n\t\t\ttelemetryProperties: {\n\t\t\t\tsourceBranchLength,\n\t\t\t\trebaseDistance: targetCommitIndex + 1,\n\t\t\t\tcountDropped: 0,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Iterate through the target path and look for commits that are also present on the source branch (i.e. they\n\t// have matching tags). Each commit found in the target branch can be skipped when processing the source branch\n\t// because it has already been rebased onto the target. In the case that one or more of these commits are present\n\t// directly after `targetCommit`, then the new base can be advanced further without having to do any work.\n\tconst sourceSet = new Set(sourcePath.map((r) => r.revision));\n\tlet newBaseIndex = targetCommitIndex;\n\n\tfor (const [i, { revision }] of targetPath.entries()) {\n\t\tif (sourceSet.has(revision)) {\n\t\t\tsourceSet.delete(revision);\n\t\t\tnewBaseIndex = Math.max(newBaseIndex, i);\n\t\t} else if (i > targetCommitIndex) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/** The commit on the target branch that the new source branch branches off of (i.e. the new common ancestor) */\n\tconst newBase = targetPath[newBaseIndex] ?? oob();\n\t// Figure out how much of the trunk to start rebasing over.\n\tconst targetCommits = targetPath.slice(0, newBaseIndex + 1);\n\tconst deletedSourceCommits = [...sourcePath];\n\n\t// If the source and target rebase path begin with a range that has all the same revisions, remove it; it is\n\t// equivalent on both branches and doesn't need to be rebased.\n\tconst targetRebasePath = [...targetCommits];\n\tif (hasSome(sourcePath) && hasSome(targetRebasePath)) {\n\t\tconst minLength = Math.min(sourcePath.length, targetRebasePath.length);\n\t\tfor (let i = 0; i < minLength; i++) {\n\t\t\tconst firstSourcePath = sourcePath[0];\n\t\t\tconst firstTargetRebasePath = targetRebasePath[0];\n\t\t\tif (firstSourcePath.revision === firstTargetRebasePath.revision) {\n\t\t\t\tsourcePath.shift();\n\t\t\t\ttargetRebasePath.shift();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst sourceCommits: GraphCommit<TChange>[] = [];\n\n\t// If all commits that are about to be rebased over on the target branch already comprise the start of the source branch,\n\t// are in the same order, and have no other commits interleaving them, then no rebasing needs to occur. Those commits can\n\t// simply be removed from the source branch, and the remaining commits on the source branch are reparented off of the new\n\t// base commit.\n\tif (!hasSome(targetRebasePath)) {\n\t\tfor (const c of sourcePath) {\n\t\t\tsourceCommits.push(mintCommit(sourceCommits[sourceCommits.length - 1] ?? newBase, c));\n\t\t}\n\t\treturn {\n\t\t\tnewSourceHead: sourceCommits[sourceCommits.length - 1] ?? newBase,\n\t\t\tsourceChange: undefined,\n\t\t\tcommits: {\n\t\t\t\tdeletedSourceCommits,\n\t\t\t\ttargetCommits,\n\t\t\t\tsourceCommits,\n\t\t\t},\n\t\t\ttelemetryProperties: {\n\t\t\t\tsourceBranchLength,\n\t\t\t\trebaseDistance: targetCommits.length,\n\t\t\t\tcountDropped: sourceBranchLength - sourceSet.size,\n\t\t\t},\n\t\t};\n\t}\n\n\t// For each source commit, rebase backwards over the inverses of any commits already rebased, and then\n\t// rebase forwards over the rest of the commits up to the new base before advancing the new base.\n\tlet newHead = newBase;\n\tconst revInfos = getRevInfoFromTaggedChanges([...targetRebasePath, ...sourcePath]);\n\t// Note that the `revisionMetadata` gets updated as `revInfos` gets updated.\n\tconst revisionMetadata = revisionMetadataSourceFromInfo(revInfos);\n\tlet editsToCompose: TaggedChange<TChange>[] = targetRebasePath.slice();\n\tfor (const c of sourcePath) {\n\t\tconst rollback = rollbackFromCommit(changeRebaser, c, mintRevisionTag, true /* cache */);\n\t\tif (sourceSet.has(c.revision)) {\n\t\t\tconst currentComposedEdit = makeAnonChange(changeRebaser.compose(editsToCompose));\n\t\t\teditsToCompose = [currentComposedEdit];\n\t\t\tconst change = changeRebaser.rebase(c, currentComposedEdit, revisionMetadata);\n\t\t\tnewHead = {\n\t\t\t\trevision: c.revision,\n\t\t\t\tchange,\n\t\t\t\tparent: newHead,\n\t\t\t};\n\t\t\tsourceCommits.push(newHead);\n\t\t\teditsToCompose.push(tagChange(change, c.revision));\n\t\t}\n\t\trevInfos.push({ revision: c.revision });\n\t\teditsToCompose.unshift(rollback);\n\t\trevInfos.unshift({ revision: rollback.revision, rollbackOf: rollback.rollbackOf });\n\t}\n\n\treturn defineLazyCachedProperty(\n\t\t{\n\t\t\tnewSourceHead: newHead,\n\t\t\tcommits: {\n\t\t\t\tdeletedSourceCommits,\n\t\t\t\ttargetCommits,\n\t\t\t\tsourceCommits,\n\t\t\t},\n\t\t\ttelemetryProperties: {\n\t\t\t\tsourceBranchLength,\n\t\t\t\trebaseDistance: targetCommits.length,\n\t\t\t\tcountDropped: sourceBranchLength - sourceSet.size,\n\t\t\t},\n\t\t},\n\t\t\"sourceChange\",\n\t\t() => {\n\t\t\treturn changeRebaser.compose(editsToCompose);\n\t\t},\n\t);\n}\n\n/**\n * \"Sandwich/Horseshoe Rebase\" a change over the given source and target branches\n * @param changeRebaser - the change rebaser responsible for rebasing the change over the commits in each branch\n * @param change - the change to rebase\n * @param sourceHead - the head of the branch that `change` is based on\n * @param targetHead - the branch to rebase `change` onto\n * @returns the rebased change\n *\n * @remarks inverses will be cached.\n */\nexport function rebaseChange<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tchange: TaggedChange<TChange>,\n\tsourceHead: GraphCommit<TChange>,\n\ttargetHead: GraphCommit<TChange>,\n\tmintRevisionTag: () => RevisionTag,\n): RebaseChangeResult<TChange> {\n\tconst sourcePath: GraphCommit<TChange>[] = [];\n\tconst targetPath: GraphCommit<TChange>[] = [];\n\tassert(\n\t\tfindCommonAncestor([sourceHead, sourcePath], [targetHead, targetPath]) !== undefined,\n\t\t0x576 /* branch A and branch B must be related */,\n\t);\n\n\tconst inverses = sourcePath.map((commit) =>\n\t\trollbackFromCommit(changeRebaser, commit, mintRevisionTag, true),\n\t);\n\tinverses.reverse();\n\n\tconst telemetryProperties = {\n\t\tsourceBranchLength: 1,\n\t\trebaseDistance: sourcePath.length + targetPath.length,\n\t\tcountDropped: 0,\n\t};\n\n\treturn {\n\t\tchange: rebaseChangeOverChanges(changeRebaser, change, [...inverses, ...targetPath]),\n\t\ttelemetryProperties,\n\t};\n}\n\nexport function revisionMetadataSourceFromInfo(\n\trevInfos: readonly RevisionInfo[],\n): RevisionMetadataSource {\n\tconst compareRevisions = (revision1: RevisionTag, revision2: RevisionTag): number => {\n\t\tconst index1 = getIndex(revision1);\n\t\tconst index2 = getIndex(revision2);\n\n\t\tif (index1 !== undefined) {\n\t\t\treturn index2 !== undefined ? index2 - index1 : -1;\n\t\t}\n\n\t\treturn index2 !== undefined ? 1 : 0;\n\t};\n\n\tconst tryGetInfo = (revision: RevisionTag | undefined): RevisionInfo | undefined => {\n\t\tif (revision === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn revInfos.find((info) => info.revision === revision);\n\t};\n\n\tconst hasRollback = (revision: RevisionTag): boolean => {\n\t\treturn revInfos.find((info) => info.rollbackOf === revision) !== undefined;\n\t};\n\n\tconst getIndex = (revision: RevisionTag): number | undefined => {\n\t\tconst index = revInfos.findIndex((revInfo) => revInfo.revision === revision);\n\t\tif (index >= 0) {\n\t\t\treturn index;\n\t\t}\n\n\t\tconst rollbackIndex = revInfos.findIndex((revInfo) => revInfo.rollbackOf === revision);\n\t\tif (rollbackIndex >= 0) {\n\t\t\t// This change is the forward revision of a rollback included in revInfos, so it comes after\n\t\t\t// all revisions in revInfos. Earlier rollbacks have later forward revisions.\n\t\t\treturn 2 * revInfos.length - rollbackIndex;\n\t\t}\n\n\t\treturn undefined;\n\t};\n\n\treturn { compareRevisions, tryGetInfo, hasRollback };\n}\n\nexport function rebaseChangeOverChanges<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tchangeToRebase: TaggedChange<TChange>,\n\tchangesToRebaseOver: TaggedChange<TChange>[],\n): TChange {\n\tconst revisionMetadata = revisionMetadataSourceFromInfo(\n\t\tgetRevInfoFromTaggedChanges([...changesToRebaseOver, changeToRebase]),\n\t);\n\n\treturn changesToRebaseOver.reduce(\n\t\t(a, b) => mapTaggedChange(changeToRebase, changeRebaser.rebase(a, b, revisionMetadata)),\n\t\tchangeToRebase,\n\t).change;\n}\n\n// TODO: Deduplicate\nfunction getRevInfoFromTaggedChanges(changes: TaggedChange<unknown>[]): RevisionInfo[] {\n\tconst revInfos: RevisionInfo[] = [];\n\tfor (const taggedChange of changes) {\n\t\trevInfos.push(...revisionInfoFromTaggedChange(taggedChange));\n\t}\n\n\treturn revInfos;\n}\n\n// TODO: Deduplicate\nfunction revisionInfoFromTaggedChange(taggedChange: TaggedChange<unknown>): RevisionInfo[] {\n\tconst revInfos: RevisionInfo[] = [];\n\tif (taggedChange.revision !== undefined) {\n\t\tconst info: Mutable<RevisionInfo> = { revision: taggedChange.revision };\n\t\tif (taggedChange.rollbackOf !== undefined) {\n\t\t\tinfo.rollbackOf = taggedChange.rollbackOf;\n\t\t}\n\t\trevInfos.push(info);\n\t}\n\treturn revInfos;\n}\n\nfunction rollbackFromCommit<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tcommit: GraphCommit<TChange>,\n\tmintRevisionTag: () => RevisionTag,\n\tcache?: boolean,\n): TaggedChange<TChange, RevisionTag> {\n\tconst cachedRollback = Rollback.get(commit);\n\tif (cachedRollback !== undefined) {\n\t\treturn cachedRollback;\n\t}\n\tconst tag = mintRevisionTag();\n\tconst rollback = tagRollbackInverse(\n\t\tchangeRebaser.invert(commit, true, tag),\n\t\ttag,\n\t\tcommit.revision,\n\t);\n\n\tif (cache === true) {\n\t\tRollback.set(commit, rollback);\n\t}\n\treturn rollback;\n}\n\n/**\n * Find the furthest ancestor of some descendant.\n * @param descendant - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of ancestry for `descendant` from most distant to closest (not including the furthest ancestor,\n * but otherwise including `descendant`).\n * @returns the furthest ancestor of `descendant`, or `descendant` itself if `descendant` has no ancestors.\n */\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T, path?: T[]],\n): T;\n/**\n * Find the furthest ancestor of some descendant.\n * @param descendant - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of ancestry for `descendant` from most distant to closest (not including the furthest ancestor,\n * but otherwise including `descendant`).\n * @returns the furthest ancestor of `descendant`, or `descendant` itself if `descendant` has no ancestors. Returns\n * `undefined` if `descendant` is undefined.\n */\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T | undefined, path?: T[]] | undefined,\n): T | undefined;\n/**\n * Find an ancestor of some descendant.\n * @param descendant - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of ancestry for `descendant` from most distant to closest (not including the ancestor found by `predicate`,\n * but otherwise including `descendant`).\n * @param predicate - a function which will be evaluated on `descendant` and then ancestor of `descendant` (in ascending order) until it returns true.\n * @returns the closest ancestor of `descendant` that satisfies `predicate`, or `undefined` if no such ancestor exists.\n *\n * @example\n *\n * ```typescript\n * interface Parented {\n * id: string;\n * parent?: Parented;\n * }\n * const g = { id: \"g\" }; // Grandparent\n * const p = { parent: g, id: \"p\" }; // Parent\n * const c = { parent: p, id: \"c\" }; // Child\n * const path: Parented[] = [];\n * const ancestor = findAncestor<Parented>([c, path], (n) => n.id === \"g\");\n * // ancestor === g\n * // path === [p, c]\n * ```\n */\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T | undefined, path?: T[]] | undefined,\n\tpredicate: (t: T) => boolean,\n): T | undefined;\nexport function findAncestor<T extends { parent?: T }>(\n\tdescendant: T | [descendant: T | undefined, path?: T[]] | undefined,\n\tpredicate: (t: T) => boolean = (t): boolean => t.parent === undefined,\n): T | undefined {\n\tlet d: T | undefined;\n\tlet path: T[] | undefined;\n\tif (Array.isArray(descendant)) {\n\t\t[d, path] = descendant;\n\t} else {\n\t\td = descendant;\n\t}\n\tfor (let cur = d; cur !== undefined; cur = cur.parent) {\n\t\tif (predicate(cur)) {\n\t\t\tpath?.reverse();\n\t\t\treturn cur;\n\t\t}\n\t\tpath?.push(cur);\n\t}\n\n\tif (path !== undefined) {\n\t\tpath.length = 0;\n\t}\n\treturn undefined;\n}\n\n/**\n * Find a common ancestor between two descendants that are linked by parent pointers.\n * @param descendantA - a descendant. If an empty `path` array is included, it will be populated\n * with the chain of commits from the ancestor to `descendantA` (not including the ancestor).\n * @param descendantB - another descendant. If an empty `path` array is included, it will be populated\n * with the chain of commits from the ancestor to `descendantB` (not including the ancestor).\n * @returns the common ancestor of `descendantA` and `descendantB`, or `undefined` if no such ancestor exists.\n *\n * @example\n *\n * ```typescript\n * interface Parented {\n * parent?: Parented;\n * }\n * const shared = {};\n * const a = { parent: shared };\n * const b1 = { parent: shared };\n * const b2 = { parent: b1 };\n * const pathB: Parented[] = []\n * const ancestor = findCommonAncestor<Parented>(a, [b2, pathB]);\n * // ancestor === shared\n * // pathB === [b1, b2]\n * ```\n */\nexport function findCommonAncestor<T extends { parent?: T }>(\n\tdescendantA: T | [descendantA: T, path?: T[]] | undefined,\n\tdescendantB: T | [descendantB: T, path?: T[]] | undefined,\n): T | undefined {\n\tlet a: T | undefined;\n\tlet b: T | undefined;\n\tlet pathA: T[] | undefined;\n\tlet pathB: T[] | undefined;\n\tif (Array.isArray(descendantA)) {\n\t\t[a, pathA] = descendantA;\n\t\tassert(pathA === undefined || pathA.length === 0, 0x578 /* Path A must be empty */);\n\t} else {\n\t\ta = descendantA;\n\t}\n\tif (Array.isArray(descendantB)) {\n\t\t[b, pathB] = descendantB;\n\t\tassert(pathB === undefined || pathB.length === 0, 0x579 /* Path B must be empty */);\n\t} else {\n\t\tb = descendantB;\n\t}\n\n\tif (a === b) {\n\t\treturn a;\n\t}\n\n\tconst reversePaths = (): void => {\n\t\tpathA?.reverse();\n\t\tpathB?.reverse();\n\t};\n\n\tconst visited = new Set();\n\twhile (a !== undefined || b !== undefined) {\n\t\tif (a !== undefined) {\n\t\t\tif (visited.has(a)) {\n\t\t\t\tif (pathB !== undefined) {\n\t\t\t\t\tpathB.length = pathB.findIndex((r) => Object.is(r, a));\n\t\t\t\t}\n\t\t\t\treversePaths();\n\t\t\t\treturn a;\n\t\t\t}\n\t\t\tvisited.add(a);\n\t\t\tpathA?.push(a);\n\t\t\ta = a.parent;\n\t\t}\n\n\t\tif (b !== undefined) {\n\t\t\tif (visited.has(b)) {\n\t\t\t\tif (pathA !== undefined) {\n\t\t\t\t\tpathA.length = pathA.findIndex((r) => Object.is(r, b));\n\t\t\t\t}\n\t\t\t\treversePaths();\n\t\t\t\treturn b;\n\t\t\t}\n\t\t\tvisited.add(b);\n\t\t\tpathB?.push(b);\n\t\t\tb = b.parent;\n\t\t}\n\t}\n\n\tif (pathA !== undefined) {\n\t\tpathA.length = 0;\n\t}\n\tif (pathB !== undefined) {\n\t\tpathB.length = 0;\n\t}\n\treturn undefined;\n}\n\nexport function replaceChange<TChange>(\n\tcommit: GraphCommit<TChange>,\n\tchange: TChange,\n): GraphCommit<TChange> {\n\tconst output = { ...commit, change };\n\tRollback.set(output, undefined);\n\treturn output;\n}\n\n/** Associates rollback data with commits */\nnamespace Rollback {\n\tconst map = new WeakMap<GraphCommit<unknown>, TaggedChange<unknown, RevisionTag>>();\n\n\texport function get<TChange>(\n\t\tcommit: GraphCommit<TChange>,\n\t): TaggedChange<TChange, RevisionTag> | undefined {\n\t\treturn map.get(commit) as TaggedChange<TChange, RevisionTag> | undefined;\n\t}\n\n\texport function set<TChange>(\n\t\tcommit: GraphCommit<TChange>,\n\t\trollback: TaggedChange<TChange, RevisionTag> | undefined,\n\t): void {\n\t\tif (rollback === undefined) {\n\t\t\tmap.delete(commit);\n\t\t} else {\n\t\t\tmap.set(commit, rollback);\n\t\t}\n\t}\n}\n\n/**\n * Checks if one node is an ancestor of another in a parent-linked tree structure.\n * @param ancestor - The potential ancestor node\n * @param descendant - The potential descendant node\n * @param allowEqual - If true, returns true when ancestor === descendant\n * @returns true if ancestor is an ancestor of descendant (or equal if allowEqual is true)\n */\nexport function isAncestor<TNode extends { readonly parent?: TNode }>(\n\tancestor: TNode,\n\tdescendant: TNode,\n\tallowEqual: boolean,\n): boolean {\n\tif (allowEqual && ancestor === descendant) {\n\t\treturn true;\n\t}\n\n\tlet current = descendant.parent;\n\twhile (current !== undefined) {\n\t\tif (current === ancestor) {\n\t\t\treturn true;\n\t\t}\n\t\tcurrent = current.parent;\n\t}\n\n\treturn false;\n}\n\n/**\n * Returns a change that represents the different between two places in a commit graph.\n * Applying this change to the state at `sourceCommit` will yield the state at `targetCommit`.\n * @param changeRebaser - the change rebaser responsible for providing inverses to the changes in the commits.\n * @param sourceCommit - the commit representing the initial state.\n * @param targetCommit - the commit representing the final state.\n * @param mintRevisionTag - a function which can be called to create revision tags for any rollback changes that need to be generated.\n * @returns a change representing the difference between `sourceCommit` and `targetCommit`.\n */\nexport function diffHistories<TChange>(\n\tchangeRebaser: ChangeRebaser<TChange>,\n\tsourceCommit: GraphCommit<TChange>,\n\ttargetCommit: GraphCommit<TChange>,\n\tmintRevisionTag: () => RevisionTag,\n): TChange {\n\tconst sourcePath: GraphCommit<TChange>[] = [];\n\tconst targetPath: GraphCommit<TChange>[] = [];\n\tconst ancestor = findCommonAncestor([sourceCommit, sourcePath], [targetCommit, targetPath]);\n\tassert(ancestor !== undefined, 0xc6f /* Branches must be related */);\n\tconst inverses = sourcePath.map((commit) =>\n\t\trollbackFromCommit(changeRebaser, commit, mintRevisionTag),\n\t);\n\n\tinverses.reverse();\n\treturn changeRebaser.compose([...inverses, ...targetPath]);\n}\n"]}
@@ -9,10 +9,44 @@ import type { RevisionTag, RevisionTagCodec } from "../rebase/index.js";
9
9
  import type { FieldKey } from "../schema-stored/index.js";
10
10
  import type * as Delta from "./delta.js";
11
11
  import type { ForestRootId, Major } from "./detachedFieldIndexTypes.js";
12
+ /**
13
+ * Readonly interface for {@link DetachedFieldIndex}.
14
+ */
15
+ export interface ReadOnlyDetachedFieldIndex {
16
+ /**
17
+ * Creates a deep clone of this `DetachedFieldIndex`.
18
+ */
19
+ clone(): DetachedFieldIndex;
20
+ /**
21
+ * Returns a field key for the given ID.
22
+ * This does not save the field key on the index. To do so, call {@link createEntry}.
23
+ */
24
+ toFieldKey(id: ForestRootId): FieldKey;
25
+ /**
26
+ * Returns a node ID for the node in the given field.
27
+ * @param field - The field key where the detached node resides.
28
+ */
29
+ fromFieldKey(field: FieldKey): Delta.DetachedNodeId;
30
+ /**
31
+ * Returns the `ForestRootId` associated with the given id.
32
+ * Returns undefined if no such id is known to the index.
33
+ */
34
+ tryGetEntry(id: Delta.DetachedNodeId): ForestRootId | undefined;
35
+ /**
36
+ * Returns the `ForestRootId` associated with the given id.
37
+ * Fails if no such id is known to the index.
38
+ */
39
+ getEntry(id: Delta.DetachedNodeId): ForestRootId;
40
+ }
41
+ /**
42
+ * Restores the originating DetachedFieldIndex to the state it was in when the checkpoint was created.
43
+ * Can be invoked multiple times.
44
+ */
45
+ export type DetachedFieldIndexCheckpoint = () => void;
12
46
  /**
13
47
  * The tree index records detached field IDs and associates them with a change atom ID.
14
48
  */
15
- export declare class DetachedFieldIndex {
49
+ export declare class DetachedFieldIndex implements ReadOnlyDetachedFieldIndex {
16
50
  private readonly name;
17
51
  private rootIdAllocator;
18
52
  private readonly revisionTagCodec;
@@ -46,6 +80,10 @@ export declare class DetachedFieldIndex {
46
80
  */
47
81
  constructor(name: string, rootIdAllocator: IdAllocator<ForestRootId>, revisionTagCodec: RevisionTagCodec, idCompressor: IIdCompressor, options?: CodecWriteOptions);
48
82
  clone(): DetachedFieldIndex;
83
+ /**
84
+ * Creates a restorable checkpoint of the current state of the DetachedFieldIndex.
85
+ */
86
+ createCheckpoint(): DetachedFieldIndexCheckpoint;
49
87
  entries(): Generator<{
50
88
  root: ForestRootId;
51
89
  latestRelevantRevision?: RevisionTag;
@@ -56,20 +94,9 @@ export declare class DetachedFieldIndex {
56
94
  */
57
95
  purge(): void;
58
96
  updateMajor(current: Major, updated: Major): void;
59
- /**
60
- * Returns a field key for the given ID.
61
- * This does not save the field key on the index. To do so, call {@link createEntry}.
62
- */
63
97
  toFieldKey(id: ForestRootId): FieldKey;
64
- /**
65
- * Returns the FieldKey associated with the given id.
66
- * Returns undefined if no such id is known to the index.
67
- */
98
+ fromFieldKey(field: FieldKey): Delta.DetachedNodeId;
68
99
  tryGetEntry(id: Delta.DetachedNodeId): ForestRootId | undefined;
69
- /**
70
- * Returns the FieldKey associated with the given id.
71
- * Fails if no such id is known to the index.
72
- */
73
100
  getEntry(id: Delta.DetachedNodeId): ForestRootId;
74
101
  /**
75
102
  * Returns the detached root IDs for all the trees that were detached or last modified by the given revision.
@@ -1 +1 @@
1
- {"version":3,"file":"detachedFieldIndex.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EACN,KAAK,iBAAiB,EAItB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAS3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAGX,YAAY,EACZ,KAAK,EAEL,MAAM,8BAA8B,CAAC;AAGtC;;GAEG;AACH,qBAAa,kBAAkB;IAoC7B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,eAAe;I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AG,KAAK,CAAC,cAAc;IAUnD,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,cAAc,GAAG,YAAY,GAAG,SAAS;IAI/D,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,cAAc,GAAG,YAAY;IAMvD;;OAEG;IACK,6BAA6B,CAAC,QAAQ,EAAE,WAAW,GAAG,QAAQ,CAAC,YAAY,CAAC;IAOpF;;OAEG;IACI,gCAAgC,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI;IAiB7D,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,GAAG,IAAI;IAWtD;;;;;;;OAOG;IACI,WAAW,CACjB,MAAM,CAAC,EAAE,KAAK,CAAC,cAAc,EAC7B,QAAQ,CAAC,EAAE,WAAW,EACtB,KAAK,GAAE,MAAU,GACf,YAAY;IAsBf;;OAEG;IACI,oBAAoB,CAC1B,EAAE,EAAE,KAAK,CAAC,cAAc,EACxB,QAAQ,EAAE,WAAW,GAAG,SAAS,GAC/B,IAAI;IAmBA,MAAM,IAAI,sBAAsB;IAOvC;;OAEG;IACI,QAAQ,CAAC,IAAI,EAAE,sBAAsB,GAAG,IAAI;IAmBnD;;;;OAIG;IACI,yBAAyB,CAAC,cAAc,EAAE,WAAW,GAAG,IAAI;CAqBnE"}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert } from "@fluidframework/core-utils/internal";
5
+ import { assert, fail } from "@fluidframework/core-utils/internal";
6
6
  import { FluidClientVersion, FormatValidatorNoOp, } from "../../codec/index.js";
7
7
  import { brand, deleteFromNestedMap, forEachInNestedMap, idAllocatorFromMaxId, populateNestedMap, setInNestedMap, tryGetFromNestedMap, } from "../../util/index.js";
8
8
  import { makeDetachedFieldIndexCodec } from "./detachedFieldIndexCodecs.js";
@@ -52,6 +52,18 @@ export class DetachedFieldIndex {
52
52
  populateNestedMap(this.latestRelevantRevisionToFields, clone.latestRelevantRevisionToFields, true);
53
53
  return clone;
54
54
  }
55
+ /**
56
+ * Creates a restorable checkpoint of the current state of the DetachedFieldIndex.
57
+ */
58
+ createCheckpoint() {
59
+ const clone = this.clone();
60
+ return () => {
61
+ this.purge();
62
+ populateNestedMap(clone.detachedNodeToField, this.detachedNodeToField, true);
63
+ populateNestedMap(clone.latestRelevantRevisionToFields, this.latestRelevantRevisionToFields, true);
64
+ this.rootIdAllocator = idAllocatorFromMaxId(clone.rootIdAllocator.getMaxId());
65
+ };
66
+ }
55
67
  *entries() {
56
68
  for (const [major, innerMap] of this.detachedNodeToField) {
57
69
  if (major !== undefined) {
@@ -125,24 +137,21 @@ export class DetachedFieldIndex {
125
137
  }
126
138
  }
127
139
  }
128
- /**
129
- * Returns a field key for the given ID.
130
- * This does not save the field key on the index. To do so, call {@link createEntry}.
131
- */
132
140
  toFieldKey(id) {
133
141
  return brand(`${this.name}-${id}`);
134
142
  }
135
- /**
136
- * Returns the FieldKey associated with the given id.
137
- * Returns undefined if no such id is known to the index.
138
- */
143
+ fromFieldKey(field) {
144
+ // TODO: maintain a lookup table or use field keys that encode the detached node ID
145
+ for (const { id, root } of this.entries()) {
146
+ if (this.toFieldKey(root) === field) {
147
+ return id;
148
+ }
149
+ }
150
+ fail("No known detached roots in the given field");
151
+ }
139
152
  tryGetEntry(id) {
140
153
  return tryGetFromNestedMap(this.detachedNodeToField, id.major, id.minor)?.root;
141
154
  }
142
- /**
143
- * Returns the FieldKey associated with the given id.
144
- * Fails if no such id is known to the index.
145
- */
146
155
  getEntry(id) {
147
156
  const key = this.tryGetEntry(id);
148
157
  assert(key !== undefined, 0x7aa /* Unknown removed node ID */);
@@ -1 +1 @@
1
- {"version":3,"file":"detachedFieldIndex.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAG7D,OAAO,EAEN,kBAAkB,E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E,IAAI,EAAE,CAAC,CAAC;YACjE,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;OAIG;IACI,yBAAyB,CAAC,cAA2B;QAC3D,MAAM,CACL,CAAC,IAAI,CAAC,aAAa,EACnB,KAAK,CAAC,6FAA6F,CACnG,CAAC;QAEF,MAAM,sBAAsB,GAA2C,IAAI,GAAG,EAAE,CAAC;QACjF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;QAC1B,kBAAkB,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACvE,cAAc,CAAC,sBAAsB,EAAE,KAAK,EAAE,KAAK,EAAE;gBACpD,IAAI;gBACJ,sBAAsB,EAAE,cAAc;aACtC,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,mBAAmB,GAAG,sBAAsB,CAAC;QAClD,IAAI,CAAC,8BAA8B,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC3B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\tFormatValidatorNoOp,\n\ttype IJsonCodec,\n} from \"../../codec/index.js\";\nimport {\n\ttype IdAllocator,\n\ttype JsonCompatibleReadOnly,\n\ttype NestedMap,\n\tbrand,\n\tdeleteFromNestedMap,\n\tforEachInNestedMap,\n\tidAllocatorFromMaxId,\n\tpopulateNestedMap,\n\tsetInNestedMap,\n\ttryGetFromNestedMap,\n} from \"../../util/index.js\";\nimport type { RevisionTag, RevisionTagCodec } from \"../rebase/index.js\";\nimport type { FieldKey } from \"../schema-stored/index.js\";\n\nimport type * as Delta from \"./delta.js\";\nimport type {\n\tDetachedField,\n\tDetachedFieldSummaryData,\n\tForestRootId,\n\tMajor,\n\tMinor,\n} from \"./detachedFieldIndexTypes.js\";\nimport { makeDetachedFieldIndexCodec } from \"./detachedFieldIndexCodecs.js\";\n\n/**\n * The tree index records detached field IDs and associates them with a change atom ID.\n */\nexport class DetachedFieldIndex {\n\t/**\n\t * A mapping from detached node ids to detached fields.\n\t */\n\tprivate detachedNodeToField: NestedMap<Major, Minor, DetachedField> = new Map();\n\t/**\n\t * A map from revisions to all detached fields for which the revision is the latest relevant revision.\n\t * See {@link DetachedField.latestRelevantRevision}.\n\t *\n\t * @remarks\n\t * undefined revisions are tolerated but any roots not associated with a revision must be disposed manually\n\t */\n\tprivate latestRelevantRevisionToFields: NestedMap<\n\t\tRevisionTag | undefined,\n\t\tForestRootId,\n\t\tDelta.DetachedNodeId\n\t> = new Map();\n\n\tprivate readonly codec: IJsonCodec<DetachedFieldSummaryData>;\n\tprivate readonly options: CodecWriteOptions;\n\n\t/**\n\t * The process for loading `DetachedFieldIndex` data from a summary is split into two steps:\n\t * 1. Call {@link loadData}\n\t * 2. Call {@link setRevisionsForLoadedData}\n\t *\n\t * This flag is only set to `false` after calling `loadData` and is set back to `true` after calling `setRevisionsForLoadedData`.\n\t * This helps ensure that `setRevisionsForLoadedData` is only called after `loadData` and only called once.\n\t */\n\tprivate isFullyLoaded = true;\n\n\t/**\n\t * @param name - A name for the index, used as a prefix for the generated field keys.\n\t * @param rootIdAllocator - An ID allocator used to generate unique field keys.\n\t */\n\tpublic constructor(\n\t\tprivate readonly name: string,\n\t\tprivate rootIdAllocator: IdAllocator<ForestRootId>,\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\toptions?: CodecWriteOptions,\n\t) {\n\t\tthis.options = options ?? {\n\t\t\tjsonValidator: FormatValidatorNoOp,\n\t\t\tminVersionForCollab: FluidClientVersion.v2_0,\n\t\t};\n\t\tthis.codec = makeDetachedFieldIndexCodec(revisionTagCodec, this.options, idCompressor);\n\t}\n\n\tpublic clone(): DetachedFieldIndex {\n\t\tconst clone = new DetachedFieldIndex(\n\t\t\tthis.name,\n\t\t\tidAllocatorFromMaxId(this.rootIdAllocator.getMaxId()) as IdAllocator<ForestRootId>,\n\t\t\tthis.revisionTagCodec,\n\t\t\tthis.idCompressor,\n\t\t\tthis.options,\n\t\t);\n\t\tpopulateNestedMap(this.detachedNodeToField, clone.detachedNodeToField, true);\n\t\tpopulateNestedMap(\n\t\t\tthis.latestRelevantRevisionToFields,\n\t\t\tclone.latestRelevantRevisionToFields,\n\t\t\ttrue,\n\t\t);\n\t\treturn clone;\n\t}\n\n\tpublic *entries(): Generator<{\n\t\troot: ForestRootId;\n\t\tlatestRelevantRevision?: RevisionTag;\n\t\tid: Delta.DetachedNodeId;\n\t}> {\n\t\tfor (const [major, innerMap] of this.detachedNodeToField) {\n\t\t\tif (major !== undefined) {\n\t\t\t\tfor (const [minor, { root, latestRelevantRevision }] of innerMap) {\n\t\t\t\t\tyield latestRelevantRevision !== undefined\n\t\t\t\t\t\t? { id: { major, minor }, root, latestRelevantRevision }\n\t\t\t\t\t\t: { id: { major, minor }, root };\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const [minor, { root, latestRelevantRevision }] of innerMap) {\n\t\t\t\t\tyield latestRelevantRevision !== undefined\n\t\t\t\t\t\t? { id: { minor }, root, latestRelevantRevision }\n\t\t\t\t\t\t: { id: { minor }, root };\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Removes all entries from the index.\n\t */\n\tpublic purge(): void {\n\t\tthis.detachedNodeToField.clear();\n\t\tthis.latestRelevantRevisionToFields.clear();\n\t}\n\n\tpublic updateMajor(current: Major, updated: Major): void {\n\t\t// Update latestRelevantRevision information corresponding to `current`\n\t\t{\n\t\t\tconst inner = this.latestRelevantRevisionToFields.get(current);\n\t\t\tif (inner !== undefined) {\n\t\t\t\tfor (const nodeId of inner.values()) {\n\t\t\t\t\tconst entry = tryGetFromNestedMap(\n\t\t\t\t\t\tthis.detachedNodeToField,\n\t\t\t\t\t\tnodeId.major,\n\t\t\t\t\t\tnodeId.minor,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tentry !== undefined,\n\t\t\t\t\t\t0x9b8 /* Inconsistent data: missing detached node entry */,\n\t\t\t\t\t);\n\t\t\t\t\tsetInNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor, {\n\t\t\t\t\t\t...entry,\n\t\t\t\t\t\tlatestRelevantRevision: updated,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthis.latestRelevantRevisionToFields.delete(current);\n\n\t\t\t\tconst updatedInner = this.latestRelevantRevisionToFields.get(updated);\n\t\t\t\tif (updatedInner !== undefined) {\n\t\t\t\t\tfor (const [root, nodeId] of inner) {\n\t\t\t\t\t\tupdatedInner.set(root, nodeId);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.latestRelevantRevisionToFields.set(updated, inner);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Update the major keys corresponding to `current`\n\t\t{\n\t\t\tconst innerCurrent = this.detachedNodeToField.get(current);\n\t\t\tif (innerCurrent !== undefined) {\n\t\t\t\tthis.detachedNodeToField.delete(current);\n\t\t\t\tconst innerUpdated = this.detachedNodeToField.get(updated);\n\t\t\t\tif (innerUpdated === undefined) {\n\t\t\t\t\tthis.detachedNodeToField.set(updated, innerCurrent);\n\t\t\t\t} else {\n\t\t\t\t\tfor (const [minor, entry] of innerCurrent) {\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tinnerUpdated.get(minor) === undefined,\n\t\t\t\t\t\t\t0x7a9 /* Collision during index update */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tinnerUpdated.set(minor, entry);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const [minor, entry] of innerCurrent) {\n\t\t\t\t\tconst entryInLatest = this.latestRelevantRevisionToFields.get(\n\t\t\t\t\t\tentry.latestRelevantRevision,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tentryInLatest !== undefined,\n\t\t\t\t\t\t0x9b9 /* Inconsistent data: missing node entry in latestRelevantRevision */,\n\t\t\t\t\t);\n\t\t\t\t\tentryInLatest.set(entry.root, { major: updated, minor });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns a field key for the given ID.\n\t * This does not save the field key on the index. To do so, call {@link createEntry}.\n\t */\n\tpublic toFieldKey(id: ForestRootId): FieldKey {\n\t\treturn brand(`${this.name}-${id}`);\n\t}\n\n\t/**\n\t * Returns the FieldKey associated with the given id.\n\t * Returns undefined if no such id is known to the index.\n\t */\n\tpublic tryGetEntry(id: Delta.DetachedNodeId): ForestRootId | undefined {\n\t\treturn tryGetFromNestedMap(this.detachedNodeToField, id.major, id.minor)?.root;\n\t}\n\n\t/**\n\t * Returns the FieldKey associated with the given id.\n\t * Fails if no such id is known to the index.\n\t */\n\tpublic getEntry(id: Delta.DetachedNodeId): ForestRootId {\n\t\tconst key = this.tryGetEntry(id);\n\t\tassert(key !== undefined, 0x7aa /* Unknown removed node ID */);\n\t\treturn key;\n\t}\n\n\t/**\n\t * Returns the detached root IDs for all the trees that were detached or last modified by the given revision.\n\t */\n\tpublic *getRootsLastTouchedByRevision(revision: RevisionTag): Iterable<ForestRootId> {\n\t\tconst roots = this.latestRelevantRevisionToFields.get(revision);\n\t\tif (roots !== undefined) {\n\t\t\tyield* roots.keys();\n\t\t}\n\t}\n\n\t/**\n\t * Removes the detached roots for all the trees that were detached or last modified by the given revision.\n\t */\n\tpublic deleteRootsLastTouchedByRevision(revision: RevisionTag): void {\n\t\tconst entries = this.latestRelevantRevisionToFields.get(revision);\n\t\tif (entries === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.latestRelevantRevisionToFields.delete(revision);\n\t\tfor (const detachedNodeId of entries.values()) {\n\t\t\tconst found = deleteFromNestedMap(\n\t\t\t\tthis.detachedNodeToField,\n\t\t\t\tdetachedNodeId.major,\n\t\t\t\tdetachedNodeId.minor,\n\t\t\t);\n\t\t\tassert(found, 0x9ba /* Unable to delete unknown entry */);\n\t\t}\n\t}\n\n\tpublic deleteEntry(nodeId: Delta.DetachedNodeId): void {\n\t\tconst entry = tryGetFromNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor);\n\t\tassert(entry !== undefined, 0x9bb /* Unable to delete unknown entry */);\n\t\tdeleteFromNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor);\n\t\tdeleteFromNestedMap(\n\t\t\tthis.latestRelevantRevisionToFields,\n\t\t\tentry.latestRelevantRevision,\n\t\t\tentry.root,\n\t\t);\n\t}\n\n\t/**\n\t * Associates the DetachedNodeId with a field key and creates an entry for it in the index.\n\t * @param nodeId - The ID of the detached node.\n\t * @param revision - The revision that last detached the root.\n\t * See {@link DetachedField.latestRelevantRevision} for details.\n\t * @param count - The number of entries to create. These entries will have consecutive minor IDs.\n\t * @returns The atomic ID that the `DetachedFieldIndex` uses to uniquely identify the first root.\n\t */\n\tpublic createEntry(\n\t\tnodeId?: Delta.DetachedNodeId,\n\t\trevision?: RevisionTag,\n\t\tcount: number = 1,\n\t): ForestRootId {\n\t\tconst root = this.rootIdAllocator.allocate(count);\n\t\tif (nodeId !== undefined) {\n\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\tassert(\n\t\t\t\t\ttryGetFromNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor + i) ===\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t0x7ce /* Detached node ID already exists in index */,\n\t\t\t\t);\n\t\t\t\tsetInNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor + i, {\n\t\t\t\t\troot: brand<ForestRootId>(root + i),\n\t\t\t\t\tlatestRelevantRevision: revision,\n\t\t\t\t});\n\t\t\t\tsetInNestedMap(this.latestRelevantRevisionToFields, revision, root + i, {\n\t\t\t\t\tmajor: nodeId.major,\n\t\t\t\t\tminor: nodeId.minor + i,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn root;\n\t}\n\n\t/**\n\t * Updates the latest revision that is relevant to the provided root\n\t */\n\tpublic updateLatestRevision(\n\t\tid: Delta.DetachedNodeId,\n\t\trevision: RevisionTag | undefined,\n\t): void {\n\t\tconst fieldEntry = tryGetFromNestedMap(this.detachedNodeToField, id.major, id.minor);\n\t\tassert(\n\t\t\tfieldEntry !== undefined,\n\t\t\t0x9bc /* detached node id does not exist in the detached field index */,\n\t\t);\n\t\tconst { root, latestRelevantRevision: previousRevision } = fieldEntry;\n\n\t\t// remove this root from the set of roots for the previous latest revision\n\t\tdeleteFromNestedMap(this.latestRelevantRevisionToFields, previousRevision, root);\n\n\t\t// add this root to the set of roots for the new latest revision\n\t\tsetInNestedMap(this.latestRelevantRevisionToFields, revision, root, id);\n\t\tsetInNestedMap(this.detachedNodeToField, id.major, id.minor, {\n\t\t\troot,\n\t\t\tlatestRelevantRevision: revision,\n\t\t});\n\t}\n\n\tpublic encode(): JsonCompatibleReadOnly {\n\t\treturn this.codec.encode({\n\t\t\tdata: this.detachedNodeToField,\n\t\t\tmaxId: this.rootIdAllocator.getMaxId(),\n\t\t});\n\t}\n\n\t/**\n\t * Loads the tree index from the given string, this overrides any existing data.\n\t */\n\tpublic loadData(data: JsonCompatibleReadOnly): void {\n\t\tconst detachedFieldIndex: DetachedFieldSummaryData = this.codec.decode(data);\n\n\t\tthis.rootIdAllocator = idAllocatorFromMaxId(\n\t\t\tdetachedFieldIndex.maxId,\n\t\t) as IdAllocator<ForestRootId>;\n\n\t\tthis.detachedNodeToField = new Map();\n\t\tthis.latestRelevantRevisionToFields = new Map();\n\t\tthis.isFullyLoaded = false;\n\t\tconst rootMap = new Map<ForestRootId, Delta.DetachedNodeId>();\n\t\tforEachInNestedMap(detachedFieldIndex.data, ({ root }, major, minor) => {\n\t\t\tsetInNestedMap(this.detachedNodeToField, major, minor, { root });\n\t\t\trootMap.set(root, { major, minor });\n\t\t});\n\n\t\tthis.latestRelevantRevisionToFields.set(undefined, rootMap);\n\t}\n\n\t/**\n\t * Sets the latest relevant revision for any roots that have an undefined latest relevant revision.\n\t * This occurs when the detached field index is loaded from a summary and can only be called once after\n\t * the summary has been loaded.\n\t */\n\tpublic setRevisionsForLoadedData(latestRevision: RevisionTag): void {\n\t\tassert(\n\t\t\t!this.isFullyLoaded,\n\t\t\t0x9bd /* revisions should only be set once using this function after loading data from a summary */,\n\t\t);\n\n\t\tconst newDetachedNodeToField: NestedMap<Major, Minor, DetachedField> = new Map();\n\t\tconst rootMap = new Map();\n\t\tforEachInNestedMap(this.detachedNodeToField, ({ root }, major, minor) => {\n\t\t\tsetInNestedMap(newDetachedNodeToField, major, minor, {\n\t\t\t\troot,\n\t\t\t\tlatestRelevantRevision: latestRevision,\n\t\t\t});\n\t\t\trootMap.set(root, { major, minor });\n\t\t});\n\n\t\tthis.detachedNodeToField = newDetachedNodeToField;\n\t\tthis.latestRelevantRevisionToFields.delete(undefined);\n\t\tthis.latestRelevantRevisionToFields.set(latestRevision, rootMap);\n\t\tthis.isFullyLoaded = true;\n\t}\n}\n"]}
1
+ {"version":3,"file":"detachedFieldIndex.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,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E,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACvE,cAAc,CAAC,sBAAsB,EAAE,KAAK,EAAE,KAAK,EAAE;gBACpD,IAAI;gBACJ,sBAAsB,EAAE,cAAc;aACtC,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,mBAAmB,GAAG,sBAAsB,CAAC;QAClD,IAAI,CAAC,8BAA8B,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC3B,CAAC;CACD","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 type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\tFormatValidatorNoOp,\n\ttype IJsonCodec,\n} from \"../../codec/index.js\";\nimport {\n\ttype IdAllocator,\n\ttype JsonCompatibleReadOnly,\n\ttype NestedMap,\n\tbrand,\n\tdeleteFromNestedMap,\n\tforEachInNestedMap,\n\tidAllocatorFromMaxId,\n\tpopulateNestedMap,\n\tsetInNestedMap,\n\ttryGetFromNestedMap,\n} from \"../../util/index.js\";\nimport type { RevisionTag, RevisionTagCodec } from \"../rebase/index.js\";\nimport type { FieldKey } from \"../schema-stored/index.js\";\n\nimport type * as Delta from \"./delta.js\";\nimport type {\n\tDetachedField,\n\tDetachedFieldSummaryData,\n\tForestRootId,\n\tMajor,\n\tMinor,\n} from \"./detachedFieldIndexTypes.js\";\nimport { makeDetachedFieldIndexCodec } from \"./detachedFieldIndexCodecs.js\";\n\n/**\n * Readonly interface for {@link DetachedFieldIndex}.\n */\nexport interface ReadOnlyDetachedFieldIndex {\n\t/**\n\t * Creates a deep clone of this `DetachedFieldIndex`.\n\t */\n\tclone(): DetachedFieldIndex;\n\n\t/**\n\t * Returns a field key for the given ID.\n\t * This does not save the field key on the index. To do so, call {@link createEntry}.\n\t */\n\ttoFieldKey(id: ForestRootId): FieldKey;\n\n\t/**\n\t * Returns a node ID for the node in the given field.\n\t * @param field - The field key where the detached node resides.\n\t */\n\tfromFieldKey(field: FieldKey): Delta.DetachedNodeId;\n\n\t/**\n\t * Returns the `ForestRootId` associated with the given id.\n\t * Returns undefined if no such id is known to the index.\n\t */\n\ttryGetEntry(id: Delta.DetachedNodeId): ForestRootId | undefined;\n\n\t/**\n\t * Returns the `ForestRootId` associated with the given id.\n\t * Fails if no such id is known to the index.\n\t */\n\tgetEntry(id: Delta.DetachedNodeId): ForestRootId;\n}\n\n/**\n * Restores the originating DetachedFieldIndex to the state it was in when the checkpoint was created.\n * Can be invoked multiple times.\n */\nexport type DetachedFieldIndexCheckpoint = () => void;\n\n/**\n * The tree index records detached field IDs and associates them with a change atom ID.\n */\nexport class DetachedFieldIndex implements ReadOnlyDetachedFieldIndex {\n\t/**\n\t * A mapping from detached node ids to detached fields.\n\t */\n\tprivate detachedNodeToField: NestedMap<Major, Minor, DetachedField> = new Map();\n\t/**\n\t * A map from revisions to all detached fields for which the revision is the latest relevant revision.\n\t * See {@link DetachedField.latestRelevantRevision}.\n\t *\n\t * @remarks\n\t * undefined revisions are tolerated but any roots not associated with a revision must be disposed manually\n\t */\n\tprivate latestRelevantRevisionToFields: NestedMap<\n\t\tRevisionTag | undefined,\n\t\tForestRootId,\n\t\tDelta.DetachedNodeId\n\t> = new Map();\n\n\tprivate readonly codec: IJsonCodec<DetachedFieldSummaryData>;\n\tprivate readonly options: CodecWriteOptions;\n\n\t/**\n\t * The process for loading `DetachedFieldIndex` data from a summary is split into two steps:\n\t * 1. Call {@link loadData}\n\t * 2. Call {@link setRevisionsForLoadedData}\n\t *\n\t * This flag is only set to `false` after calling `loadData` and is set back to `true` after calling `setRevisionsForLoadedData`.\n\t * This helps ensure that `setRevisionsForLoadedData` is only called after `loadData` and only called once.\n\t */\n\tprivate isFullyLoaded = true;\n\n\t/**\n\t * @param name - A name for the index, used as a prefix for the generated field keys.\n\t * @param rootIdAllocator - An ID allocator used to generate unique field keys.\n\t */\n\tpublic constructor(\n\t\tprivate readonly name: string,\n\t\tprivate rootIdAllocator: IdAllocator<ForestRootId>,\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\toptions?: CodecWriteOptions,\n\t) {\n\t\tthis.options = options ?? {\n\t\t\tjsonValidator: FormatValidatorNoOp,\n\t\t\tminVersionForCollab: FluidClientVersion.v2_0,\n\t\t};\n\t\tthis.codec = makeDetachedFieldIndexCodec(revisionTagCodec, this.options, idCompressor);\n\t}\n\n\tpublic clone(): DetachedFieldIndex {\n\t\tconst clone = new DetachedFieldIndex(\n\t\t\tthis.name,\n\t\t\tidAllocatorFromMaxId(this.rootIdAllocator.getMaxId()) as IdAllocator<ForestRootId>,\n\t\t\tthis.revisionTagCodec,\n\t\t\tthis.idCompressor,\n\t\t\tthis.options,\n\t\t);\n\t\tpopulateNestedMap(this.detachedNodeToField, clone.detachedNodeToField, true);\n\t\tpopulateNestedMap(\n\t\t\tthis.latestRelevantRevisionToFields,\n\t\t\tclone.latestRelevantRevisionToFields,\n\t\t\ttrue,\n\t\t);\n\t\treturn clone;\n\t}\n\n\t/**\n\t * Creates a restorable checkpoint of the current state of the DetachedFieldIndex.\n\t */\n\tpublic createCheckpoint(): DetachedFieldIndexCheckpoint {\n\t\tconst clone = this.clone();\n\t\treturn () => {\n\t\t\tthis.purge();\n\t\t\tpopulateNestedMap(clone.detachedNodeToField, this.detachedNodeToField, true);\n\t\t\tpopulateNestedMap(\n\t\t\t\tclone.latestRelevantRevisionToFields,\n\t\t\t\tthis.latestRelevantRevisionToFields,\n\t\t\t\ttrue,\n\t\t\t);\n\t\t\tthis.rootIdAllocator = idAllocatorFromMaxId(\n\t\t\t\tclone.rootIdAllocator.getMaxId(),\n\t\t\t) as IdAllocator<ForestRootId>;\n\t\t};\n\t}\n\n\tpublic *entries(): Generator<{\n\t\troot: ForestRootId;\n\t\tlatestRelevantRevision?: RevisionTag;\n\t\tid: Delta.DetachedNodeId;\n\t}> {\n\t\tfor (const [major, innerMap] of this.detachedNodeToField) {\n\t\t\tif (major !== undefined) {\n\t\t\t\tfor (const [minor, { root, latestRelevantRevision }] of innerMap) {\n\t\t\t\t\tyield latestRelevantRevision !== undefined\n\t\t\t\t\t\t? { id: { major, minor }, root, latestRelevantRevision }\n\t\t\t\t\t\t: { id: { major, minor }, root };\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const [minor, { root, latestRelevantRevision }] of innerMap) {\n\t\t\t\t\tyield latestRelevantRevision !== undefined\n\t\t\t\t\t\t? { id: { minor }, root, latestRelevantRevision }\n\t\t\t\t\t\t: { id: { minor }, root };\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Removes all entries from the index.\n\t */\n\tpublic purge(): void {\n\t\tthis.detachedNodeToField.clear();\n\t\tthis.latestRelevantRevisionToFields.clear();\n\t}\n\n\tpublic updateMajor(current: Major, updated: Major): void {\n\t\t// Update latestRelevantRevision information corresponding to `current`\n\t\t{\n\t\t\tconst inner = this.latestRelevantRevisionToFields.get(current);\n\t\t\tif (inner !== undefined) {\n\t\t\t\tfor (const nodeId of inner.values()) {\n\t\t\t\t\tconst entry = tryGetFromNestedMap(\n\t\t\t\t\t\tthis.detachedNodeToField,\n\t\t\t\t\t\tnodeId.major,\n\t\t\t\t\t\tnodeId.minor,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tentry !== undefined,\n\t\t\t\t\t\t0x9b8 /* Inconsistent data: missing detached node entry */,\n\t\t\t\t\t);\n\t\t\t\t\tsetInNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor, {\n\t\t\t\t\t\t...entry,\n\t\t\t\t\t\tlatestRelevantRevision: updated,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthis.latestRelevantRevisionToFields.delete(current);\n\n\t\t\t\tconst updatedInner = this.latestRelevantRevisionToFields.get(updated);\n\t\t\t\tif (updatedInner !== undefined) {\n\t\t\t\t\tfor (const [root, nodeId] of inner) {\n\t\t\t\t\t\tupdatedInner.set(root, nodeId);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.latestRelevantRevisionToFields.set(updated, inner);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Update the major keys corresponding to `current`\n\t\t{\n\t\t\tconst innerCurrent = this.detachedNodeToField.get(current);\n\t\t\tif (innerCurrent !== undefined) {\n\t\t\t\tthis.detachedNodeToField.delete(current);\n\t\t\t\tconst innerUpdated = this.detachedNodeToField.get(updated);\n\t\t\t\tif (innerUpdated === undefined) {\n\t\t\t\t\tthis.detachedNodeToField.set(updated, innerCurrent);\n\t\t\t\t} else {\n\t\t\t\t\tfor (const [minor, entry] of innerCurrent) {\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tinnerUpdated.get(minor) === undefined,\n\t\t\t\t\t\t\t0x7a9 /* Collision during index update */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tinnerUpdated.set(minor, entry);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const [minor, entry] of innerCurrent) {\n\t\t\t\t\tconst entryInLatest = this.latestRelevantRevisionToFields.get(\n\t\t\t\t\t\tentry.latestRelevantRevision,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tentryInLatest !== undefined,\n\t\t\t\t\t\t0x9b9 /* Inconsistent data: missing node entry in latestRelevantRevision */,\n\t\t\t\t\t);\n\t\t\t\t\tentryInLatest.set(entry.root, { major: updated, minor });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic toFieldKey(id: ForestRootId): FieldKey {\n\t\treturn brand(`${this.name}-${id}`);\n\t}\n\n\tpublic fromFieldKey(field: FieldKey): Delta.DetachedNodeId {\n\t\t// TODO: maintain a lookup table or use field keys that encode the detached node ID\n\t\tfor (const { id, root } of this.entries()) {\n\t\t\tif (this.toFieldKey(root) === field) {\n\t\t\t\treturn id;\n\t\t\t}\n\t\t}\n\t\tfail(\"No known detached roots in the given field\");\n\t}\n\n\tpublic tryGetEntry(id: Delta.DetachedNodeId): ForestRootId | undefined {\n\t\treturn tryGetFromNestedMap(this.detachedNodeToField, id.major, id.minor)?.root;\n\t}\n\n\tpublic getEntry(id: Delta.DetachedNodeId): ForestRootId {\n\t\tconst key = this.tryGetEntry(id);\n\t\tassert(key !== undefined, 0x7aa /* Unknown removed node ID */);\n\t\treturn key;\n\t}\n\n\t/**\n\t * Returns the detached root IDs for all the trees that were detached or last modified by the given revision.\n\t */\n\tpublic *getRootsLastTouchedByRevision(revision: RevisionTag): Iterable<ForestRootId> {\n\t\tconst roots = this.latestRelevantRevisionToFields.get(revision);\n\t\tif (roots !== undefined) {\n\t\t\tyield* roots.keys();\n\t\t}\n\t}\n\n\t/**\n\t * Removes the detached roots for all the trees that were detached or last modified by the given revision.\n\t */\n\tpublic deleteRootsLastTouchedByRevision(revision: RevisionTag): void {\n\t\tconst entries = this.latestRelevantRevisionToFields.get(revision);\n\t\tif (entries === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.latestRelevantRevisionToFields.delete(revision);\n\t\tfor (const detachedNodeId of entries.values()) {\n\t\t\tconst found = deleteFromNestedMap(\n\t\t\t\tthis.detachedNodeToField,\n\t\t\t\tdetachedNodeId.major,\n\t\t\t\tdetachedNodeId.minor,\n\t\t\t);\n\t\t\tassert(found, 0x9ba /* Unable to delete unknown entry */);\n\t\t}\n\t}\n\n\tpublic deleteEntry(nodeId: Delta.DetachedNodeId): void {\n\t\tconst entry = tryGetFromNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor);\n\t\tassert(entry !== undefined, 0x9bb /* Unable to delete unknown entry */);\n\t\tdeleteFromNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor);\n\t\tdeleteFromNestedMap(\n\t\t\tthis.latestRelevantRevisionToFields,\n\t\t\tentry.latestRelevantRevision,\n\t\t\tentry.root,\n\t\t);\n\t}\n\n\t/**\n\t * Associates the DetachedNodeId with a field key and creates an entry for it in the index.\n\t * @param nodeId - The ID of the detached node.\n\t * @param revision - The revision that last detached the root.\n\t * See {@link DetachedField.latestRelevantRevision} for details.\n\t * @param count - The number of entries to create. These entries will have consecutive minor IDs.\n\t * @returns The atomic ID that the `DetachedFieldIndex` uses to uniquely identify the first root.\n\t */\n\tpublic createEntry(\n\t\tnodeId?: Delta.DetachedNodeId,\n\t\trevision?: RevisionTag,\n\t\tcount: number = 1,\n\t): ForestRootId {\n\t\tconst root = this.rootIdAllocator.allocate(count);\n\t\tif (nodeId !== undefined) {\n\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\tassert(\n\t\t\t\t\ttryGetFromNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor + i) ===\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t0x7ce /* Detached node ID already exists in index */,\n\t\t\t\t);\n\t\t\t\tsetInNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor + i, {\n\t\t\t\t\troot: brand<ForestRootId>(root + i),\n\t\t\t\t\tlatestRelevantRevision: revision,\n\t\t\t\t});\n\t\t\t\tsetInNestedMap(this.latestRelevantRevisionToFields, revision, root + i, {\n\t\t\t\t\tmajor: nodeId.major,\n\t\t\t\t\tminor: nodeId.minor + i,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn root;\n\t}\n\n\t/**\n\t * Updates the latest revision that is relevant to the provided root\n\t */\n\tpublic updateLatestRevision(\n\t\tid: Delta.DetachedNodeId,\n\t\trevision: RevisionTag | undefined,\n\t): void {\n\t\tconst fieldEntry = tryGetFromNestedMap(this.detachedNodeToField, id.major, id.minor);\n\t\tassert(\n\t\t\tfieldEntry !== undefined,\n\t\t\t0x9bc /* detached node id does not exist in the detached field index */,\n\t\t);\n\t\tconst { root, latestRelevantRevision: previousRevision } = fieldEntry;\n\n\t\t// remove this root from the set of roots for the previous latest revision\n\t\tdeleteFromNestedMap(this.latestRelevantRevisionToFields, previousRevision, root);\n\n\t\t// add this root to the set of roots for the new latest revision\n\t\tsetInNestedMap(this.latestRelevantRevisionToFields, revision, root, id);\n\t\tsetInNestedMap(this.detachedNodeToField, id.major, id.minor, {\n\t\t\troot,\n\t\t\tlatestRelevantRevision: revision,\n\t\t});\n\t}\n\n\tpublic encode(): JsonCompatibleReadOnly {\n\t\treturn this.codec.encode({\n\t\t\tdata: this.detachedNodeToField,\n\t\t\tmaxId: this.rootIdAllocator.getMaxId(),\n\t\t});\n\t}\n\n\t/**\n\t * Loads the tree index from the given string, this overrides any existing data.\n\t */\n\tpublic loadData(data: JsonCompatibleReadOnly): void {\n\t\tconst detachedFieldIndex: DetachedFieldSummaryData = this.codec.decode(data);\n\n\t\tthis.rootIdAllocator = idAllocatorFromMaxId(\n\t\t\tdetachedFieldIndex.maxId,\n\t\t) as IdAllocator<ForestRootId>;\n\n\t\tthis.detachedNodeToField = new Map();\n\t\tthis.latestRelevantRevisionToFields = new Map();\n\t\tthis.isFullyLoaded = false;\n\t\tconst rootMap = new Map<ForestRootId, Delta.DetachedNodeId>();\n\t\tforEachInNestedMap(detachedFieldIndex.data, ({ root }, major, minor) => {\n\t\t\tsetInNestedMap(this.detachedNodeToField, major, minor, { root });\n\t\t\trootMap.set(root, { major, minor });\n\t\t});\n\n\t\tthis.latestRelevantRevisionToFields.set(undefined, rootMap);\n\t}\n\n\t/**\n\t * Sets the latest relevant revision for any roots that have an undefined latest relevant revision.\n\t * This occurs when the detached field index is loaded from a summary and can only be called once after\n\t * the summary has been loaded.\n\t */\n\tpublic setRevisionsForLoadedData(latestRevision: RevisionTag): void {\n\t\tassert(\n\t\t\t!this.isFullyLoaded,\n\t\t\t0x9bd /* revisions should only be set once using this function after loading data from a summary */,\n\t\t);\n\n\t\tconst newDetachedNodeToField: NestedMap<Major, Minor, DetachedField> = new Map();\n\t\tconst rootMap = new Map();\n\t\tforEachInNestedMap(this.detachedNodeToField, ({ root }, major, minor) => {\n\t\t\tsetInNestedMap(newDetachedNodeToField, major, minor, {\n\t\t\t\troot,\n\t\t\t\tlatestRelevantRevision: latestRevision,\n\t\t\t});\n\t\t\trootMap.set(root, { major, minor });\n\t\t});\n\n\t\tthis.detachedNodeToField = newDetachedNodeToField;\n\t\tthis.latestRelevantRevisionToFields.delete(undefined);\n\t\tthis.latestRelevantRevisionToFields.set(latestRevision, rootMap);\n\t\tthis.isFullyLoaded = true;\n\t}\n}\n"]}
@@ -6,7 +6,7 @@ export { type Anchor, type AnchorLocator, AnchorSet, type AnchorSlot, type Ancho
6
6
  export { type ITreeCursor, CursorLocationType, castCursorToSynchronous, mapCursorField, mapCursorFields, forEachNode, forEachNodeInSubtree, forEachField, iterateCursorField, type ITreeCursorSynchronous, type PathRootPrefix, inCursorField, inCursorNode, CursorMarker, isCursor, } from "./cursor.js";
7
7
  export type { ProtoNodes, Root as DeltaRoot, Mark as DeltaMark, DetachedNodeId as DeltaDetachedNodeId, FieldMap as DeltaFieldMap, DetachedNodeChanges as DeltaDetachedNodeChanges, DetachedNodeBuild as DeltaDetachedNodeBuild, DetachedNodeDestruction as DeltaDetachedNodeDestruction, DetachedNodeRename as DeltaDetachedNodeRename, FieldChanges as DeltaFieldChanges, } from "./delta.js";
8
8
  export { type MapTree, type ExclusiveMapTree, deepCopyMapTree } from "./mapTree.js";
9
- export { clonePath, topDownPath, getDepth, type UpPath, type NormalizedUpPath, type INormalizedUpPath, type NormalizedFieldUpPath, type FieldUpPath, type Range, type RangeUpPath, type PlaceUpPath, type PlaceIndex, type NodeIndex, compareUpPaths, compareFieldUpPaths, isDetachedUpPathRoot as isDetachedUpPath, getDetachedFieldContainingPath, type UpPathDefault, } from "./pathTree.js";
9
+ export { clonePath, topDownPath, getDepth, type UpPath, type NormalizedUpPath, type INormalizedUpPath, type NormalizedFieldUpPath, type FieldUpPath, type Range, type RangeUpPath, type PlaceUpPath, type PlaceIndex, type NodeIndex, compareUpPaths, compareFieldUpPaths, isDetachedUpPathRoot, getDetachedFieldContainingPath, getDetachedFieldContainingFieldPath, type UpPathDefault, } from "./pathTree.js";
10
10
  export { type FieldMapObject, type GenericFieldsNode, genericTreeDeleteIfEmpty, genericTreeKeys, type GenericTreeNode, getGenericTreeField, type JsonableTree, setGenericTreeField, } from "./treeTextFormat.js";
11
11
  export { EncodedJsonableTree } from "./persistedTreeTextFormat.js";
12
12
  export { EmptyKey, type TreeType, type ChildLocation, type DetachedField, type ChildCollection, type RootField, type Value, type TreeValue, detachedFieldAsKey, keyAsDetachedField, rootFieldKey, type NodeData, rootField, aboveRootPlaceholder, } from "./types.js";
@@ -15,8 +15,9 @@ export { type AnnouncedVisitor, announceDelta, applyDelta, createAnnouncedVisito
15
15
  export { SparseNode, getDescendant } from "./sparseTree.js";
16
16
  export { deltaForRootInitialization, makeDetachedNodeId, offsetDetachId, emptyDelta, } from "./deltaUtil.js";
17
17
  export { type TreeChunk, dummyRoot, cursorChunk, tryGetChunk, type ChunkedCursor, } from "./chunk.js";
18
- export { DetachedFieldIndex } from "./detachedFieldIndex.js";
18
+ export { DetachedFieldIndex, type DetachedFieldIndexCheckpoint, type ReadOnlyDetachedFieldIndex, } from "./detachedFieldIndex.js";
19
19
  export { getCodecTreeForDetachedFieldIndexFormat } from "./detachedFieldIndexCodecs.js";
20
- export { type DetachedFieldIndexFormatVersion } from "./detachedFieldIndexFormatCommon.js";
20
+ export { DetachedFieldIndexFormatVersion } from "./detachedFieldIndexFormatCommon.js";
21
+ export { type FormatV1 } from "./detachedFieldIndexFormatV1.js";
21
22
  export { type ForestRootId } from "./detachedFieldIndexTypes.js";
22
23
  //# sourceMappingURL=index.d.ts.map