@fluidframework/tree 2.74.0 → 2.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (895) hide show
  1. package/.eslintrc.cjs +1 -16
  2. package/CHANGELOG.md +18 -0
  3. package/api-report/tree.alpha.api.md +20 -2
  4. package/dist/alpha.d.ts +4 -0
  5. package/dist/codec/codec.d.ts +31 -3
  6. package/dist/codec/codec.d.ts.map +1 -1
  7. package/dist/codec/codec.js +10 -0
  8. package/dist/codec/codec.js.map +1 -1
  9. package/dist/codec/index.d.ts +2 -2
  10. package/dist/codec/index.d.ts.map +1 -1
  11. package/dist/codec/index.js +2 -2
  12. package/dist/codec/index.js.map +1 -1
  13. package/dist/codec/versioned/codec.d.ts +80 -22
  14. package/dist/codec/versioned/codec.d.ts.map +1 -1
  15. package/dist/codec/versioned/codec.js +137 -15
  16. package/dist/codec/versioned/codec.js.map +1 -1
  17. package/dist/codec/versioned/index.d.ts +1 -1
  18. package/dist/codec/versioned/index.d.ts.map +1 -1
  19. package/dist/codec/versioned/index.js +2 -2
  20. package/dist/codec/versioned/index.js.map +1 -1
  21. package/dist/core/index.d.ts +2 -2
  22. package/dist/core/index.d.ts.map +1 -1
  23. package/dist/core/index.js +3 -4
  24. package/dist/core/index.js.map +1 -1
  25. package/dist/core/rebase/changeRebaser.d.ts +36 -2
  26. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  27. package/dist/core/rebase/changeRebaser.js.map +1 -1
  28. package/dist/core/rebase/index.d.ts +2 -2
  29. package/dist/core/rebase/index.d.ts.map +1 -1
  30. package/dist/core/rebase/index.js +1 -2
  31. package/dist/core/rebase/index.js.map +1 -1
  32. package/dist/core/rebase/types.d.ts +6 -2
  33. package/dist/core/rebase/types.d.ts.map +1 -1
  34. package/dist/core/rebase/types.js +1 -12
  35. package/dist/core/rebase/types.js.map +1 -1
  36. package/dist/core/rebase/utils.js +3 -3
  37. package/dist/core/rebase/utils.js.map +1 -1
  38. package/dist/core/schema-stored/schema.js +3 -3
  39. package/dist/core/schema-stored/schema.js.map +1 -1
  40. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  41. package/dist/core/tree/anchorSet.js +3 -4
  42. package/dist/core/tree/anchorSet.js.map +1 -1
  43. package/dist/core/tree/detachedFieldIndex.d.ts +1 -2
  44. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  45. package/dist/core/tree/detachedFieldIndex.js +12 -56
  46. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  47. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +18 -10
  48. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  49. package/dist/core/tree/detachedFieldIndexCodecCommon.js +6 -6
  50. package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  51. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts +2 -3
  52. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  53. package/dist/core/tree/detachedFieldIndexCodecV1.js +4 -5
  54. package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  55. package/dist/core/tree/detachedFieldIndexCodecV2.d.ts +2 -3
  56. package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  57. package/dist/core/tree/detachedFieldIndexCodecV2.js +4 -6
  58. package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  59. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +5 -6
  60. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  61. package/dist/core/tree/detachedFieldIndexCodecs.js +11 -41
  62. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  63. package/dist/core/tree/index.d.ts +1 -1
  64. package/dist/core/tree/index.d.ts.map +1 -1
  65. package/dist/core/tree/index.js +2 -2
  66. package/dist/core/tree/index.js.map +1 -1
  67. package/dist/core/tree/mapTree.js +1 -1
  68. package/dist/core/tree/mapTree.js.map +1 -1
  69. package/dist/core/tree/sparseTree.d.ts.map +1 -1
  70. package/dist/core/tree/sparseTree.js +1 -0
  71. package/dist/core/tree/sparseTree.js.map +1 -1
  72. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  73. package/dist/core/tree/treeTextFormat.js +5 -9
  74. package/dist/core/tree/treeTextFormat.js.map +1 -1
  75. package/dist/feature-libraries/changeAtomIdBTree.d.ts +10 -0
  76. package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -0
  77. package/dist/feature-libraries/changeAtomIdBTree.js +16 -0
  78. package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -0
  79. package/dist/feature-libraries/chunked-forest/basicChunk.js +1 -1
  80. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  81. package/dist/feature-libraries/chunked-forest/chunkedForest.js +6 -6
  82. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  83. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  84. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +7 -4
  85. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  86. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  87. package/dist/feature-libraries/chunked-forest/codec/codecs.js +19 -11
  88. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  89. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
  90. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  91. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +9 -5
  92. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  93. package/dist/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  94. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  95. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +15 -5
  96. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  97. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +19 -14
  98. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  99. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -1
  100. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  101. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  102. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  103. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +2 -0
  104. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  105. package/dist/feature-libraries/default-schema/mappedEditBuilder.js +6 -0
  106. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  107. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  108. package/dist/feature-libraries/flex-tree/lazyField.js +11 -13
  109. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  110. package/dist/feature-libraries/index.d.ts +3 -2
  111. package/dist/feature-libraries/index.d.ts.map +1 -1
  112. package/dist/feature-libraries/index.js +9 -7
  113. package/dist/feature-libraries/index.js.map +1 -1
  114. package/dist/feature-libraries/indexing/anchorTreeIndex.js +6 -6
  115. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  116. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  117. package/dist/feature-libraries/mitigatedChangeFamily.js +10 -1
  118. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  119. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  120. package/dist/feature-libraries/modular-schema/comparison.js +12 -9
  121. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  122. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +25 -0
  123. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -0
  124. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +59 -0
  125. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -0
  126. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +3 -3
  127. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  128. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  129. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  130. package/dist/feature-libraries/modular-schema/genericFieldKind.js +4 -4
  131. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  132. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +2 -2
  133. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  134. package/dist/feature-libraries/modular-schema/index.d.ts +4 -2
  135. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  136. package/dist/feature-libraries/modular-schema/index.js +11 -7
  137. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  138. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +49 -0
  139. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -0
  140. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +315 -0
  141. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -0
  142. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +15 -0
  143. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -0
  144. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +31 -0
  145. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -0
  146. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  147. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  148. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +25 -288
  149. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  150. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +14 -8
  151. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  152. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +225 -195
  153. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  154. package/dist/feature-libraries/modular-schema/{modularChangeFormat.d.ts → modularChangeFormatV1.d.ts} +5 -6
  155. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -0
  156. package/dist/feature-libraries/modular-schema/{modularChangeFormat.js → modularChangeFormatV1.js} +7 -7
  157. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -0
  158. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +112 -0
  159. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -0
  160. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +21 -0
  161. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -0
  162. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +13 -3
  163. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  164. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  165. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -1
  166. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  167. package/dist/feature-libraries/object-forest/objectForest.js +4 -4
  168. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  169. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  170. package/dist/feature-libraries/optional-field/optionalField.js +34 -39
  171. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  172. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  173. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +14 -2
  174. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  175. package/dist/feature-libraries/schema-index/codec.d.ts +7 -21
  176. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  177. package/dist/feature-libraries/schema-index/codec.js +28 -70
  178. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  179. package/dist/feature-libraries/schema-index/index.d.ts +2 -2
  180. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  181. package/dist/feature-libraries/schema-index/index.js +2 -5
  182. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  183. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +1 -9
  184. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  185. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -12
  186. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  187. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
  188. package/dist/feature-libraries/schemaChecker.js +11 -6
  189. package/dist/feature-libraries/schemaChecker.js.map +1 -1
  190. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  191. package/dist/feature-libraries/sequence-field/compose.js +17 -13
  192. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  193. package/dist/feature-libraries/sequence-field/invert.js +5 -4
  194. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  195. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  196. package/dist/feature-libraries/sequence-field/moveEffectTable.js +15 -9
  197. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  198. package/dist/feature-libraries/sequence-field/rebase.js +26 -18
  199. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  200. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts +2 -2
  201. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  202. package/dist/feature-libraries/sequence-field/replaceRevisions.js +40 -35
  203. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  204. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  205. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +16 -8
  206. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  207. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  208. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +4 -2
  209. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  210. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  211. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +6 -3
  212. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  213. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  214. package/dist/feature-libraries/sequence-field/utils.js +46 -27
  215. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  216. package/dist/feature-libraries/treeCursorUtils.js +7 -7
  217. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  218. package/dist/feature-libraries/treeTextCursor.js +2 -2
  219. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  220. package/dist/feature-libraries/valueUtilities.d.ts.map +1 -1
  221. package/dist/feature-libraries/valueUtilities.js +16 -8
  222. package/dist/feature-libraries/valueUtilities.js.map +1 -1
  223. package/dist/index.d.ts +2 -2
  224. package/dist/index.d.ts.map +1 -1
  225. package/dist/index.js.map +1 -1
  226. package/dist/packageVersion.d.ts +1 -1
  227. package/dist/packageVersion.js +1 -1
  228. package/dist/packageVersion.js.map +1 -1
  229. package/dist/shared-tree/schematizingTreeView.d.ts +2 -3
  230. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  231. package/dist/shared-tree/schematizingTreeView.js +20 -9
  232. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  233. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  234. package/dist/shared-tree/sharedTree.js +61 -44
  235. package/dist/shared-tree/sharedTree.js.map +1 -1
  236. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  237. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  238. package/dist/shared-tree/sharedTreeChangeCodecs.js +9 -8
  239. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  240. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  241. package/dist/shared-tree/sharedTreeChangeEnricher.js +4 -2
  242. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  243. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +3 -2
  244. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  245. package/dist/shared-tree/sharedTreeChangeFamily.js +19 -14
  246. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  247. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  248. package/dist/shared-tree/sharedTreeEditBuilder.js +1 -1
  249. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  250. package/dist/shared-tree/treeAlpha.d.ts +35 -29
  251. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  252. package/dist/shared-tree/treeAlpha.js +21 -23
  253. package/dist/shared-tree/treeAlpha.js.map +1 -1
  254. package/dist/shared-tree/treeCheckout.d.ts +2 -0
  255. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  256. package/dist/shared-tree/treeCheckout.js +31 -18
  257. package/dist/shared-tree/treeCheckout.js.map +1 -1
  258. package/dist/shared-tree-core/branch.d.ts +3 -1
  259. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  260. package/dist/shared-tree-core/branch.js +5 -3
  261. package/dist/shared-tree-core/branch.js.map +1 -1
  262. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  263. package/dist/shared-tree-core/branchCommitEnricher.js +1 -1
  264. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  265. package/dist/shared-tree-core/editManager.js +1 -1
  266. package/dist/shared-tree-core/editManager.js.map +1 -1
  267. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  268. package/dist/shared-tree-core/editManagerCodecs.js +9 -4
  269. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  270. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +1 -0
  271. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  272. package/dist/shared-tree-core/editManagerFormatCommons.js +6 -0
  273. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  274. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  275. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  276. package/dist/shared-tree-core/editManagerFormatV1toV4.js +1 -0
  277. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  278. package/dist/shared-tree-core/editManagerSummarizer.js +3 -3
  279. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  280. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  281. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  282. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  283. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  284. package/dist/shared-tree-core/messageCodecVSharedBranches.js +2 -1
  285. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  286. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  287. package/dist/shared-tree-core/messageCodecs.js +8 -4
  288. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  289. package/dist/shared-tree-core/messageFormat.d.ts +1 -0
  290. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  291. package/dist/shared-tree-core/messageFormat.js +6 -0
  292. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  293. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
  294. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  295. package/dist/shared-tree-core/messageFormatV1ToV4.js +8 -1
  296. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  297. package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  298. package/dist/shared-tree-core/sequenceIdUtils.js +4 -4
  299. package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
  300. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  301. package/dist/shared-tree-core/sharedTreeCore.js +12 -8
  302. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  303. package/dist/shared-tree-core/transaction.d.ts +25 -8
  304. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  305. package/dist/shared-tree-core/transaction.js +65 -30
  306. package/dist/shared-tree-core/transaction.js.map +1 -1
  307. package/dist/shared-tree-core/transactionEnricher.d.ts +2 -2
  308. package/dist/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  309. package/dist/shared-tree-core/transactionEnricher.js +3 -3
  310. package/dist/shared-tree-core/transactionEnricher.js.map +1 -1
  311. package/dist/simple-tree/api/configuration.js +1 -1
  312. package/dist/simple-tree/api/configuration.js.map +1 -1
  313. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  314. package/dist/simple-tree/api/customTree.js +13 -9
  315. package/dist/simple-tree/api/customTree.js.map +1 -1
  316. package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
  317. package/dist/simple-tree/api/discrepancies.js +21 -17
  318. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  319. package/dist/simple-tree/api/index.d.ts +1 -1
  320. package/dist/simple-tree/api/index.d.ts.map +1 -1
  321. package/dist/simple-tree/api/index.js.map +1 -1
  322. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  323. package/dist/simple-tree/api/schemaFactory.js +12 -8
  324. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  325. package/dist/simple-tree/api/schemaFromSimple.js +18 -9
  326. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  327. package/dist/simple-tree/api/simpleSchemaCodec.js +10 -5
  328. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  329. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  330. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +15 -11
  331. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  332. package/dist/simple-tree/api/simpleTreeIndex.js +10 -10
  333. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  334. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  335. package/dist/simple-tree/api/storedSchema.js +2 -3
  336. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  337. package/dist/simple-tree/api/transactionTypes.d.ts +17 -4
  338. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  339. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  340. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  341. package/dist/simple-tree/api/treeNodeApi.js +21 -13
  342. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  343. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  344. package/dist/simple-tree/api/verboseTree.js +14 -9
  345. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  346. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  347. package/dist/simple-tree/core/treeNodeKernel.js +6 -3
  348. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  349. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  350. package/dist/simple-tree/core/unhydratedFlexTree.js +20 -15
  351. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  352. package/dist/simple-tree/getTreeNodeForField.d.ts.map +1 -1
  353. package/dist/simple-tree/getTreeNodeForField.js +2 -1
  354. package/dist/simple-tree/getTreeNodeForField.js.map +1 -1
  355. package/dist/simple-tree/index.d.ts +1 -1
  356. package/dist/simple-tree/index.d.ts.map +1 -1
  357. package/dist/simple-tree/index.js.map +1 -1
  358. package/dist/simple-tree/leafNodeSchema.js +9 -6
  359. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  360. package/dist/simple-tree/node-kinds/array/arrayNode.js +15 -15
  361. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  362. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  363. package/dist/simple-tree/node-kinds/object/objectNode.js +4 -5
  364. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  365. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  366. package/dist/simple-tree/node-kinds/record/recordNode.js +2 -3
  367. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  368. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  369. package/dist/simple-tree/toStoredSchema.js +9 -5
  370. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  371. package/dist/treeFactory.js +7 -3
  372. package/dist/treeFactory.js.map +1 -1
  373. package/dist/util/bTreeUtils.js +1 -1
  374. package/dist/util/bTreeUtils.js.map +1 -1
  375. package/dist/util/breakable.js +7 -9
  376. package/dist/util/breakable.js.map +1 -1
  377. package/dist/util/idAllocator.d.ts.map +1 -1
  378. package/dist/util/idAllocator.js +1 -2
  379. package/dist/util/idAllocator.js.map +1 -1
  380. package/dist/util/nestedMap.d.ts.map +1 -1
  381. package/dist/util/nestedMap.js +1 -1
  382. package/dist/util/nestedMap.js.map +1 -1
  383. package/dist/util/utils.d.ts.map +1 -1
  384. package/dist/util/utils.js +16 -15
  385. package/dist/util/utils.js.map +1 -1
  386. package/eslint.config.mts +1 -16
  387. package/lib/alpha.d.ts +4 -0
  388. package/lib/codec/codec.d.ts +31 -3
  389. package/lib/codec/codec.d.ts.map +1 -1
  390. package/lib/codec/codec.js +10 -0
  391. package/lib/codec/codec.js.map +1 -1
  392. package/lib/codec/index.d.ts +2 -2
  393. package/lib/codec/index.d.ts.map +1 -1
  394. package/lib/codec/index.js +1 -1
  395. package/lib/codec/index.js.map +1 -1
  396. package/lib/codec/versioned/codec.d.ts +80 -22
  397. package/lib/codec/versioned/codec.d.ts.map +1 -1
  398. package/lib/codec/versioned/codec.js +138 -15
  399. package/lib/codec/versioned/codec.js.map +1 -1
  400. package/lib/codec/versioned/index.d.ts +1 -1
  401. package/lib/codec/versioned/index.d.ts.map +1 -1
  402. package/lib/codec/versioned/index.js +1 -1
  403. package/lib/codec/versioned/index.js.map +1 -1
  404. package/lib/core/index.d.ts +2 -2
  405. package/lib/core/index.d.ts.map +1 -1
  406. package/lib/core/index.js +2 -2
  407. package/lib/core/index.js.map +1 -1
  408. package/lib/core/rebase/changeRebaser.d.ts +36 -2
  409. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  410. package/lib/core/rebase/changeRebaser.js.map +1 -1
  411. package/lib/core/rebase/index.d.ts +2 -2
  412. package/lib/core/rebase/index.d.ts.map +1 -1
  413. package/lib/core/rebase/index.js +1 -1
  414. package/lib/core/rebase/index.js.map +1 -1
  415. package/lib/core/rebase/types.d.ts +6 -2
  416. package/lib/core/rebase/types.d.ts.map +1 -1
  417. package/lib/core/rebase/types.js +0 -10
  418. package/lib/core/rebase/types.js.map +1 -1
  419. package/lib/core/rebase/utils.js +3 -3
  420. package/lib/core/rebase/utils.js.map +1 -1
  421. package/lib/core/schema-stored/schema.js +3 -3
  422. package/lib/core/schema-stored/schema.js.map +1 -1
  423. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  424. package/lib/core/tree/anchorSet.js +3 -4
  425. package/lib/core/tree/anchorSet.js.map +1 -1
  426. package/lib/core/tree/detachedFieldIndex.d.ts +1 -2
  427. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  428. package/lib/core/tree/detachedFieldIndex.js +13 -57
  429. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  430. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +18 -10
  431. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  432. package/lib/core/tree/detachedFieldIndexCodecCommon.js +4 -4
  433. package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  434. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts +2 -3
  435. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  436. package/lib/core/tree/detachedFieldIndexCodecV1.js +4 -5
  437. package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  438. package/lib/core/tree/detachedFieldIndexCodecV2.d.ts +2 -3
  439. package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  440. package/lib/core/tree/detachedFieldIndexCodecV2.js +4 -6
  441. package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  442. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +5 -6
  443. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  444. package/lib/core/tree/detachedFieldIndexCodecs.js +12 -39
  445. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  446. package/lib/core/tree/index.d.ts +1 -1
  447. package/lib/core/tree/index.d.ts.map +1 -1
  448. package/lib/core/tree/index.js +1 -1
  449. package/lib/core/tree/index.js.map +1 -1
  450. package/lib/core/tree/mapTree.js +1 -1
  451. package/lib/core/tree/mapTree.js.map +1 -1
  452. package/lib/core/tree/sparseTree.d.ts.map +1 -1
  453. package/lib/core/tree/sparseTree.js +1 -0
  454. package/lib/core/tree/sparseTree.js.map +1 -1
  455. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  456. package/lib/core/tree/treeTextFormat.js +5 -9
  457. package/lib/core/tree/treeTextFormat.js.map +1 -1
  458. package/lib/feature-libraries/changeAtomIdBTree.d.ts +10 -0
  459. package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -0
  460. package/lib/feature-libraries/changeAtomIdBTree.js +11 -0
  461. package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -0
  462. package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -1
  463. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  464. package/lib/feature-libraries/chunked-forest/chunkedForest.js +6 -6
  465. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  466. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  467. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +7 -4
  468. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  469. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  470. package/lib/feature-libraries/chunked-forest/codec/codecs.js +19 -11
  471. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  472. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
  473. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  474. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +9 -5
  475. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  476. package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  477. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  478. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +15 -5
  479. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  480. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +19 -14
  481. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  482. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -1
  483. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  484. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  485. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  486. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +2 -0
  487. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  488. package/lib/feature-libraries/default-schema/mappedEditBuilder.js +6 -0
  489. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  490. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  491. package/lib/feature-libraries/flex-tree/lazyField.js +11 -13
  492. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  493. package/lib/feature-libraries/index.d.ts +3 -2
  494. package/lib/feature-libraries/index.d.ts.map +1 -1
  495. package/lib/feature-libraries/index.js +3 -2
  496. package/lib/feature-libraries/index.js.map +1 -1
  497. package/lib/feature-libraries/indexing/anchorTreeIndex.js +6 -6
  498. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  499. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  500. package/lib/feature-libraries/mitigatedChangeFamily.js +10 -1
  501. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  502. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  503. package/lib/feature-libraries/modular-schema/comparison.js +12 -9
  504. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  505. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +25 -0
  506. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -0
  507. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +55 -0
  508. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -0
  509. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +3 -3
  510. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  511. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  512. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  513. package/lib/feature-libraries/modular-schema/genericFieldKind.js +5 -5
  514. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  515. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +1 -1
  516. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  517. package/lib/feature-libraries/modular-schema/index.d.ts +4 -2
  518. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  519. package/lib/feature-libraries/modular-schema/index.js +3 -1
  520. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  521. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +49 -0
  522. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -0
  523. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +298 -0
  524. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -0
  525. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +15 -0
  526. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -0
  527. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js +27 -0
  528. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -0
  529. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  530. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  531. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +27 -290
  532. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  533. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +14 -8
  534. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  535. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +118 -88
  536. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  537. package/lib/feature-libraries/modular-schema/{modularChangeFormat.d.ts → modularChangeFormatV1.d.ts} +5 -6
  538. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -0
  539. package/lib/feature-libraries/modular-schema/{modularChangeFormat.js → modularChangeFormatV1.js} +4 -4
  540. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -0
  541. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +112 -0
  542. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -0
  543. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +18 -0
  544. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -0
  545. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +13 -3
  546. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  547. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  548. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -1
  549. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  550. package/lib/feature-libraries/object-forest/objectForest.js +4 -4
  551. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  552. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  553. package/lib/feature-libraries/optional-field/optionalField.js +35 -40
  554. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  555. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  556. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +15 -3
  557. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  558. package/lib/feature-libraries/schema-index/codec.d.ts +7 -21
  559. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  560. package/lib/feature-libraries/schema-index/codec.js +30 -68
  561. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  562. package/lib/feature-libraries/schema-index/index.d.ts +2 -2
  563. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  564. package/lib/feature-libraries/schema-index/index.js +2 -2
  565. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  566. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +1 -9
  567. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  568. package/lib/feature-libraries/schema-index/schemaSummarizer.js +0 -10
  569. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  570. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
  571. package/lib/feature-libraries/schemaChecker.js +11 -6
  572. package/lib/feature-libraries/schemaChecker.js.map +1 -1
  573. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  574. package/lib/feature-libraries/sequence-field/compose.js +17 -13
  575. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  576. package/lib/feature-libraries/sequence-field/invert.js +5 -4
  577. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  578. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  579. package/lib/feature-libraries/sequence-field/moveEffectTable.js +15 -9
  580. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  581. package/lib/feature-libraries/sequence-field/rebase.js +26 -18
  582. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  583. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts +2 -2
  584. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  585. package/lib/feature-libraries/sequence-field/replaceRevisions.js +41 -36
  586. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  587. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  588. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +16 -8
  589. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  590. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  591. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +4 -2
  592. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  593. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  594. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +6 -3
  595. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  596. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  597. package/lib/feature-libraries/sequence-field/utils.js +46 -27
  598. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  599. package/lib/feature-libraries/treeCursorUtils.js +7 -7
  600. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  601. package/lib/feature-libraries/treeTextCursor.js +2 -2
  602. package/lib/feature-libraries/treeTextCursor.js.map +1 -1
  603. package/lib/feature-libraries/valueUtilities.d.ts.map +1 -1
  604. package/lib/feature-libraries/valueUtilities.js +16 -8
  605. package/lib/feature-libraries/valueUtilities.js.map +1 -1
  606. package/lib/index.d.ts +2 -2
  607. package/lib/index.d.ts.map +1 -1
  608. package/lib/index.js.map +1 -1
  609. package/lib/packageVersion.d.ts +1 -1
  610. package/lib/packageVersion.js +1 -1
  611. package/lib/packageVersion.js.map +1 -1
  612. package/lib/shared-tree/schematizingTreeView.d.ts +2 -3
  613. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  614. package/lib/shared-tree/schematizingTreeView.js +20 -9
  615. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  616. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  617. package/lib/shared-tree/sharedTree.js +30 -13
  618. package/lib/shared-tree/sharedTree.js.map +1 -1
  619. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  620. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  621. package/lib/shared-tree/sharedTreeChangeCodecs.js +9 -8
  622. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  623. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  624. package/lib/shared-tree/sharedTreeChangeEnricher.js +4 -2
  625. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  626. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +3 -2
  627. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  628. package/lib/shared-tree/sharedTreeChangeFamily.js +19 -14
  629. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  630. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  631. package/lib/shared-tree/sharedTreeEditBuilder.js +1 -1
  632. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  633. package/lib/shared-tree/treeAlpha.d.ts +35 -29
  634. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  635. package/lib/shared-tree/treeAlpha.js +21 -23
  636. package/lib/shared-tree/treeAlpha.js.map +1 -1
  637. package/lib/shared-tree/treeCheckout.d.ts +2 -0
  638. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  639. package/lib/shared-tree/treeCheckout.js +32 -19
  640. package/lib/shared-tree/treeCheckout.js.map +1 -1
  641. package/lib/shared-tree-core/branch.d.ts +3 -1
  642. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  643. package/lib/shared-tree-core/branch.js +5 -3
  644. package/lib/shared-tree-core/branch.js.map +1 -1
  645. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  646. package/lib/shared-tree-core/branchCommitEnricher.js +2 -2
  647. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  648. package/lib/shared-tree-core/editManager.js +1 -1
  649. package/lib/shared-tree-core/editManager.js.map +1 -1
  650. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  651. package/lib/shared-tree-core/editManagerCodecs.js +9 -4
  652. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  653. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +1 -0
  654. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  655. package/lib/shared-tree-core/editManagerFormatCommons.js +6 -0
  656. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  657. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  658. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  659. package/lib/shared-tree-core/editManagerFormatV1toV4.js +1 -0
  660. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  661. package/lib/shared-tree-core/editManagerSummarizer.js +3 -3
  662. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  663. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  664. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  665. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  666. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  667. package/lib/shared-tree-core/messageCodecVSharedBranches.js +2 -1
  668. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  669. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  670. package/lib/shared-tree-core/messageCodecs.js +8 -4
  671. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  672. package/lib/shared-tree-core/messageFormat.d.ts +1 -0
  673. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  674. package/lib/shared-tree-core/messageFormat.js +6 -0
  675. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  676. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
  677. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  678. package/lib/shared-tree-core/messageFormatV1ToV4.js +8 -1
  679. package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  680. package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  681. package/lib/shared-tree-core/sequenceIdUtils.js +4 -4
  682. package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
  683. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  684. package/lib/shared-tree-core/sharedTreeCore.js +12 -8
  685. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  686. package/lib/shared-tree-core/transaction.d.ts +25 -8
  687. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  688. package/lib/shared-tree-core/transaction.js +67 -32
  689. package/lib/shared-tree-core/transaction.js.map +1 -1
  690. package/lib/shared-tree-core/transactionEnricher.d.ts +2 -2
  691. package/lib/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  692. package/lib/shared-tree-core/transactionEnricher.js +3 -3
  693. package/lib/shared-tree-core/transactionEnricher.js.map +1 -1
  694. package/lib/simple-tree/api/configuration.js +1 -1
  695. package/lib/simple-tree/api/configuration.js.map +1 -1
  696. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  697. package/lib/simple-tree/api/customTree.js +13 -9
  698. package/lib/simple-tree/api/customTree.js.map +1 -1
  699. package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
  700. package/lib/simple-tree/api/discrepancies.js +21 -17
  701. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  702. package/lib/simple-tree/api/index.d.ts +1 -1
  703. package/lib/simple-tree/api/index.d.ts.map +1 -1
  704. package/lib/simple-tree/api/index.js.map +1 -1
  705. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  706. package/lib/simple-tree/api/schemaFactory.js +12 -8
  707. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  708. package/lib/simple-tree/api/schemaFromSimple.js +18 -9
  709. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  710. package/lib/simple-tree/api/simpleSchemaCodec.js +10 -5
  711. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  712. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  713. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +15 -11
  714. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  715. package/lib/simple-tree/api/simpleTreeIndex.js +10 -10
  716. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  717. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  718. package/lib/simple-tree/api/storedSchema.js +4 -7
  719. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  720. package/lib/simple-tree/api/transactionTypes.d.ts +17 -4
  721. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  722. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  723. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  724. package/lib/simple-tree/api/treeNodeApi.js +21 -13
  725. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  726. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  727. package/lib/simple-tree/api/verboseTree.js +14 -9
  728. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  729. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  730. package/lib/simple-tree/core/treeNodeKernel.js +6 -3
  731. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  732. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  733. package/lib/simple-tree/core/unhydratedFlexTree.js +20 -15
  734. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  735. package/lib/simple-tree/getTreeNodeForField.d.ts.map +1 -1
  736. package/lib/simple-tree/getTreeNodeForField.js +2 -1
  737. package/lib/simple-tree/getTreeNodeForField.js.map +1 -1
  738. package/lib/simple-tree/index.d.ts +1 -1
  739. package/lib/simple-tree/index.d.ts.map +1 -1
  740. package/lib/simple-tree/index.js.map +1 -1
  741. package/lib/simple-tree/leafNodeSchema.js +9 -6
  742. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  743. package/lib/simple-tree/node-kinds/array/arrayNode.js +15 -15
  744. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  745. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  746. package/lib/simple-tree/node-kinds/object/objectNode.js +4 -5
  747. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  748. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  749. package/lib/simple-tree/node-kinds/record/recordNode.js +2 -3
  750. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  751. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  752. package/lib/simple-tree/toStoredSchema.js +9 -5
  753. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  754. package/lib/treeFactory.js +7 -3
  755. package/lib/treeFactory.js.map +1 -1
  756. package/lib/util/bTreeUtils.js +1 -1
  757. package/lib/util/bTreeUtils.js.map +1 -1
  758. package/lib/util/breakable.js +7 -9
  759. package/lib/util/breakable.js.map +1 -1
  760. package/lib/util/idAllocator.d.ts.map +1 -1
  761. package/lib/util/idAllocator.js +1 -2
  762. package/lib/util/idAllocator.js.map +1 -1
  763. package/lib/util/nestedMap.d.ts.map +1 -1
  764. package/lib/util/nestedMap.js +1 -1
  765. package/lib/util/nestedMap.js.map +1 -1
  766. package/lib/util/utils.d.ts.map +1 -1
  767. package/lib/util/utils.js +16 -15
  768. package/lib/util/utils.js.map +1 -1
  769. package/package.json +32 -32
  770. package/src/codec/codec.ts +48 -8
  771. package/src/codec/index.ts +4 -1
  772. package/src/codec/versioned/codec.ts +340 -22
  773. package/src/codec/versioned/index.ts +3 -1
  774. package/src/core/index.ts +2 -2
  775. package/src/core/rebase/changeRebaser.ts +40 -6
  776. package/src/core/rebase/index.ts +1 -1
  777. package/src/core/rebase/types.ts +6 -18
  778. package/src/core/rebase/utils.ts +3 -3
  779. package/src/core/schema-stored/schema.ts +3 -3
  780. package/src/core/tree/anchorSet.ts +3 -4
  781. package/src/core/tree/detachedFieldIndex.ts +13 -74
  782. package/src/core/tree/detachedFieldIndexCodecCommon.ts +4 -8
  783. package/src/core/tree/detachedFieldIndexCodecV1.ts +3 -7
  784. package/src/core/tree/detachedFieldIndexCodecV2.ts +5 -9
  785. package/src/core/tree/detachedFieldIndexCodecs.ts +21 -64
  786. package/src/core/tree/index.ts +1 -1
  787. package/src/core/tree/mapTree.ts +1 -1
  788. package/src/core/tree/sparseTree.ts +1 -0
  789. package/src/core/tree/treeTextFormat.ts +5 -9
  790. package/src/feature-libraries/changeAtomIdBTree.ts +24 -0
  791. package/src/feature-libraries/chunked-forest/basicChunk.ts +1 -1
  792. package/src/feature-libraries/chunked-forest/chunkedForest.ts +5 -5
  793. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +7 -4
  794. package/src/feature-libraries/chunked-forest/codec/codecs.ts +19 -11
  795. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +3 -3
  796. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +9 -5
  797. package/src/feature-libraries/chunked-forest/uniformChunk.ts +1 -1
  798. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +48 -17
  799. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +12 -2
  800. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +6 -0
  801. package/src/feature-libraries/flex-tree/lazyField.ts +13 -14
  802. package/src/feature-libraries/index.ts +10 -5
  803. package/src/feature-libraries/indexing/anchorTreeIndex.ts +5 -5
  804. package/src/feature-libraries/mitigatedChangeFamily.ts +11 -6
  805. package/src/feature-libraries/modular-schema/comparison.ts +12 -9
  806. package/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts +70 -0
  807. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +3 -6
  808. package/src/feature-libraries/modular-schema/genericFieldKind.ts +5 -7
  809. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +1 -1
  810. package/src/feature-libraries/modular-schema/index.ts +5 -2
  811. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +703 -0
  812. package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +89 -0
  813. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +39 -523
  814. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +159 -125
  815. package/src/feature-libraries/modular-schema/{modularChangeFormat.ts → modularChangeFormatV1.ts} +4 -4
  816. package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +34 -0
  817. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +13 -4
  818. package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +1 -1
  819. package/src/feature-libraries/object-forest/objectForest.ts +4 -4
  820. package/src/feature-libraries/optional-field/optionalField.ts +34 -46
  821. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +18 -3
  822. package/src/feature-libraries/schema-index/codec.ts +30 -90
  823. package/src/feature-libraries/schema-index/index.ts +2 -4
  824. package/src/feature-libraries/schema-index/schemaSummarizer.ts +0 -17
  825. package/src/feature-libraries/schemaChecker.ts +11 -6
  826. package/src/feature-libraries/sequence-field/compose.ts +17 -13
  827. package/src/feature-libraries/sequence-field/invert.ts +5 -4
  828. package/src/feature-libraries/sequence-field/moveEffectTable.ts +15 -9
  829. package/src/feature-libraries/sequence-field/rebase.ts +26 -18
  830. package/src/feature-libraries/sequence-field/replaceRevisions.ts +52 -56
  831. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +16 -8
  832. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +4 -2
  833. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +6 -3
  834. package/src/feature-libraries/sequence-field/utils.ts +46 -27
  835. package/src/feature-libraries/treeCursorUtils.ts +7 -7
  836. package/src/feature-libraries/treeTextCursor.ts +2 -2
  837. package/src/feature-libraries/valueUtilities.ts +16 -8
  838. package/src/index.ts +4 -0
  839. package/src/packageVersion.ts +1 -1
  840. package/src/shared-tree/schematizingTreeView.ts +23 -13
  841. package/src/shared-tree/sharedTree.ts +30 -14
  842. package/src/shared-tree/sharedTreeChangeCodecs.ts +10 -9
  843. package/src/shared-tree/sharedTreeChangeEnricher.ts +4 -2
  844. package/src/shared-tree/sharedTreeChangeFamily.ts +29 -19
  845. package/src/shared-tree/sharedTreeEditBuilder.ts +9 -5
  846. package/src/shared-tree/treeAlpha.ts +60 -51
  847. package/src/shared-tree/treeCheckout.ts +66 -50
  848. package/src/shared-tree-core/branch.ts +8 -3
  849. package/src/shared-tree-core/branchCommitEnricher.ts +3 -8
  850. package/src/shared-tree-core/editManager.ts +1 -1
  851. package/src/shared-tree-core/editManagerCodecs.ts +9 -4
  852. package/src/shared-tree-core/editManagerFormatCommons.ts +6 -0
  853. package/src/shared-tree-core/editManagerFormatV1toV4.ts +3 -1
  854. package/src/shared-tree-core/editManagerSummarizer.ts +3 -3
  855. package/src/shared-tree-core/messageCodecV1ToV4.ts +2 -1
  856. package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -1
  857. package/src/shared-tree-core/messageCodecs.ts +8 -4
  858. package/src/shared-tree-core/messageFormat.ts +6 -1
  859. package/src/shared-tree-core/messageFormatV1ToV4.ts +16 -2
  860. package/src/shared-tree-core/sequenceIdUtils.ts +4 -4
  861. package/src/shared-tree-core/sharedTreeCore.ts +11 -7
  862. package/src/shared-tree-core/transaction.ts +115 -56
  863. package/src/shared-tree-core/transactionEnricher.ts +5 -6
  864. package/src/simple-tree/api/configuration.ts +1 -1
  865. package/src/simple-tree/api/customTree.ts +14 -10
  866. package/src/simple-tree/api/discrepancies.ts +23 -17
  867. package/src/simple-tree/api/index.ts +2 -0
  868. package/src/simple-tree/api/schemaFactory.ts +11 -7
  869. package/src/simple-tree/api/schemaFromSimple.ts +18 -9
  870. package/src/simple-tree/api/simpleSchemaCodec.ts +10 -5
  871. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +17 -13
  872. package/src/simple-tree/api/simpleTreeIndex.ts +8 -8
  873. package/src/simple-tree/api/storedSchema.ts +10 -7
  874. package/src/simple-tree/api/transactionTypes.ts +19 -4
  875. package/src/simple-tree/api/treeNodeApi.ts +21 -13
  876. package/src/simple-tree/api/verboseTree.ts +14 -9
  877. package/src/simple-tree/core/treeNodeKernel.ts +6 -3
  878. package/src/simple-tree/core/unhydratedFlexTree.ts +22 -17
  879. package/src/simple-tree/getTreeNodeForField.ts +2 -1
  880. package/src/simple-tree/index.ts +2 -0
  881. package/src/simple-tree/leafNodeSchema.ts +8 -5
  882. package/src/simple-tree/node-kinds/array/arrayNode.ts +23 -23
  883. package/src/simple-tree/node-kinds/object/objectNode.ts +4 -5
  884. package/src/simple-tree/node-kinds/record/recordNode.ts +2 -3
  885. package/src/simple-tree/toStoredSchema.ts +9 -5
  886. package/src/treeFactory.ts +10 -5
  887. package/src/util/bTreeUtils.ts +1 -1
  888. package/src/util/breakable.ts +9 -9
  889. package/src/util/idAllocator.ts +1 -2
  890. package/src/util/nestedMap.ts +1 -3
  891. package/src/util/utils.ts +14 -13
  892. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +0 -1
  893. package/dist/feature-libraries/modular-schema/modularChangeFormat.js.map +0 -1
  894. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +0 -1
  895. package/lib/feature-libraries/modular-schema/modularChangeFormat.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,4CAuGyB;AAtGxB,oGAAA,QAAQ,OAAA;AAIR,qGAAA,SAAS,OAAA;AAoBT,+GAAA,mBAAmB,OAAA;AACnB,wGAAA,YAAY,OAAA;AACZ,qGAAA,SAAS,OAAA;AAET,8GAAA,kBAAkB,OAAA;AAElB,mHAAA,uBAAuB,OAAA;AAGvB,2GAAA,eAAe,OAAA;AACf,+GAAA,mBAAmB,OAAA;AACnB,oHAAA,wBAAwB,OAAA;AACxB,oGAAA,QAAQ,OAAA;AACR,0GAAA,cAAc,OAAA;AACd,2GAAA,eAAe,OAAA;AACf,8GAAA,kBAAkB,OAAA;AAElB,8GAAA,kBAAkB,OAAA;AAClB,8GAAA,kBAAkB,OAAA;AAClB,sGAAA,UAAU,OAAA;AACV,kHAAA,sBAAsB,OAAA;AACtB,2GAAA,eAAe,OAAA;AACf,yGAAA,aAAa,OAAA;AACb,sGAAA,UAAU,OAAA;AACV,kHAAA,sBAAsB,OAAA;AACtB,+GAAA,mBAAmB,OAAA;AAGnB,sGAAA,UAAU,OAAA;AACV,yGAAA,aAAa,OAAA;AACb,0GAAA,cAAc,OAAA;AACd,qGAAA,SAAS,OAAA;AACT,uGAAA,WAAW,OAAA;AACX,+GAAA,mBAAmB,OAAA;AACnB,uGAAA,WAAW,OAAA;A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1B,iHAAA,qBAAqB,OAAA;AACrB,oHAAA,wBAAwB,OAAA;AACxB,4GAAA,gBAAgB,OAAA;AAChB,0GAAA,cAAc,OAAA;AAEd,wGAAA,YAAY,OAAA;AACZ,8GAAA,kBAAkB,OAAA;AAElB,sGAAA,UAAU,OAAA;AAIV,6GAAA,iBAAiB,OAAA;AACjB,4GAAA,gBAAgB,OAAA;AAKhB,0GAAA,cAAc,OAAA;AACd,qGAAA,SAAS,OAAA;AACT,2GAAA,eAAe,OAAA;AACf,8GAAA,kBAAkB,OAAA;AAClB,2GAAA,eAAe,OAAA;AACf,sGAAA,UAAU,OAAA;AACV,wGAAA,YAAY,OAAA;AAEZ,wGAAA,YAAY,OAAA;AACZ,mHAAA,uBAAuB,OAAA;AAEvB,0HAAA,8BAA8B,OAAA;AAK9B,wGAAA,YAAY,OAAA;AACZ,2GAAA,eAAe,OAAA;AACf,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AACd,iHAAA,qBAAqB,OAAA;AACrB,gHAAA,oBAAoB,OAAA;AACpB,yGAAA,aAAa,OAAA;AAGb,sGAAA,UAAU,OAAA;AAEV,mHAAA,uBAAuB,OAAA;AACvB,4GAAA,gBAAgB,OAAA;AAChB,yGAAA,aAAa,OAAA;AAGd,mDAIgC;AAF/B,6GAAA,iBAAiB,OAAA;AAIlB,iDAMyB;AAJxB,iHAAA,gBAAgB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tEmptyKey,\n\ttype TreeType,\n\ttype Value,\n\ttype TreeValue,\n\tAnchorSet,\n\ttype DetachedField,\n\ttype UpPath,\n\ttype NormalizedUpPath,\n\ttype INormalizedUpPath,\n\ttype NormalizedFieldUpPath,\n\ttype Range,\n\ttype RangeUpPath,\n\ttype PlaceUpPath,\n\ttype PlaceIndex,\n\ttype NodeIndex,\n\ttype FieldUpPath,\n\ttype Anchor,\n\ttype RootField,\n\ttype ChildCollection,\n\ttype ChildLocation,\n\ttype FieldMapObject,\n\ttype NodeData,\n\ttype GenericTreeNode,\n\ttype JsonableTree,\n\tEncodedJsonableTree,\n\trootFieldKey,\n\trootField,\n\ttype ITreeCursor,\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\tcastCursorToSynchronous,\n\ttype GenericFieldsNode,\n\ttype AnchorLocator,\n\tgenericTreeKeys,\n\tgetGenericTreeField,\n\tgenericTreeDeleteIfEmpty,\n\tgetDepth,\n\tmapCursorField,\n\tmapCursorFields,\n\titerateCursorField,\n\ttype MapTree,\n\tdetachedFieldAsKey,\n\tkeyAsDetachedField,\n\tvisitDelta,\n\tcreateAnnouncedVisitor,\n\tcombineVisitors,\n\tannounceDelta,\n\tapplyDelta,\n\tmakeDetachedFieldIndex,\n\tsetGenericTreeField,\n\ttype DeltaVisitor,\n\ttype AnnouncedVisitor,\n\tSparseNode,\n\tgetDescendant,\n\tcompareUpPaths,\n\tclonePath,\n\ttopDownPath,\n\tcompareFieldUpPaths,\n\tforEachNode,\n\tforEachNodeInSubtree,\n\tforEachField,\n\ttype PathRootPrefix,\n\tdeltaForRootInitialization,\n\tmakeDetachedNodeId,\n\toffsetDetachId,\n\temptyDelta,\n\ttype AnchorSlot,\n\ttype AnchorNode,\n\tanchorSlot,\n\ttype UpPathDefault,\n\tisDetachedUpPath,\n\tinCursorField,\n\tinCursorNode,\n\ttype AnchorEvents,\n\ttype AnchorSetRootEvents,\n\ttype ProtoNodes,\n\tCursorMarker,\n\tisCursor,\n\tDetachedFieldIndex,\n\ttype ReadOnlyDetachedFieldIndex,\n\ttype DetachedFieldIndexCheckpoint,\n\ttype ForestRootId,\n\tgetDetachedFieldContainingPath,\n\taboveRootPlaceholder,\n\ttype DeltaRoot,\n\ttype DeltaMark,\n\ttype DeltaDetachedNodeId,\n\ttype DeltaFieldMap,\n\ttype DeltaDetachedNodeChanges,\n\ttype DeltaDetachedNodeBuild,\n\ttype DeltaDetachedNodeDestruction,\n\ttype DeltaDetachedNodeRename,\n\ttype DeltaFieldChanges,\n\ttype ExclusiveMapTree,\n\tdeepCopyMapTree,\n\ttype TreeChunk,\n\tdummyRoot,\n\tcursorChunk,\n\ttryGetChunk,\n\ttype ChunkedCursor,\n\tDetachedFieldIndexFormatVersion,\n\tgetCodecTreeForDetachedFieldIndexFormat,\n} from \"./tree/index.js\";\n\nexport {\n\tTreeNavigationResult,\n\ttype IEditableForest,\n\ttype IForestSubscription,\n\ttype TreeLocation,\n\ttype FieldLocation,\n\ttype ForestLocation,\n\ttype ITreeSubscriptionCursor,\n\tITreeSubscriptionCursorState,\n\ttype FieldAnchor,\n\tmoveToDetachedField,\n\ttype ForestEvents,\n} from \"./forest/index.js\";\n\nexport {\n\ttype FieldKey,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeFieldStoredSchema,\n\tValueSchema,\n\tTreeNodeStoredSchema,\n\ttype TreeStoredSchemaSubscription,\n\ttype MutableTreeStoredSchema,\n\ttype FieldKindIdentifier,\n\ttype FieldKindData,\n\ttype TreeTypeSet,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\tschemaDataIsEmpty,\n\ttype SchemaEvents,\n\tforbiddenFieldKindIdentifier,\n\tidentifierFieldKindIdentifier,\n\tstoredEmptyFieldSchema,\n\ttype StoredSchemaCollection,\n\tschemaFormatV1,\n\tschemaFormatV2,\n\tLeafNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tdecodeFieldSchema,\n\tencodeFieldSchemaV1,\n\tencodeFieldSchemaV2,\n\tstoredSchemaDecodeDispatcher,\n\ttype SchemaAndPolicy,\n\tMultiplicity,\n\ttype SchemaPolicy,\n\tSchemaFormatVersion,\n} from \"./schema-stored/index.js\";\n\nexport {\n\ttype ChangeFamily,\n\ttype ChangeFamilyCodec,\n\ttype ChangeEncodingContext,\n\ttype ChangeFamilyEditor,\n\tEditBuilder,\n} from \"./change-family/index.js\";\n\nexport {\n\tareEqualChangeAtomIds,\n\tareEqualChangeAtomIdOpts,\n\tmakeChangeAtomId,\n\tasChangeAtomId,\n\ttype ChangeRebaser,\n\tfindAncestor,\n\tfindCommonAncestor,\n\ttype GraphCommit,\n\tCommitKind,\n\ttype CommitMetadata,\n\ttype ChangeMetadata,\n\ttype RevisionTag,\n\tRevisionTagSchema,\n\tRevisionTagCodec,\n\ttype ChangesetLocalId,\n\ttype ChangeAtomId,\n\ttype ChangeAtomIdMap,\n\ttype TaggedChange,\n\tmakeAnonChange,\n\ttagChange,\n\tmapTaggedChange,\n\ttagRollbackInverse,\n\tSessionIdSchema,\n\tmintCommit,\n\trebaseBranch,\n\ttype BranchRebaseResult,\n\trebaseChange,\n\trebaseChangeOverChanges,\n\ttype RevisionMetadataSource,\n\trevisionMetadataSourceFromInfo,\n\ttype RevisionInfo,\n\ttype EncodedRevisionTag,\n\ttype EncodedStableId,\n\ttype EncodedChangeAtomId,\n\ttaggedAtomId,\n\ttaggedOptAtomId,\n\toffsetChangeAtomId,\n\tStableIdSchema,\n\tsubtractChangeAtomIds,\n\treplaceAtomRevisions,\n\treplaceChange,\n\ttype RebaseStats,\n\ttype RebaseStatsWithDuration,\n\tisAncestor,\n\ttype ChangeAtomIdRangeMap,\n\tnewChangeAtomIdRangeMap,\n\tcompareRevisions,\n\tdiffHistories,\n} from \"./rebase/index.js\";\n\nexport {\n\ttype Adapters,\n\tAdaptedViewSchema,\n\ttype TreeAdapter,\n} from \"./schema-view/index.js\";\n\nexport {\n\ttype Revertible,\n\tRevertibleStatus,\n\ttype RevertibleFactory,\n\ttype RevertibleAlphaFactory,\n\ttype RevertibleAlpha,\n} from \"./revertible.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,4CAuGyB;AAtGxB,oGAAA,QAAQ,OAAA;AAIR,qGAAA,SAAS,OAAA;AAoBT,+GAAA,mBAAmB,OAAA;AACnB,wGAAA,YA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f,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AACd,iHAAA,qBAAqB,OAAA;AACrB,yGAAA,aAAa,OAAA;AAGb,sGAAA,UAAU,OAAA;AAEV,mHAAA,uBAAuB,OAAA;AACvB,4GAAA,gBAAgB,OAAA;AAChB,yGAAA,aAAa,OAAA;AAId,mDAIgC;AAF/B,6GAAA,iBAAiB,OAAA;AAIlB,iDAMyB;AAJxB,iHAAA,gBAAgB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tEmptyKey,\n\ttype TreeType,\n\ttype Value,\n\ttype TreeValue,\n\tAnchorSet,\n\ttype DetachedField,\n\ttype UpPath,\n\ttype NormalizedUpPath,\n\ttype INormalizedUpPath,\n\ttype NormalizedFieldUpPath,\n\ttype Range,\n\ttype RangeUpPath,\n\ttype PlaceUpPath,\n\ttype PlaceIndex,\n\ttype NodeIndex,\n\ttype FieldUpPath,\n\ttype Anchor,\n\ttype RootField,\n\ttype ChildCollection,\n\ttype ChildLocation,\n\ttype FieldMapObject,\n\ttype NodeData,\n\ttype GenericTreeNode,\n\ttype JsonableTree,\n\tEncodedJsonableTree,\n\trootFieldKey,\n\trootField,\n\ttype ITreeCursor,\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\tcastCursorToSynchronous,\n\ttype GenericFieldsNode,\n\ttype AnchorLocator,\n\tgenericTreeKeys,\n\tgetGenericTreeField,\n\tgenericTreeDeleteIfEmpty,\n\tgetDepth,\n\tmapCursorField,\n\tmapCursorFields,\n\titerateCursorField,\n\ttype MapTree,\n\tdetachedFieldAsKey,\n\tkeyAsDetachedField,\n\tvisitDelta,\n\tcreateAnnouncedVisitor,\n\tcombineVisitors,\n\tannounceDelta,\n\tapplyDelta,\n\tmakeDetachedFieldIndex,\n\tsetGenericTreeField,\n\ttype DeltaVisitor,\n\ttype AnnouncedVisitor,\n\tSparseNode,\n\tgetDescendant,\n\tcompareUpPaths,\n\tclonePath,\n\ttopDownPath,\n\tcompareFieldUpPaths,\n\tforEachNode,\n\tforEachNodeInSubtree,\n\tforEachField,\n\ttype PathRootPrefix,\n\tdeltaForRootInitialization,\n\tmakeDetachedNodeId,\n\toffsetDetachId,\n\temptyDelta,\n\ttype AnchorSlot,\n\ttype AnchorNode,\n\tanchorSlot,\n\ttype UpPathDefault,\n\tisDetachedUpPath,\n\tinCursorField,\n\tinCursorNode,\n\ttype AnchorEvents,\n\ttype AnchorSetRootEvents,\n\ttype ProtoNodes,\n\tCursorMarker,\n\tisCursor,\n\tDetachedFieldIndex,\n\ttype ReadOnlyDetachedFieldIndex,\n\ttype DetachedFieldIndexCheckpoint,\n\ttype ForestRootId,\n\tgetDetachedFieldContainingPath,\n\taboveRootPlaceholder,\n\ttype DeltaRoot,\n\ttype DeltaMark,\n\ttype DeltaDetachedNodeId,\n\ttype DeltaFieldMap,\n\ttype DeltaDetachedNodeChanges,\n\ttype DeltaDetachedNodeBuild,\n\ttype DeltaDetachedNodeDestruction,\n\ttype DeltaDetachedNodeRename,\n\ttype DeltaFieldChanges,\n\ttype ExclusiveMapTree,\n\tdeepCopyMapTree,\n\ttype TreeChunk,\n\tdummyRoot,\n\tcursorChunk,\n\ttryGetChunk,\n\ttype ChunkedCursor,\n\tDetachedFieldIndexFormatVersion,\n\tdetachedFieldIndexCodecBuilder,\n} from \"./tree/index.js\";\n\nexport {\n\tTreeNavigationResult,\n\ttype IEditableForest,\n\ttype IForestSubscription,\n\ttype TreeLocation,\n\ttype FieldLocation,\n\ttype ForestLocation,\n\ttype ITreeSubscriptionCursor,\n\tITreeSubscriptionCursorState,\n\ttype FieldAnchor,\n\tmoveToDetachedField,\n\ttype ForestEvents,\n} from \"./forest/index.js\";\n\nexport {\n\ttype FieldKey,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeFieldStoredSchema,\n\tValueSchema,\n\tTreeNodeStoredSchema,\n\ttype TreeStoredSchemaSubscription,\n\ttype MutableTreeStoredSchema,\n\ttype FieldKindIdentifier,\n\ttype FieldKindData,\n\ttype TreeTypeSet,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\tschemaDataIsEmpty,\n\ttype SchemaEvents,\n\tforbiddenFieldKindIdentifier,\n\tidentifierFieldKindIdentifier,\n\tstoredEmptyFieldSchema,\n\ttype StoredSchemaCollection,\n\tschemaFormatV1,\n\tschemaFormatV2,\n\tLeafNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tdecodeFieldSchema,\n\tencodeFieldSchemaV1,\n\tencodeFieldSchemaV2,\n\tstoredSchemaDecodeDispatcher,\n\ttype SchemaAndPolicy,\n\tMultiplicity,\n\ttype SchemaPolicy,\n\tSchemaFormatVersion,\n} from \"./schema-stored/index.js\";\n\nexport {\n\ttype ChangeFamily,\n\ttype ChangeFamilyCodec,\n\ttype ChangeEncodingContext,\n\ttype ChangeFamilyEditor,\n\tEditBuilder,\n} from \"./change-family/index.js\";\n\nexport {\n\tareEqualChangeAtomIds,\n\tareEqualChangeAtomIdOpts,\n\tmakeChangeAtomId,\n\tasChangeAtomId,\n\ttype ChangeRebaser,\n\tfindAncestor,\n\tfindCommonAncestor,\n\ttype GraphCommit,\n\tCommitKind,\n\ttype CommitMetadata,\n\ttype ChangeMetadata,\n\ttype RevisionTag,\n\tRevisionTagSchema,\n\tRevisionTagCodec,\n\ttype ChangesetLocalId,\n\ttype ChangeAtomId,\n\ttype ChangeAtomIdMap,\n\ttype TaggedChange,\n\tmakeAnonChange,\n\ttagChange,\n\tmapTaggedChange,\n\ttagRollbackInverse,\n\tSessionIdSchema,\n\tmintCommit,\n\trebaseBranch,\n\ttype BranchRebaseResult,\n\trebaseChange,\n\trebaseChangeOverChanges,\n\ttype RevisionMetadataSource,\n\trevisionMetadataSourceFromInfo,\n\ttype RevisionInfo,\n\ttype EncodedRevisionTag,\n\ttype EncodedStableId,\n\ttype EncodedChangeAtomId,\n\ttaggedAtomId,\n\ttaggedOptAtomId,\n\toffsetChangeAtomId,\n\tStableIdSchema,\n\tsubtractChangeAtomIds,\n\treplaceChange,\n\ttype RebaseStats,\n\ttype RebaseStatsWithDuration,\n\tisAncestor,\n\ttype ChangeAtomIdRangeMap,\n\tnewChangeAtomIdRangeMap,\n\tcompareRevisions,\n\tdiffHistories,\n\ttype RevisionReplacer,\n} from \"./rebase/index.js\";\n\nexport {\n\ttype Adapters,\n\tAdaptedViewSchema,\n\ttype TreeAdapter,\n} from \"./schema-view/index.js\";\n\nexport {\n\ttype Revertible,\n\tRevertibleStatus,\n\ttype RevertibleFactory,\n\ttype RevertibleAlphaFactory,\n\ttype RevertibleAlpha,\n} from \"./revertible.js\";\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { Invariant } from "../../util/index.js";
