@fluidframework/tree 2.81.0 → 2.82.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 (579) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/api-report/tree.alpha.api.md +54 -22
  3. package/api-report/tree.beta.api.md +150 -1
  4. package/api-report/tree.legacy.beta.api.md +150 -1
  5. package/api-report/tree.legacy.public.api.md +1 -0
  6. package/api-report/tree.public.api.md +1 -0
  7. package/dist/alpha.d.ts +8 -2
  8. package/dist/beta.d.ts +3 -0
  9. package/dist/codec/codec.d.ts +17 -8
  10. package/dist/codec/codec.d.ts.map +1 -1
  11. package/dist/codec/codec.js +8 -1
  12. package/dist/codec/codec.js.map +1 -1
  13. package/dist/codec/index.d.ts +1 -1
  14. package/dist/codec/index.d.ts.map +1 -1
  15. package/dist/codec/index.js +2 -1
  16. package/dist/codec/index.js.map +1 -1
  17. package/dist/codec/versioned/codec.d.ts +1 -1
  18. package/dist/codec/versioned/codec.d.ts.map +1 -1
  19. package/dist/codec/versioned/codec.js.map +1 -1
  20. package/dist/core/index.d.ts +1 -1
  21. package/dist/core/index.d.ts.map +1 -1
  22. package/dist/core/index.js +4 -2
  23. package/dist/core/index.js.map +1 -1
  24. package/dist/core/rebase/changeRebaser.d.ts +3 -2
  25. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  26. package/dist/core/rebase/changeRebaser.js.map +1 -1
  27. package/dist/core/rebase/index.d.ts +1 -1
  28. package/dist/core/rebase/index.d.ts.map +1 -1
  29. package/dist/core/rebase/index.js +4 -2
  30. package/dist/core/rebase/index.js.map +1 -1
  31. package/dist/core/rebase/types.d.ts +23 -3
  32. package/dist/core/rebase/types.d.ts.map +1 -1
  33. package/dist/core/rebase/types.js +30 -16
  34. package/dist/core/rebase/types.js.map +1 -1
  35. package/dist/core/schema-stored/formatV1.d.ts +2 -2
  36. package/dist/core/schema-stored/formatV1.d.ts.map +1 -1
  37. package/dist/core/schema-stored/formatV1.js +0 -5
  38. package/dist/core/schema-stored/formatV1.js.map +1 -1
  39. package/dist/core/schema-stored/formatV2.d.ts +11 -10
  40. package/dist/core/schema-stored/formatV2.d.ts.map +1 -1
  41. package/dist/core/schema-stored/formatV2.js +1 -6
  42. package/dist/core/schema-stored/formatV2.js.map +1 -1
  43. package/dist/core/schema-stored/index.d.ts.map +1 -1
  44. package/dist/core/schema-stored/index.js.map +1 -1
  45. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  46. package/dist/core/schema-stored/schema.js.map +1 -1
  47. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  48. package/dist/core/tree/anchorSet.js.map +1 -1
  49. package/dist/core/tree/delta.d.ts +9 -7
  50. package/dist/core/tree/delta.d.ts.map +1 -1
  51. package/dist/core/tree/delta.js.map +1 -1
  52. package/dist/core/tree/deltaUtil.js +1 -1
  53. package/dist/core/tree/deltaUtil.js.map +1 -1
  54. package/dist/core/tree/visitDelta.js +2 -2
  55. package/dist/core/tree/visitDelta.js.map +1 -1
  56. package/dist/extensibleSchemaUnion.d.ts +72 -0
  57. package/dist/extensibleSchemaUnion.d.ts.map +1 -0
  58. package/dist/extensibleSchemaUnion.js +79 -0
  59. package/dist/extensibleSchemaUnion.js.map +1 -0
  60. package/dist/feature-libraries/changeAtomIdBTree.d.ts +4 -2
  61. package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
  62. package/dist/feature-libraries/changeAtomIdBTree.js +9 -1
  63. package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
  64. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -3
  65. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  66. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +20 -21
  67. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  68. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  69. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  70. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  71. package/dist/feature-libraries/forest-summary/codec.d.ts +2 -1
  72. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  73. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  74. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  75. package/dist/feature-libraries/forest-summary/forestSummarizer.js +5 -2
  76. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  77. package/dist/feature-libraries/forest-summary/formatCommon.d.ts +1 -39
  78. package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
  79. package/dist/feature-libraries/forest-summary/formatCommon.js +1 -2
  80. package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  81. package/dist/feature-libraries/forest-summary/formatV1.d.ts +1 -39
  82. package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
  83. package/dist/feature-libraries/forest-summary/formatV2.d.ts +1 -39
  84. package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
  85. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
  86. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  87. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +1 -1
  88. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  89. package/dist/feature-libraries/index.d.ts +3 -3
  90. package/dist/feature-libraries/index.d.ts.map +1 -1
  91. package/dist/feature-libraries/index.js +4 -3
  92. package/dist/feature-libraries/index.js.map +1 -1
  93. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +2 -2
  94. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
  95. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +42 -22
  96. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
  97. package/dist/feature-libraries/modular-schema/genericFieldKind.js +1 -1
  98. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  99. package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
  100. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  101. package/dist/feature-libraries/modular-schema/index.js +2 -1
  102. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  103. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +1 -1
  104. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  105. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +9 -5
  106. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  107. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +11 -1
  108. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  109. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +30 -7
  110. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  111. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  112. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +38 -27
  113. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  114. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +10 -127
  115. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  116. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -4
  117. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  118. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +3 -79
  119. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
  120. package/dist/feature-libraries/optional-field/optionalField.js +1 -1
  121. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  122. package/dist/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
  123. package/dist/feature-libraries/optional-field/requiredField.js.map +1 -1
  124. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  125. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  126. package/dist/feature-libraries/schema-index/formatV2.d.ts +4 -4
  127. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -1
  128. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  129. package/dist/feature-libraries/sequence-field/invert.js +2 -2
  130. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  131. package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -16
  132. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  133. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -1
  134. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  135. package/dist/index.d.ts +5 -5
  136. package/dist/index.d.ts.map +1 -1
  137. package/dist/index.js +4 -1
  138. package/dist/index.js.map +1 -1
  139. package/dist/legacy.d.ts +3 -0
  140. package/dist/packageVersion.d.ts +1 -1
  141. package/dist/packageVersion.js +1 -1
  142. package/dist/packageVersion.js.map +1 -1
  143. package/dist/shared-tree/independentView.d.ts +36 -13
  144. package/dist/shared-tree/independentView.d.ts.map +1 -1
  145. package/dist/shared-tree/independentView.js +1 -0
  146. package/dist/shared-tree/independentView.js.map +1 -1
  147. package/dist/shared-tree/index.d.ts +1 -1
  148. package/dist/shared-tree/index.d.ts.map +1 -1
  149. package/dist/shared-tree/index.js.map +1 -1
  150. package/dist/shared-tree/schematizingTreeView.d.ts +10 -0
  151. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  152. package/dist/shared-tree/schematizingTreeView.js +25 -9
  153. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  154. package/dist/shared-tree/sharedTree.d.ts +3 -3
  155. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  156. package/dist/shared-tree/sharedTree.js +8 -32
  157. package/dist/shared-tree/sharedTree.js.map +1 -1
  158. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +11 -3
  159. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  160. package/dist/shared-tree/sharedTreeChangeCodecs.js +38 -4
  161. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  162. package/dist/shared-tree/sharedTreeChangeFormat.d.ts +4 -4
  163. package/dist/shared-tree/tree.js +1 -1
  164. package/dist/shared-tree/tree.js.map +1 -1
  165. package/dist/shared-tree/treeCheckout.d.ts +20 -0
  166. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  167. package/dist/shared-tree/treeCheckout.js +39 -3
  168. package/dist/shared-tree/treeCheckout.js.map +1 -1
  169. package/dist/shared-tree-core/editManagerSummarizer.js +1 -1
  170. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  171. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  172. package/dist/shared-tree-core/messageCodecV1ToV4.js +2 -2
  173. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  174. package/dist/shared-tree-core/transaction.d.ts +14 -3
  175. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  176. package/dist/shared-tree-core/transaction.js +59 -16
  177. package/dist/shared-tree-core/transaction.js.map +1 -1
  178. package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
  179. package/dist/shared-tree-core/versionedSummarizer.js +1 -1
  180. package/dist/shared-tree-core/versionedSummarizer.js.map +1 -1
  181. package/dist/simple-tree/api/index.d.ts +1 -1
  182. package/dist/simple-tree/api/index.d.ts.map +1 -1
  183. package/dist/simple-tree/api/index.js +3 -2
  184. package/dist/simple-tree/api/index.js.map +1 -1
  185. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +9 -0
  186. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  187. package/dist/simple-tree/api/schemaCreationUtilities.js +16 -1
  188. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  189. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  190. package/dist/simple-tree/api/transactionTypes.d.ts +10 -0
  191. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  192. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  193. package/dist/simple-tree/api/tree.d.ts +81 -6
  194. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  195. package/dist/simple-tree/api/tree.js.map +1 -1
  196. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  197. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  198. package/dist/simple-tree/index.d.ts +2 -2
  199. package/dist/simple-tree/index.d.ts.map +1 -1
  200. package/dist/simple-tree/index.js +4 -2
  201. package/dist/simple-tree/index.js.map +1 -1
  202. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  203. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  204. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +63 -0
  205. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  206. package/dist/simple-tree/node-kinds/array/arrayNode.js +43 -1
  207. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  208. package/dist/simple-tree/node-kinds/array/index.d.ts +1 -1
  209. package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -1
  210. package/dist/simple-tree/node-kinds/array/index.js +2 -1
  211. package/dist/simple-tree/node-kinds/array/index.js.map +1 -1
  212. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  213. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  214. package/dist/simple-tree/node-kinds/index.js +2 -1
  215. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  216. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  217. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  218. package/dist/tableSchema.d.ts +71 -48
  219. package/dist/tableSchema.d.ts.map +1 -1
  220. package/dist/tableSchema.js +200 -98
  221. package/dist/tableSchema.js.map +1 -1
  222. package/dist/text/textDomainFormatted.js +1 -1
  223. package/dist/text/textDomainFormatted.js.map +1 -1
  224. package/dist/util/bTreeUtils.d.ts +30 -4
  225. package/dist/util/bTreeUtils.d.ts.map +1 -1
  226. package/dist/util/bTreeUtils.js +29 -17
  227. package/dist/util/bTreeUtils.js.map +1 -1
  228. package/dist/util/brand.d.ts.map +1 -1
  229. package/dist/util/brand.js.map +1 -1
  230. package/dist/util/brandedMap.d.ts.map +1 -1
  231. package/dist/util/brandedMap.js.map +1 -1
  232. package/dist/util/breakable.d.ts.map +1 -1
  233. package/dist/util/breakable.js +2 -1
  234. package/dist/util/breakable.js.map +1 -1
  235. package/dist/util/index.d.ts +2 -2
  236. package/dist/util/index.d.ts.map +1 -1
  237. package/dist/util/index.js +6 -3
  238. package/dist/util/index.js.map +1 -1
  239. package/dist/util/opaque.d.ts.map +1 -1
  240. package/dist/util/opaque.js.map +1 -1
  241. package/dist/util/rangeMap.d.ts +3 -2
  242. package/dist/util/rangeMap.d.ts.map +1 -1
  243. package/dist/util/rangeMap.js +7 -1
  244. package/dist/util/rangeMap.js.map +1 -1
  245. package/dist/util/readSnapshotBlob.d.ts +1 -1
  246. package/dist/util/readSnapshotBlob.d.ts.map +1 -1
  247. package/dist/util/readSnapshotBlob.js.map +1 -1
  248. package/dist/util/typeCheck.d.ts.map +1 -1
  249. package/dist/util/typeCheck.js.map +1 -1
  250. package/dist/util/utils.d.ts +20 -16
  251. package/dist/util/utils.d.ts.map +1 -1
  252. package/dist/util/utils.js +49 -17
  253. package/dist/util/utils.js.map +1 -1
  254. package/eslint.config.mts +0 -9
  255. package/lib/alpha.d.ts +8 -2
  256. package/lib/beta.d.ts +3 -0
  257. package/lib/codec/codec.d.ts +17 -8
  258. package/lib/codec/codec.d.ts.map +1 -1
  259. package/lib/codec/codec.js +6 -0
  260. package/lib/codec/codec.js.map +1 -1
  261. package/lib/codec/index.d.ts +1 -1
  262. package/lib/codec/index.d.ts.map +1 -1
  263. package/lib/codec/index.js +1 -1
  264. package/lib/codec/index.js.map +1 -1
  265. package/lib/codec/versioned/codec.d.ts +1 -1
  266. package/lib/codec/versioned/codec.d.ts.map +1 -1
  267. package/lib/codec/versioned/codec.js.map +1 -1
  268. package/lib/core/index.d.ts +1 -1
  269. package/lib/core/index.d.ts.map +1 -1
  270. package/lib/core/index.js +1 -1
  271. package/lib/core/index.js.map +1 -1
  272. package/lib/core/rebase/changeRebaser.d.ts +3 -2
  273. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  274. package/lib/core/rebase/changeRebaser.js.map +1 -1
  275. package/lib/core/rebase/index.d.ts +1 -1
  276. package/lib/core/rebase/index.d.ts.map +1 -1
  277. package/lib/core/rebase/index.js +1 -1
  278. package/lib/core/rebase/index.js.map +1 -1
  279. package/lib/core/rebase/types.d.ts +23 -3
  280. package/lib/core/rebase/types.d.ts.map +1 -1
  281. package/lib/core/rebase/types.js +27 -15
  282. package/lib/core/rebase/types.js.map +1 -1
  283. package/lib/core/schema-stored/formatV1.d.ts +2 -2
  284. package/lib/core/schema-stored/formatV1.d.ts.map +1 -1
  285. package/lib/core/schema-stored/formatV1.js +0 -5
  286. package/lib/core/schema-stored/formatV1.js.map +1 -1
  287. package/lib/core/schema-stored/formatV2.d.ts +11 -10
  288. package/lib/core/schema-stored/formatV2.d.ts.map +1 -1
  289. package/lib/core/schema-stored/formatV2.js +1 -6
  290. package/lib/core/schema-stored/formatV2.js.map +1 -1
  291. package/lib/core/schema-stored/index.d.ts.map +1 -1
  292. package/lib/core/schema-stored/index.js +2 -0
  293. package/lib/core/schema-stored/index.js.map +1 -1
  294. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  295. package/lib/core/schema-stored/schema.js.map +1 -1
  296. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  297. package/lib/core/tree/anchorSet.js.map +1 -1
  298. package/lib/core/tree/delta.d.ts +9 -7
  299. package/lib/core/tree/delta.d.ts.map +1 -1
  300. package/lib/core/tree/delta.js.map +1 -1
  301. package/lib/core/tree/deltaUtil.js +1 -1
  302. package/lib/core/tree/deltaUtil.js.map +1 -1
  303. package/lib/core/tree/visitDelta.js +2 -2
  304. package/lib/core/tree/visitDelta.js.map +1 -1
  305. package/lib/extensibleSchemaUnion.d.ts +72 -0
  306. package/lib/extensibleSchemaUnion.d.ts.map +1 -0
  307. package/lib/extensibleSchemaUnion.js +76 -0
  308. package/lib/extensibleSchemaUnion.js.map +1 -0
  309. package/lib/feature-libraries/changeAtomIdBTree.d.ts +4 -2
  310. package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
  311. package/lib/feature-libraries/changeAtomIdBTree.js +7 -0
  312. package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -1
  313. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -3
  314. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  315. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +4 -5
  316. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  317. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  318. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  319. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  320. package/lib/feature-libraries/forest-summary/codec.d.ts +2 -1
  321. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  322. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  323. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  324. package/lib/feature-libraries/forest-summary/forestSummarizer.js +6 -3
  325. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  326. package/lib/feature-libraries/forest-summary/formatCommon.d.ts +1 -39
  327. package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
  328. package/lib/feature-libraries/forest-summary/formatCommon.js +2 -3
  329. package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  330. package/lib/feature-libraries/forest-summary/formatV1.d.ts +1 -39
  331. package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
  332. package/lib/feature-libraries/forest-summary/formatV2.d.ts +1 -39
  333. package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
  334. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
  335. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  336. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +1 -1
  337. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  338. package/lib/feature-libraries/index.d.ts +3 -3
  339. package/lib/feature-libraries/index.d.ts.map +1 -1
  340. package/lib/feature-libraries/index.js +3 -3
  341. package/lib/feature-libraries/index.js.map +1 -1
  342. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +2 -2
  343. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
  344. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +41 -21
  345. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
  346. package/lib/feature-libraries/modular-schema/genericFieldKind.js +1 -1
  347. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  348. package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
  349. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  350. package/lib/feature-libraries/modular-schema/index.js +1 -1
  351. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  352. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +1 -1
  353. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  354. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +10 -6
  355. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  356. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +11 -1
  357. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  358. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +29 -6
  359. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  360. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  361. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +41 -30
  362. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  363. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +10 -127
  364. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  365. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -4
  366. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  367. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +3 -79
  368. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
  369. package/lib/feature-libraries/optional-field/optionalField.js +1 -1
  370. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  371. package/lib/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
  372. package/lib/feature-libraries/optional-field/requiredField.js.map +1 -1
  373. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  374. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  375. package/lib/feature-libraries/schema-index/formatV2.d.ts +4 -4
  376. package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -1
  377. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  378. package/lib/feature-libraries/sequence-field/invert.js +2 -2
  379. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  380. package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -16
  381. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  382. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -1
  383. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  384. package/lib/index.d.ts +5 -5
  385. package/lib/index.d.ts.map +1 -1
  386. package/lib/index.js +4 -3
  387. package/lib/index.js.map +1 -1
  388. package/lib/legacy.d.ts +3 -0
  389. package/lib/packageVersion.d.ts +1 -1
  390. package/lib/packageVersion.js +1 -1
  391. package/lib/packageVersion.js.map +1 -1
  392. package/lib/shared-tree/independentView.d.ts +36 -13
  393. package/lib/shared-tree/independentView.d.ts.map +1 -1
  394. package/lib/shared-tree/independentView.js +1 -0
  395. package/lib/shared-tree/independentView.js.map +1 -1
  396. package/lib/shared-tree/index.d.ts +1 -1
  397. package/lib/shared-tree/index.d.ts.map +1 -1
  398. package/lib/shared-tree/index.js.map +1 -1
  399. package/lib/shared-tree/schematizingTreeView.d.ts +10 -0
  400. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  401. package/lib/shared-tree/schematizingTreeView.js +25 -9
  402. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  403. package/lib/shared-tree/sharedTree.d.ts +3 -3
  404. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  405. package/lib/shared-tree/sharedTree.js +10 -34
  406. package/lib/shared-tree/sharedTree.js.map +1 -1
  407. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +11 -3
  408. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  409. package/lib/shared-tree/sharedTreeChangeCodecs.js +39 -5
  410. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  411. package/lib/shared-tree/sharedTreeChangeFormat.d.ts +4 -4
  412. package/lib/shared-tree/tree.js +1 -1
  413. package/lib/shared-tree/tree.js.map +1 -1
  414. package/lib/shared-tree/treeCheckout.d.ts +20 -0
  415. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  416. package/lib/shared-tree/treeCheckout.js +39 -3
  417. package/lib/shared-tree/treeCheckout.js.map +1 -1
  418. package/lib/shared-tree-core/editManagerSummarizer.js +1 -1
  419. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  420. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  421. package/lib/shared-tree-core/messageCodecV1ToV4.js +2 -2
  422. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  423. package/lib/shared-tree-core/transaction.d.ts +14 -3
  424. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  425. package/lib/shared-tree-core/transaction.js +61 -18
  426. package/lib/shared-tree-core/transaction.js.map +1 -1
  427. package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
  428. package/lib/shared-tree-core/versionedSummarizer.js +1 -1
  429. package/lib/shared-tree-core/versionedSummarizer.js.map +1 -1
  430. package/lib/simple-tree/api/index.d.ts +1 -1
  431. package/lib/simple-tree/api/index.d.ts.map +1 -1
  432. package/lib/simple-tree/api/index.js +1 -1
  433. package/lib/simple-tree/api/index.js.map +1 -1
  434. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +9 -0
  435. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  436. package/lib/simple-tree/api/schemaCreationUtilities.js +14 -0
  437. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  438. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  439. package/lib/simple-tree/api/transactionTypes.d.ts +10 -0
  440. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  441. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  442. package/lib/simple-tree/api/tree.d.ts +81 -6
  443. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  444. package/lib/simple-tree/api/tree.js.map +1 -1
  445. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  446. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  447. package/lib/simple-tree/index.d.ts +2 -2
  448. package/lib/simple-tree/index.d.ts.map +1 -1
  449. package/lib/simple-tree/index.js +2 -2
  450. package/lib/simple-tree/index.js.map +1 -1
  451. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  452. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  453. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +63 -0
  454. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  455. package/lib/simple-tree/node-kinds/array/arrayNode.js +41 -0
  456. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  457. package/lib/simple-tree/node-kinds/array/index.d.ts +1 -1
  458. package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -1
  459. package/lib/simple-tree/node-kinds/array/index.js +1 -1
  460. package/lib/simple-tree/node-kinds/array/index.js.map +1 -1
  461. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  462. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  463. package/lib/simple-tree/node-kinds/index.js +1 -1
  464. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  465. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  466. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  467. package/lib/tableSchema.d.ts +71 -48
  468. package/lib/tableSchema.d.ts.map +1 -1
  469. package/lib/tableSchema.js +201 -99
  470. package/lib/tableSchema.js.map +1 -1
  471. package/lib/text/textDomainFormatted.js +1 -1
  472. package/lib/text/textDomainFormatted.js.map +1 -1
  473. package/lib/util/bTreeUtils.d.ts +30 -4
  474. package/lib/util/bTreeUtils.d.ts.map +1 -1
  475. package/lib/util/bTreeUtils.js +27 -16
  476. package/lib/util/bTreeUtils.js.map +1 -1
  477. package/lib/util/brand.d.ts.map +1 -1
  478. package/lib/util/brand.js.map +1 -1
  479. package/lib/util/brandedMap.d.ts.map +1 -1
  480. package/lib/util/brandedMap.js.map +1 -1
  481. package/lib/util/breakable.d.ts.map +1 -1
  482. package/lib/util/breakable.js +2 -1
  483. package/lib/util/breakable.js.map +1 -1
  484. package/lib/util/index.d.ts +2 -2
  485. package/lib/util/index.d.ts.map +1 -1
  486. package/lib/util/index.js +2 -2
  487. package/lib/util/index.js.map +1 -1
  488. package/lib/util/opaque.d.ts.map +1 -1
  489. package/lib/util/opaque.js.map +1 -1
  490. package/lib/util/rangeMap.d.ts +3 -2
  491. package/lib/util/rangeMap.d.ts.map +1 -1
  492. package/lib/util/rangeMap.js +7 -1
  493. package/lib/util/rangeMap.js.map +1 -1
  494. package/lib/util/readSnapshotBlob.d.ts +1 -1
  495. package/lib/util/readSnapshotBlob.d.ts.map +1 -1
  496. package/lib/util/readSnapshotBlob.js.map +1 -1
  497. package/lib/util/typeCheck.d.ts.map +1 -1
  498. package/lib/util/typeCheck.js.map +1 -1
  499. package/lib/util/utils.d.ts +20 -16
  500. package/lib/util/utils.d.ts.map +1 -1
  501. package/lib/util/utils.js +44 -15
  502. package/lib/util/utils.js.map +1 -1
  503. package/package.json +23 -23
  504. package/src/codec/codec.ts +30 -11
  505. package/src/codec/index.ts +2 -0
  506. package/src/codec/versioned/codec.ts +9 -13
  507. package/src/core/index.ts +3 -1
  508. package/src/core/rebase/changeRebaser.ts +3 -2
  509. package/src/core/rebase/index.ts +3 -1
  510. package/src/core/rebase/types.ts +51 -13
  511. package/src/core/schema-stored/formatV1.ts +2 -4
  512. package/src/core/schema-stored/formatV2.ts +9 -7
  513. package/src/core/schema-stored/index.ts +2 -0
  514. package/src/core/schema-stored/schema.ts +4 -1
  515. package/src/core/tree/anchorSet.ts +1 -3
  516. package/src/core/tree/delta.ts +9 -7
  517. package/src/core/tree/deltaUtil.ts +1 -1
  518. package/src/core/tree/visitDelta.ts +2 -2
  519. package/src/extensibleSchemaUnion.ts +135 -0
  520. package/src/feature-libraries/changeAtomIdBTree.ts +17 -2
  521. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +5 -6
  522. package/src/feature-libraries/default-schema/index.ts +0 -1
  523. package/src/feature-libraries/forest-summary/codec.ts +7 -2
  524. package/src/feature-libraries/forest-summary/forestSummarizer.ts +15 -3
  525. package/src/feature-libraries/forest-summary/formatCommon.ts +2 -3
  526. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +4 -5
  527. package/src/feature-libraries/index.ts +3 -2
  528. package/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts +57 -31
  529. package/src/feature-libraries/modular-schema/genericFieldKind.ts +1 -1
  530. package/src/feature-libraries/modular-schema/index.ts +4 -1
  531. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +7 -6
  532. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +32 -7
  533. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +54 -33
  534. package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +2 -4
  535. package/src/feature-libraries/optional-field/optionalField.ts +1 -1
  536. package/src/feature-libraries/optional-field/requiredField.ts +2 -4
  537. package/src/feature-libraries/schema-index/codec.ts +1 -1
  538. package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -1
  539. package/src/feature-libraries/sequence-field/invert.ts +2 -2
  540. package/src/feature-libraries/sequence-field/replaceRevisions.ts +17 -10
  541. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +1 -1
  542. package/src/index.ts +12 -7
  543. package/src/packageVersion.ts +1 -1
  544. package/src/shared-tree/independentView.ts +42 -6
  545. package/src/shared-tree/index.ts +2 -0
  546. package/src/shared-tree/schematizingTreeView.ts +63 -18
  547. package/src/shared-tree/sharedTree.ts +19 -37
  548. package/src/shared-tree/sharedTreeChangeCodecs.ts +43 -9
  549. package/src/shared-tree/tree.ts +1 -1
  550. package/src/shared-tree/treeCheckout.ts +50 -3
  551. package/src/shared-tree-core/editManagerSummarizer.ts +1 -1
  552. package/src/shared-tree-core/messageCodecV1ToV4.ts +4 -3
  553. package/src/shared-tree-core/transaction.ts +125 -23
  554. package/src/shared-tree-core/versionedSummarizer.ts +3 -2
  555. package/src/simple-tree/api/index.ts +1 -0
  556. package/src/simple-tree/api/schemaCreationUtilities.ts +35 -5
  557. package/src/simple-tree/api/simpleTreeIndex.ts +1 -1
  558. package/src/simple-tree/api/transactionTypes.ts +10 -0
  559. package/src/simple-tree/api/tree.ts +88 -6
  560. package/src/simple-tree/core/treeNodeSchema.ts +5 -8
  561. package/src/simple-tree/index.ts +3 -0
  562. package/src/simple-tree/leafNodeSchema.ts +3 -2
  563. package/src/simple-tree/node-kinds/array/arrayNode.ts +86 -0
  564. package/src/simple-tree/node-kinds/array/index.ts +2 -0
  565. package/src/simple-tree/node-kinds/index.ts +2 -0
  566. package/src/simple-tree/node-kinds/object/objectNode.ts +19 -18
  567. package/src/tableSchema.ts +280 -140
  568. package/src/text/textDomainFormatted.ts +1 -1
  569. package/src/util/bTreeUtils.ts +45 -26
  570. package/src/util/brand.ts +4 -12
  571. package/src/util/brandedMap.ts +2 -6
  572. package/src/util/breakable.ts +3 -2
  573. package/src/util/index.ts +9 -3
  574. package/src/util/opaque.ts +2 -6
  575. package/src/util/rangeMap.ts +11 -5
  576. package/src/util/readSnapshotBlob.ts +3 -3
  577. package/src/util/typeCheck.ts +11 -9
  578. package/src/util/utils.ts +57 -28
  579. package/biome.jsonc +0 -4