6
- import type { RevisionTag } from "./types.js";
6
+ import type { ChangeAtomId, RevisionTag } from "./types.js";
7
7
  /**
8
8
  * Rebasing logic for a particular kind of change.
9
9
  *
@@ -74,7 +74,41 @@ export interface ChangeRebaser<TChangeset> {
74
74
  * - `rebase(compose([]), a)` is equal to `compose([])`.
75
75
  */
76
76
  rebase(change: TaggedChange<TChangeset>, over: TaggedChange<TChangeset>, revisionMetadata: RevisionMetadataSource): TChangeset;
77
- changeRevision(change: TChangeset, newRevision: RevisionTag | undefined, rollBackOf?: RevisionTag): TChangeset;
77
+ /**
78
+ * Retrieves the set of revisions associated with the given change.
79
+ */
80
+ getRevisions(change: TChangeset): Set<RevisionTag | undefined>;
81
+ /**
82
+ * Produces a changeset that is equivalent to the given `change`, but with all references to its own revisions replaced according to the given `replacer`.
83
+ * @param change - The change to update. Not modified.
84
+ * @param replacer - The replacer to use.
85
+ * @returns A changeset equivalent to `change`, but with all references to its own revision replaced according to `replacer`.
86
+ */
87
+ changeRevision(change: TChangeset, replacer: RevisionReplacer): TChangeset;
88
+ }
89
+ /**
90
+ * A type that can update references to a set of obsolete revisions across multiple changesets.
91
+ */
92
+ export interface RevisionReplacer {
93
+ /**
94
+ * The revision to use in place of the obsolete revisions.
95
+ */
96
+ readonly updatedRevision: RevisionTag;
97
+ /**
98
+ * Predicate to determine if a revision needs replacing.
99
+ * @param revision - The revision that may need replacing.
100
+ * @returns true iff the given `revision` needs replacing.
101
+ */
102
+ isObsolete(revision: RevisionTag | undefined): boolean;
103
+ /**
104
+ * Returns the updated ID for the given ID.
105
+ * @param id - The ID to update.
106
+ * @returns an updated ID iff the given `id` needs updating, otherwise returns the given `id`.
107
+ * @remarks
108
+ * This function always maps the same input {@link ChangeAtomId.revision | revision} and {@link ChangeAtomId.localId | local ID} to the same output revision local ID.
109
+ * This means multiple references to the same atom of change will remain consistent after revision replacement.
110
+ */
111
+ getUpdatedAtomId<T extends ChangeAtomId>(id: T): T;
78
112
  }
79
113
  export interface TaggedChange<TChangeset, TTag = RevisionTag | undefined> {
80
114
  readonly revision: TTag;
@@ -1 +1 @@
1
- {"version":3,"file":"changeRebaser.d.ts","sourceRoot":"","sources":["../../../src/core/rebase/changeRebaser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,aAAa,CAAC,UAAU;IACxC,UAAU,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IAEnC;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,UAAU,CAAC,EAAE,GAAG,UAAU,CAAC;IAEzD;;;;;;;;;;;;OAYG;IACH,MAAM,CACL,OAAO,EAAE,YAAY,CAAC,UAAU,CAAC,EACjC,UAAU,EAAE,OAAO,EACnB,QAAQ,EAAE,WAAW,GACnB,UAAU,CAAC;IAEd;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CACL,MAAM,EAAE,Y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AAE,MAAM,EAAE,CAAC;AACxC,CAAC;AAFD,wCAEC;AAMD,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC5B,qEAAU,CAAA;IACV,+DAAO,CAAA;IACP,iEAAQ,CAAA;AACT,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Invariant } from \"../../util/index.js\";\n\nimport type { RevisionTag } from \"./types.js\";\n\n/**\n * Rebasing logic for a particular kind of change.\n *\n * This interface is used to provide rebase policy to `Rebaser`.\n *\n * The implementation must ensure TChangeset forms a {@link https://en.wikipedia.org/wiki/Group_(mathematics | group}) where:\n * - `compose([])` is the identity element.\n * - associativity is defined as `compose([...a, ...b])` is equal to\n * `compose([compose(a), compose(b)])` for all `a` and `b`.\n * - `inverse(a)` gives the inverse element of `a`.\n *\n * In these requirements the definition of equality is up to the implementer,\n * but it is required that any two changes which are considered equal:\n * - have the same impact when applied to any tree.\n * - can be substituted for each-other in all methods on this\n * interface and produce equal (by this same definition) results.\n *\n * For the sake of testability, implementations will likely want to have a concrete equality implementation.\n *\n * This API uses `compose` on arrays instead of an explicit identity element and associative binary operator\n * to allow the implementation more room for optimization,\n * but should otherwise be equivalent to the identity element and binary operator group approach.\n *\n * TODO:\n * Be more specific about the above requirements.\n * For example, would something that is close to forming a group but has precision issues\n * (ex: the floating point numbers and addition) be ok?\n * Would this cause decoherence (and thus be absolutely not ok),\n * or just minor semantic precision issues, which could be tolerated.\n * For now assume that such issues are not ok.\n */\nexport interface ChangeRebaser<TChangeset> {\n\t_typeCheck?: Invariant<TChangeset>;\n\n\t/**\n\t * Compose a collection of changesets into a single one.\n\t * See {@link ChangeRebaser} for requirements.\n\t */\n\tcompose(changes: TaggedChange<TChangeset>[]): TChangeset;\n\n\t/**\n\t * @param changes - The changes to invert.\n\t * @param isRollback - Whether the inverted change is meant to rollback a change on a branch as is the case when\n\t * performing a sandwich rebase.\n\t * @param revision - The revision for the invert changeset.\n\t * This flag is relevant to merge semantics that are dependent on edit sequencing order:\n\t * - In the context of an undo, this function inverts a change that is sequenced and applied before the produced inverse.\n\t * - In the context of a rollback, this function inverts a change that is sequenced after but applied before the produced inverse.\n\t * @returns the inverse of `changes`.\n\t *\n\t * `compose([changes, inverse(changes)])` be equal to `compose([])`:\n\t * See {@link ChangeRebaser} for details.\n\t */\n\tinvert(\n\t\tchanges: TaggedChange<TChangeset>,\n\t\tisRollback: boolean,\n\t\trevision: RevisionTag,\n\t): TChangeset;\n\n\t/**\n\t * Rebase `change` over `over`.\n\t *\n\t * The resulting changeset should, as much as possible, replicate the same semantics as `change`,\n\t * except be valid to apply after `over` instead of before it.\n\t *\n\t * When rebasing `change` onto a new branch, `revisionMetadata` should include entries for all changesets\n\t * from the source which are being rebased onto the target branch.\n\t *\n\t * Requirements:\n\t * The implementation must ensure that for all possible changesets `a`, `b` and `c`:\n\t * - `rebase(a, compose([b, c])` is equal to `rebase(rebase(a, b), c)`.\n\t * - `rebase(compose([a, b]), c)` is equal to\n\t * `compose([rebase(a, c), rebase(b, compose([inverse(a), c, rebase(a, c)])])`.\n\t * - `rebase(a, compose([]))` is equal to `a`.\n\t * - `rebase(compose([]), a)` is equal to `compose([])`.\n\t */\n\trebase(\n\t\tchange: TaggedChange<TChangeset>,\n\t\tover: TaggedChange<TChangeset>,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): TChangeset;\n\n\tchangeRevision(\n\t\tchange: TChangeset,\n\t\tnewRevision: RevisionTag | undefined,\n\t\trollBackOf?: RevisionTag,\n\t): TChangeset;\n}\n\nexport interface TaggedChange<TChangeset, TTag = RevisionTag | undefined> {\n\treadonly revision: TTag;\n\t/**\n\t * When populated, indicates that the changeset is a rollback for the purpose of a rebase sandwich.\n\t * The value corresponds to the `revision` of the original changeset being rolled back.\n\t */\n\treadonly rollbackOf?: RevisionTag;\n\treadonly change: TChangeset;\n}\n\nexport function mapTaggedChange<TIn, TOut>(\n\tinput: TaggedChange<TIn>,\n\tchange: TOut,\n): TaggedChange<TOut> {\n\treturn { ...input, change };\n}\n\n/**\n * A callback that returns the index of the changeset associated with the given RevisionTag among the changesets being\n * composed or rebased. This index is solely meant to communicate relative ordering, and is only valid within the scope of the\n * compose or rebase operation.\n *\n * During composition, the index reflects the order of the changeset within the overall composed changeset that is\n * being produced.\n *\n * During rebase, the indices of the base changes are all lower than the indices of the change being rebased.\n */\nexport type RevisionIndexer = (tag: RevisionTag) => number | undefined;\n\nexport interface RevisionMetadataSource {\n\treadonly getIndex: RevisionIndexer;\n\treadonly tryGetInfo: (tag: RevisionTag | undefined) => RevisionInfo | undefined;\n\treadonly hasRollback: (tag: RevisionTag) => boolean;\n}\n\nexport interface RevisionInfo {\n\treadonly revision: RevisionTag;\n\t/**\n\t * When populated, indicates that the changeset is a rollback for the purpose of a rebase sandwich.\n\t * The value corresponds to the `revision` of the original changeset being rolled back.\n\t */\n\treadonly rollbackOf?: RevisionTag;\n}\n\nexport function tagChange<T>(change: T, revision: RevisionTag | undefined): TaggedChange<T> {\n\treturn { revision, change };\n}\n\nexport function tagRollbackInverse<TChange, TTag>(\n\tinverseChange: TChange,\n\trevision: TTag,\n\trollbackOf: RevisionTag | undefined,\n): TaggedChange<TChange, TTag> {\n\treturn {\n\t\trevision,\n\t\tchange: inverseChange,\n\t\trollbackOf,\n\t};\n}\n\nexport function makeAnonChange<T>(change: T): TaggedChange<T> {\n\treturn { revision: undefined, change };\n}\n\nexport interface FinalChange {\n\treadonly status: FinalChangeStatus;\n}\n\nexport enum FinalChangeStatus {\n\tconflicted,\n\trebased,\n\tcommuted,\n}\n"]}
1
+ {"version":3,"file":"changeRebaser.js","sourceRoot":"","sources":["../../../src/core/rebase/changeRebaser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA2IH,SAAgB,eAAe,CAC9B,KAAwB,EACxB,MAAY;IAEZ,OAAO,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,CAAC;AAC7B,CAAC;AALD,0CAKC;AA6BD,SAAgB,SAAS,CAAI,MAAS,EAAE,QAAiC;IACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAC7B,CAAC;AAFD,8BAEC;AAED,SAAgB,kBAAkB,CACjC,aAAsB,EACtB,QAAc,EACd,UAAmC;IAEnC,OAAO;QACN,QAAQ;QACR,MAAM,EAAE,aAAa;QACrB,UAAU;KACV,CAAC;AACH,CAAC;AAVD,gDAUC;AAED,SAAgB,cAAc,CAAI,MAAS;IAC1C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AACxC,CAAC;AAFD,wCAEC;AAMD,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC5B,qEAAU,CAAA;IACV,+DAAO,CAAA;IACP,iEAAQ,CAAA;AACT,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Invariant } from \"../../util/index.js\";\n\nimport type { ChangeAtomId, RevisionTag } from \"./types.js\";\n\n/**\n * Rebasing logic for a particular kind of change.\n *\n * This interface is used to provide rebase policy to `Rebaser`.\n *\n * The implementation must ensure TChangeset forms a {@link https://en.wikipedia.org/wiki/Group_(mathematics | group}) where:\n * - `compose([])` is the identity element.\n * - associativity is defined as `compose([...a, ...b])` is equal to\n * `compose([compose(a), compose(b)])` for all `a` and `b`.\n * - `inverse(a)` gives the inverse element of `a`.\n *\n * In these requirements the definition of equality is up to the implementer,\n * but it is required that any two changes which are considered equal:\n * - have the same impact when applied to any tree.\n * - can be substituted for each-other in all methods on this\n * interface and produce equal (by this same definition) results.\n *\n * For the sake of testability, implementations will likely want to have a concrete equality implementation.\n *\n * This API uses `compose` on arrays instead of an explicit identity element and associative binary operator\n * to allow the implementation more room for optimization,\n * but should otherwise be equivalent to the identity element and binary operator group approach.\n *\n * TODO:\n * Be more specific about the above requirements.\n * For example, would something that is close to forming a group but has precision issues\n * (ex: the floating point numbers and addition) be ok?\n * Would this cause decoherence (and thus be absolutely not ok),\n * or just minor semantic precision issues, which could be tolerated.\n * For now assume that such issues are not ok.\n */\nexport interface ChangeRebaser<TChangeset> {\n\t_typeCheck?: Invariant<TChangeset>;\n\n\t/**\n\t * Compose a collection of changesets into a single one.\n\t * See {@link ChangeRebaser} for requirements.\n\t */\n\tcompose(changes: TaggedChange<TChangeset>[]): TChangeset;\n\n\t/**\n\t * @param changes - The changes to invert.\n\t * @param isRollback - Whether the inverted change is meant to rollback a change on a branch as is the case when\n\t * performing a sandwich rebase.\n\t * @param revision - The revision for the invert changeset.\n\t * This flag is relevant to merge semantics that are dependent on edit sequencing order:\n\t * - In the context of an undo, this function inverts a change that is sequenced and applied before the produced inverse.\n\t * - In the context of a rollback, this function inverts a change that is sequenced after but applied before the produced inverse.\n\t * @returns the inverse of `changes`.\n\t *\n\t * `compose([changes, inverse(changes)])` be equal to `compose([])`:\n\t * See {@link ChangeRebaser} for details.\n\t */\n\tinvert(\n\t\tchanges: TaggedChange<TChangeset>,\n\t\tisRollback: boolean,\n\t\trevision: RevisionTag,\n\t): TChangeset;\n\n\t/**\n\t * Rebase `change` over `over`.\n\t *\n\t * The resulting changeset should, as much as possible, replicate the same semantics as `change`,\n\t * except be valid to apply after `over` instead of before it.\n\t *\n\t * When rebasing `change` onto a new branch, `revisionMetadata` should include entries for all changesets\n\t * from the source which are being rebased onto the target branch.\n\t *\n\t * Requirements:\n\t * The implementation must ensure that for all possible changesets `a`, `b` and `c`:\n\t * - `rebase(a, compose([b, c])` is equal to `rebase(rebase(a, b), c)`.\n\t * - `rebase(compose([a, b]), c)` is equal to\n\t * `compose([rebase(a, c), rebase(b, compose([inverse(a), c, rebase(a, c)])])`.\n\t * - `rebase(a, compose([]))` is equal to `a`.\n\t * - `rebase(compose([]), a)` is equal to `compose([])`.\n\t */\n\trebase(\n\t\tchange: TaggedChange<TChangeset>,\n\t\tover: TaggedChange<TChangeset>,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): TChangeset;\n\n\t/**\n\t * Retrieves the set of revisions associated with the given change.\n\t */\n\tgetRevisions(change: TChangeset): Set<RevisionTag | undefined>;\n\n\t/**\n\t * Produces a changeset that is equivalent to the given `change`, but with all references to its own revisions replaced according to the given `replacer`.\n\t * @param change - The change to update. Not modified.\n\t * @param replacer - The replacer to use.\n\t * @returns A changeset equivalent to `change`, but with all references to its own revision replaced according to `replacer`.\n\t */\n\tchangeRevision(change: TChangeset, replacer: RevisionReplacer): TChangeset;\n}\n\n/**\n * A type that can update references to a set of obsolete revisions across multiple changesets.\n */\nexport interface RevisionReplacer {\n\t/**\n\t * The revision to use in place of the obsolete revisions.\n\t */\n\treadonly updatedRevision: RevisionTag;\n\n\t/**\n\t * Predicate to determine if a revision needs replacing.\n\t * @param revision - The revision that may need replacing.\n\t * @returns true iff the given `revision` needs replacing.\n\t */\n\tisObsolete(revision: RevisionTag | undefined): boolean;\n\n\t/**\n\t * Returns the updated ID for the given ID.\n\t * @param id - The ID to update.\n\t * @returns an updated ID iff the given `id` needs updating, otherwise returns the given `id`.\n\t * @remarks\n\t * This function always maps the same input {@link ChangeAtomId.revision | revision} and {@link ChangeAtomId.localId | local ID} to the same output revision local ID.\n\t * This means multiple references to the same atom of change will remain consistent after revision replacement.\n\t */\n\tgetUpdatedAtomId<T extends ChangeAtomId>(id: T): T;\n}\n\nexport interface TaggedChange<TChangeset, TTag = RevisionTag | undefined> {\n\treadonly revision: TTag;\n\t/**\n\t * When populated, indicates that the changeset is a rollback for the purpose of a rebase sandwich.\n\t * The value corresponds to the `revision` of the original changeset being rolled back.\n\t */\n\treadonly rollbackOf?: RevisionTag;\n\treadonly change: TChangeset;\n}\n\nexport function mapTaggedChange<TIn, TOut>(\n\tinput: TaggedChange<TIn>,\n\tchange: TOut,\n): TaggedChange<TOut> {\n\treturn { ...input, change };\n}\n\n/**\n * A callback that returns the index of the changeset associated with the given RevisionTag among the changesets being\n * composed or rebased. This index is solely meant to communicate relative ordering, and is only valid within the scope of the\n * compose or rebase operation.\n *\n * During composition, the index reflects the order of the changeset within the overall composed changeset that is\n * being produced.\n *\n * During rebase, the indices of the base changes are all lower than the indices of the change being rebased.\n */\nexport type RevisionIndexer = (tag: RevisionTag) => number | undefined;\n\nexport interface RevisionMetadataSource {\n\treadonly getIndex: RevisionIndexer;\n\treadonly tryGetInfo: (tag: RevisionTag | undefined) => RevisionInfo | undefined;\n\treadonly hasRollback: (tag: RevisionTag) => boolean;\n}\n\nexport interface RevisionInfo {\n\treadonly revision: RevisionTag;\n\t/**\n\t * When populated, indicates that the changeset is a rollback for the purpose of a rebase sandwich.\n\t * The value corresponds to the `revision` of the original changeset being rolled back.\n\t */\n\treadonly rollbackOf?: RevisionTag;\n}\n\nexport function tagChange<T>(change: T, revision: RevisionTag | undefined): TaggedChange<T> {\n\treturn { revision, change };\n}\n\nexport function tagRollbackInverse<TChange, TTag>(\n\tinverseChange: TChange,\n\trevision: TTag,\n\trollbackOf: RevisionTag | undefined,\n): TaggedChange<TChange, TTag> {\n\treturn {\n\t\trevision,\n\t\tchange: inverseChange,\n\t\trollbackOf,\n\t};\n}\n\nexport function makeAnonChange<T>(change: T): TaggedChange<T> {\n\treturn { revision: undefined, change };\n}\n\nexport interface FinalChange {\n\treadonly status: FinalChangeStatus;\n}\n\nexport enum FinalChangeStatus {\n\tconflicted,\n\trebased,\n\tcommuted,\n}\n"]}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { areEqualChangeAtomIds, areEqualChangeAtomIdOpts, makeChangeAtomId, asChangeAtomId, mintCommit, type GraphCommit, CommitKind, type CommitMetadata, type ChangeMetadata, type RevisionTag, RevisionTagSchema, type EncodedRevisionTag, type EncodedChangeAtomId, type EncodedStableId, type ChangesetLocalId, type ChangeAtomId, type ChangeAtomIdMap, SessionIdSchema, taggedAtomId, taggedOptAtomId, offsetChangeAtomId, StableIdSchema, subtractChangeAtomIds, replaceAtomRevisions, type ChangeAtomIdRangeMap, newChangeAtomIdRangeMap, compareRevisions, } from "./types.js";
5
+ export { areEqualChangeAtomIds, areEqualChangeAtomIdOpts, makeChangeAtomId, asChangeAtomId, mintCommit, type GraphCommit, CommitKind, type CommitMetadata, type ChangeMetadata, type RevisionTag, RevisionTagSchema, type EncodedRevisionTag, type EncodedChangeAtomId, type EncodedStableId, type ChangesetLocalId, type ChangeAtomId, type ChangeAtomIdMap, SessionIdSchema, taggedAtomId, taggedOptAtomId, offsetChangeAtomId, StableIdSchema, subtractChangeAtomIds, type ChangeAtomIdRangeMap, newChangeAtomIdRangeMap, compareRevisions, } from "./types.js";
6
6
  export { RevisionTagCodec } from "./revisionTagCodec.js";
7
- export { type ChangeRebaser, type FinalChange, FinalChangeStatus, makeAnonChange, tagChange, mapTaggedChange, tagRollbackInverse, type TaggedChange, type RevisionMetadataSource, type RevisionInfo, } from "./changeRebaser.js";
7
+ export { type ChangeRebaser, type FinalChange, FinalChangeStatus, makeAnonChange, tagChange, mapTaggedChange, tagRollbackInverse, type TaggedChange, type RevisionMetadataSource, type RevisionInfo, type RevisionReplacer, } from "./changeRebaser.js";
8
8
  export { findAncestor, findCommonAncestor, rebaseBranch, type BranchRebaseResult, rebaseChange, rebaseChangeOverChanges, revisionMetadataSourceFromInfo, type RebaseStats, type RebaseStatsWithDuration, replaceChange, isAncestor, diffHistories, } from "./utils.js";
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/rebase/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,KAAK,WAAW,EAChB,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,gBAAgB,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,KAAK,kBAAkB,EACvB,YAAY,EACZ,uBAAuB,EACvB,8BAA8B,EAC9B,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,aAAa,EACb,UAAU,EACV,aAAa,GACb,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/rebase/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,KAAK,WAAW,EAChB,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,gBAAgB,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,gBAAgB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,KAAK,kBAAkB,EACvB,YAAY,EACZ,uBAAuB,EACvB,8BAA8B,EAC9B,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,aAAa,EACb,UAAU,EACV,aAAa,GACb,MAAM,YAAY,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.diffHistories = exports.isAncestor = exports.replaceChange = exports.revisionMetadataSourceFromInfo = exports.rebaseChangeOverChanges = exports.rebaseChange = exports.rebaseBranch = exports.findCommonAncestor = exports.findAncestor = exports.tagRollbackInverse = exports.mapTaggedChange = exports.tagChange = exports.makeAnonChange = exports.FinalChangeStatus = exports.RevisionTagCodec = exports.compareRevisions = exports.newChangeAtomIdRangeMap = exports.replaceAtomRevisions = exports.subtractChangeAtomIds = exports.StableIdSchema = exports.offsetChangeAtomId = exports.taggedOptAtomId = exports.taggedAtomId = exports.SessionIdSchema = exports.RevisionTagSchema = exports.CommitKind = exports.mintCommit = exports.asChangeAtomId = exports.makeChangeAtomId = exports.areEqualChangeAtomIdOpts = exports.areEqualChangeAtomIds = void 0;
7
+ exports.diffHistories = exports.isAncestor = exports.replaceChange = exports.revisionMetadataSourceFromInfo = exports.rebaseChangeOverChanges = exports.rebaseChange = exports.rebaseBranch = exports.findCommonAncestor = exports.findAncestor = exports.tagRollbackInverse = exports.mapTaggedChange = exports.tagChange = exports.makeAnonChange = exports.FinalChangeStatus = exports.RevisionTagCodec = exports.compareRevisions = exports.newChangeAtomIdRangeMap = exports.subtractChangeAtomIds = exports.StableIdSchema = exports.offsetChangeAtomId = exports.taggedOptAtomId = exports.taggedAtomId = exports.SessionIdSchema = exports.RevisionTagSchema = exports.CommitKind = exports.mintCommit = exports.asChangeAtomId = exports.makeChangeAtomId = exports.areEqualChangeAtomIdOpts = exports.areEqualChangeAtomIds = void 0;
8
8
  var types_js_1 = require("./types.js");
9
9
  Object.defineProperty(exports, "areEqualChangeAtomIds", { enumerable: true, get: function () { return types_js_1.areEqualChangeAtomIds; } });
10
10
  Object.defineProperty(exports, "areEqualChangeAtomIdOpts", { enumerable: true, get: function () { return types_js_1.areEqualChangeAtomIdOpts; } });
@@ -19,7 +19,6 @@ Object.defineProperty(exports, "taggedOptAtomId", { enumerable: true, get: funct
19
19
  Object.defineProperty(exports, "offsetChangeAtomId", { enumerable: true, get: function () { return types_js_1.offsetChangeAtomId; } });
20
20
  Object.defineProperty(exports, "StableIdSchema", { enumerable: true, get: function () { return types_js_1.StableIdSchema; } });
21
21
  Object.defineProperty(exports, "subtractChangeAtomIds", { enumerable: true, get: function () { return types_js_1.subtractChangeAtomIds; } });
22
- Object.defineProperty(exports, "replaceAtomRevisions", { enumerable: true, get: function () { return types_js_1.replaceAtomRevisions; } });
23
22
  Object.defineProperty(exports, "newChangeAtomIdRangeMap", { enumerable: true, get: function () { return types_js_1.newChangeAtomIdRangeMap; } });
24
23
  Object.defineProperty(exports, "compareRevisions", { enumerable: true, get: function () { return types_js_1.compareRevisions; } });
25
24
  var revisionTagCodec_js_1 = require("./revisionTagCodec.js");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/rebase/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uCA4BoB;AA3BnB,iHAAA,qBAAqB,OAAA;AACrB,oHAAA,wBAAwB,OAAA;AACxB,4GAAA,gBAAgB,OAAA;AAChB,0GAAA,cAAc,OAAA;AACd,sGAAA,UAAU,OAAA;AAEV,sGAAA,UAAU,OAAA;AAIV,6GAAA,iBAAiB,OAAA;AAOjB,2GAAA,eAAe,OAAA;AACf,wGAAA,YAAY,OAAA;AACZ,2GAAA,eAAe,OAAA;AACf,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AACd,iHAAA,qBAAqB,OAAA;AACrB,gHAAA,oBAAoB,OAAA;AAEpB,mHAAA,uBAAuB,OAAA;AACvB,4GAAA,gBAAgB,OAAA;AAEjB,6DAAyD;AAAhD,uHAAA,gBAAgB,OAAA;AACzB,uDAW4B;AAR3B,qHAAA,iBAAiB,OAAA;AACjB,kHAAA,cAAc,OAAA;AACd,6GAAA,SAAS,OAAA;AACT,mHAAA,eAAe,OAAA;AACf,sHAAA,kBAAkB,OAAA;AAKnB,uCAaoB;AAZnB,wGAAA,YAAY,OAAA;AACZ,8GAAA,kBAAkB,OAAA;AAClB,wGAAA,YAAY,OAAA;AAEZ,wGAAA,YAAY,OAAA;AACZ,mHAAA,uBAAuB,OAAA;AACvB,0HAAA,8BAA8B,OAAA;AAG9B,yGAAA,aAAa,OAAA;AACb,sGAAA,UAAU,OAAA;AACV,yGAAA,aAAa,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tareEqualChangeAtomIds,\n\tareEqualChangeAtomIdOpts,\n\tmakeChangeAtomId,\n\tasChangeAtomId,\n\tmintCommit,\n\ttype GraphCommit,\n\tCommitKind,\n\ttype CommitMetadata,\n\ttype ChangeMetadata,\n\ttype RevisionTag,\n\tRevisionTagSchema,\n\ttype EncodedRevisionTag,\n\ttype EncodedChangeAtomId,\n\ttype EncodedStableId,\n\ttype ChangesetLocalId,\n\ttype ChangeAtomId,\n\ttype ChangeAtomIdMap,\n\tSessionIdSchema,\n\ttaggedAtomId,\n\ttaggedOptAtomId,\n\toffsetChangeAtomId,\n\tStableIdSchema,\n\tsubtractChangeAtomIds,\n\treplaceAtomRevisions,\n\ttype ChangeAtomIdRangeMap,\n\tnewChangeAtomIdRangeMap,\n\tcompareRevisions,\n} from \"./types.js\";\nexport { RevisionTagCodec } from \"./revisionTagCodec.js\";\nexport {\n\ttype ChangeRebaser,\n\ttype FinalChange,\n\tFinalChangeStatus,\n\tmakeAnonChange,\n\ttagChange,\n\tmapTaggedChange,\n\ttagRollbackInverse,\n\ttype TaggedChange,\n\ttype RevisionMetadataSource,\n\ttype RevisionInfo,\n} from \"./changeRebaser.js\";\nexport {\n\tfindAncestor,\n\tfindCommonAncestor,\n\trebaseBranch,\n\ttype BranchRebaseResult,\n\trebaseChange,\n\trebaseChangeOverChanges,\n\trevisionMetadataSourceFromInfo,\n\ttype RebaseStats,\n\ttype RebaseStatsWithDuration,\n\treplaceChange,\n\tisAncestor,\n\tdiffHistories,\n} from \"./utils.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/rebase/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uCA2BoB;AA1BnB,iHAAA,qBAAqB,OAAA;AACrB,oHAAA,wBAAwB,OAAA;AACxB,4GAAA,gBAAgB,OAAA;AAChB,0GAAA,cAAc,OAAA;AACd,sGAAA,UAAU,OAAA;AAEV,sGAAA,UAAU,OAAA;AAIV,6GAAA,iBAAiB,OAAA;AAOjB,2GAAA,eAAe,OAAA;AACf,wGAAA,YAAY,OAAA;AACZ,2GAAA,eAAe,OAAA;AACf,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AACd,iHAAA,qBAAqB,OAAA;AAErB,mHAAA,uBAAuB,OAAA;AACvB,4GAAA,gBAAgB,OAAA;AAEjB,6DAAyD;AAAhD,uHAAA,gBAAgB,OAAA;AACzB,uDAY4B;AAT3B,qHAAA,iBAAiB,OAAA;AACjB,kHAAA,cAAc,OAAA;AACd,6GAAA,SAAS,OAAA;AACT,mHAAA,eAAe,OAAA;AACf,sHAAA,kBAAkB,OAAA;AAMnB,uCAaoB;AAZnB,wGAAA,YAAY,OAAA;AACZ,8GAAA,kBAAkB,OAAA;AAClB,wGAAA,YAAY,OAAA;AAEZ,wGAAA,YAAY,OAAA;AACZ,mHAAA,uBAAuB,OAAA;AACvB,0HAAA,8BAA8B,OAAA;AAG9B,yGAAA,aAAa,OAAA;AACb,sGAAA,UAAU,OAAA;AACV,yGAAA,aAAa,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tareEqualChangeAtomIds,\n\tareEqualChangeAtomIdOpts,\n\tmakeChangeAtomId,\n\tasChangeAtomId,\n\tmintCommit,\n\ttype GraphCommit,\n\tCommitKind,\n\ttype CommitMetadata,\n\ttype ChangeMetadata,\n\ttype RevisionTag,\n\tRevisionTagSchema,\n\ttype EncodedRevisionTag,\n\ttype EncodedChangeAtomId,\n\ttype EncodedStableId,\n\ttype ChangesetLocalId,\n\ttype ChangeAtomId,\n\ttype ChangeAtomIdMap,\n\tSessionIdSchema,\n\ttaggedAtomId,\n\ttaggedOptAtomId,\n\toffsetChangeAtomId,\n\tStableIdSchema,\n\tsubtractChangeAtomIds,\n\ttype ChangeAtomIdRangeMap,\n\tnewChangeAtomIdRangeMap,\n\tcompareRevisions,\n} from \"./types.js\";\nexport { RevisionTagCodec } from \"./revisionTagCodec.js\";\nexport {\n\ttype ChangeRebaser,\n\ttype FinalChange,\n\tFinalChangeStatus,\n\tmakeAnonChange,\n\ttagChange,\n\tmapTaggedChange,\n\ttagRollbackInverse,\n\ttype TaggedChange,\n\ttype RevisionMetadataSource,\n\ttype RevisionInfo,\n\ttype RevisionReplacer,\n} from \"./changeRebaser.js\";\nexport {\n\tfindAncestor,\n\tfindCommonAncestor,\n\trebaseBranch,\n\ttype BranchRebaseResult,\n\trebaseChange,\n\trebaseChangeOverChanges,\n\trevisionMetadataSourceFromInfo,\n\ttype RebaseStats,\n\ttype RebaseStatsWithDuration,\n\treplaceChange,\n\tisAncestor,\n\tdiffHistories,\n} from \"./utils.js\";\n"]}