@@ -1 +1 @@
1
- {"version":3,"file":"treeCheckout.js","sourceRoot":"","sources":["../../src/shared-tree/treeCheckout.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,+DAA6D;AAG7D,kEAAoF;AAEpF,qEAAoE;AACpE,uEAGkD;AAElD,gDAI2B;AAC3B,+CAwC0B;AAC1B,4DAUuC;AACvC,2DAOsC;AACtC,sDAaiC;AACjC,+CAO0B;AAE1B,uEAAoF;AACpF,+EAAyE;AACzE,2EAAsF;AAqLtF;;;;;;GAMG;AACH,SAAgB,kBAAkB,CACjC,YAA2B,EAC3B,eAAkC,EAClC,gBAAkC,EAClC,IAYC;IAED,MAAM,OAAO,GAAG,IAAI,EAAE,OAAO,IAAI,IAAI,oBAAS,CAAC,cAAc,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,IAAI,qCAA0B,EAAE,CAAC;IAChE,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,IAAA,sBAAW,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5D,MAAM,mBAAmB,GAA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oB,EAAE,CAAC;QAChD,OAAO,MAAyB,CAAC;IAClC,CAAC;IAED,OAAO;QACN,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,MAAsC;KAC9C,CAAC;AACH,CAAC;AASD,SAAS,kBAAkB,CAAC,KAAc;IACzC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACjD,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,MAAM,GAAG,KAAkC,CAAC;IAClD,OAAO,CACN,MAAM,CAAC,OAAO,KAAK,CAAC;QACpB,CAAC,MAAM,CAAC,QAAQ,KAAK,MAAM,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC;QACnE,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ;QACvC,IAAA,qBAAU,EAAC,MAAM,CAAC,YAAY,CAAC;QAC/B,MAAM,CAAC,MAAM,KAAK,SAAS,CAC3B,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { IDisposable } from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandle, Listenable } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\nimport { isStableId } from \"@fluidframework/id-compressor/internal\";\nimport {\n\tUsageError,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tFluidClientVersion,\n\tFormatValidatorNoOp,\n\ttype CodecWriteOptions,\n} from \"../codec/index.js\";\nimport {\n\ttype Anchor,\n\ttype AnchorLocator,\n\ttype AnchorNode,\n\tAnchorSet,\n\ttype AnchorSetRootEvents,\n\ttype ChangeFamily,\n\tCommitKind,\n\ttype DeltaVisitor,\n\ttype DetachedFieldIndex,\n\ttype IEditableForest,\n\ttype IForestSubscription,\n\ttype JsonableTree,\n\tRevertibleStatus,\n\ttype RevisionTag,\n\ttype RevisionTagCodec,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\ttype TreeStoredSchemaSubscription,\n\tcombineVisitors,\n\tmakeDetachedFieldIndex,\n\trebaseChange,\n\trootFieldKey,\n\ttagChange,\n\tvisitDelta,\n\ttype RevertibleAlphaFactory,\n\ttype RevertibleAlpha,\n\ttype GraphCommit,\n\tisAncestor,\n\tmoveToDetachedField,\n\ttype ITreeCursor,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\tLeafNodeStoredSchema,\n\tdiffHistories,\n\ttype ChangeMetadata,\n\ttype ChangeEncodingContext,\n\ttype ReadOnlyDetachedFieldIndex,\n\tmakeAnonChange,\n\ttype TaggedChange,\n} from \"../core/index.js\";\nimport {\n\ttype FieldBatchCodec,\n\ttype TreeCompressionStrategy,\n\tallowsRepoSuperset,\n\tbuildForest,\n\tcreateNodeIdentifierManager,\n\tdefaultSchemaPolicy,\n\tintoDelta,\n\tjsonableTreeFromCursor,\n\tmakeFieldBatchCodec,\n} from \"../feature-libraries/index.js\";\nimport {\n\tSquashingTransactionStack,\n\tSharedTreeBranch,\n\tTransactionResult,\n\tonForkTransitive,\n\ttype SharedTreeBranchChange,\n\ttype Transactor,\n} from \"../shared-tree-core/index.js\";\nimport {\n\ttype ImplicitFieldSchema,\n\ttype ReadSchema,\n\ttype TreeView,\n\ttype TreeViewConfiguration,\n\ttype UnsafeUnknownSchema,\n\ttype ViewableTree,\n\ttype TreeBranch,\n\ttype TreeChangeEvents,\n\ttype VerboseTree,\n\tcustomFromCursorStored,\n\ttype CustomTreeValue,\n\ttype CustomTreeNode,\n} from \"../simple-tree/index.js\";\nimport {\n\tBreakable,\n\tdisposeSymbol,\n\tgetOrCreate,\n\thasSome,\n\ttype JsonCompatibleReadOnly,\n\ttype WithBreakable,\n} from \"../util/index.js\";\n\nimport { getCheckout, SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { SharedTreeChangeEnricher } from \"./sharedTreeChangeEnricher.js\";\nimport { SharedTreeChangeFamily, hasSchemaChange } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { ISharedTreeEditor, SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\n\n/**\n * Events for {@link ITreeCheckout}.\n */\nexport interface CheckoutEvents {\n\t/**\n\t * The view is currently in a consistent state, but a batch of changes is about to be processed.\n\t * @remarks Once this event fires, it is not safe to access the FlexTree, Forest and AnchorSet again until the corresponding {@link CheckoutEvents.afterBatch} fires.\n\t * Every call to `beforeBatch` will be followed by a corresponding call to `afterBatch` (before any more calls to `beforeBatch`).\n\t * @param change - The {@link SharedTreeBranchChange | change} to the checkout's active branch that is about to be processed.\n\t * May be empty if the changes were produced by e.g. a rebase or the initial loading of the document.\n\t */\n\tbeforeBatch(change: SharedTreeBranchChange<SharedTreeChange>): void;\n\n\t/**\n\t * A batch of changes has finished processing and the view is in a consistent state.\n\t * @remarks It is once again safe to access the FlexTree, Forest and AnchorSet.\n\t *\n\t * While every call to `beforeBatch` will be followed by a corresponding call to `afterBatch`, the converse is not true.\n\t * This event may be fired without a preceding `beforeBatch` event if the checkout's branch and forest were directly updated via e.g. a summary load rather than via normal application of changes.\n\t * @remarks\n\t * This is mainly useful for knowing when to do followup work scheduled during events from Anchors.\n\t */\n\tafterBatch(): void;\n\n\t/**\n\t * Fired when a change is made to the branch. Includes data about the change that is made which listeners\n\t * can use to filter on changes they care about e.g. local vs remote changes.\n\t *\n\t * @param data - information about the change\n\t */\n\tchanged(data: ChangeMetadata, getRevertible?: RevertibleAlphaFactory): void;\n\n\t/**\n\t * Fired when a new branch is created from this checkout.\n\t */\n\tfork(branch: ITreeCheckout): void;\n\n\t/**\n\t * Fired when the checkout is disposed.\n\t */\n\tdispose(): void;\n}\n\n/**\n * A \"version control\"-style branch of a SharedTree.\n * @remarks Branches may be used to coordinate edits to a SharedTree, e.g. via merge and rebase operations.\n * Changes applied to a branch of a branch only apply to that branch and are isolated from other branches.\n * Changes may be synchronized across branches via merge and rebase operations provided on the branch object.\n * @alpha @sealed\n */\nexport interface BranchableTree extends ViewableTree {\n\t/**\n\t * Spawn a new branch which is based off of the current state of this branch.\n\t * Any mutations of the new branch will not apply to this branch until the new branch is merged back into this branch via `merge()`.\n\t */\n\tbranch(): TreeBranchFork;\n\n\t/**\n\t * Apply all the new changes on the given branch to this branch.\n\t * @param view - a branch which was created by a call to `branch()`.\n\t * It is automatically disposed after the merge completes.\n\t * @remarks All ongoing transactions (if any) in `branch` will be committed before the merge.\n\t * A \"changed\" event and a corresponding {@link Revertible} will be emitted on this branch for each new change merged from 'branch'.\n\t */\n\tmerge(branch: TreeBranchFork): void;\n\n\t/**\n\t * Apply all the new changes on the given branch to this branch.\n\t * @param branch - a branch which was created by a call to `branch()`.\n\t * @param disposeMerged - whether or not to dispose `branch` after the merge completes.\n\t * @remarks All ongoing transactions (if any) in `branch` will be committed before the merge.\n\t */\n\tmerge(branch: TreeBranchFork, disposeMerged: boolean): void;\n\n\t/**\n\t * Rebase the given branch onto this branch.\n\t * @param branch - a branch which was created by a call to `branch()`. It is modified by this operation.\n\t */\n\trebase(branch: TreeBranchFork): void;\n}\n\n/**\n * A {@link BranchableTree | branch} of a SharedTree that has merged from another branch.\n * @remarks This branch should be disposed when it is no longer needed in order to free resources.\n * @alpha @sealed\n */\nexport interface TreeBranchFork extends BranchableTree, IDisposable {\n\t/**\n\t * Rebase the changes that have been applied to this branch over all the new changes in the given branch.\n\t * @param branch - Either the root branch or a branch that was created by a call to `branch()`. It is not modified by this operation.\n\t */\n\trebaseOnto(branch: BranchableTree): void;\n}\n\n/**\n * Provides a means for interacting with a SharedTree.\n * This includes reading data from the tree and running transactions to mutate the tree.\n * @remarks This interface should not have any implementations other than those provided by the SharedTree package libraries.\n * @privateRemarks\n * API for interacting with a {@link SharedTreeBranch}.\n * Implementations of this interface must implement the {@link branchKey} property.\n */\nexport interface ITreeCheckout extends AnchorLocator, ViewableTree, WithBreakable {\n\t/**\n\t * Read and Write access for schema stored in the document.\n\t *\n\t * These APIs are temporary and will be replaced with different abstractions (View Schema based) in a different place later.\n\t *\n\t * TODO:\n\t * Editing of this should be moved into transactions with the rest of tree editing to they can be intermixed.\n\t * This will be done after the relations between views, branches and Indexes are figured out.\n\t *\n\t * TODO:\n\t * Public APIs for dealing with schema should be in terms of View Schema, and schema update policies.\n\t * The actual stored schema should be hidden (or ar least not be the most prominent way to interact with schema).\n\t *\n\t * TODO:\n\t * Something should ensure the document contents are always in schema.\n\t */\n\treadonly storedSchema: TreeStoredSchemaSubscription;\n\t/**\n\t * Current contents.\n\t * Updated by edits (local and remote).\n\t * Use `editor` to create a local edit.\n\t */\n\treadonly forest: IForestSubscription;\n\n\t/**\n\t * Used to edit the state of the tree. Edits will be immediately applied locally to the tree.\n\t * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.\n\t */\n\treadonly editor: ISharedTreeEditor;\n\n\t/**\n\t * A collection of functions for managing transactions.\n\t */\n\treadonly transaction: Transactor;\n\n\tbranch(): ITreeCheckoutFork;\n\n\tmerge(checkout: ITreeCheckoutFork): void;\n\n\tmerge(checkout: ITreeCheckoutFork, disposeMerged: boolean): void;\n\n\trebase(checkout: ITreeCheckoutFork): void;\n\n\t/**\n\t * Replaces all schema with the provided schema.\n\t * Can over-write preexisting schema, and removes unmentioned schema.\n\t *\n\t * @param newSchema - The new schema to replace the existing schema.\n\t * @param allowNonSupersetSchema - Whether to allow non-superset schemas.\n\t * Defaults to false.\n\t * If false, an assert will be thrown if the new schema does not permit all possible documents which were permitted under the old schema.\n\t */\n\tupdateSchema(newSchema: TreeStoredSchema, allowNonSupersetSchema?: true): void;\n\n\t/**\n\t * Events about this view.\n\t */\n\treadonly events: Listenable<CheckoutEvents>;\n\n\t/**\n\t * Events about the root of the tree in this view.\n\t */\n\treadonly rootEvents: Listenable<AnchorSetRootEvents>;\n\n\t/**\n\t * Returns a JsonableTree for each tree that was removed from (and not restored to) the document.\n\t * This list is guaranteed to contain all nodes that are recoverable through undo/redo on this checkout.\n\t * The list may also contain additional nodes.\n\t *\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t */\n\tgetRemovedRoots(): [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * Creates a {@link TreeCheckout}.\n * @param args - an object containing optional components that will be used to build the view.\n * Any components not provided will be created by default.\n * @remarks This does not create a {@link SharedTree}, but rather a view with the minimal state\n * and functionality required to implement {@link ITreeCheckout}.\n */\nexport function createTreeCheckout(\n\tidCompressor: IIdCompressor,\n\tmintRevisionTag: () => RevisionTag,\n\trevisionTagCodec: RevisionTagCodec,\n\targs?: {\n\t\tbranch?: SharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange>;\n\t\tchangeFamily?: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange>;\n\t\tschema?: TreeStoredSchemaRepository;\n\t\tforest?: IEditableForest;\n\t\tfieldBatchCodec?: FieldBatchCodec;\n\t\tremovedRoots?: DetachedFieldIndex;\n\t\tchunkCompressionStrategy?: TreeCompressionStrategy;\n\t\tlogger?: ITelemetryLoggerExt;\n\t\tbreaker?: Breakable;\n\t\tdisposeForksAfterTransaction?: boolean;\n\t\tcodecOptions?: Partial<CodecWriteOptions>;\n\t},\n): TreeCheckout {\n\tconst breaker = args?.breaker ?? new Breakable(\"TreeCheckout\");\n\tconst schema = args?.schema ?? new TreeStoredSchemaRepository();\n\tconst forest = args?.forest ?? buildForest(breaker, schema);\n\tconst defaultCodecOptions: CodecWriteOptions = {\n\t\tjsonValidator: FormatValidatorNoOp,\n\t\tminVersionForCollab: FluidClientVersion.v2_0,\n\t};\n\tconst codecOptions: CodecWriteOptions = { ...defaultCodecOptions, ...args?.codecOptions };\n\tconst changeFamily =\n\t\targs?.changeFamily ??\n\t\tnew SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\targs?.fieldBatchCodec ?? makeFieldBatchCodec(codecOptions),\n\t\t\tcodecOptions,\n\t\t\targs?.chunkCompressionStrategy,\n\t\t\tidCompressor,\n\t\t);\n\n\t// TODO: If a branch is passed in, is it supposed to be local main?\n\t// Otherwise shouldn't we set `isSharedBranch` to false?\n\tconst branch =\n\t\targs?.branch ??\n\t\tnew SharedTreeBranch(\n\t\t\t{\n\t\t\t\tchange: changeFamily.rebaser.compose([]),\n\t\t\t\trevision: \"root\",\n\t\t\t},\n\t\t\tchangeFamily,\n\t\t\t() => idCompressor.generateCompressedId(),\n\t\t);\n\n\treturn new TreeCheckout(\n\t\tbranch,\n\t\ttrue,\n\t\tchangeFamily,\n\t\tschema,\n\t\tforest,\n\t\tmintRevisionTag,\n\t\trevisionTagCodec,\n\t\tidCompressor,\n\t\targs?.removedRoots,\n\t\targs?.logger,\n\t\tbreaker,\n\t\targs?.disposeForksAfterTransaction,\n\t);\n}\n\n/**\n * Branch (like in a version control system) of SharedTree.\n *\n * {@link ITreeCheckout} that has forked off of the main trunk/branch.\n */\nexport interface ITreeCheckoutFork extends ITreeCheckout {\n\trebaseOnto(view: ITreeCheckout): void;\n}\n\n/**\n * Metrics derived from a revert operation.\n *\n * @see {@link TreeCheckout.revertRevertible}.\n */\nexport interface RevertMetrics {\n\t/**\n\t * The age of the revertible commit relative to the head of the branch to which the reversion will be applied.\n\t */\n\treadonly age: number;\n\n\t// TODO: add other stats as needed for telemetry, etc.\n}\n\n/**\n * An implementation of {@link ITreeCheckoutFork}.\n */\nexport class TreeCheckout implements ITreeCheckoutFork {\n\tpublic disposed = false;\n\n\tprivate editLock: EditLock;\n\n\tprivate readonly views = new Set<TreeView<ImplicitFieldSchema>>();\n\n\t/**\n\t * Set of revertibles maintained for automatic disposal\n\t */\n\tprivate readonly revertibles = new Set<RevertibleAlpha>();\n\n\t/**\n\t * Each branch's head commit corresponds to a revertible commit.\n\t * Maintaining a whole branch ensures the commit graph is not pruned in a way that would prevent the commit from\n\t * being reverted.\n\t */\n\tprivate readonly revertibleCommitBranches = new Map<\n\t\tRevisionTag,\n\t\tSharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange>\n\t>();\n\n\t/**\n\t * The name of the telemetry event logged for calls to {@link TreeCheckout.revertRevertible}.\n\t * @privateRemarks Exposed for testing purposes.\n\t */\n\tpublic static readonly revertTelemetryEventName = \"RevertRevertible\";\n\n\treadonly #events = createEmitter<CheckoutEvents>();\n\tpublic events: Listenable<CheckoutEvents> = this.#events;\n\n\tpublic constructor(\n\t\tbranch: SharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange>,\n\t\t/** True if and only if this checkout is for a branch which is persisted and shared with other clients. */\n\t\tpublic readonly isSharedBranch: boolean,\n\t\tprivate readonly changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,\n\t\tpublic readonly storedSchema: TreeStoredSchemaRepository,\n\t\tpublic readonly forest: IEditableForest,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\tprivate readonly _removedRoots: DetachedFieldIndex = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\tidCompressor,\n\t\t),\n\t\t/** Optional logger for telemetry. */\n\t\tprivate readonly logger?: ITelemetryLoggerExt,\n\t\tpublic readonly breaker: Breakable = new Breakable(\"TreeCheckout\"),\n\t\tpublic readonly disposeForksAfterTransaction = true,\n\t) {\n\t\tthis.#transaction = this.createTransactionStack(branch);\n\t\tthis.editLock = new EditLock(this.#transaction.activeBranchEditor);\n\t\tthis.registerForBranchEvents();\n\t}\n\n\tpublic get removedRoots(): ReadOnlyDetachedFieldIndex {\n\t\treturn this._removedRoots;\n\t}\n\n\tprivate registerForBranchEvents(): void {\n\t\tthis.#transaction.branch.events.on(\"afterChange\", this.onAfterBranchChange);\n\t\tthis.#transaction.activeBranchEvents.on(\"afterChange\", this.onAfterChange);\n\t\tthis.#transaction.activeBranchEvents.on(\"ancestryTrimmed\", this.onAncestryTrimmed);\n\t}\n\n\tprivate unregisterFromBranchEvents(): void {\n\t\tthis.#transaction.branch.events.off(\"afterChange\", this.onAfterBranchChange);\n\t\tthis.#transaction.activeBranchEvents.off(\"afterChange\", this.onAfterChange);\n\t\tthis.#transaction.activeBranchEvents.off(\"ancestryTrimmed\", this.onAncestryTrimmed);\n\t}\n\n\tprivate createTransactionStack(\n\t\tbranch: SharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange>,\n\t): SquashingTransactionStack<SharedTreeEditBuilder, SharedTreeChange> {\n\t\treturn new SquashingTransactionStack(branch, this.mintRevisionTag, () => {\n\t\t\tconst disposeForks = this.disposeForksAfterTransaction\n\t\t\t\t? trackForksForDisposal(this)\n\t\t\t\t: undefined;\n\t\t\t// When each transaction is started, make a restorable checkpoint of the current state of removed roots\n\t\t\tconst restoreRemovedRoots = this._removedRoots.createCheckpoint();\n\t\t\treturn (result) => {\n\t\t\t\tswitch (result) {\n\t\t\t\t\tcase TransactionResult.Abort: {\n\t\t\t\t\t\trestoreRemovedRoots();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase TransactionResult.Commit: {\n\t\t\t\t\t\tif (!this.transaction.isInProgress()) {\n\t\t\t\t\t\t\t// The changes in a transaction squash commit have already applied to the checkout and are known to be valid, so we can validate the squash commit automatically.\n\t\t\t\t\t\t\tthis.validateCommit(this.#transaction.branch.getHead());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tunreachableCase(result);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdisposeForks?.();\n\t\t\t};\n\t\t});\n\t}\n\n\tpublic exportVerbose(): VerboseTree | undefined {\n\t\tconst cursor = this.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.forest, cursor);\n\t\t\tconst length = cursor.getFieldLength();\n\t\t\tif (length === 0) {\n\t\t\t\treturn undefined;\n\t\t\t} else if (length === 1) {\n\t\t\t\tcursor.enterNode(0);\n\t\t\t\treturn verboseFromCursor(cursor, this.storedSchema.nodeSchema);\n\t\t\t} else {\n\t\t\t\tfail(0xac8 /* Invalid document root length */);\n\t\t\t}\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\tprivate readonly onAfterBranchChange = (\n\t\tevent: SharedTreeBranchChange<SharedTreeChange>,\n\t): void => {\n\t\t// The following logic allows revertibles to be generated for the change.\n\t\t// Currently only appends (including merges and transaction commits) are supported.\n\t\tif (event.type === \"append\") {\n\t\t\t// TODO:#20949: When the SharedTree is detached, these commits will already have been garbage collected.\n\t\t\t// Figure out a way to generate revertibles before the commits are garbage collected.\n\t\t\tfor (const commit of event.newCommits) {\n\t\t\t\tconst kind = event.type === \"append\" ? event.kind : CommitKind.Default;\n\t\t\t\tconst { change, revision } = commit;\n\n\t\t\t\tconst getRevertible = hasSchemaChange(change)\n\t\t\t\t\t? undefined\n\t\t\t\t\t: (onRevertibleDisposed?: (revertible: RevertibleAlpha) => void) => {\n\t\t\t\t\t\t\tif (!withinEventContext) {\n\t\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\t\"Cannot get a revertible outside of the context of a changed event.\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (this.revertibleCommitBranches.get(revision) !== undefined) {\n\t\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\t\"Cannot generate the same revertible more than once. Note that this can happen when multiple changed event listeners are registered.\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst revertible = this.createRevertible(\n\t\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\tonRevertibleDisposed,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tthis.revertibleCommitBranches.set(\n\t\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\t\tthis.#transaction.activeBranch.fork(commit),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tthis.revertibles.add(revertible);\n\t\t\t\t\t\t\treturn revertible;\n\t\t\t\t\t\t};\n\n\t\t\t\tlet withinEventContext = true;\n\n\t\t\t\tconst metadata: ChangeMetadata = {\n\t\t\t\t\tkind,\n\t\t\t\t\tisLocal: true,\n\t\t\t\t\tgetChange: () => {\n\t\t\t\t\t\tconst context: ChangeEncodingContext = {\n\t\t\t\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t\t\t\t\toriginatorId: this.idCompressor.localSessionId,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst encodedChange = this.changeFamily.codecs\n\t\t\t\t\t\t\t.resolve(4)\n\t\t\t\t\t\t\t.json.encode(change, context);\n\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tcommit.parent !== undefined,\n\t\t\t\t\t\t\t0xca4 /* Expected applied commit to be parented */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\toriginatorId: this.idCompressor.localSessionId,\n\t\t\t\t\t\t\tchange: encodedChange,\n\t\t\t\t\t\t} satisfies SerializedChange;\n\t\t\t\t\t},\n\t\t\t\t\tgetRevertible: (onDisposed) => getRevertible?.(onDisposed),\n\t\t\t\t};\n\n\t\t\t\tthis.#events.emit(\"changed\", metadata, getRevertible);\n\t\t\t\twithinEventContext = false;\n\t\t\t}\n\t\t} else if (this.isRemoteChangeEvent(event)) {\n\t\t\t// TODO: figure out how to plumb through commit kind info for remote changes\n\t\t\tthis.#events.emit(\"changed\", { isLocal: false, kind: CommitKind.Default });\n\t\t}\n\t};\n\n\tprivate readonly onAfterChange = (event: SharedTreeBranchChange<SharedTreeChange>): void => {\n\t\tthis.editLock.lock();\n\t\tthis.#events.emit(\"beforeBatch\", event);\n\t\tif (event.change !== undefined) {\n\t\t\tconst revision =\n\t\t\t\tevent.type === \"rebase\"\n\t\t\t\t\t? this.#transaction.activeBranch.getHead().revision\n\t\t\t\t\t: event.change.revision;\n\n\t\t\tthis.applyChange(event.change.change, revision);\n\t\t}\n\t\tthis.#events.emit(\"afterBatch\");\n\t\tthis.editLock.unlock();\n\t\tif (event.type === \"append\") {\n\t\t\tfor (const commit of event.newCommits) {\n\t\t\t\tthis.validateCommit(commit);\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * Applies the given serialized change (as was produced via a `\"changed\"` event of another checkout) to this checkout.\n\t */\n\tpublic applySerializedChange(serializedChange: JsonCompatibleReadOnly): void {\n\t\tif (!isSerializedChange(serializedChange)) {\n\t\t\tthrow new UsageError(`Cannot apply change. Invalid serialized change format.`);\n\t\t}\n\t\tconst { revision, originatorId, change } = serializedChange;\n\t\tif (originatorId !== this.idCompressor.localSessionId) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Cannot apply change. A serialized changed must be applied to the same SharedTree as it was created from.`,\n\t\t\t);\n\t\t}\n\t\tconst context: ChangeEncodingContext = {\n\t\t\tidCompressor: this.idCompressor,\n\t\t\toriginatorId: this.idCompressor.localSessionId,\n\t\t\trevision,\n\t\t};\n\t\tconst decodedChange = this.changeFamily.codecs.resolve(4).json.decode(change, context);\n\t\tthis.applyChange(decodedChange, revision);\n\t}\n\n\t// Revision is the revision of the commit, if any, which caused this change.\n\tprivate applyChange(change: SharedTreeChange, revision?: RevisionTag): void {\n\t\t// Conflicts due to schema will be empty and thus are not applied.\n\t\tfor (const innerChange of change.changes) {\n\t\t\tif (innerChange.type === \"data\") {\n\t\t\t\tconst delta = intoDelta(tagChange(innerChange.innerChange, revision));\n\t\t\t\tthis.withCombinedVisitor((visitor) => {\n\t\t\t\t\tvisitDelta(delta, visitor, this._removedRoots, revision);\n\t\t\t\t});\n\t\t\t} else if (innerChange.type === \"schema\") {\n\t\t\t\t// Schema changes from a current to a new schema are expected to be backwards compatible.\n\t\t\t\t// This guarantees that all data in the forest (which is valid before the schema change)\n\t\t\t\t// is also valid under the new schema.\n\t\t\t\t// Note however, that such schema changes may in some cases be rolled back:\n\t\t\t\t// Case 1: A transaction with a schema change may be aborted.\n\t\t\t\t// The transaction may have made some data changes that would render some trees invalid\n\t\t\t\t// under the old schema, but these changes will also be rolled back, thereby putting the forest\n\t\t\t\t// back in the state before the transaction, which is valid under the original (reinstated) schema.\n\t\t\t\t// Case 2: A branch with a schema change may be rebased such that the schema change (because\n\t\t\t\t// of a constraint) is no longer applied.\n\t\t\t\t// Such a branch may contain data changes that would render some trees invalid under the\n\t\t\t\t// original schema. These data changes may not necessarily be rolled back.\n\t\t\t\t// They will however be rebased over the rollback of the schema change. This rebasing will\n\t\t\t\t// ensure that these data changes are muted if they would render some trees invalid under the\n\t\t\t\t// original (reinstated) schema.\n\t\t\t\tthis.storedSchema.apply(innerChange.innerChange.schema.new);\n\t\t\t} else {\n\t\t\t\tfail(0xad1 /* Unknown Shared Tree change type. */);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate readonly onAncestryTrimmed = (revisions: RevisionTag[]): void => {\n\t\t// When the branch is trimmed, we can garbage collect any repair data whose latest relevant revision is one of the\n\t\t// trimmed revisions.\n\t\tthis.withCombinedVisitor((visitor) => {\n\t\t\tfor (const revision of revisions) {\n\t\t\t\t// get all the roots last created or used by the revision\n\t\t\t\tconst roots = this._removedRoots.getRootsLastTouchedByRevision(revision);\n\n\t\t\t\t// get the detached field for the root and delete it from the removed roots\n\t\t\t\tfor (const root of roots) {\n\t\t\t\t\tvisitor.destroy(this._removedRoots.toFieldKey(root), 1);\n\t\t\t\t}\n\n\t\t\t\tthis._removedRoots.deleteRootsLastTouchedByRevision(revision);\n\t\t\t}\n\t\t});\n\t};\n\n\tprivate withCombinedVisitor(fn: (visitor: DeltaVisitor) => void): void {\n\t\tconst anchorVisitor = this.forest.anchors.acquireVisitor();\n\t\tconst combinedVisitor = combineVisitors([this.forest.acquireVisitor(), anchorVisitor]);\n\t\tfn(combinedVisitor);\n\t\tcombinedVisitor.free();\n\t}\n\n\tprivate checkNotDisposed(usageError?: string): void {\n\t\tthis.breaker.use();\n\t\tif (this.disposed) {\n\t\t\tif (usageError !== undefined) {\n\t\t\t\tthrow new UsageError(usageError);\n\t\t\t}\n\t\t\tassert(false, 0x911 /* Invalid operation on a disposed TreeCheckout */);\n\t\t}\n\t}\n\n\t/**\n\t * Creates a {@link RevertibleAlpha} object that can undo a specific change in the tree's history.\n\t * Revision must exist in the given {@link TreeCheckout}'s branch.\n\t *\n\t * @param revision - The revision tag identifying the change to be made revertible.\n\t * @param kind - The {@link CommitKind} that produced this revertible (e.g., Default, Undo, Redo).\n\t * @param checkout - The {@link TreeCheckout} instance this revertible belongs to.\n\t * @param onRevertibleDisposed - Callback function that will be called when the revertible is disposed.\n\t * @returns A {@link RevertibleAlpha} object.\n\t */\n\tprivate createRevertible(\n\t\trevision: RevisionTag,\n\t\tkind: CommitKind,\n\t\tcheckout: TreeCheckout,\n\t\tonRevertibleDisposed: ((revertible: RevertibleAlpha) => void) | undefined,\n\t): RevertibleAlpha {\n\t\tconst commitBranches = checkout.revertibleCommitBranches;\n\n\t\tconst revertible: RevertibleAlpha = {\n\t\t\tget status(): RevertibleStatus {\n\t\t\t\tconst revertibleCommit = commitBranches.get(revision);\n\t\t\t\treturn revertibleCommit === undefined\n\t\t\t\t\t? RevertibleStatus.Disposed\n\t\t\t\t\t: RevertibleStatus.Valid;\n\t\t\t},\n\t\t\trevert: (release: boolean = true) => {\n\t\t\t\tif (revertible.status === RevertibleStatus.Disposed) {\n\t\t\t\t\tthrow new UsageError(\"Unable to revert a revertible that has been disposed.\");\n\t\t\t\t}\n\n\t\t\t\tconst revertMetrics = checkout.revertRevertible(revision, kind);\n\t\t\t\tcheckout.logger?.sendTelemetryEvent({\n\t\t\t\t\teventName: TreeCheckout.revertTelemetryEventName,\n\t\t\t\t\t...revertMetrics,\n\t\t\t\t});\n\n\t\t\t\tif (release) {\n\t\t\t\t\trevertible.dispose();\n\t\t\t\t}\n\t\t\t},\n\t\t\tclone: (targetBranch: TreeBranch) => {\n\t\t\t\t// TODO:#23442: When a revertible is cloned for a forked branch, optimize to create a fork of a revertible branch once per revision NOT once per revision per checkout.\n\t\t\t\tconst targetCheckout = getCheckout(targetBranch);\n\n\t\t\t\tconst revertibleBranch = this.revertibleCommitBranches.get(revision);\n\t\t\t\tif (revertibleBranch === undefined) {\n\t\t\t\t\tthrow new UsageError(\"Unable to clone a revertible that has been disposed.\");\n\t\t\t\t}\n\n\t\t\t\tconst commitToRevert = revertibleBranch.getHead();\n\t\t\t\tconst activeBranchHead = targetCheckout.#transaction.activeBranch.getHead();\n\n\t\t\t\tif (isAncestor(commitToRevert, activeBranchHead, true) === false) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\"Cannot clone revertible for a commit that is not present on the given branch.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\ttargetCheckout.revertibleCommitBranches.set(revision, revertibleBranch.fork());\n\n\t\t\t\treturn this.createRevertible(revision, kind, targetCheckout, onRevertibleDisposed);\n\t\t\t},\n\t\t\tdispose: () => {\n\t\t\t\tif (revertible.status === RevertibleStatus.Disposed) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\"Unable to dispose a revertible that has already been disposed.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcheckout.disposeRevertible(revertible, revision);\n\t\t\t\tonRevertibleDisposed?.(revertible);\n\t\t\t},\n\t\t};\n\n\t\treturn revertible;\n\t}\n\n\t// For the new TreeViewAlpha API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot>;\n\n\t// For the old TreeView API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> {\n\t\tconst view = new SchematizingSimpleTreeView(\n\t\t\tthis,\n\t\t\tconfig,\n\t\t\tcreateNodeIdentifierManager(this.idCompressor),\n\t\t\t() => {\n\t\t\t\tthis.views.delete(view);\n\t\t\t},\n\t\t);\n\t\tthis.views.add(view);\n\t\treturn view;\n\t}\n\n\tpublic get rootEvents(): Listenable<AnchorSetRootEvents> {\n\t\treturn this.forest.anchors.events;\n\t}\n\n\tpublic get editor(): ISharedTreeEditor {\n\t\tthis.checkNotDisposed();\n\t\treturn this.editLock.editor;\n\t}\n\n\tpublic locate(anchor: Anchor): AnchorNode | undefined {\n\t\tthis.checkNotDisposed();\n\t\treturn this.forest.anchors.locate(anchor);\n\t}\n\n\tpublic get transaction(): Transactor {\n\t\treturn this.#transaction;\n\t}\n\t/**\n\t * The {@link Transactor} for this checkout.\n\t * @remarks In the context of a checkout, transactions allow edits to be batched into atomic units.\n\t * Edits made during a transaction will update the local state of the tree immediately, but will be squashed into a single edit when the transaction is committed.\n\t * If the transaction is aborted, the local state will be reset to what it was before the transaction began.\n\t * Transactions may nest, meaning that a transaction may be started while a transaction is already ongoing.\n\t *\n\t * To avoid updating observers of the view state with intermediate results during a transaction,\n\t * use {@link ITreeCheckout#branch} and {@link ISharedTreeFork#merge}.\n\t */\n\t#transaction: SquashingTransactionStack<SharedTreeEditBuilder, SharedTreeChange>;\n\n\tpublic branch(): TreeCheckout {\n\t\tthis.checkNotDisposed(\n\t\t\t\"The parent branch has already been disposed and can no longer create new branches.\",\n\t\t);\n\t\t// Branching after an unfinished transaction would expose the application to a state where its invariants may be violated.\n\t\tif (this.transaction.isInProgress()) {\n\t\t\tthrow new UsageError(\"A view cannot be forked while it has a pending transaction.\");\n\t\t}\n\n\t\tthis.editLock.checkUnlocked(\"Branching\");\n\t\tconst anchors = new AnchorSet();\n\t\tconst branch = this.#transaction.activeBranch.fork();\n\t\tconst storedSchema = this.storedSchema.clone();\n\t\tconst forest = this.forest.clone(storedSchema, anchors);\n\t\tconst checkout = new TreeCheckout(\n\t\t\tbranch,\n\t\t\tfalse,\n\t\t\tthis.changeFamily,\n\t\t\tstoredSchema,\n\t\t\tforest,\n\t\t\tthis.mintRevisionTag,\n\t\t\tthis.revisionTagCodec,\n\t\t\tthis.idCompressor,\n\t\t\tthis._removedRoots.clone(),\n\t\t\tthis.logger,\n\t\t\tthis.breaker,\n\t\t\tthis.disposeForksAfterTransaction,\n\t\t);\n\t\tthis.#events.emit(\"fork\", checkout);\n\t\treturn checkout;\n\t}\n\n\tpublic switchBranch(\n\t\tbranch: SharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange>,\n\t): void {\n\t\t// TODO: Dispose old branch, if necessary\n\t\tassert(\n\t\t\t!this.#transaction.isInProgress(),\n\t\t\t0xc55 /* Cannot switch branches during a transaction */,\n\t\t);\n\t\tconst diff = diffHistories(\n\t\t\tthis.changeFamily.rebaser,\n\t\t\tthis.#transaction.branch.getHead(),\n\t\t\tbranch.getHead(),\n\t\t\tthis.mintRevisionTag,\n\t\t);\n\n\t\tthis.unregisterFromBranchEvents();\n\n\t\tthis.#transaction = this.createTransactionStack(branch);\n\t\tthis.editLock = new EditLock(this.#transaction.activeBranchEditor);\n\t\tthis.registerForBranchEvents();\n\n\t\t// TODO: Rework eventing\n\t\tthis.applyChange(diff);\n\t\tthis.#events.emit(\"afterBatch\");\n\t}\n\n\tpublic rebase(checkout: TreeCheckout): void {\n\t\tthis.checkNotDisposed(\n\t\t\t\"The target of the branch rebase has been disposed and cannot be rebased.\",\n\t\t);\n\t\tcheckout.checkNotDisposed(\n\t\t\t\"The source of the branch rebase has been disposed and cannot be rebased.\",\n\t\t);\n\t\tthis.editLock.checkUnlocked(\"Rebasing\");\n\n\t\tif (this.transaction.isInProgress()) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Views cannot be rebased onto a view that has a pending transaction.\",\n\t\t\t);\n\t\t}\n\t\tif (checkout.transaction.isInProgress()) {\n\t\t\tthrow new UsageError(\"A view cannot be rebased while it has a pending transaction.\");\n\t\t}\n\n\t\tassert(\n\t\t\t!checkout.isSharedBranch,\n\t\t\t0xa5d /* Shared branches cannot be rebased onto another branch. */,\n\t\t);\n\n\t\tcheckout.#transaction.activeBranch.rebaseOnto(this.#transaction.activeBranch);\n\t}\n\n\tpublic rebaseOnto(checkout: ITreeCheckout): void {\n\t\tthis.checkNotDisposed(\n\t\t\t\"The target of the branch rebase has been disposed and cannot be rebased.\",\n\t\t);\n\t\tcheckout.rebase(this);\n\t}\n\n\tpublic merge(checkout: TreeCheckout): void;\n\tpublic merge(checkout: TreeCheckout, disposeMerged: boolean): void;\n\tpublic merge(checkout: TreeCheckout, disposeMerged = true): void {\n\t\tthis.checkNotDisposed(\n\t\t\t\"The target of the branch merge has been disposed and cannot be merged.\",\n\t\t);\n\t\tcheckout.checkNotDisposed(\n\t\t\t\"The source of the branch merge has been disposed and cannot be merged.\",\n\t\t);\n\t\tthis.editLock.checkUnlocked(\"Merging\");\n\t\tif (this.transaction.isInProgress()) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Views cannot be merged into a view while it has a pending transaction.\",\n\t\t\t);\n\t\t}\n\t\tif (checkout.transaction.isInProgress()) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Views with an open transaction cannot be merged into another view.\",\n\t\t\t);\n\t\t}\n\t\tthis.#transaction.activeBranch.merge(checkout.#transaction.activeBranch);\n\t\tif (disposeMerged && !checkout.isSharedBranch) {\n\t\t\t// Dispose the merged checkout unless it is a shared branch.\n\t\t\tcheckout[disposeSymbol]();\n\t\t}\n\t}\n\n\tpublic updateSchema(newSchema: TreeStoredSchema, allowNonSupersetSchema?: true): void {\n\t\tthis.checkNotDisposed();\n\t\tif (allowNonSupersetSchema !== true) {\n\t\t\tassert(\n\t\t\t\tallowsRepoSuperset(defaultSchemaPolicy, this.storedSchema.clone(), newSchema),\n\t\t\t\t0xbe6 /* New schema must allow all documents allowed by old schema */,\n\t\t\t);\n\t\t}\n\t\tthis.editor.schema.setStoredSchema(this.storedSchema.clone(), newSchema);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.editLock.checkUnlocked(\"Disposing a view\");\n\t\tthis[disposeSymbol]();\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tthis.checkNotDisposed(\n\t\t\t\"The branch has already been disposed and cannot be disposed again.\",\n\t\t);\n\t\tthis.disposed = true;\n\t\tthis.#transaction.branch.dispose();\n\t\tthis.#transaction.dispose();\n\t\tthis.purgeRevertibles();\n\t\tfor (const view of this.views) {\n\t\t\tview.dispose();\n\t\t}\n\t\tthis.#events.emit(\"dispose\");\n\t}\n\n\tpublic getRemovedRoots(): [string | number | undefined, number, JsonableTree][] {\n\t\tthis.assertNoUntrackedRoots();\n\t\tconst trees: [string | number | undefined, number, JsonableTree][] = [];\n\t\tconst cursor = this.forest.allocateCursor(\"getRemovedRoots\");\n\t\tfor (const { id, root } of this._removedRoots.entries()) {\n\t\t\tconst parentField = this._removedRoots.toFieldKey(root);\n\t\t\tthis.forest.moveCursorToPath({ parent: undefined, parentField, parentIndex: 0 }, cursor);\n\t\t\tconst tree = jsonableTreeFromCursor(cursor);\n\t\t\t// This method is used for tree consistency comparison.\n\t\t\tconst { major, minor } = id;\n\t\t\tconst finalizedMajor = major === undefined ? major : this.revisionTagCodec.encode(major);\n\t\t\ttrees.push([finalizedMajor, minor, tree]);\n\t\t}\n\t\tcursor.free();\n\t\treturn trees;\n\t}\n\n\t/**\n\t * This must be called on the root/main checkout after loading from a summary.\n\t * @remarks This pattern is necessary because the EditManager skips the normal process of applying commits to branches when loading a summary.\n\t * Instead, it simply {@link SharedTreeBranch#setHead | mutates} the branches directly which does not propagate the typical events throughout the rest of the system.\n\t */\n\tpublic load(): void {\n\t\t// Set the tip revision as the latest relevant revision for any removed roots that are loaded from a summary - this allows them to be garbage collected later.\n\t\t// When a load happens, the head of the trunk and the head of the local/main branch must be the same (this is enforced by SharedTree).\n\t\tthis._removedRoots.setRevisionsForLoadedData(this.#transaction.branch.getHead().revision);\n\t\t// The content of the checkout (e.g. the forest) has (maybe) changed, so fire an afterBatch event.\n\t\tthis.#events.emit(\"afterBatch\");\n\t}\n\n\tprivate purgeRevertibles(): void {\n\t\tfor (const revertible of this.revertibles) {\n\t\t\trevertible.dispose();\n\t\t}\n\t}\n\n\tprivate disposeRevertible(revertible: RevertibleAlpha, revision: RevisionTag): void {\n\t\tthis.revertibleCommitBranches.get(revision)?.dispose();\n\t\tthis.revertibleCommitBranches.delete(revision);\n\t\tthis.revertibles.delete(revertible);\n\t}\n\n\tprivate revertRevertible(revision: RevisionTag, kind: CommitKind): RevertMetrics {\n\t\tthis.editLock.checkUnlocked(\"Reverting a commit\");\n\t\tif (this.transaction.isInProgress()) {\n\t\t\tthrow new UsageError(\"Undo is not yet supported during transactions.\");\n\t\t}\n\n\t\tconst revertibleBranch = this.revertibleCommitBranches.get(revision);\n\t\tassert(revertibleBranch !== undefined, 0x7cc /* expected to find a revertible commit */);\n\t\tconst commitToRevert = revertibleBranch.getHead();\n\t\tconst revisionForInvert = this.mintRevisionTag();\n\n\t\tlet change = tagChange(\n\t\t\tthis.changeFamily.rebaser.invert(commitToRevert, false, revisionForInvert),\n\t\t\trevisionForInvert,\n\t\t);\n\n\t\tconst headCommit = this.#transaction.activeBranch.getHead();\n\t\t// Rebase the inverted change onto any commits that occurred after the undoable commits.\n\t\tif (commitToRevert !== headCommit) {\n\t\t\tchange = tagChange(\n\t\t\t\trebaseChange(\n\t\t\t\t\tthis.changeFamily.rebaser,\n\t\t\t\t\tchange,\n\t\t\t\t\tcommitToRevert,\n\t\t\t\t\theadCommit,\n\t\t\t\t\tthis.mintRevisionTag,\n\t\t\t\t).change,\n\t\t\t\trevisionForInvert,\n\t\t\t);\n\t\t}\n\n\t\tthis.#transaction.activeBranch.apply(\n\t\t\tchange,\n\t\t\tkind === CommitKind.Default || kind === CommitKind.Redo\n\t\t\t\t? CommitKind.Undo\n\t\t\t\t: CommitKind.Redo,\n\t\t);\n\n\t\t// Derive some stats about the reversion to return to the caller.\n\t\tlet revertAge = 0;\n\t\tlet currentCommit = headCommit;\n\t\twhile (commitToRevert.revision !== currentCommit.revision) {\n\t\t\trevertAge++;\n\n\t\t\tconst parentCommit = currentCommit.parent;\n\t\t\tassert(parentCommit !== undefined, 0x9a9 /* expected to find a parent commit */);\n\t\t\tcurrentCommit = parentCommit;\n\t\t}\n\n\t\treturn { age: revertAge };\n\t}\n\n\tprivate assertNoUntrackedRoots(): void {\n\t\tconst cursor = this.forest.getCursorAboveDetachedFields();\n\t\tconst rootFields = new Set([rootFieldKey]);\n\t\tfor (const { root } of this._removedRoots.entries()) {\n\t\t\trootFields.add(this._removedRoots.toFieldKey(root));\n\t\t}\n\n\t\tif (!cursor.firstField()) {\n\t\t\treturn;\n\t\t}\n\n\t\tdo {\n\t\t\tconst field = cursor.getFieldKey();\n\t\t\tassert(\n\t\t\t\trootFields.has(field),\n\t\t\t\t0xa22 /* Forest has a root field which is unknown to the detached field index */,\n\t\t\t);\n\n\t\t\trootFields.delete(field);\n\t\t} while (cursor.nextField());\n\t}\n\n\t/**\n\t * `true` iff the given branch change event is due to a remote change\n\t */\n\tprivate isRemoteChangeEvent(event: SharedTreeBranchChange<SharedTreeChange>): boolean {\n\t\treturn (\n\t\t\t// Remote changes are only ever applied to shared branches\n\t\t\tthis.isSharedBranch &&\n\t\t\t// Remote changes are applied to the branch by rebasing it onto the trunk.\n\t\t\t// No other rebases are allowed on shared branches, so we can use this to detect remote changes.\n\t\t\tevent.type === \"rebase\"\n\t\t);\n\t}\n\n\t// #region Commit Validation\n\n\t/** Used to maintain the contract of {@link onCommitValid}(). */\n\treadonly #validatedCommits = new WeakMap<\n\t\tGraphCommit<SharedTreeChange>,\n\t\t((commit: GraphCommit<SharedTreeChange>) => void)[] | true\n\t>();\n\n\t/**\n\t * Registers a function to be called when the given commit is validated.\n\t * @remarks A commit is validated by the checkout after it has been applied to the checkout's state (e.g. it has an effect on the forest).\n\t * If the commit applies successfully (i.e. it does not raise any unexpected errors), the commit is considered valid and the registered function is called.\n\t * If the commit does not apply successfully (because it causes an unexpected error), the function is not called (and the checkout will left in an error state).\n\t *\n\t * If the commit has already been validated when this function is called, the function is called immediately and this function returns `true`.\n\t * Otherwise, the function is registered to be called later and this function returns `false`.\n\t */\n\tpublic onCommitValid(\n\t\tcommit: GraphCommit<SharedTreeChange>,\n\t\tfn: (commit: GraphCommit<SharedTreeChange>) => void,\n\t): boolean {\n\t\tconst validated = getOrCreate(this.#validatedCommits, commit, () => []);\n\t\tif (validated === true) {\n\t\t\tfn(commit);\n\t\t\treturn true;\n\t\t}\n\n\t\tvalidated.push(fn);\n\t\treturn false;\n\t}\n\n\t/** Mark the given commit as \"validated\" according to the contract of {@link onCommitValid}(). */\n\tprivate validateCommit(commit: GraphCommit<SharedTreeChange>): void {\n\t\tconst validated = getOrCreate(this.#validatedCommits, commit, () => []);\n\t\tif (validated !== true) {\n\t\t\tfor (const fn of validated) {\n\t\t\t\tfn(commit);\n\t\t\t}\n\t\t\tthis.#validatedCommits.set(commit, true);\n\t\t}\n\t}\n\n\t// #endregion Commit Validation\n\n\t// #region Enrichment\n\n\t/**\n\t * Statistics about enrichment operations performed by this checkout.\n\t * Used for testing. May be used for telemetry in the future.\n\t * The performance cost of maintaining this information is negligible.\n\t */\n\tprivate readonly enrichmentStats: {\n\t\tbatches: number;\n\t\tdiffs: number;\n\t\tcommitsEnriched: number;\n\t\trefreshers: number;\n\t\tforks: number;\n\t\tapplied: number;\n\t} = { batches: 0, diffs: 0, commitsEnriched: 0, refreshers: 0, forks: 0, applied: 0 };\n\n\tpublic resetEnrichmentStats(): void {\n\t\tthis.enrichmentStats.batches = 0;\n\t\tthis.enrichmentStats.diffs = 0;\n\t\tthis.enrichmentStats.commitsEnriched = 0;\n\t\tthis.enrichmentStats.refreshers = 0;\n\t\tthis.enrichmentStats.forks = 0;\n\t\tthis.enrichmentStats.applied = 0;\n\t}\n\n\tpublic getEnrichmentStats(): {\n\t\tbatches: number;\n\t\tdiffs: number;\n\t\tcommitsEnriched: number;\n\t\trefreshers: number;\n\t\tforks: number;\n\t\tapplied: number;\n\t} {\n\t\treturn { ...this.enrichmentStats };\n\t}\n\n\tpublic enrich(\n\t\tcontext: GraphCommit<SharedTreeChange>,\n\t\tchanges: readonly TaggedChange<SharedTreeChange>[],\n\t): SharedTreeChange[] {\n\t\tif (!hasSome(changes)) {\n\t\t\treturn [];\n\t\t}\n\t\tthis.enrichmentStats.batches += 1;\n\t\tconst enricher = new SharedTreeChangeEnricher(\n\t\t\tthis.forest,\n\t\t\tthis._removedRoots,\n\t\t\tthis.storedSchema,\n\t\t\tthis.idCompressor,\n\t\t\t() => (this.enrichmentStats.commitsEnriched += 1),\n\t\t\t() => (this.enrichmentStats.refreshers += 1),\n\t\t\t() => (this.enrichmentStats.forks += 1),\n\t\t\t() => (this.enrichmentStats.applied += 1),\n\t\t);\n\t\t// This `lastCommitApplied` may be on the main branch or on a transaction branch.\n\t\t// In either case, it is crucial that the state of the forest & detached field index reflects all changes up to and including this commit.\n\t\tconst lastCommitApplied = this.#transaction.activeBranch.getHead();\n\t\tif (context !== lastCommitApplied) {\n\t\t\tenricher.enqueueChange(() => {\n\t\t\t\tthis.enrichmentStats.diffs += 1;\n\t\t\t\tconst diff = diffHistories(\n\t\t\t\t\tthis.changeFamily.rebaser,\n\t\t\t\t\tlastCommitApplied,\n\t\t\t\t\tcontext,\n\t\t\t\t\tthis.mintRevisionTag,\n\t\t\t\t);\n\t\t\t\treturn makeAnonChange(diff);\n\t\t\t});\n\t\t}\n\t\tconst enriched: SharedTreeChange[] = [];\n\t\tfor (const change of changes) {\n\t\t\tenriched.push(enricher.enrich(change.change));\n\t\t\tenricher.enqueueChange(change);\n\t\t}\n\t\tenricher[disposeSymbol]();\n\t\treturn enriched;\n\t}\n\n\tpublic get mainBranch(): SharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange> {\n\t\treturn this.#transaction.branch;\n\t}\n\n\t// #endregion Enrichment\n}\n\n/**\n * A helper class that assists {@link TreeCheckout} in preventing functionality from being used while the tree is in the middle of being edited.\n */\nclass EditLock {\n\t/**\n\t * Edits the tree by calling the methods of the editor passed into the {@link EditLock} constructor.\n\t * @remarks Edits will throw an error if the lock is currently locked.\n\t */\n\tpublic readonly editor: ISharedTreeEditor;\n\tprivate locked = false;\n\n\t/**\n\t * @param editor - an editor which will be used to create a new editor that is monitored to determine if any changes are happening to the tree.\n\t * Use {@link EditLock.editor} in place of the original editor to ensure that changes are monitored.\n\t */\n\tpublic constructor(editor: ISharedTreeEditor) {\n\t\tconst checkLock = (): void => this.checkUnlocked(\"Editing the tree\");\n\t\tthis.editor = {\n\t\t\tget schema() {\n\t\t\t\treturn editor.schema;\n\t\t\t},\n\t\t\tvalueField(...fieldArgs) {\n\t\t\t\tconst valueField = editor.valueField(...fieldArgs);\n\t\t\t\treturn {\n\t\t\t\t\tset(...editArgs) {\n\t\t\t\t\t\tcheckLock();\n\t\t\t\t\t\tvalueField.set(...editArgs);\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t\toptionalField(...fieldArgs) {\n\t\t\t\tconst optionalField = editor.optionalField(...fieldArgs);\n\t\t\t\treturn {\n\t\t\t\t\tset(...editArgs) {\n\t\t\t\t\t\tcheckLock();\n\t\t\t\t\t\toptionalField.set(...editArgs);\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t\tsequenceField(...fieldArgs) {\n\t\t\t\tconst sequenceField = editor.sequenceField(...fieldArgs);\n\t\t\t\treturn {\n\t\t\t\t\tinsert(...editArgs) {\n\t\t\t\t\t\tcheckLock();\n\t\t\t\t\t\tsequenceField.insert(...editArgs);\n\t\t\t\t\t},\n\t\t\t\t\tremove(...editArgs) {\n\t\t\t\t\t\tcheckLock();\n\t\t\t\t\t\tsequenceField.remove(...editArgs);\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t\tmove(...moveArgs) {\n\t\t\t\tcheckLock();\n\t\t\t\teditor.move(...moveArgs);\n\t\t\t},\n\t\t\taddNodeExistsConstraint(path) {\n\t\t\t\teditor.addNodeExistsConstraint(path);\n\t\t\t},\n\t\t\taddNodeExistsConstraintOnRevert(path) {\n\t\t\t\teditor.addNodeExistsConstraintOnRevert(path);\n\t\t\t},\n\t\t\taddNoChangeConstraint() {\n\t\t\t\teditor.addNoChangeConstraint();\n\t\t\t},\n\t\t\taddNoChangeConstraintOnRevert() {\n\t\t\t\teditor.addNoChangeConstraintOnRevert();\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Prevent further changes from being made to {@link EditLock.editor} until {@link EditLock.unlock} is called.\n\t * @remarks May only be called when the lock is not already locked.\n\t */\n\tpublic lock(): void {\n\t\tif (this.locked) {\n\t\t\tdebugger;\n\t\t}\n\t\tassert(!this.locked, 0xaa7 /* Checkout has already been locked */);\n\t\tthis.locked = true;\n\t}\n\n\t/**\n\t * Throws an error if the lock is currently locked.\n\t * @param action - The current action being performed by the user.\n\t * This must start with a capital letter, as it shows up as the first part of the error message and we want it to look nice.\n\t */\n\tpublic checkUnlocked<T extends string>(action: T extends Capitalize<T> ? T : never): void {\n\t\tif (this.locked) {\n\t\t\t// These type assertions ensure that the event name strings used here match the actual event names\n\t\t\tconst nodeChanged: keyof TreeChangeEvents = \"nodeChanged\";\n\t\t\tconst treeChanged: keyof TreeChangeEvents = \"treeChanged\";\n\t\t\tthrow new UsageError(\n\t\t\t\t`${action} is forbidden during a ${nodeChanged} or ${treeChanged} event`,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Allow changes to be made to {@link EditLock.editor} again.\n\t * @remarks May only be called when the lock is currently locked.\n\t */\n\tpublic unlock(): void {\n\t\tassert(this.locked, 0xaa8 /* Checkout has not been locked */);\n\t\tthis.locked = false;\n\t}\n}\n\n/**\n * Keeps track of all new forks created until the returned function is invoked, which will dispose all of those for.\n * The returned function may only be called once.\n *\n * @param checkout - The tree checkout for which you want to monitor forks for disposal.\n * @returns a function which can be called to dispose all of the tracked forks.\n */\nfunction trackForksForDisposal(checkout: TreeCheckout): () => void {\n\tconst forks = new Set<TreeCheckout>();\n\tconst onDisposeUnSubscribes: (() => void)[] = [];\n\tconst onForkUnSubscribe = onForkTransitive(checkout, (fork) => {\n\t\tforks.add(fork);\n\t\tonDisposeUnSubscribes.push(fork.events.on(\"dispose\", () => forks.delete(fork)));\n\t});\n\tlet disposed = false;\n\treturn () => {\n\t\tassert(!disposed, 0xaa9 /* Forks may only be disposed once */);\n\t\tfor (const fork of forks) {\n\t\t\tfork.dispose();\n\t\t}\n\t\tfor (const unsubscribe of onDisposeUnSubscribes) {\n\t\t\tunsubscribe();\n\t\t}\n\t\tonForkUnSubscribe();\n\t\tdisposed = true;\n\t};\n}\n\nfunction verboseFromCursor(\n\treader: ITreeCursor,\n\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n): VerboseTree {\n\tconst fields = customFromCursorStored(reader, schema, verboseFromCursor);\n\tconst nodeSchema =\n\t\tschema.get(reader.type) ?? fail(0xac9 /* missing schema for type in cursor */);\n\tif (nodeSchema instanceof LeafNodeStoredSchema) {\n\t\treturn fields as CustomTreeValue;\n\t}\n\n\treturn {\n\t\ttype: reader.type,\n\t\tfields: fields as CustomTreeNode<IFluidHandle>,\n\t};\n}\n\ninterface SerializedChange {\n\tversion: 1;\n\trevision: RevisionTag;\n\tchange: JsonCompatibleReadOnly;\n\toriginatorId: SessionId;\n}\n\nfunction isSerializedChange(value: unknown): value is SerializedChange {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tconst change = value as Partial<SerializedChange>;\n\treturn (\n\t\tchange.version === 1 &&\n\t\t(change.revision === \"root\" || typeof change.revision === \"number\") &&\n\t\ttypeof change.originatorId === \"string\" &&\n\t\tisStableId(change.originatorId) &&\n\t\tchange.change !== undefined\n\t);\n}\n"]}
1
+ {"version":3,"file":"treeCheckout.js","sourceRoot":"","sources":["../../src/shared-tree/treeCheckout.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,+DAA6D;AAG7D,kEAAoF;AAEpF,qEAAoE;AACpE,uEAGkD;AAElD,gDAI2B;AAC3B,+CAwC0B;AAC1B,4DAUuC;AACvC,2DAOsC;AACtC,sDAaiC;AACjC,+CAO0B;AAE1B,uEAAoF;AACpF,+EAAyE;AACzE,2EAAsF;AAqLtF;;;;;;GAMG;AACH,SAAgB,kBAAkB,CACjC,YAA2B,EAC3B,eAAkC,EAClC,gBAAkC,EAClC,IAYC;IAED,MAAM,OAAO,GAAG,IAAI,EAAE,OAAO,IAAI,IAAI,oBAAS,CAAC,cAAc,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,IAAI,qCAA0B,EAAE,CAAC;IAChE,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,IAAA,sBAAW,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5D,MAAM,mBAAmB,GAAsB;QAC9C,aAAa,EAAE,8BAAmB;QAClC,mBAAmB,EAAE,6BAAkB,CAAC,IAAI;KAC5C,CAAC;IACF,MAAM,YAAY,GAAsB,EAAE,GAAG,mBAAmB,EAAE,GAAG,IAAI,EAAE,YAAY,EAAE,CAAC;IAC1F,MAAM,YAAY,GACjB,IAAI,EAAE,YAAY;QAClB,IAAI,kDAAsB,CACzB,gBAAgB,EAChB,IAAI,EAAE,eAAe,IAAI,IAAA,8BAAmB,EAAC,YAAY,CAAC,EAC1D,YAAY,EACZ,IAAI,EAAE,wBAAwB,EAC9B,YAAY,CACZ,CAAC;IAEH,mEAAmE;IACnE,wDAAwD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iBAAiB,EAAE,CAAC;QACpB,QAAQ,GAAG,IAAI,CAAC;IACjB,CAAC,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CACzB,MAAmB,EACnB,MAAmE;IAEnE,MAAM,MAAM,GAAG,IAAA,iCAAsB,EAAC,MAAM,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACzE,MAAM,UAAU,GACf,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAA,eAAI,EAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAChF,IAAI,UAAU,YAAY,+BAAoB,EAAE,CAAC;QAChD,OAAO,MAAyB,CAAC;IAClC,CAAC;IAED,OAAO;QACN,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,MAAsC;KAC9C,CAAC;AACH,CAAC;AASD,SAAS,kBAAkB,CAAC,KAAc;IACzC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACjD,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,MAAM,GAAG,KAAkC,CAAC;IAClD,OAAO,CACN,MAAM,CAAC,OAAO,KAAK,CAAC;QACpB,CAAC,MAAM,CAAC,QAAQ,KAAK,MAAM,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC;QACnE,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ;QACvC,IAAA,qBAAU,EAAC,MAAM,CAAC,YAAY,CAAC;QAC/B,MAAM,CAAC,MAAM,KAAK,SAAS,CAC3B,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { IDisposable } from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandle, Listenable } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\nimport { isStableId } from \"@fluidframework/id-compressor/internal\";\nimport {\n\tUsageError,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tFluidClientVersion,\n\tFormatValidatorNoOp,\n\ttype CodecWriteOptions,\n} from \"../codec/index.js\";\nimport {\n\ttype Anchor,\n\ttype AnchorLocator,\n\ttype AnchorNode,\n\tAnchorSet,\n\ttype AnchorSetRootEvents,\n\ttype ChangeFamily,\n\tCommitKind,\n\ttype DeltaVisitor,\n\ttype DetachedFieldIndex,\n\ttype IEditableForest,\n\ttype IForestSubscription,\n\ttype JsonableTree,\n\tRevertibleStatus,\n\ttype RevisionTag,\n\ttype RevisionTagCodec,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\ttype TreeStoredSchemaSubscription,\n\tcombineVisitors,\n\tmakeDetachedFieldIndex,\n\trebaseChange,\n\trootFieldKey,\n\ttagChange,\n\tvisitDelta,\n\ttype RevertibleAlphaFactory,\n\ttype RevertibleAlpha,\n\ttype GraphCommit,\n\tisAncestor,\n\tmoveToDetachedField,\n\ttype ITreeCursor,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\tLeafNodeStoredSchema,\n\tdiffHistories,\n\ttype ChangeMetadata,\n\ttype ChangeEncodingContext,\n\ttype ReadOnlyDetachedFieldIndex,\n\tmakeAnonChange,\n\ttype TaggedChange,\n} from \"../core/index.js\";\nimport {\n\ttype FieldBatchCodec,\n\ttype TreeCompressionStrategy,\n\tallowsRepoSuperset,\n\tbuildForest,\n\tcreateNodeIdentifierManager,\n\tdefaultSchemaPolicy,\n\tintoDelta,\n\tjsonableTreeFromCursor,\n\tmakeFieldBatchCodec,\n} from \"../feature-libraries/index.js\";\nimport {\n\tSquashingTransactionStack,\n\tSharedTreeBranch,\n\tTransactionResult,\n\tonForkTransitive,\n\ttype SharedTreeBranchChange,\n\ttype Transactor,\n} from \"../shared-tree-core/index.js\";\nimport {\n\ttype ImplicitFieldSchema,\n\ttype ReadSchema,\n\ttype TreeView,\n\ttype TreeViewConfiguration,\n\ttype UnsafeUnknownSchema,\n\ttype ViewableTree,\n\ttype TreeBranch,\n\ttype TreeChangeEvents,\n\ttype VerboseTree,\n\tcustomFromCursorStored,\n\ttype CustomTreeValue,\n\ttype CustomTreeNode,\n} from \"../simple-tree/index.js\";\nimport {\n\tBreakable,\n\tdisposeSymbol,\n\tgetOrCreate,\n\thasSome,\n\ttype JsonCompatibleReadOnly,\n\ttype WithBreakable,\n} from \"../util/index.js\";\n\nimport { getCheckout, SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { SharedTreeChangeEnricher } from \"./sharedTreeChangeEnricher.js\";\nimport { SharedTreeChangeFamily, hasSchemaChange } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { ISharedTreeEditor, SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\n\n/**\n * Events for {@link ITreeCheckout}.\n */\nexport interface CheckoutEvents {\n\t/**\n\t * The view is currently in a consistent state, but a batch of changes is about to be processed.\n\t * @remarks Once this event fires, it is not safe to access the FlexTree, Forest and AnchorSet again until the corresponding {@link CheckoutEvents.afterBatch} fires.\n\t * Every call to `beforeBatch` will be followed by a corresponding call to `afterBatch` (before any more calls to `beforeBatch`).\n\t * @param change - The {@link SharedTreeBranchChange | change} to the checkout's active branch that is about to be processed.\n\t * May be empty if the changes were produced by e.g. a rebase or the initial loading of the document.\n\t */\n\tbeforeBatch(change: SharedTreeBranchChange<SharedTreeChange>): void;\n\n\t/**\n\t * A batch of changes has finished processing and the view is in a consistent state.\n\t * @remarks It is once again safe to access the FlexTree, Forest and AnchorSet.\n\t *\n\t * While every call to `beforeBatch` will be followed by a corresponding call to `afterBatch`, the converse is not true.\n\t * This event may be fired without a preceding `beforeBatch` event if the checkout's branch and forest were directly updated via e.g. a summary load rather than via normal application of changes.\n\t * @remarks\n\t * This is mainly useful for knowing when to do followup work scheduled during events from Anchors.\n\t */\n\tafterBatch(): void;\n\n\t/**\n\t * Fired when a change is made to the branch. Includes data about the change that is made which listeners\n\t * can use to filter on changes they care about e.g. local vs remote changes.\n\t *\n\t * @param data - information about the change\n\t */\n\tchanged(data: ChangeMetadata, getRevertible?: RevertibleAlphaFactory): void;\n\n\t/**\n\t * Fired when a new branch is created from this checkout.\n\t */\n\tfork(branch: ITreeCheckout): void;\n\n\t/**\n\t * Fired when the checkout is disposed.\n\t */\n\tdispose(): void;\n}\n\n/**\n * A \"version control\"-style branch of a SharedTree.\n * @remarks Branches may be used to coordinate edits to a SharedTree, e.g. via merge and rebase operations.\n * Changes applied to a branch of a branch only apply to that branch and are isolated from other branches.\n * Changes may be synchronized across branches via merge and rebase operations provided on the branch object.\n * @alpha @sealed\n */\nexport interface BranchableTree extends ViewableTree {\n\t/**\n\t * Spawn a new branch which is based off of the current state of this branch.\n\t * Any mutations of the new branch will not apply to this branch until the new branch is merged back into this branch via `merge()`.\n\t */\n\tbranch(): TreeBranchFork;\n\n\t/**\n\t * Apply all the new changes on the given branch to this branch.\n\t * @param view - a branch which was created by a call to `branch()`.\n\t * It is automatically disposed after the merge completes.\n\t * @remarks All ongoing transactions (if any) in `branch` will be committed before the merge.\n\t * A \"changed\" event and a corresponding {@link Revertible} will be emitted on this branch for each new change merged from 'branch'.\n\t */\n\tmerge(branch: TreeBranchFork): void;\n\n\t/**\n\t * Apply all the new changes on the given branch to this branch.\n\t * @param branch - a branch which was created by a call to `branch()`.\n\t * @param disposeMerged - whether or not to dispose `branch` after the merge completes.\n\t * @remarks All ongoing transactions (if any) in `branch` will be committed before the merge.\n\t */\n\tmerge(branch: TreeBranchFork, disposeMerged: boolean): void;\n\n\t/**\n\t * Rebase the given branch onto this branch.\n\t * @param branch - a branch which was created by a call to `branch()`. It is modified by this operation.\n\t */\n\trebase(branch: TreeBranchFork): void;\n}\n\n/**\n * A {@link BranchableTree | branch} of a SharedTree that has merged from another branch.\n * @remarks This branch should be disposed when it is no longer needed in order to free resources.\n * @alpha @sealed\n */\nexport interface TreeBranchFork extends BranchableTree, IDisposable {\n\t/**\n\t * Rebase the changes that have been applied to this branch over all the new changes in the given branch.\n\t * @param branch - Either the root branch or a branch that was created by a call to `branch()`. It is not modified by this operation.\n\t */\n\trebaseOnto(branch: BranchableTree): void;\n}\n\n/**\n * Provides a means for interacting with a SharedTree.\n * This includes reading data from the tree and running transactions to mutate the tree.\n * @remarks This interface should not have any implementations other than those provided by the SharedTree package libraries.\n * @privateRemarks\n * API for interacting with a {@link SharedTreeBranch}.\n * Implementations of this interface must implement the {@link branchKey} property.\n */\nexport interface ITreeCheckout extends AnchorLocator, ViewableTree, WithBreakable {\n\t/**\n\t * Read and Write access for schema stored in the document.\n\t *\n\t * These APIs are temporary and will be replaced with different abstractions (View Schema based) in a different place later.\n\t *\n\t * TODO:\n\t * Editing of this should be moved into transactions with the rest of tree editing to they can be intermixed.\n\t * This will be done after the relations between views, branches and Indexes are figured out.\n\t *\n\t * TODO:\n\t * Public APIs for dealing with schema should be in terms of View Schema, and schema update policies.\n\t * The actual stored schema should be hidden (or ar least not be the most prominent way to interact with schema).\n\t *\n\t * TODO:\n\t * Something should ensure the document contents are always in schema.\n\t */\n\treadonly storedSchema: TreeStoredSchemaSubscription;\n\t/**\n\t * Current contents.\n\t * Updated by edits (local and remote).\n\t * Use `editor` to create a local edit.\n\t */\n\treadonly forest: IForestSubscription;\n\n\t/**\n\t * Used to edit the state of the tree. Edits will be immediately applied locally to the tree.\n\t * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.\n\t */\n\treadonly editor: ISharedTreeEditor;\n\n\t/**\n\t * A collection of functions for managing transactions.\n\t */\n\treadonly transaction: Transactor;\n\n\tbranch(): ITreeCheckoutFork;\n\n\tmerge(checkout: ITreeCheckoutFork): void;\n\n\tmerge(checkout: ITreeCheckoutFork, disposeMerged: boolean): void;\n\n\trebase(checkout: ITreeCheckoutFork): void;\n\n\t/**\n\t * Replaces all schema with the provided schema.\n\t * Can over-write preexisting schema, and removes unmentioned schema.\n\t *\n\t * @param newSchema - The new schema to replace the existing schema.\n\t * @param allowNonSupersetSchema - Whether to allow non-superset schemas.\n\t * Defaults to false.\n\t * If false, an assert will be thrown if the new schema does not permit all possible documents which were permitted under the old schema.\n\t */\n\tupdateSchema(newSchema: TreeStoredSchema, allowNonSupersetSchema?: true): void;\n\n\t/**\n\t * Events about this view.\n\t */\n\treadonly events: Listenable<CheckoutEvents>;\n\n\t/**\n\t * Events about the root of the tree in this view.\n\t */\n\treadonly rootEvents: Listenable<AnchorSetRootEvents>;\n\n\t/**\n\t * Returns a JsonableTree for each tree that was removed from (and not restored to) the document.\n\t * This list is guaranteed to contain all nodes that are recoverable through undo/redo on this checkout.\n\t * The list may also contain additional nodes.\n\t *\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t */\n\tgetRemovedRoots(): [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * Creates a {@link TreeCheckout}.\n * @param args - an object containing optional components that will be used to build the view.\n * Any components not provided will be created by default.\n * @remarks This does not create a {@link SharedTree}, but rather a view with the minimal state\n * and functionality required to implement {@link ITreeCheckout}.\n */\nexport function createTreeCheckout(\n\tidCompressor: IIdCompressor,\n\tmintRevisionTag: () => RevisionTag,\n\trevisionTagCodec: RevisionTagCodec,\n\targs?: {\n\t\tbranch?: SharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange>;\n\t\tchangeFamily?: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange>;\n\t\tschema?: TreeStoredSchemaRepository;\n\t\tforest?: IEditableForest;\n\t\tfieldBatchCodec?: FieldBatchCodec;\n\t\tremovedRoots?: DetachedFieldIndex;\n\t\tchunkCompressionStrategy?: TreeCompressionStrategy;\n\t\tlogger?: ITelemetryLoggerExt;\n\t\tbreaker?: Breakable;\n\t\tdisposeForksAfterTransaction?: boolean;\n\t\tcodecOptions?: Partial<CodecWriteOptions>;\n\t},\n): TreeCheckout {\n\tconst breaker = args?.breaker ?? new Breakable(\"TreeCheckout\");\n\tconst schema = args?.schema ?? new TreeStoredSchemaRepository();\n\tconst forest = args?.forest ?? buildForest(breaker, schema);\n\tconst defaultCodecOptions: CodecWriteOptions = {\n\t\tjsonValidator: FormatValidatorNoOp,\n\t\tminVersionForCollab: FluidClientVersion.v2_0,\n\t};\n\tconst codecOptions: CodecWriteOptions = { ...defaultCodecOptions, ...args?.codecOptions };\n\tconst changeFamily =\n\t\targs?.changeFamily ??\n\t\tnew SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\targs?.fieldBatchCodec ?? makeFieldBatchCodec(codecOptions),\n\t\t\tcodecOptions,\n\t\t\targs?.chunkCompressionStrategy,\n\t\t\tidCompressor,\n\t\t);\n\n\t// TODO: If a branch is passed in, is it supposed to be local main?\n\t// Otherwise shouldn't we set `isSharedBranch` to false?\n\tconst branch =\n\t\targs?.branch ??\n\t\tnew SharedTreeBranch(\n\t\t\t{\n\t\t\t\tchange: changeFamily.rebaser.compose([]),\n\t\t\t\trevision: \"root\",\n\t\t\t},\n\t\t\tchangeFamily,\n\t\t\t() => idCompressor.generateCompressedId(),\n\t\t);\n\n\treturn new TreeCheckout(\n\t\tbranch,\n\t\ttrue,\n\t\tchangeFamily,\n\t\tschema,\n\t\tforest,\n\t\tmintRevisionTag,\n\t\trevisionTagCodec,\n\t\tidCompressor,\n\t\targs?.removedRoots,\n\t\targs?.logger,\n\t\tbreaker,\n\t\targs?.disposeForksAfterTransaction,\n\t);\n}\n\n/**\n * Branch (like in a version control system) of SharedTree.\n *\n * {@link ITreeCheckout} that has forked off of the main trunk/branch.\n */\nexport interface ITreeCheckoutFork extends ITreeCheckout {\n\trebaseOnto(view: ITreeCheckout): void;\n}\n\n/**\n * Metrics derived from a revert operation.\n *\n * @see {@link TreeCheckout.revertRevertible}.\n */\nexport interface RevertMetrics {\n\t/**\n\t * The age of the revertible commit relative to the head of the branch to which the reversion will be applied.\n\t */\n\treadonly age: number;\n\n\t// TODO: add other stats as needed for telemetry, etc.\n}\n\n/**\n * An implementation of {@link ITreeCheckoutFork}.\n */\nexport class TreeCheckout implements ITreeCheckoutFork {\n\tpublic disposed = false;\n\n\tprivate editLock: EditLock;\n\n\t/**\n\t * User-defined label associated with the transaction whose commit is currently being produced for this checkout.\n\t *\n\t * @remarks\n\t * This label is used to implement {@link TreeCheckout.runWithTransactionLabel}.\n\t */\n\tprivate transactionLabel?: unknown;\n\n\tprivate readonly views = new Set<TreeView<ImplicitFieldSchema>>();\n\n\t/**\n\t * Set of revertibles maintained for automatic disposal\n\t */\n\tprivate readonly revertibles = new Set<RevertibleAlpha>();\n\n\t/**\n\t * Each branch's head commit corresponds to a revertible commit.\n\t * Maintaining a whole branch ensures the commit graph is not pruned in a way that would prevent the commit from\n\t * being reverted.\n\t */\n\tprivate readonly revertibleCommitBranches = new Map<\n\t\tRevisionTag,\n\t\tSharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange>\n\t>();\n\n\t/**\n\t * The name of the telemetry event logged for calls to {@link TreeCheckout.revertRevertible}.\n\t * @privateRemarks Exposed for testing purposes.\n\t */\n\tpublic static readonly revertTelemetryEventName = \"RevertRevertible\";\n\n\treadonly #events = createEmitter<CheckoutEvents>();\n\tpublic events: Listenable<CheckoutEvents> = this.#events;\n\n\tpublic constructor(\n\t\tbranch: SharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange>,\n\t\t/** True if and only if this checkout is for a branch which is persisted and shared with other clients. */\n\t\tpublic readonly isSharedBranch: boolean,\n\t\tprivate readonly changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,\n\t\tpublic readonly storedSchema: TreeStoredSchemaRepository,\n\t\tpublic readonly forest: IEditableForest,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\tprivate readonly _removedRoots: DetachedFieldIndex = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\tidCompressor,\n\t\t),\n\t\t/** Optional logger for telemetry. */\n\t\tprivate readonly logger?: ITelemetryLoggerExt,\n\t\tpublic readonly breaker: Breakable = new Breakable(\"TreeCheckout\"),\n\t\tpublic readonly disposeForksAfterTransaction = true,\n\t) {\n\t\tthis.#transaction = this.createTransactionStack(branch);\n\t\tthis.editLock = new EditLock(this.#transaction.activeBranchEditor);\n\t\tthis.registerForBranchEvents();\n\t}\n\n\t/**\n\t * Helper method for {@link SchematizingSimpleTreeView.runTransaction} to properly clear transaction labels once the function completes.\n\t *\n\t * @remarks\n\t * The label is stored during the execution of the function and will be included in the {@link ChangeMetadata} of the transaction.\n\t *\n\t * Labels supplied to nested transactions are ignored - only the outermost transaction label is ever used.\n\t *\n\t * @param fn - The function to execute. It receives the user provided transaction label as an optional parameter.\n\t * @param label - The label to associate with the outermost transaction.\n\t * @returns The result of executing `fn`.\n\t */\n\tpublic runWithTransactionLabel<TLabel, TResult>(\n\t\tfn: (label?: TLabel) => TResult,\n\t\tlabel: TLabel | undefined,\n\t): TResult {\n\t\t// If a transaction label is already set, nesting is occurring, so we should not override it.\n\t\tif (this.transactionLabel !== undefined) {\n\t\t\treturn fn(this.transactionLabel as TLabel);\n\t\t}\n\t\tthis.transactionLabel = label;\n\t\ttry {\n\t\t\treturn fn(this.transactionLabel as TLabel);\n\t\t} finally {\n\t\t\tthis.transactionLabel = undefined;\n\t\t}\n\t}\n\n\tpublic get removedRoots(): ReadOnlyDetachedFieldIndex {\n\t\treturn this._removedRoots;\n\t}\n\n\tprivate registerForBranchEvents(): void {\n\t\tthis.#transaction.branch.events.on(\"afterChange\", this.onAfterBranchChange);\n\t\tthis.#transaction.activeBranchEvents.on(\"afterChange\", this.onAfterChange);\n\t\tthis.#transaction.activeBranchEvents.on(\"ancestryTrimmed\", this.onAncestryTrimmed);\n\t}\n\n\tprivate unregisterFromBranchEvents(): void {\n\t\tthis.#transaction.branch.events.off(\"afterChange\", this.onAfterBranchChange);\n\t\tthis.#transaction.activeBranchEvents.off(\"afterChange\", this.onAfterChange);\n\t\tthis.#transaction.activeBranchEvents.off(\"ancestryTrimmed\", this.onAncestryTrimmed);\n\t}\n\n\tprivate createTransactionStack(\n\t\tbranch: SharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange>,\n\t): SquashingTransactionStack<SharedTreeEditBuilder, SharedTreeChange> {\n\t\treturn new SquashingTransactionStack(branch, this.mintRevisionTag, () => {\n\t\t\tconst disposeForks = this.disposeForksAfterTransaction\n\t\t\t\t? trackForksForDisposal(this)\n\t\t\t\t: undefined;\n\t\t\t// When each transaction is started, make a restorable checkpoint of the current state of removed roots\n\t\t\tconst restoreRemovedRoots = this._removedRoots.createCheckpoint();\n\t\t\treturn (result, viewUpdate: SharedTreeChange | undefined) => {\n\t\t\t\tconst newHead = this.#transaction.branch.getHead();\n\t\t\t\tswitch (result) {\n\t\t\t\t\tcase TransactionResult.Abort: {\n\t\t\t\t\t\trestoreRemovedRoots();\n\t\t\t\t\t\tif (viewUpdate !== undefined) {\n\t\t\t\t\t\t\tthis.applyChange(viewUpdate, newHead.revision);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase TransactionResult.Commit: {\n\t\t\t\t\t\tif (viewUpdate !== undefined) {\n\t\t\t\t\t\t\tthis.applyChange(viewUpdate, newHead.revision);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!this.transaction.isInProgress()) {\n\t\t\t\t\t\t\t// The changes in a transaction squash commit have already applied to the checkout and are known to be valid, so we can validate the squash commit automatically.\n\t\t\t\t\t\t\tthis.validateCommit(newHead);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tunreachableCase(result);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdisposeForks?.();\n\t\t\t};\n\t\t});\n\t}\n\n\tpublic exportVerbose(): VerboseTree | undefined {\n\t\tconst cursor = this.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.forest, cursor);\n\t\t\tconst length = cursor.getFieldLength();\n\t\t\tif (length === 0) {\n\t\t\t\treturn undefined;\n\t\t\t} else if (length === 1) {\n\t\t\t\tcursor.enterNode(0);\n\t\t\t\treturn verboseFromCursor(cursor, this.storedSchema.nodeSchema);\n\t\t\t} else {\n\t\t\t\tfail(0xac8 /* Invalid document root length */);\n\t\t\t}\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\tprivate readonly onAfterBranchChange = (\n\t\tevent: SharedTreeBranchChange<SharedTreeChange>,\n\t): void => {\n\t\t// The following logic allows revertibles to be generated for the change.\n\t\t// Currently only appends (including merges and transaction commits) are supported.\n\t\tif (event.type === \"append\") {\n\t\t\t// TODO:#20949: When the SharedTree is detached, these commits will already have been garbage collected.\n\t\t\t// Figure out a way to generate revertibles before the commits are garbage collected.\n\t\t\tfor (const commit of event.newCommits) {\n\t\t\t\tconst kind = event.type === \"append\" ? event.kind : CommitKind.Default;\n\t\t\t\tconst { change, revision } = commit;\n\n\t\t\t\tconst getRevertible = hasSchemaChange(change)\n\t\t\t\t\t? undefined\n\t\t\t\t\t: (onRevertibleDisposed?: (revertible: RevertibleAlpha) => void) => {\n\t\t\t\t\t\t\tif (!withinEventContext) {\n\t\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\t\"Cannot get a revertible outside of the context of a changed event.\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (this.revertibleCommitBranches.get(revision) !== undefined) {\n\t\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\t\"Cannot generate the same revertible more than once. Note that this can happen when multiple changed event listeners are registered.\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst revertible = this.createRevertible(\n\t\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\tonRevertibleDisposed,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tthis.revertibleCommitBranches.set(\n\t\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\t\tthis.#transaction.activeBranch.fork(commit),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tthis.revertibles.add(revertible);\n\t\t\t\t\t\t\treturn revertible;\n\t\t\t\t\t\t};\n\n\t\t\t\tlet withinEventContext = true;\n\n\t\t\t\tconst metadata: ChangeMetadata = {\n\t\t\t\t\tkind,\n\t\t\t\t\tisLocal: true,\n\t\t\t\t\tgetChange: () => {\n\t\t\t\t\t\tconst context: ChangeEncodingContext = {\n\t\t\t\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t\t\t\t\toriginatorId: this.idCompressor.localSessionId,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst encodedChange = this.changeFamily.codecs\n\t\t\t\t\t\t\t.resolve(4)\n\t\t\t\t\t\t\t.json.encode(change, context);\n\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tcommit.parent !== undefined,\n\t\t\t\t\t\t\t0xca4 /* Expected applied commit to be parented */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\toriginatorId: this.idCompressor.localSessionId,\n\t\t\t\t\t\t\tchange: encodedChange,\n\t\t\t\t\t\t} satisfies SerializedChange;\n\t\t\t\t\t},\n\t\t\t\t\tgetRevertible: (onDisposed) => getRevertible?.(onDisposed),\n\t\t\t\t\tlabel: this.transactionLabel,\n\t\t\t\t};\n\n\t\t\t\tthis.#events.emit(\"changed\", metadata, getRevertible);\n\t\t\t\twithinEventContext = false;\n\t\t\t}\n\t\t} else if (this.isRemoteChangeEvent(event)) {\n\t\t\t// TODO: figure out how to plumb through commit kind info for remote changes\n\t\t\tthis.#events.emit(\"changed\", {\n\t\t\t\tisLocal: false,\n\t\t\t\tkind: CommitKind.Default,\n\t\t\t});\n\t\t}\n\t};\n\n\tprivate readonly onAfterChange = (event: SharedTreeBranchChange<SharedTreeChange>): void => {\n\t\tthis.editLock.lock();\n\t\tthis.#events.emit(\"beforeBatch\", event);\n\t\tif (event.change !== undefined) {\n\t\t\tconst revision =\n\t\t\t\tevent.type === \"rebase\"\n\t\t\t\t\t? this.#transaction.activeBranch.getHead().revision\n\t\t\t\t\t: event.change.revision;\n\n\t\t\tthis.applyChange(event.change.change, revision);\n\t\t}\n\t\tthis.#events.emit(\"afterBatch\");\n\t\tthis.editLock.unlock();\n\t\tif (event.type === \"append\") {\n\t\t\tfor (const commit of event.newCommits) {\n\t\t\t\tthis.validateCommit(commit);\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * Applies the given serialized change (as was produced via a `\"changed\"` event of another checkout) to this checkout.\n\t */\n\tpublic applySerializedChange(serializedChange: JsonCompatibleReadOnly): void {\n\t\tif (!isSerializedChange(serializedChange)) {\n\t\t\tthrow new UsageError(`Cannot apply change. Invalid serialized change format.`);\n\t\t}\n\t\tconst { revision, originatorId, change } = serializedChange;\n\t\tif (originatorId !== this.idCompressor.localSessionId) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Cannot apply change. A serialized changed must be applied to the same SharedTree as it was created from.`,\n\t\t\t);\n\t\t}\n\t\tconst context: ChangeEncodingContext = {\n\t\t\tidCompressor: this.idCompressor,\n\t\t\toriginatorId: this.idCompressor.localSessionId,\n\t\t\trevision,\n\t\t};\n\t\tconst decodedChange = this.changeFamily.codecs.resolve(4).json.decode(change, context);\n\t\tthis.applyChange(decodedChange, revision);\n\t}\n\n\t// Revision is the revision of the commit, if any, which caused this change.\n\tprivate applyChange(change: SharedTreeChange, revision?: RevisionTag): void {\n\t\t// Conflicts due to schema will be empty and thus are not applied.\n\t\tfor (const innerChange of change.changes) {\n\t\t\tif (innerChange.type === \"data\") {\n\t\t\t\tconst delta = intoDelta(tagChange(innerChange.innerChange, revision));\n\t\t\t\tthis.withCombinedVisitor((visitor) => {\n\t\t\t\t\tvisitDelta(delta, visitor, this._removedRoots, revision);\n\t\t\t\t});\n\t\t\t} else if (innerChange.type === \"schema\") {\n\t\t\t\t// Schema changes from a current to a new schema are expected to be backwards compatible.\n\t\t\t\t// This guarantees that all data in the forest (which is valid before the schema change)\n\t\t\t\t// is also valid under the new schema.\n\t\t\t\t// Note however, that such schema changes may in some cases be rolled back:\n\t\t\t\t// Case 1: A transaction with a schema change may be aborted.\n\t\t\t\t// The transaction may have made some data changes that would render some trees invalid\n\t\t\t\t// under the old schema, but these changes will also be rolled back, thereby putting the forest\n\t\t\t\t// back in the state before the transaction, which is valid under the original (reinstated) schema.\n\t\t\t\t// Case 2: A branch with a schema change may be rebased such that the schema change (because\n\t\t\t\t// of a constraint) is no longer applied.\n\t\t\t\t// Such a branch may contain data changes that would render some trees invalid under the\n\t\t\t\t// original schema. These data changes may not necessarily be rolled back.\n\t\t\t\t// They will however be rebased over the rollback of the schema change. This rebasing will\n\t\t\t\t// ensure that these data changes are muted if they would render some trees invalid under the\n\t\t\t\t// original (reinstated) schema.\n\t\t\t\tthis.storedSchema.apply(innerChange.innerChange.schema.new);\n\t\t\t} else {\n\t\t\t\tfail(0xad1 /* Unknown Shared Tree change type. */);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate readonly onAncestryTrimmed = (revisions: RevisionTag[]): void => {\n\t\t// When the branch is trimmed, we can garbage collect any repair data whose latest relevant revision is one of the\n\t\t// trimmed revisions.\n\t\tthis.withCombinedVisitor((visitor) => {\n\t\t\tfor (const revision of revisions) {\n\t\t\t\t// get all the roots last created or used by the revision\n\t\t\t\tconst roots = this._removedRoots.getRootsLastTouchedByRevision(revision);\n\n\t\t\t\t// get the detached field for the root and delete it from the removed roots\n\t\t\t\tfor (const root of roots) {\n\t\t\t\t\tvisitor.destroy(this._removedRoots.toFieldKey(root), 1);\n\t\t\t\t}\n\n\t\t\t\tthis._removedRoots.deleteRootsLastTouchedByRevision(revision);\n\t\t\t}\n\t\t});\n\t};\n\n\tprivate withCombinedVisitor(fn: (visitor: DeltaVisitor) => void): void {\n\t\tconst anchorVisitor = this.forest.anchors.acquireVisitor();\n\t\tconst combinedVisitor = combineVisitors([this.forest.acquireVisitor(), anchorVisitor]);\n\t\tfn(combinedVisitor);\n\t\tcombinedVisitor.free();\n\t}\n\n\tprivate checkNotDisposed(usageError?: string): void {\n\t\tthis.breaker.use();\n\t\tif (this.disposed) {\n\t\t\tif (usageError !== undefined) {\n\t\t\t\tthrow new UsageError(usageError);\n\t\t\t}\n\t\t\tassert(false, 0x911 /* Invalid operation on a disposed TreeCheckout */);\n\t\t}\n\t}\n\n\t/**\n\t * Creates a {@link RevertibleAlpha} object that can undo a specific change in the tree's history.\n\t * Revision must exist in the given {@link TreeCheckout}'s branch.\n\t *\n\t * @param revision - The revision tag identifying the change to be made revertible.\n\t * @param kind - The {@link CommitKind} that produced this revertible (e.g., Default, Undo, Redo).\n\t * @param checkout - The {@link TreeCheckout} instance this revertible belongs to.\n\t * @param onRevertibleDisposed - Callback function that will be called when the revertible is disposed.\n\t * @returns A {@link RevertibleAlpha} object.\n\t */\n\tprivate createRevertible(\n\t\trevision: RevisionTag,\n\t\tkind: CommitKind,\n\t\tcheckout: TreeCheckout,\n\t\tonRevertibleDisposed: ((revertible: RevertibleAlpha) => void) | undefined,\n\t): RevertibleAlpha {\n\t\tconst commitBranches = checkout.revertibleCommitBranches;\n\n\t\tconst revertible: RevertibleAlpha = {\n\t\t\tget status(): RevertibleStatus {\n\t\t\t\tconst revertibleCommit = commitBranches.get(revision);\n\t\t\t\treturn revertibleCommit === undefined\n\t\t\t\t\t? RevertibleStatus.Disposed\n\t\t\t\t\t: RevertibleStatus.Valid;\n\t\t\t},\n\t\t\trevert: (release: boolean = true) => {\n\t\t\t\tif (revertible.status === RevertibleStatus.Disposed) {\n\t\t\t\t\tthrow new UsageError(\"Unable to revert a revertible that has been disposed.\");\n\t\t\t\t}\n\n\t\t\t\tconst revertMetrics = checkout.revertRevertible(revision, kind);\n\t\t\t\tcheckout.logger?.sendTelemetryEvent({\n\t\t\t\t\teventName: TreeCheckout.revertTelemetryEventName,\n\t\t\t\t\t...revertMetrics,\n\t\t\t\t});\n\n\t\t\t\tif (release) {\n\t\t\t\t\trevertible.dispose();\n\t\t\t\t}\n\t\t\t},\n\t\t\tclone: (targetBranch: TreeBranch) => {\n\t\t\t\t// TODO:#23442: When a revertible is cloned for a forked branch, optimize to create a fork of a revertible branch once per revision NOT once per revision per checkout.\n\t\t\t\tconst targetCheckout = getCheckout(targetBranch);\n\n\t\t\t\tconst revertibleBranch = this.revertibleCommitBranches.get(revision);\n\t\t\t\tif (revertibleBranch === undefined) {\n\t\t\t\t\tthrow new UsageError(\"Unable to clone a revertible that has been disposed.\");\n\t\t\t\t}\n\n\t\t\t\tconst commitToRevert = revertibleBranch.getHead();\n\t\t\t\tconst activeBranchHead = targetCheckout.#transaction.activeBranch.getHead();\n\n\t\t\t\tif (isAncestor(commitToRevert, activeBranchHead, true) === false) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\"Cannot clone revertible for a commit that is not present on the given branch.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\ttargetCheckout.revertibleCommitBranches.set(revision, revertibleBranch.fork());\n\n\t\t\t\treturn this.createRevertible(revision, kind, targetCheckout, onRevertibleDisposed);\n\t\t\t},\n\t\t\tdispose: () => {\n\t\t\t\tif (revertible.status === RevertibleStatus.Disposed) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\"Unable to dispose a revertible that has already been disposed.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcheckout.disposeRevertible(revertible, revision);\n\t\t\t\tonRevertibleDisposed?.(revertible);\n\t\t\t},\n\t\t};\n\n\t\treturn revertible;\n\t}\n\n\t// For the new TreeViewAlpha API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot>;\n\n\t// For the old TreeView API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> {\n\t\tconst view = new SchematizingSimpleTreeView(\n\t\t\tthis,\n\t\t\tconfig,\n\t\t\tcreateNodeIdentifierManager(this.idCompressor),\n\t\t\t() => {\n\t\t\t\tthis.views.delete(view);\n\t\t\t},\n\t\t);\n\t\tthis.views.add(view);\n\t\treturn view;\n\t}\n\n\tpublic get rootEvents(): Listenable<AnchorSetRootEvents> {\n\t\treturn this.forest.anchors.events;\n\t}\n\n\tpublic get editor(): ISharedTreeEditor {\n\t\tthis.checkNotDisposed();\n\t\treturn this.editLock.editor;\n\t}\n\n\tpublic locate(anchor: Anchor): AnchorNode | undefined {\n\t\tthis.checkNotDisposed();\n\t\treturn this.forest.anchors.locate(anchor);\n\t}\n\n\tpublic get transaction(): Transactor {\n\t\treturn this.#transaction;\n\t}\n\t/**\n\t * The {@link Transactor} for this checkout.\n\t * @remarks In the context of a checkout, transactions allow edits to be batched into atomic units.\n\t * Edits made during a transaction will update the local state of the tree immediately, but will be squashed into a single edit when the transaction is committed.\n\t * If the transaction is aborted, the local state will be reset to what it was before the transaction began.\n\t * Transactions may nest, meaning that a transaction may be started while a transaction is already ongoing.\n\t *\n\t * To avoid updating observers of the view state with intermediate results during a transaction,\n\t * use {@link ITreeCheckout#branch} and {@link ISharedTreeFork#merge}.\n\t */\n\t#transaction: SquashingTransactionStack<SharedTreeEditBuilder, SharedTreeChange>;\n\n\tpublic branch(): TreeCheckout {\n\t\tthis.checkNotDisposed(\n\t\t\t\"The parent branch has already been disposed and can no longer create new branches.\",\n\t\t);\n\t\t// Branching after an unfinished transaction would expose the application to a state where its invariants may be violated.\n\t\tif (this.transaction.isInProgress()) {\n\t\t\tthrow new UsageError(\"A view cannot be forked while it has a pending transaction.\");\n\t\t}\n\n\t\tthis.editLock.checkUnlocked(\"Branching\");\n\t\tconst anchors = new AnchorSet();\n\t\tconst branch = this.#transaction.activeBranch.fork();\n\t\tconst storedSchema = this.storedSchema.clone();\n\t\tconst forest = this.forest.clone(storedSchema, anchors);\n\t\tconst checkout = new TreeCheckout(\n\t\t\tbranch,\n\t\t\tfalse,\n\t\t\tthis.changeFamily,\n\t\t\tstoredSchema,\n\t\t\tforest,\n\t\t\tthis.mintRevisionTag,\n\t\t\tthis.revisionTagCodec,\n\t\t\tthis.idCompressor,\n\t\t\tthis._removedRoots.clone(),\n\t\t\tthis.logger,\n\t\t\tthis.breaker,\n\t\t\tthis.disposeForksAfterTransaction,\n\t\t);\n\t\tthis.#events.emit(\"fork\", checkout);\n\t\treturn checkout;\n\t}\n\n\tpublic switchBranch(\n\t\tbranch: SharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange>,\n\t): void {\n\t\t// TODO: Dispose old branch, if necessary\n\t\tassert(\n\t\t\t!this.#transaction.isInProgress(),\n\t\t\t0xc55 /* Cannot switch branches during a transaction */,\n\t\t);\n\t\tconst diff = diffHistories(\n\t\t\tthis.changeFamily.rebaser,\n\t\t\tthis.#transaction.branch.getHead(),\n\t\t\tbranch.getHead(),\n\t\t\tthis.mintRevisionTag,\n\t\t);\n\n\t\tthis.unregisterFromBranchEvents();\n\n\t\tthis.#transaction = this.createTransactionStack(branch);\n\t\tthis.editLock = new EditLock(this.#transaction.activeBranchEditor);\n\t\tthis.registerForBranchEvents();\n\n\t\t// TODO: Rework eventing\n\t\tthis.applyChange(diff);\n\t\tthis.#events.emit(\"afterBatch\");\n\t}\n\n\tpublic rebase(checkout: TreeCheckout): void {\n\t\tthis.checkNotDisposed(\n\t\t\t\"The target of the branch rebase has been disposed and cannot be rebased.\",\n\t\t);\n\t\tcheckout.checkNotDisposed(\n\t\t\t\"The source of the branch rebase has been disposed and cannot be rebased.\",\n\t\t);\n\t\tthis.editLock.checkUnlocked(\"Rebasing\");\n\n\t\tif (this.transaction.isInProgress()) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Views cannot be rebased onto a view that has a pending transaction.\",\n\t\t\t);\n\t\t}\n\t\tif (checkout.transaction.isInProgress()) {\n\t\t\tthrow new UsageError(\"A view cannot be rebased while it has a pending transaction.\");\n\t\t}\n\n\t\tassert(\n\t\t\t!checkout.isSharedBranch,\n\t\t\t0xa5d /* Shared branches cannot be rebased onto another branch. */,\n\t\t);\n\n\t\tcheckout.#transaction.activeBranch.rebaseOnto(this.#transaction.activeBranch);\n\t}\n\n\tpublic rebaseOnto(checkout: ITreeCheckout): void {\n\t\tthis.checkNotDisposed(\n\t\t\t\"The target of the branch rebase has been disposed and cannot be rebased.\",\n\t\t);\n\t\tcheckout.rebase(this);\n\t}\n\n\tpublic merge(checkout: TreeCheckout): void;\n\tpublic merge(checkout: TreeCheckout, disposeMerged: boolean): void;\n\tpublic merge(checkout: TreeCheckout, disposeMerged = true): void {\n\t\tthis.checkNotDisposed(\n\t\t\t\"The target of the branch merge has been disposed and cannot be merged.\",\n\t\t);\n\t\tcheckout.checkNotDisposed(\n\t\t\t\"The source of the branch merge has been disposed and cannot be merged.\",\n\t\t);\n\t\tthis.editLock.checkUnlocked(\"Merging\");\n\t\tif (this.transaction.isInProgress()) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Views cannot be merged into a view while it has a pending transaction.\",\n\t\t\t);\n\t\t}\n\t\tif (checkout.transaction.isInProgress()) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Views with an open transaction cannot be merged into another view.\",\n\t\t\t);\n\t\t}\n\t\tthis.#transaction.activeBranch.merge(checkout.#transaction.activeBranch);\n\t\tif (disposeMerged && !checkout.isSharedBranch) {\n\t\t\t// Dispose the merged checkout unless it is a shared branch.\n\t\t\tcheckout[disposeSymbol]();\n\t\t}\n\t}\n\n\tpublic updateSchema(newSchema: TreeStoredSchema, allowNonSupersetSchema?: true): void {\n\t\tthis.checkNotDisposed();\n\t\tif (allowNonSupersetSchema !== true) {\n\t\t\tassert(\n\t\t\t\tallowsRepoSuperset(defaultSchemaPolicy, this.storedSchema.clone(), newSchema),\n\t\t\t\t0xbe6 /* New schema must allow all documents allowed by old schema */,\n\t\t\t);\n\t\t}\n\t\tthis.editor.schema.setStoredSchema(this.storedSchema.clone(), newSchema);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.editLock.checkUnlocked(\"Disposing a view\");\n\t\tthis[disposeSymbol]();\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tthis.checkNotDisposed(\n\t\t\t\"The branch has already been disposed and cannot be disposed again.\",\n\t\t);\n\t\tthis.disposed = true;\n\t\tthis.#transaction.branch.dispose();\n\t\tthis.#transaction.dispose();\n\t\tthis.purgeRevertibles();\n\t\tfor (const view of this.views) {\n\t\t\tview.dispose();\n\t\t}\n\t\tthis.#events.emit(\"dispose\");\n\t}\n\n\tpublic getRemovedRoots(): [string | number | undefined, number, JsonableTree][] {\n\t\tthis.assertNoUntrackedRoots();\n\t\tconst trees: [string | number | undefined, number, JsonableTree][] = [];\n\t\tconst cursor = this.forest.allocateCursor(\"getRemovedRoots\");\n\t\tfor (const { id, root } of this._removedRoots.entries()) {\n\t\t\tconst parentField = this._removedRoots.toFieldKey(root);\n\t\t\tthis.forest.moveCursorToPath({ parent: undefined, parentField, parentIndex: 0 }, cursor);\n\t\t\tconst tree = jsonableTreeFromCursor(cursor);\n\t\t\t// This method is used for tree consistency comparison.\n\t\t\tconst { major, minor } = id;\n\t\t\tconst finalizedMajor = major === undefined ? major : this.revisionTagCodec.encode(major);\n\t\t\ttrees.push([finalizedMajor, minor, tree]);\n\t\t}\n\t\tcursor.free();\n\t\treturn trees;\n\t}\n\n\t/**\n\t * This must be called on the root/main checkout after loading from a summary.\n\t * @remarks This pattern is necessary because the EditManager skips the normal process of applying commits to branches when loading a summary.\n\t * Instead, it simply {@link SharedTreeBranch#setHead | mutates} the branches directly which does not propagate the typical events throughout the rest of the system.\n\t */\n\tpublic load(): void {\n\t\t// Set the tip revision as the latest relevant revision for any removed roots that are loaded from a summary - this allows them to be garbage collected later.\n\t\t// When a load happens, the head of the trunk and the head of the local/main branch must be the same (this is enforced by SharedTree).\n\t\tthis._removedRoots.setRevisionsForLoadedData(this.#transaction.branch.getHead().revision);\n\t\t// The content of the checkout (e.g. the forest) has (maybe) changed, so fire an afterBatch event.\n\t\tthis.#events.emit(\"afterBatch\");\n\t}\n\n\tprivate purgeRevertibles(): void {\n\t\tfor (const revertible of this.revertibles) {\n\t\t\trevertible.dispose();\n\t\t}\n\t}\n\n\tprivate disposeRevertible(revertible: RevertibleAlpha, revision: RevisionTag): void {\n\t\tthis.revertibleCommitBranches.get(revision)?.dispose();\n\t\tthis.revertibleCommitBranches.delete(revision);\n\t\tthis.revertibles.delete(revertible);\n\t}\n\n\tprivate revertRevertible(revision: RevisionTag, kind: CommitKind): RevertMetrics {\n\t\tthis.editLock.checkUnlocked(\"Reverting a commit\");\n\t\tif (this.transaction.isInProgress()) {\n\t\t\tthrow new UsageError(\"Undo is not yet supported during transactions.\");\n\t\t}\n\n\t\tconst revertibleBranch = this.revertibleCommitBranches.get(revision);\n\t\tassert(revertibleBranch !== undefined, 0x7cc /* expected to find a revertible commit */);\n\t\tconst commitToRevert = revertibleBranch.getHead();\n\t\tconst revisionForInvert = this.mintRevisionTag();\n\n\t\tlet change = tagChange(\n\t\t\tthis.changeFamily.rebaser.invert(commitToRevert, false, revisionForInvert),\n\t\t\trevisionForInvert,\n\t\t);\n\n\t\tconst headCommit = this.#transaction.activeBranch.getHead();\n\t\t// Rebase the inverted change onto any commits that occurred after the undoable commits.\n\t\tif (commitToRevert !== headCommit) {\n\t\t\tchange = tagChange(\n\t\t\t\trebaseChange(\n\t\t\t\t\tthis.changeFamily.rebaser,\n\t\t\t\t\tchange,\n\t\t\t\t\tcommitToRevert,\n\t\t\t\t\theadCommit,\n\t\t\t\t\tthis.mintRevisionTag,\n\t\t\t\t).change,\n\t\t\t\trevisionForInvert,\n\t\t\t);\n\t\t}\n\n\t\tthis.#transaction.activeBranch.apply(\n\t\t\tchange,\n\t\t\tkind === CommitKind.Default || kind === CommitKind.Redo\n\t\t\t\t? CommitKind.Undo\n\t\t\t\t: CommitKind.Redo,\n\t\t);\n\n\t\t// Derive some stats about the reversion to return to the caller.\n\t\tlet revertAge = 0;\n\t\tlet currentCommit = headCommit;\n\t\twhile (commitToRevert.revision !== currentCommit.revision) {\n\t\t\trevertAge++;\n\n\t\t\tconst parentCommit = currentCommit.parent;\n\t\t\tassert(parentCommit !== undefined, 0x9a9 /* expected to find a parent commit */);\n\t\t\tcurrentCommit = parentCommit;\n\t\t}\n\n\t\treturn { age: revertAge };\n\t}\n\n\tprivate assertNoUntrackedRoots(): void {\n\t\tconst cursor = this.forest.getCursorAboveDetachedFields();\n\t\tconst rootFields = new Set([rootFieldKey]);\n\t\tfor (const { root } of this._removedRoots.entries()) {\n\t\t\trootFields.add(this._removedRoots.toFieldKey(root));\n\t\t}\n\n\t\tif (!cursor.firstField()) {\n\t\t\treturn;\n\t\t}\n\n\t\tdo {\n\t\t\tconst field = cursor.getFieldKey();\n\t\t\tassert(\n\t\t\t\trootFields.has(field),\n\t\t\t\t0xa22 /* Forest has a root field which is unknown to the detached field index */,\n\t\t\t);\n\n\t\t\trootFields.delete(field);\n\t\t} while (cursor.nextField());\n\t}\n\n\t/**\n\t * `true` iff the given branch change event is due to a remote change\n\t */\n\tprivate isRemoteChangeEvent(event: SharedTreeBranchChange<SharedTreeChange>): boolean {\n\t\treturn (\n\t\t\t// Remote changes are only ever applied to shared branches\n\t\t\tthis.isSharedBranch &&\n\t\t\t// Remote changes are applied to the branch by rebasing it onto the trunk.\n\t\t\t// No other rebases are allowed on shared branches, so we can use this to detect remote changes.\n\t\t\tevent.type === \"rebase\"\n\t\t);\n\t}\n\n\t// #region Commit Validation\n\n\t/** Used to maintain the contract of {@link onCommitValid}(). */\n\treadonly #validatedCommits = new WeakMap<\n\t\tGraphCommit<SharedTreeChange>,\n\t\t((commit: GraphCommit<SharedTreeChange>) => void)[] | true\n\t>();\n\n\t/**\n\t * Registers a function to be called when the given commit is validated.\n\t * @remarks A commit is validated by the checkout after it has been applied to the checkout's state (e.g. it has an effect on the forest).\n\t * If the commit applies successfully (i.e. it does not raise any unexpected errors), the commit is considered valid and the registered function is called.\n\t * If the commit does not apply successfully (because it causes an unexpected error), the function is not called (and the checkout will left in an error state).\n\t *\n\t * If the commit has already been validated when this function is called, the function is called immediately and this function returns `true`.\n\t * Otherwise, the function is registered to be called later and this function returns `false`.\n\t */\n\tpublic onCommitValid(\n\t\tcommit: GraphCommit<SharedTreeChange>,\n\t\tfn: (commit: GraphCommit<SharedTreeChange>) => void,\n\t): boolean {\n\t\tconst validated = getOrCreate(this.#validatedCommits, commit, () => []);\n\t\tif (validated === true) {\n\t\t\tfn(commit);\n\t\t\treturn true;\n\t\t}\n\n\t\tvalidated.push(fn);\n\t\treturn false;\n\t}\n\n\t/** Mark the given commit as \"validated\" according to the contract of {@link onCommitValid}(). */\n\tprivate validateCommit(commit: GraphCommit<SharedTreeChange>): void {\n\t\tconst validated = getOrCreate(this.#validatedCommits, commit, () => []);\n\t\tif (validated !== true) {\n\t\t\tfor (const fn of validated) {\n\t\t\t\tfn(commit);\n\t\t\t}\n\t\t\tthis.#validatedCommits.set(commit, true);\n\t\t}\n\t}\n\n\t// #endregion Commit Validation\n\n\t// #region Enrichment\n\n\t/**\n\t * Statistics about enrichment operations performed by this checkout.\n\t * Used for testing. May be used for telemetry in the future.\n\t * The performance cost of maintaining this information is negligible.\n\t */\n\tprivate readonly enrichmentStats: {\n\t\tbatches: number;\n\t\tdiffs: number;\n\t\tcommitsEnriched: number;\n\t\trefreshers: number;\n\t\tforks: number;\n\t\tapplied: number;\n\t} = { batches: 0, diffs: 0, commitsEnriched: 0, refreshers: 0, forks: 0, applied: 0 };\n\n\tpublic resetEnrichmentStats(): void {\n\t\tthis.enrichmentStats.batches = 0;\n\t\tthis.enrichmentStats.diffs = 0;\n\t\tthis.enrichmentStats.commitsEnriched = 0;\n\t\tthis.enrichmentStats.refreshers = 0;\n\t\tthis.enrichmentStats.forks = 0;\n\t\tthis.enrichmentStats.applied = 0;\n\t}\n\n\tpublic getEnrichmentStats(): {\n\t\tbatches: number;\n\t\tdiffs: number;\n\t\tcommitsEnriched: number;\n\t\trefreshers: number;\n\t\tforks: number;\n\t\tapplied: number;\n\t} {\n\t\treturn { ...this.enrichmentStats };\n\t}\n\n\tpublic enrich(\n\t\tcontext: GraphCommit<SharedTreeChange>,\n\t\tchanges: readonly TaggedChange<SharedTreeChange>[],\n\t): SharedTreeChange[] {\n\t\tif (!hasSome(changes)) {\n\t\t\treturn [];\n\t\t}\n\t\tthis.enrichmentStats.batches += 1;\n\t\tconst enricher = new SharedTreeChangeEnricher(\n\t\t\tthis.forest,\n\t\t\tthis._removedRoots,\n\t\t\tthis.storedSchema,\n\t\t\tthis.idCompressor,\n\t\t\t() => (this.enrichmentStats.commitsEnriched += 1),\n\t\t\t() => (this.enrichmentStats.refreshers += 1),\n\t\t\t() => (this.enrichmentStats.forks += 1),\n\t\t\t() => (this.enrichmentStats.applied += 1),\n\t\t);\n\t\t// This `lastCommitApplied` may be on the main branch or on a transaction branch.\n\t\t// In either case, it is crucial that the state of the forest & detached field index reflects all changes up to and including this commit.\n\t\tconst lastCommitApplied = this.#transaction.activeBranch.getHead();\n\t\tif (context !== lastCommitApplied) {\n\t\t\tenricher.enqueueChange(() => {\n\t\t\t\tthis.enrichmentStats.diffs += 1;\n\t\t\t\tconst diff = diffHistories(\n\t\t\t\t\tthis.changeFamily.rebaser,\n\t\t\t\t\tlastCommitApplied,\n\t\t\t\t\tcontext,\n\t\t\t\t\tthis.mintRevisionTag,\n\t\t\t\t);\n\t\t\t\treturn makeAnonChange(diff);\n\t\t\t});\n\t\t}\n\t\tconst enriched: SharedTreeChange[] = [];\n\t\tfor (const change of changes) {\n\t\t\tenriched.push(enricher.enrich(change.change));\n\t\t\tenricher.enqueueChange(change);\n\t\t}\n\t\tenricher[disposeSymbol]();\n\t\treturn enriched;\n\t}\n\n\tpublic get mainBranch(): SharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange> {\n\t\treturn this.#transaction.branch;\n\t}\n\n\t// #endregion Enrichment\n}\n\n/**\n * A helper class that assists {@link TreeCheckout} in preventing functionality from being used while the tree is in the middle of being edited.\n */\nclass EditLock {\n\t/**\n\t * Edits the tree by calling the methods of the editor passed into the {@link EditLock} constructor.\n\t * @remarks Edits will throw an error if the lock is currently locked.\n\t */\n\tpublic readonly editor: ISharedTreeEditor;\n\tprivate locked = false;\n\n\t/**\n\t * @param editor - an editor which will be used to create a new editor that is monitored to determine if any changes are happening to the tree.\n\t * Use {@link EditLock.editor} in place of the original editor to ensure that changes are monitored.\n\t */\n\tpublic constructor(editor: ISharedTreeEditor) {\n\t\tconst checkLock = (): void => this.checkUnlocked(\"Editing the tree\");\n\t\tthis.editor = {\n\t\t\tget schema() {\n\t\t\t\treturn editor.schema;\n\t\t\t},\n\t\t\tvalueField(...fieldArgs) {\n\t\t\t\tconst valueField = editor.valueField(...fieldArgs);\n\t\t\t\treturn {\n\t\t\t\t\tset(...editArgs) {\n\t\t\t\t\t\tcheckLock();\n\t\t\t\t\t\tvalueField.set(...editArgs);\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t\toptionalField(...fieldArgs) {\n\t\t\t\tconst optionalField = editor.optionalField(...fieldArgs);\n\t\t\t\treturn {\n\t\t\t\t\tset(...editArgs) {\n\t\t\t\t\t\tcheckLock();\n\t\t\t\t\t\toptionalField.set(...editArgs);\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t\tsequenceField(...fieldArgs) {\n\t\t\t\tconst sequenceField = editor.sequenceField(...fieldArgs);\n\t\t\t\treturn {\n\t\t\t\t\tinsert(...editArgs) {\n\t\t\t\t\t\tcheckLock();\n\t\t\t\t\t\tsequenceField.insert(...editArgs);\n\t\t\t\t\t},\n\t\t\t\t\tremove(...editArgs) {\n\t\t\t\t\t\tcheckLock();\n\t\t\t\t\t\tsequenceField.remove(...editArgs);\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t\tmove(...moveArgs) {\n\t\t\t\tcheckLock();\n\t\t\t\teditor.move(...moveArgs);\n\t\t\t},\n\t\t\taddNodeExistsConstraint(path) {\n\t\t\t\teditor.addNodeExistsConstraint(path);\n\t\t\t},\n\t\t\taddNodeExistsConstraintOnRevert(path) {\n\t\t\t\teditor.addNodeExistsConstraintOnRevert(path);\n\t\t\t},\n\t\t\taddNoChangeConstraint() {\n\t\t\t\teditor.addNoChangeConstraint();\n\t\t\t},\n\t\t\taddNoChangeConstraintOnRevert() {\n\t\t\t\teditor.addNoChangeConstraintOnRevert();\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Prevent further changes from being made to {@link EditLock.editor} until {@link EditLock.unlock} is called.\n\t * @remarks May only be called when the lock is not already locked.\n\t */\n\tpublic lock(): void {\n\t\tif (this.locked) {\n\t\t\tdebugger;\n\t\t}\n\t\tassert(!this.locked, 0xaa7 /* Checkout has already been locked */);\n\t\tthis.locked = true;\n\t}\n\n\t/**\n\t * Throws an error if the lock is currently locked.\n\t * @param action - The current action being performed by the user.\n\t * This must start with a capital letter, as it shows up as the first part of the error message and we want it to look nice.\n\t */\n\tpublic checkUnlocked<T extends string>(action: T extends Capitalize<T> ? T : never): void {\n\t\tif (this.locked) {\n\t\t\t// These type assertions ensure that the event name strings used here match the actual event names\n\t\t\tconst nodeChanged: keyof TreeChangeEvents = \"nodeChanged\";\n\t\t\tconst treeChanged: keyof TreeChangeEvents = \"treeChanged\";\n\t\t\tthrow new UsageError(\n\t\t\t\t`${action} is forbidden during a ${nodeChanged} or ${treeChanged} event`,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Allow changes to be made to {@link EditLock.editor} again.\n\t * @remarks May only be called when the lock is currently locked.\n\t */\n\tpublic unlock(): void {\n\t\tassert(this.locked, 0xaa8 /* Checkout has not been locked */);\n\t\tthis.locked = false;\n\t}\n}\n\n/**\n * Keeps track of all new forks created until the returned function is invoked, which will dispose all of those for.\n * The returned function may only be called once.\n *\n * @param checkout - The tree checkout for which you want to monitor forks for disposal.\n * @returns a function which can be called to dispose all of the tracked forks.\n */\nfunction trackForksForDisposal(checkout: TreeCheckout): () => void {\n\tconst forks = new Set<TreeCheckout>();\n\tconst onDisposeUnSubscribes: (() => void)[] = [];\n\tconst onForkUnSubscribe = onForkTransitive(checkout, (fork) => {\n\t\tforks.add(fork);\n\t\tonDisposeUnSubscribes.push(fork.events.on(\"dispose\", () => forks.delete(fork)));\n\t});\n\tlet disposed = false;\n\treturn () => {\n\t\tassert(!disposed, 0xaa9 /* Forks may only be disposed once */);\n\t\tfor (const fork of forks) {\n\t\t\tfork.dispose();\n\t\t}\n\t\tfor (const unsubscribe of onDisposeUnSubscribes) {\n\t\t\tunsubscribe();\n\t\t}\n\t\tonForkUnSubscribe();\n\t\tdisposed = true;\n\t};\n}\n\nfunction verboseFromCursor(\n\treader: ITreeCursor,\n\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n): VerboseTree {\n\tconst fields = customFromCursorStored(reader, schema, verboseFromCursor);\n\tconst nodeSchema =\n\t\tschema.get(reader.type) ?? fail(0xac9 /* missing schema for type in cursor */);\n\tif (nodeSchema instanceof LeafNodeStoredSchema) {\n\t\treturn fields as CustomTreeValue;\n\t}\n\n\treturn {\n\t\ttype: reader.type,\n\t\tfields: fields as CustomTreeNode<IFluidHandle>,\n\t};\n}\n\ninterface SerializedChange {\n\tversion: 1;\n\trevision: RevisionTag;\n\tchange: JsonCompatibleReadOnly;\n\toriginatorId: SessionId;\n}\n\nfunction isSerializedChange(value: unknown): value is SerializedChange {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tconst change = value as Partial<SerializedChange>;\n\treturn (\n\t\tchange.version === 1 &&\n\t\t(change.revision === \"root\" || typeof change.revision === \"number\") &&\n\t\ttypeof change.originatorId === \"string\" &&\n\t\tisStableId(change.originatorId) &&\n\t\tchange.change !== undefined\n\t);\n}\n"]}
@@ -64,7 +64,7 @@ class EditManagerSummarizer extends versionedSummarizer_js_1.VersionedSummarizer
64
64
  // This detects any data that could have been accidentally added through