@@ -58,12 +58,16 @@ export declare function asChangeAtomId(id: ChangesetLocalId | ChangeAtomId): Cha
58
58
  export declare function taggedAtomId(id: ChangeAtomId, revision: RevisionTag | undefined): ChangeAtomId;
59
59
  export declare function taggedOptAtomId(id: ChangeAtomId | undefined, revision: RevisionTag | undefined): ChangeAtomId | undefined;
60
60
  export declare function offsetChangeAtomId(id: ChangeAtomId, offset: number): ChangeAtomId;
61
- export declare function replaceAtomRevisions(id: ChangeAtomId, oldRevisions: Set<RevisionTag | undefined>, newRevision: RevisionTag | undefined): ChangeAtomId;
62
61
  /**
63
62
  * A node in a graph of commits. A commit's parent is the commit on which it was based.
64
63
  */
65
64
  export interface GraphCommit<TChange> {
66
- /** The tag for this commit. If this commit is rebased, the corresponding rebased commit will retain this tag. */
65
+ /**
66
+ * The tag for this commit.
67
+ * @remarks
68
+ * If this commit is rebased, the corresponding rebased commit will retain this tag.
69
+ * With the exception of transaction commits (which all share the same tag), this tag is unique within a given branch history.
70
+ */
67
71
  readonly revision: RevisionTag;
68
72
  /** The change that will result from applying this commit */
69
73
  readonly change: TChange;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/rebase/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,mBAAmB,EACnB,SAAS,EACT,wBAAwB,EACxB,QAAQ,EACR,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EACN,KAAK,KAAK,EACV,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,QAAQ,EAIR,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,eAAO,MAAM,eAAe,gDAAiC,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,wBAAwB,GAAG,MAAM,CAAC;AAC5D,MAAM,MAAM,kBAAkB,GAAG,KAAK,CA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,SAAS,GACxB,MAAM,CAYR"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.compareRevisions = exports.subtractChangeAtomIds = exports.newChangeAtomIdRangeMap = exports.mintCommit = exports.CommitKind = exports.replaceAtomRevisions = exports.offsetChangeAtomId = exports.taggedOptAtomId = exports.taggedAtomId = exports.asChangeAtomId = exports.makeChangeAtomId = exports.areEqualChangeAtomIdOpts = exports.areEqualChangeAtomIds = exports.StableIdSchema = exports.RevisionTagSchema = exports.SessionIdSchema = void 0;
7
+ exports.compareRevisions = exports.subtractChangeAtomIds = exports.newChangeAtomIdRangeMap = exports.mintCommit = exports.CommitKind = exports.offsetChangeAtomId = exports.taggedOptAtomId = exports.taggedAtomId = exports.asChangeAtomId = exports.makeChangeAtomId = exports.areEqualChangeAtomIdOpts = exports.areEqualChangeAtomIds = exports.StableIdSchema = exports.RevisionTagSchema = exports.SessionIdSchema = void 0;
8
8
  const typebox_1 = require("@sinclair/typebox");
9
9
  const index_js_1 = require("../../util/index.js");
10
10
  /**
@@ -56,17 +56,6 @@ function offsetChangeAtomId(id, offset) {
56
56
  return { ...id, localId: (0, index_js_1.brand)(id.localId + offset) };
57
57
  }
58
58
  exports.offsetChangeAtomId = offsetChangeAtomId;
59
- function replaceAtomRevisions(id, oldRevisions, newRevision) {
60
- return oldRevisions.has(id.revision) ? atomWithRevision(id, newRevision) : id;
61
- }
62
- exports.replaceAtomRevisions = replaceAtomRevisions;
63
- function atomWithRevision(id, revision) {
64
- const updated = { ...id, revision };
65
- if (revision === undefined) {
66
- delete updated.revision;
67
- }
68
- return updated;
69
- }
70
59
  /**
71
60
  * The type of a commit. This is used to describe the context in which the commit was created.
72
61
  *
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/rebase/types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,+CAAyC;AAEzC,kDAQ6B;AAE7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IACpC,OAAO;QACN,QAAQ;QACR,MAAM;QACN,MAAM;KACN,CAAC;AACH,CAAC;AAVD,gCAUC;AAID,SAAgB,uBAAuB;IACtC,OAAO,IAAI,mBAAQ,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,CAAC;AAChE,CAAC;AAFD,0DAEC;AAED,SAAgB,qBAAqB,CAAC,CAAe,EAAE,CAAe;IACrE,MAAM,GAAG,GAAG,gBAAgB,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,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;AAPD,sDAOC;AAED,SAAgB,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;AAfD,4CAeC","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 JsonCompatibleReadOnly,\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 * Information about a commit that has been applied.\n *\n * @sealed @alpha\n */\nexport type ChangeMetadata = CommitMetadata &\n\t(\n\t\t| {\n\t\t\t\treadonly isLocal: true;\n\t\t\t\t/**\n\t\t\t\t * A serializable object that encodes the change.\n\t\t\t\t * @remarks This change object can be {@link TreeBranchAlpha.applyChange | applied to another branch} in the same state as the one which generated it.\n\t\t\t\t * The change object must be applied to a SharedTree with the same IdCompressor session ID as it was created from.\n\t\t\t\t * @privateRemarks\n\t\t\t\t * This is a `SerializedChange` from treeCheckout.ts.\n\t\t\t\t */\n\t\t\t\tgetChange(): JsonCompatibleReadOnly;\n\t\t }\n\t\t| {\n\t\t\t\treadonly isLocal: false;\n\t\t\t\treadonly getChange?: undefined;\n\t\t }\n\t);\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,+CAAyC;AAEzC,kDAQ6B;AAE7B;;GAEG;AACU,QAAA,eAAe,GAAG,IAAA,4BAAiB,GAAa,CAAC;AAWjD,QAAA,iBAAiB,GAAG,cAAI,CAAC,KAAK,CAAC;IAC3C,cAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IACpB,IAAA,4BAAiB,GAAuC;CACxD,CAAC,CAAC;AAGU,QAAA,cAAc,GAAG,cAAI,CAAC,MAAM,EAAE,CAAC;AA+B5C;;GAEG;AACH,SAAgB,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;AAFD,sDAEC;AAED,SAAgB,wBAAwB,CACvC,CAA2B,EAC3B,CAA2B;IAE3B,IAAI,CAAC,KAAK,SAAS,IA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["/*!\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 JsonCompatibleReadOnly,\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\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/**\n\t * The tag for this commit.\n\t * @remarks\n\t * If this commit is rebased, the corresponding rebased commit will retain this tag.\n\t * With the exception of transaction commits (which all share the same tag), this tag is unique within a given branch history.\n\t */\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 * Information about a commit that has been applied.\n *\n * @sealed @alpha\n */\nexport type ChangeMetadata = CommitMetadata &\n\t(\n\t\t| {\n\t\t\t\treadonly isLocal: true;\n\t\t\t\t/**\n\t\t\t\t * A serializable object that encodes the change.\n\t\t\t\t * @remarks This change object can be {@link TreeBranchAlpha.applyChange | applied to another branch} in the same state as the one which generated it.\n\t\t\t\t * The change object must be applied to a SharedTree with the same IdCompressor session ID as it was created from.\n\t\t\t\t * @privateRemarks\n\t\t\t\t * This is a `SerializedChange` from treeCheckout.ts.\n\t\t\t\t */\n\t\t\t\tgetChange(): JsonCompatibleReadOnly;\n\t\t }\n\t\t| {\n\t\t\t\treadonly isLocal: false;\n\t\t\t\treadonly getChange?: undefined;\n\t\t }\n\t);\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"]}
@@ -17,7 +17,7 @@ function rebaseBranch(mintRevisionTag, changeRebaser, sourceHead, targetCommit,
17
17
  (0, internal_1.assert)(ancestor !== undefined, 0x675 /* branches must be related */);
18
18
  const sourceBranchLength = sourcePath.length;
19
19
  // Find where `targetCommit` is in the target branch
20
- const targetCommitIndex = targetPath.findIndex((r) => r === targetCommit);
20
+ const targetCommitIndex = targetPath.indexOf(targetCommit);
21
21
  if (targetCommitIndex === -1) {
22
22
  // If the targetCommit is not in the target path, then it is either disjoint from `target` or it is behind/at
23
23
  // the commit where source and target diverge (ancestor), in which case there is nothing more to rebase
@@ -103,7 +103,7 @@ function rebaseBranch(mintRevisionTag, changeRebaser, sourceHead, targetCommit,
103
103
  const revInfos = getRevInfoFromTaggedChanges([...targetRebasePath, ...sourcePath]);
104
104
  // Note that the `revisionMetadata` gets updated as `revInfos` gets updated.
105
105
  const revisionMetadata = revisionMetadataSourceFromInfo(revInfos);
106
- let editsToCompose = targetRebasePath.slice();
106
+ let editsToCompose = [...targetRebasePath];
107
107
  for (const c of sourcePath) {
108
108
  const rollback = rollbackFromCommit(changeRebaser, c, mintRevisionTag, true /* cache */);
109
109
  if (sourceSet.has(c.revision)) {
@@ -177,7 +177,7 @@ function revisionMetadataSourceFromInfo(revInfos) {
177
177
  return index === undefined ? undefined : revInfos[index];
178
178
  };
179
179
  const hasRollback = (revision) => {
180
- return revInfos.find((info) => info.rollbackOf === revision) !== undefined;
180
+ return revInfos.some((info) => info.rollbackOf === revision);
181
181
  };
182
182
  return { getIndex, tryGetInfo, hasRollback };
183
183
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/core/rebase/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAkE;AAElE,kDAAsF;AAEtF,yDAS4B;AAC5B,yCAA4E;AAuK5E,SAAgB,YAAY,CAC3B,eAAkC,EAClC,aAAqC,EACrC,UAAgC,EAChC,YAAkC,EAClC,UAAU,GAAG,YAAY;IAEzB,4CAA4C;IAC5C,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,kBAAkB,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;IACxF,IAAA,iBAAM,EAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAErE,MAAM,kBAAkB,GAAG,UAAU,CAAC,MAAM,CAAC;IAE7C,oDAAoD;IACpD,MAAM,iBAAiB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC;IAC1E,IAAI,iBAAiB,KAAK,CAAC,CAAC,EAAE,CAAC;QAC9B,6GAA6G;QAC7G,uGAAuG;QACvG,+GAA+G;QAC/G,8GAA8G;QAC9G,8FAA8F;QAC9F,UAAU;QACV,+DAA+D;QAC/D,sDAAsD;QACtD,KAAK;QACL,OAA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E,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;AAhBD,sCAgBC","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":";AAAA;;;GAGG;;;AAEH,kEAAkE;AAElE,kDAAsF;AAEtF,yDAS4B;AAC5B,yCAA4E;AAuK5E,SAAgB,YAAY,CAC3B,eAAkC,EAClC,aAAqC,EACrC,UAAgC,EAChC,YAAkC,EAClC,UAAU,GAAG,YAAY;IAEzB,4CAA4C;IAC5C,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,kBAAkB,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;IACxF,IAAA,iBAAM,EAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAErE,MAAM,kBAAkB,GAAG,UAAU,CAAC,MAAM,CAAC;IAE7C,oDAAoD;IACpD,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3D,IAAI,iBAAiB,KAAK,CAAC,CAAC,EAAE,CAAC;QAC9B,6GAA6G;QAC7G,uGAAuG;QACvG,+GAA+G;QAC/G,8GAA8G;QAC9G,8FAA8F;QAC9F,UAAU;QACV,+DAA+D;QAC/D,sDAAsD;QACtD,KA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E,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;AAhBD,sCAgBC","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.indexOf(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];\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.some((info) => info.rollbackOf === revision);\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"]}
@@ -211,9 +211,9 @@ exports.encodeFieldSchemaV1 = encodeFieldSchemaV1;
211
211
  function encodeFieldSchemaV2(schema) {
212
212
  const fieldSchema = encodeFieldSchemaV1(schema);
213
213
  // Omit metadata from the output if it is undefined
214
- return schema.persistedMetadata !== undefined
215
- ? { ...fieldSchema, metadata: schema.persistedMetadata }
216
- : { ...fieldSchema };
214
+ return schema.persistedMetadata === undefined
215
+ ? { ...fieldSchema }
216
+ : { ...fieldSchema, metadata: schema.persistedMetadata };
217
217
  }
218
218
  exports.encodeFieldSchemaV2 = encodeFieldSchemaV2;
219
219
  function decodeFieldSchema(schema) {