65
65
  // invalid means and is about to be overwritten.
66
66
  (0, internal_1.assert)(this.editManager.isEmpty(), 0x42c /* There should not already be stored EditManager data when loading from summary */);
67
- const summary = parse((0, client_utils_1.bufferToString)(schemaBuffer, "utf-8"));
67
+ const summary = parse((0, client_utils_1.bufferToString)(schemaBuffer, "utf8"));
68
68
  const data = this.codec.decode(summary, { idCompressor: this.idCompressor });
69
69
  this.editManager.loadSummaryData(data);
70
70
  }
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerSummarizer.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerSummarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,kEAA6D;AAqB7D,qEAA+D;AAElD,QAAA,SAAS,GAAG,QAAQ,CAAC;AAElC;;GAEG;AACH,IAAkB,+BAajB;AAbD,WAAkB,+BAA+B;IAChD;;OAEG;IACH,iFAAM,CAAA;IACN;;OAEG;IACH,iFAAM,CAAA;IACN;;OAEG;IACH,2FAAY,CAAA;AACb,CAAC,EAbiB,+BAA+B,+CAA/B,+BAA+B,QAahD;AAED,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAkC;;;CAGlE,CAAC,CAAC;AAEH;;GAEG;AACH,SAAS,2CAA2C,CACnD,OAAgC;IAEhC,2EAA2E;IAC3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F,CAAC;QAEF,MAAM,OAAO,GAAG,KAAK,CAAC,IAAA,6BAAc,EAAC,YAAY,EAAE,OAAO,CAAC,CAA2B,CAAC;QACvF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QAC7E,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;;AAhEF,sDAiEC;AA7DuB,yBAAG,GAAG,aAAa,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tITelemetryContext,\n\tMinimumVersionForCollab,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\n\nimport type { IJsonCodec } from \"../codec/index.js\";\nimport type { ChangeFamily, ChangeFamilyEditor, SchemaAndPolicy } from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport type { EditManager, SummaryData } from \"./editManager.js\";\nimport type { EditManagerEncodingContext } from \"./editManagerCodecs.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"./summaryTypes.js\";\nimport { VersionedSummarizer } from \"./versionedSummarizer.js\";\n\nexport const stringKey = \"String\";\n\n/**\n * The versions for the edit manager summary format.\n */\nexport const enum EditManagerSummaryFormatVersion {\n\t/**\n\t * This version represents summary format before summary versioning was introduced.\n\t */\n\tv1 = 1,\n\t/**\n\t * This version adds metadata to the summary. This is backward compatible with version 1.\n\t */\n\tv2 = 2,\n\t/**\n\t * The latest version of the summary. Must be updated when a new version is added.\n\t */\n\tvLatest = v2,\n}\n\nconst supportedVersions = new Set<EditManagerSummaryFormatVersion>([\n\tEditManagerSummaryFormatVersion.v1,\n\tEditManagerSummaryFormatVersion.v2,\n]);\n\n/**\n * Returns the summary version to use as per the given minimum version for collab.\n */\nfunction minVersionToEditManagerSummaryFormatVersion(\n\tversion: MinimumVersionForCollab,\n): EditManagerSummaryFormatVersion {\n\t// Currently, version 2 is written which adds metadata blob to the summary.\n\treturn EditManagerSummaryFormatVersion.v2;\n}\n\n/**\n * Provides methods for summarizing and loading an `EditManager`\n */\nexport class EditManagerSummarizer<TChangeset>\n\textends VersionedSummarizer<EditManagerSummaryFormatVersion>\n\timplements Summarizable\n{\n\tpublic static readonly key = \"EditManager\";\n\tpublic constructor(\n\t\tprivate readonly editManager: EditManager<\n\t\t\tChangeFamilyEditor,\n\t\t\tTChangeset,\n\t\t\tChangeFamily<ChangeFamilyEditor, TChangeset>\n\t\t>,\n\t\tprivate readonly codec: IJsonCodec<\n\t\t\tSummaryData<TChangeset>,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tEditManagerEncodingContext\n\t\t>,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\tminVersionForCollab: MinimumVersionForCollab,\n\t\tprivate readonly schemaAndPolicy?: SchemaAndPolicy,\n\t) {\n\t\tsuper(\n\t\t\tEditManagerSummarizer.key,\n\t\t\tminVersionToEditManagerSummaryFormatVersion(minVersionForCollab),\n\t\t\tsupportedVersions,\n\t\t\ttrue /* supportPreVersioningFormat */,\n\t\t);\n\t}\n\n\tprotected summarizeInternal(props: {\n\t\tstringify: SummaryElementStringifier;\n\t\tfullTree?: boolean;\n\t\ttrackState?: boolean;\n\t\ttelemetryContext?: ITelemetryContext;\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext;\n\t\tbuilder: SummaryTreeBuilder;\n\t}): void {\n\t\tconst { stringify, builder } = props;\n\t\tconst context: EditManagerEncodingContext =\n\t\t\tthis.schemaAndPolicy === undefined\n\t\t\t\t? { idCompressor: this.idCompressor }\n\t\t\t\t: { schema: this.schemaAndPolicy, idCompressor: this.idCompressor };\n\t\tconst jsonCompatible = this.codec.encode(this.editManager.getSummaryData(), context);\n\t\tconst dataString = stringify(jsonCompatible);\n\t\tbuilder.addBlob(stringKey, dataString);\n\t}\n\n\tprotected async loadInternal(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\tconst schemaBuffer: ArrayBufferLike = await services.readBlob(stringKey);\n\n\t\t// After the awaits, validate that the data is in a clean state.\n\t\t// This detects any data that could have been accidentally added through\n\t\t// invalid means and is about to be overwritten.\n\t\tassert(\n\t\t\tthis.editManager.isEmpty(),\n\t\t\t0x42c /* There should not already be stored EditManager data when loading from summary */,\n\t\t);\n\n\t\tconst summary = parse(bufferToString(schemaBuffer, \"utf-8\")) as JsonCompatibleReadOnly;\n\t\tconst data = this.codec.decode(summary, { idCompressor: this.idCompressor });\n\t\tthis.editManager.loadSummaryData(data);\n\t}\n}\n"]}
1
+ {"version":3,"file":"editManagerSummarizer.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerSummarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,kEAA6D;AAqB7D,qEAA+D;AAElD,QAAA,SAAS,GAAG,QAAQ,CAAC;AAElC;;GAEG;AACH,IAAkB,+BAajB;AAbD,WAAkB,+BAA+B;IAChD;;OAEG;IACH,iFAAM,CAAA;IACN;;OAEG;IACH,iFAAM,CAAA;IACN;;OAEG;IACH,2FAAY,CAAA;AACb,CAAC,EAbiB,+BAA+B,+CAA/B,+BAA+B,QAahD;AAED,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAkC;;;CAGlE,CAAC,CAAC;AAEH;;GAEG;AACH,SAAS,2CAA2C,CACnD,OAAgC;IAEhC,2EAA2E;IAC3E,kDAA0C;AAC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MAAM,OAAO,GAAG,KAAK,CAAC,IAAA,6BAAc,EAAC,YAAY,EAAE,MAAM,CAAC,CAA2B,CAAC;QACtF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QAC7E,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;;AAhEF,sDAiEC;AA7DuB,yBAAG,GAAG,aAAa,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tITelemetryContext,\n\tMinimumVersionForCollab,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\n\nimport type { IJsonCodec } from \"../codec/index.js\";\nimport type { ChangeFamily, ChangeFamilyEditor, SchemaAndPolicy } from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport type { EditManager, SummaryData } from \"./editManager.js\";\nimport type { EditManagerEncodingContext } from \"./editManagerCodecs.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"./summaryTypes.js\";\nimport { VersionedSummarizer } from \"./versionedSummarizer.js\";\n\nexport const stringKey = \"String\";\n\n/**\n * The versions for the edit manager summary format.\n */\nexport const enum EditManagerSummaryFormatVersion {\n\t/**\n\t * This version represents summary format before summary versioning was introduced.\n\t */\n\tv1 = 1,\n\t/**\n\t * This version adds metadata to the summary. This is backward compatible with version 1.\n\t */\n\tv2 = 2,\n\t/**\n\t * The latest version of the summary. Must be updated when a new version is added.\n\t */\n\tvLatest = v2,\n}\n\nconst supportedVersions = new Set<EditManagerSummaryFormatVersion>([\n\tEditManagerSummaryFormatVersion.v1,\n\tEditManagerSummaryFormatVersion.v2,\n]);\n\n/**\n * Returns the summary version to use as per the given minimum version for collab.\n */\nfunction minVersionToEditManagerSummaryFormatVersion(\n\tversion: MinimumVersionForCollab,\n): EditManagerSummaryFormatVersion {\n\t// Currently, version 2 is written which adds metadata blob to the summary.\n\treturn EditManagerSummaryFormatVersion.v2;\n}\n\n/**\n * Provides methods for summarizing and loading an `EditManager`\n */\nexport class EditManagerSummarizer<TChangeset>\n\textends VersionedSummarizer<EditManagerSummaryFormatVersion>\n\timplements Summarizable\n{\n\tpublic static readonly key = \"EditManager\";\n\tpublic constructor(\n\t\tprivate readonly editManager: EditManager<\n\t\t\tChangeFamilyEditor,\n\t\t\tTChangeset,\n\t\t\tChangeFamily<ChangeFamilyEditor, TChangeset>\n\t\t>,\n\t\tprivate readonly codec: IJsonCodec<\n\t\t\tSummaryData<TChangeset>,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tEditManagerEncodingContext\n\t\t>,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\tminVersionForCollab: MinimumVersionForCollab,\n\t\tprivate readonly schemaAndPolicy?: SchemaAndPolicy,\n\t) {\n\t\tsuper(\n\t\t\tEditManagerSummarizer.key,\n\t\t\tminVersionToEditManagerSummaryFormatVersion(minVersionForCollab),\n\t\t\tsupportedVersions,\n\t\t\ttrue /* supportPreVersioningFormat */,\n\t\t);\n\t}\n\n\tprotected summarizeInternal(props: {\n\t\tstringify: SummaryElementStringifier;\n\t\tfullTree?: boolean;\n\t\ttrackState?: boolean;\n\t\ttelemetryContext?: ITelemetryContext;\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext;\n\t\tbuilder: SummaryTreeBuilder;\n\t}): void {\n\t\tconst { stringify, builder } = props;\n\t\tconst context: EditManagerEncodingContext =\n\t\t\tthis.schemaAndPolicy === undefined\n\t\t\t\t? { idCompressor: this.idCompressor }\n\t\t\t\t: { schema: this.schemaAndPolicy, idCompressor: this.idCompressor };\n\t\tconst jsonCompatible = this.codec.encode(this.editManager.getSummaryData(), context);\n\t\tconst dataString = stringify(jsonCompatible);\n\t\tbuilder.addBlob(stringKey, dataString);\n\t}\n\n\tprotected async loadInternal(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\tconst schemaBuffer: ArrayBufferLike = await services.readBlob(stringKey);\n\n\t\t// After the awaits, validate that the data is in a clean state.\n\t\t// This detects any data that could have been accidentally added through\n\t\t// invalid means and is about to be overwritten.\n\t\tassert(\n\t\t\tthis.editManager.isEmpty(),\n\t\t\t0x42c /* There should not already be stored EditManager data when loading from summary */,\n\t\t);\n\n\t\tconst summary = parse(bufferToString(schemaBuffer, \"utf8\")) as JsonCompatibleReadOnly;\n\t\tconst data = this.codec.decode(summary, { idCompressor: this.idCompressor });\n\t\tthis.editManager.loadSummaryData(data);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"messageCodecV1ToV4.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/messageCodecV1ToV4.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAwB,MAAM,mBAAmB,CAAC;AAC9F,OAAO,KAAK,EACX,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAA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OAAO,oBAAoB,CAAC,EAAE,GAC9B,OAAO,oBAAoB,CAAC,EAAE,GAC9B,OAAO,oBAAoB,CAAC,EAAE,GAC9B,OAAO,oBAAoB,CAAC,EAAE,GAC/B,UAAU,CACZ,cAAc,CAAC,UAAU,CAAC,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,CACtB,CAmEA"}
@@ -6,11 +6,11 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.makeV1ToV4CodecWithVersion = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
- const typebox_1 = require("@sinclair/typebox");
10
9
  const index_js_1 = require("../codec/index.js");
10
+ const index_js_2 = require("../util/index.js");
11
11
  const messageFormatV1ToV4_js_1 = require("./messageFormatV1ToV4.js");
12
12
  function makeV1ToV4CodecWithVersion(changeCodec, revisionTagCodec, options, version) {
13
- return (0, index_js_1.withSchemaValidation)((0, messageFormatV1ToV4_js_1.Message)(changeCodec.encodedSchema ?? typebox_1.Type.Any()), {
13
+ return (0, index_js_1.withSchemaValidation)((0, messageFormatV1ToV4_js_1.Message)(changeCodec.encodedSchema ?? index_js_2.JsonCompatibleReadOnlySchema), {
14
14
  encode: (decoded, context) => {
15
15
  (0, internal_1.assert)(decoded.type === "commit", 0xc68 /* Only commit messages are supported */);
16
16
  (0, internal_1.assert)(decoded.branchId === "main", 0xc69 /* Only commit messages to main are supported */);
@@ -1 +1 @@
1
- {"version":3,"file":"messageCodecV1ToV4.js","sourceRoot":"","sources":["../../src/shared-tree-core/messageCodecV1ToV4.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,+CAA0D;AAE1D,gDAA8F;AAW9F,qEAAmD;AAGnD,SAAgB,0BAA0B,CACzC,WAA0C,EAC1C,gBAKC,EACD,OAAsB,EACtB,OAKiC;IAOjC,OAAO,IAAA,+BAAoB,EAO1B,IAAA,gCAAO,EAAC,WAAW,CAAC,aAAa,IAAI,cAAI,CAAC,GA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M,CAAC,SAAS,EAAE;wBACrC,YAAY;wBACZ,QAAQ;wBACR,YAAY,EAAE,OAAO,CAAC,YAAY;qBAClC,CAAC;iBACF;gBACD,SAAS,EAAE,YAAY;aACvB,CAAC;QACH,CAAC;KACD,EACD,OAAO,CAAC,aAAa,CACrB,CAAC;AACH,CAAC;AAvFD,gEAuFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { type TAnySchema, Type } from \"@sinclair/typebox\";\n\nimport { type ICodecOptions, type IJsonCodec, withSchemaValidation } from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tChangeFamilyCodec,\n\tEncodedRevisionTag,\n\tRevisionTag,\n} from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport type { MessageEncodingContext } from \"./messageCodecs.js\";\nimport type { MessageFormatVersion } from \"./messageFormat.js\";\nimport { Message } from \"./messageFormatV1ToV4.js\";\nimport type { DecodedMessage } from \"./messageTypes.js\";\n\nexport function makeV1ToV4CodecWithVersion<TChangeset>(\n\tchangeCodec: ChangeFamilyCodec<TChangeset>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n\tversion:\n\t\t| typeof MessageFormatVersion.v1\n\t\t| typeof MessageFormatVersion.v2\n\t\t| typeof MessageFormatVersion.v3\n\t\t| typeof MessageFormatVersion.v4\n\t\t| typeof MessageFormatVersion.v6,\n): IJsonCodec<\n\tDecodedMessage<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tMessageEncodingContext\n> {\n\treturn withSchemaValidation<\n\t\tDecodedMessage<TChangeset>,\n\t\tTAnySchema,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tMessageEncodingContext\n\t>(\n\t\tMessage(changeCodec.encodedSchema ?? Type.Any()),\n\t\t{\n\t\t\tencode: (decoded: DecodedMessage<TChangeset>, context: MessageEncodingContext) => {\n\t\t\t\tassert(decoded.type === \"commit\", 0xc68 /* Only commit messages are supported */);\n\t\t\t\tassert(\n\t\t\t\t\tdecoded.branchId === \"main\",\n\t\t\t\t\t0xc69 /* Only commit messages to main are supported */,\n\t\t\t\t);\n\t\t\t\tconst { commit, sessionId: originatorId } = decoded;\n\t\t\t\tconst message: Message = {\n\t\t\t\t\trevision: revisionTagCodec.encode(commit.revision, {\n\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t}),\n\t\t\t\t\toriginatorId,\n\t\t\t\t\tchangeset: changeCodec.encode(commit.change, {\n\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\tschema: context.schema,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\trevision: commit.revision,\n\t\t\t\t\t}),\n\t\t\t\t\tversion,\n\t\t\t\t};\n\t\t\t\treturn message as unknown as JsonCompatibleReadOnly;\n\t\t\t},\n\t\t\tdecode: (\n\t\t\t\tencoded: JsonCompatibleReadOnly,\n\t\t\t\tcontext: MessageEncodingContext,\n\t\t\t): DecodedMessage<TChangeset> => {\n\t\t\t\tconst {\n\t\t\t\t\trevision: encodedRevision,\n\t\t\t\t\toriginatorId,\n\t\t\t\t\tchangeset,\n\t\t\t\t} = encoded as unknown as Message;\n\n\t\t\t\tconst revision = revisionTagCodec.decode(encodedRevision, {\n\t\t\t\t\toriginatorId,\n\t\t\t\t\trevision: undefined,\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\tbranchId: \"main\",\n\t\t\t\t\ttype: \"commit\",\n\t\t\t\t\tcommit: {\n\t\t\t\t\t\trevision,\n\t\t\t\t\t\tchange: changeCodec.decode(changeset, {\n\t\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\tsessionId: originatorId,\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t\toptions.jsonValidator,\n\t);\n}\n"]}
1
+ {"version":3,"file":"messageCodecV1ToV4.js","sourceRoot":"","sources":["../../src/shared-tree-core/messageCodecV1ToV4.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAG7D,gDAA8F;AAQ9F,+CAAgE;AAIhE,qEAAmD;AAGnD,SAAgB,0BAA0B,CACzC,WAA0C,EAC1C,gBAKC,EACD,OAAsB,EACtB,OAKiC;IAOjC,OAAO,IAAA,+BAAoB,EAO1B,IAAA,gCAAO,EAAC,WAAW,CAAC,aAAa,IAAI,uCAA4B,CAAC,EAClE;QACC,MAAM,EAAE,CAAC,OAAmC,EAAE,OAA+B,EAAE,EAAE;YAChF,IAAA,iBAAM,EAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,KAAK,CAAC,wCAAwC,CAAC,CAAC;YAClF,IAAA,iBAAM,EACL,OAAO,CAAC,QAAQ,KAAK,MAAM,EAC3B,KAAK,CAAC,gDAAgD,CACtD,CAAC;YACF,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;YACpD,MAAM,OAAO,GAAY;gBACxB,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;oBAClD,YAAY;oBACZ,YAAY,EAAE,OAAO,CAAC,YAAY;oBAClC,QAAQ,EAAE,SAAS;iBACnB,CAAC;gBACF,YAAY;gBACZ,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;oBAC5C,YAAY;oBACZ,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,YAAY,EAAE,OAAO,CAAC,YAAY;oBAClC,QAAQ,EAAE,MAAM,CAAC,QAAQ;iBACzB,CAAC;gBACF,OAAO;aACP,CAAC;YACF,OAAO,OAA4C,CAAC;QACrD,CAAC;QACD,MAAM,EAAE,CACP,OAA+B,EAC/B,OAA+B,EACF,EAAE;YAC/B,MAAM,EACL,QAAQ,EAAE,eAAe,EACzB,YAAY,EACZ,SAAS,GACT,GAAG,OAA6B,CAAC;YAElC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,eAAe,EAAE;gBACzD,YAAY;gBACZ,QAAQ,EAAE,SAAS;gBACnB,YAAY,EAAE,OAAO,CAAC,YAAY;aAClC,CAAC,CAAC;YAEH,OAAO;gBACN,QAAQ,EAAE,MAAM;gBAChB,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE;oBACP,QAAQ;oBACR,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE;wBACrC,YAAY;wBACZ,QAAQ;wBACR,YAAY,EAAE,OAAO,CAAC,YAAY;qBAClC,CAAC;iBACF;gBACD,SAAS,EAAE,YAAY;aACvB,CAAC;QACH,CAAC;KACD,EACD,OAAO,CAAC,aAAa,CACrB,CAAC;AACH,CAAC;AAvFD,gEAuFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { TAnySchema } from \"@sinclair/typebox\";\n\nimport { type ICodecOptions, type IJsonCodec, withSchemaValidation } from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tChangeFamilyCodec,\n\tEncodedRevisionTag,\n\tRevisionTag,\n} from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\nimport { JsonCompatibleReadOnlySchema } from \"../util/index.js\";\n\nimport type { MessageEncodingContext } from \"./messageCodecs.js\";\nimport type { MessageFormatVersion } from \"./messageFormat.js\";\nimport { Message } from \"./messageFormatV1ToV4.js\";\nimport type { DecodedMessage } from \"./messageTypes.js\";\n\nexport function makeV1ToV4CodecWithVersion<TChangeset>(\n\tchangeCodec: ChangeFamilyCodec<TChangeset>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n\tversion:\n\t\t| typeof MessageFormatVersion.v1\n\t\t| typeof MessageFormatVersion.v2\n\t\t| typeof MessageFormatVersion.v3\n\t\t| typeof MessageFormatVersion.v4\n\t\t| typeof MessageFormatVersion.v6,\n): IJsonCodec<\n\tDecodedMessage<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tMessageEncodingContext\n> {\n\treturn withSchemaValidation<\n\t\tDecodedMessage<TChangeset>,\n\t\tTAnySchema | typeof JsonCompatibleReadOnlySchema,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tMessageEncodingContext\n\t>(\n\t\tMessage(changeCodec.encodedSchema ?? JsonCompatibleReadOnlySchema),\n\t\t{\n\t\t\tencode: (decoded: DecodedMessage<TChangeset>, context: MessageEncodingContext) => {\n\t\t\t\tassert(decoded.type === \"commit\", 0xc68 /* Only commit messages are supported */);\n\t\t\t\tassert(\n\t\t\t\t\tdecoded.branchId === \"main\",\n\t\t\t\t\t0xc69 /* Only commit messages to main are supported */,\n\t\t\t\t);\n\t\t\t\tconst { commit, sessionId: originatorId } = decoded;\n\t\t\t\tconst message: Message = {\n\t\t\t\t\trevision: revisionTagCodec.encode(commit.revision, {\n\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t}),\n\t\t\t\t\toriginatorId,\n\t\t\t\t\tchangeset: changeCodec.encode(commit.change, {\n\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\tschema: context.schema,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\trevision: commit.revision,\n\t\t\t\t\t}),\n\t\t\t\t\tversion,\n\t\t\t\t};\n\t\t\t\treturn message as unknown as JsonCompatibleReadOnly;\n\t\t\t},\n\t\t\tdecode: (\n\t\t\t\tencoded: JsonCompatibleReadOnly,\n\t\t\t\tcontext: MessageEncodingContext,\n\t\t\t): DecodedMessage<TChangeset> => {\n\t\t\t\tconst {\n\t\t\t\t\trevision: encodedRevision,\n\t\t\t\t\toriginatorId,\n\t\t\t\t\tchangeset,\n\t\t\t\t} = encoded as unknown as Message;\n\n\t\t\t\tconst revision = revisionTagCodec.decode(encodedRevision, {\n\t\t\t\t\toriginatorId,\n\t\t\t\t\trevision: undefined,\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\tbranchId: \"main\",\n\t\t\t\t\ttype: \"commit\",\n\t\t\t\t\tcommit: {\n\t\t\t\t\t\trevision,\n\t\t\t\t\t\tchange: changeCodec.decode(changeset, {\n\t\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\tsessionId: originatorId,\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t\toptions.jsonValidator,\n\t);\n}\n"]}
@@ -27,6 +27,8 @@ export interface Transactor {
27
27
  * Start a new transaction.
28
28
  * If a transaction is already in progress when this new transaction starts, then this transaction will be "nested" inside of it,
29
29
  * i.e. the outer transaction will still be in progress after this new transaction is committed or aborted.
30
+ * @param isAsync - Whether the transaction is asynchronous.
31
+ * An error will be thrown if an asynchronous transaction is started while a synchronous transaction is in progress.
30
32
  *
31
33
  * @remarks Asynchronous transactions are not supported on the root checkout,
32
34
  * since it is always kept up-to-date with the latest remote edits and the results of this rebasing (which might invalidate
@@ -40,7 +42,7 @@ export interface Transactor {
40
42
  * @privateRemarks There is currently no enforcement that asynchronous transactions don't happen on the root checkout.
41
43
  * AB#6488 tracks adding some enforcement to make it more clear to application authors that this is not supported.
42
44
  */
43
- start(): void;
45
+ start(isAsync: boolean): void;
44
46
  /**
45
47
  * Close this transaction by squashing its edits and committing them as a single edit.
46
48
  * If this is the root checkout and there are no ongoing transactions remaining, the squashed edit will be submitted to Fluid.
@@ -120,12 +122,21 @@ export declare class TransactionStack implements Transactor, IDisposable {
120
122
  */
121
123
  constructor(onPush?: OnPush);
122
124
  isInProgress(): boolean;
123
- start(): void;
125
+ start(isAsync: boolean): void;
124
126
  commit(): void;
125
127
  abort(): void;
126
128
  dispose(): void;
127
129
  private ensureNotDisposed;
128
130
  }
131
+ /**
132
+ * A function that will be called when a transaction is popped from the {@link SquashingTransactionStack | stack}.
133
+ * @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.isInProgress} will be false during its execution.
134
+ * @param result - The result of the transaction.
135
+ * @param viewUpdate - The change that needs to be applied to the view to keep it up-to-date with the branch after the transaction ends.
136
+ * This is needed in asynchronous transactions where new commits have been added to the branch while the transaction was in progress.
137
+ * This will be `undefined` if no such change is necessary.
138
+ */
139
+ export type OnPopWithViewUpdate<TChange> = (result: TransactionResult, viewUpdate: TChange | undefined) => void;
129
140
  /**
130
141
  * An implementation of {@link Transactor} that {@link TransactionStack | uses a stack} and a {@link SharedTreeBranch | branch} to manage transactions.
131
142
  * @remarks Given a branch, this class will fork the branch when a transaction begins and squash the forked branch back into the original branch when the transaction ends.
@@ -156,7 +167,7 @@ export declare class SquashingTransactionStack<TEditor extends ChangeFamilyEdito
156
167
  * @param branch - The {@link SquashingTransactionStack.branch | branch} that will be forked off of when a transaction begins.
157
168
  * @param onPush - A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.
158
169
  */
159
- constructor(branch: SharedTreeBranch<TEditor, TChange>, mintRevisionTag: () => RevisionTag, onPush?: () => OnPop | void);
170
+ constructor(branch: SharedTreeBranch<TEditor, TChange>, mintRevisionTag: () => RevisionTag, onPush?: () => OnPopWithViewUpdate<TChange> | void);
160
171
  /** Updates the transaction branch (and therefore the active branch) and rebinds the branch events. */
161
172
  private setTransactionBranch;
162
173
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/transaction.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAI/E,OAAO,EAGN,KAAK,kBAAkB,EAEvB,KAAK,WAAW,EAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE5E;;;GAGG;AACH,oBAAY,iBAAiB;IAC5B;;OAEG;IACH,KAAK,IAAA;IACL;;OAEG;IACH,MAAM,IAAA;CACN;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,IAAI,IAAI,CAAC;IACd;;;OAGG;IACH,MAAM,IAAI,IAAI,CAAC;IACf;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IACd;;OAEG;IACH,YAAY,IAAI,OAAO,CAAC;IACxB;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IACjC;;;OAGG;IACH,OAAO,IAAI,IAAI,CAAC;IAChB;;;OAGG;IACH,QAAQ,IAAI,IAAI,CAAC;IACjB;;;OAGG;IACH,UAAU,IAAI,IAAI,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IACvB;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,SAAS,GAAG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