@fluidframework/tree 2.110.0 → 2.112.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 (598) hide show
  1. package/.vscode/settings.json +1 -0
  2. package/CHANGELOG.md +193 -0
  3. package/api-report/tree.alpha.api.md +96 -36
  4. package/api-report/tree.beta.api.md +39 -1
  5. package/api-report/tree.legacy.beta.api.md +39 -1
  6. package/api-report/tree.legacy.public.api.md +1 -1
  7. package/api-report/tree.public.api.md +1 -1
  8. package/dist/componentApi.d.ts +198 -0
  9. package/dist/componentApi.d.ts.map +1 -0
  10. package/dist/componentApi.js +138 -0
  11. package/dist/componentApi.js.map +1 -0
  12. package/dist/core/change-family/changeFamily.d.ts +3 -10
  13. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  14. package/dist/core/change-family/changeFamily.js.map +1 -1
  15. package/dist/core/rebase/types.d.ts +2 -2
  16. package/dist/core/rebase/types.js.map +1 -1
  17. package/dist/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  18. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  19. package/dist/entrypoints/alpha.d.ts +1 -1
  20. package/dist/entrypoints/alpha.d.ts.map +1 -1
  21. package/dist/entrypoints/alpha.js +4 -2
  22. package/dist/entrypoints/alpha.js.map +1 -1
  23. package/dist/entrypoints/beta.d.ts +1 -1
  24. package/dist/entrypoints/beta.d.ts.map +1 -1
  25. package/dist/entrypoints/beta.js.map +1 -1
  26. package/dist/entrypoints/legacy.d.ts +1 -1
  27. package/dist/entrypoints/legacy.d.ts.map +1 -1
  28. package/dist/entrypoints/legacy.js.map +1 -1
  29. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -20
  30. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  31. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +13 -32
  32. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
  34. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  35. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +73 -28
  37. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  38. package/dist/feature-libraries/chunked-forest/codec/codecs.js +76 -9
  39. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  40. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
  41. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  42. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +11 -0
  43. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  45. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  47. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
  49. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
  51. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  53. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  55. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  56. package/dist/feature-libraries/forest-summary/codec.d.ts +3 -3
  57. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  58. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  59. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  60. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  61. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -6
  62. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  63. package/dist/feature-libraries/index.d.ts +3 -3
  64. package/dist/feature-libraries/index.d.ts.map +1 -1
  65. package/dist/feature-libraries/index.js +4 -2
  66. package/dist/feature-libraries/index.js.map +1 -1
  67. package/dist/feature-libraries/modular-schema/index.d.ts +1 -0
  68. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  69. package/dist/feature-libraries/modular-schema/index.js +3 -1
  70. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  71. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
  72. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
  73. package/dist/feature-libraries/modular-schema/minimizeModularChange.js +29 -0
  74. package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
  75. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  76. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +9 -9
  77. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  78. package/dist/feature-libraries/schemaChecker.d.ts +22 -3
  79. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
  80. package/dist/feature-libraries/schemaChecker.js +48 -5
  81. package/dist/feature-libraries/schemaChecker.js.map +1 -1
  82. package/dist/index.d.ts +4 -3
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +6 -2
  85. package/dist/index.js.map +1 -1
  86. package/dist/packageVersion.d.ts +1 -1
  87. package/dist/packageVersion.js +1 -1
  88. package/dist/packageVersion.js.map +1 -1
  89. package/dist/shared-tree/independentView.d.ts +17 -4
  90. package/dist/shared-tree/independentView.d.ts.map +1 -1
  91. package/dist/shared-tree/independentView.js +15 -12
  92. package/dist/shared-tree/independentView.js.map +1 -1
  93. package/dist/shared-tree/index.d.ts +3 -2
  94. package/dist/shared-tree/index.d.ts.map +1 -1
  95. package/dist/shared-tree/index.js +3 -1
  96. package/dist/shared-tree/index.js.map +1 -1
  97. package/dist/shared-tree/schematizingTreeView.d.ts +6 -5
  98. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  99. package/dist/shared-tree/schematizingTreeView.js +6 -3
  100. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  101. package/dist/shared-tree/serializedChange.d.ts +41 -0
  102. package/dist/shared-tree/serializedChange.d.ts.map +1 -0
  103. package/dist/shared-tree/serializedChange.js +87 -0
  104. package/dist/shared-tree/serializedChange.js.map +1 -0
  105. package/dist/shared-tree/sharedTree.d.ts +18 -0
  106. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  107. package/dist/shared-tree/sharedTree.js +9 -4
  108. package/dist/shared-tree/sharedTree.js.map +1 -1
  109. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +7 -0
  110. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  111. package/dist/shared-tree/sharedTreeChangeFamily.js +8 -1
  112. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  113. package/dist/shared-tree/transactionMinimize.d.ts +35 -0
  114. package/dist/shared-tree/transactionMinimize.d.ts.map +1 -0
  115. package/dist/shared-tree/transactionMinimize.js +65 -0
  116. package/dist/shared-tree/transactionMinimize.js.map +1 -0
  117. package/dist/shared-tree/transactionPostProcessor.d.ts +28 -0
  118. package/dist/shared-tree/transactionPostProcessor.d.ts.map +1 -0
  119. package/dist/shared-tree/transactionPostProcessor.js +28 -0
  120. package/dist/shared-tree/transactionPostProcessor.js.map +1 -0
  121. package/dist/shared-tree/treeAlpha.js +3 -3
  122. package/dist/shared-tree/treeAlpha.js.map +1 -1
  123. package/dist/shared-tree/treeCheckout.d.ts +19 -13
  124. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  125. package/dist/shared-tree/treeCheckout.js +54 -71
  126. package/dist/shared-tree/treeCheckout.js.map +1 -1
  127. package/dist/shared-tree/unhydratedTreeContext.d.ts +5 -5
  128. package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  129. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
  130. package/dist/shared-tree-core/editManager.d.ts +6 -3
  131. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  132. package/dist/shared-tree-core/editManager.js +35 -14
  133. package/dist/shared-tree-core/editManager.js.map +1 -1
  134. package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -2
  135. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  136. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  137. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
  138. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  139. package/dist/shared-tree-core/editManagerCodecsCommons.js +2 -4
  140. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  141. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
  142. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  143. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  144. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
  145. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  146. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  147. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
  148. package/dist/shared-tree-core/editManagerFormatCommons.js +1 -1
  149. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  150. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  151. package/dist/shared-tree-core/editManagerSummarizer.d.ts +5 -9
  152. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  153. package/dist/shared-tree-core/editManagerSummarizer.js +5 -10
  154. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  155. package/dist/shared-tree-core/index.d.ts +1 -1
  156. package/dist/shared-tree-core/index.d.ts.map +1 -1
  157. package/dist/shared-tree-core/index.js +3 -2
  158. package/dist/shared-tree-core/index.js.map +1 -1
  159. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  160. package/dist/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  161. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  162. package/dist/shared-tree-core/messageFormat.d.ts +1 -1
  163. package/dist/shared-tree-core/messageFormat.js +1 -1
  164. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  165. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
  166. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  167. package/dist/shared-tree-core/messageFormatVSharedBranches.js +1 -0
  168. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  169. package/dist/shared-tree-core/messageTypes.d.ts +1 -0
  170. package/dist/shared-tree-core/messageTypes.d.ts.map +1 -1
  171. package/dist/shared-tree-core/messageTypes.js.map +1 -1
  172. package/dist/shared-tree-core/sharedTreeCore.d.ts +9 -3
  173. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  174. package/dist/shared-tree-core/sharedTreeCore.js +27 -12
  175. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  176. package/dist/shared-tree-core/transaction.d.ts +84 -9
  177. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  178. package/dist/shared-tree-core/transaction.js +88 -7
  179. package/dist/shared-tree-core/transaction.js.map +1 -1
  180. package/dist/simple-tree/api/index.d.ts +2 -2
  181. package/dist/simple-tree/api/index.d.ts.map +1 -1
  182. package/dist/simple-tree/api/index.js +2 -2
  183. package/dist/simple-tree/api/index.js.map +1 -1
  184. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +9 -24
  185. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  186. package/dist/simple-tree/api/schemaCompatibilityTester.js +31 -44
  187. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  188. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  189. package/dist/simple-tree/api/schemaCreationUtilities.js +3 -3
  190. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  191. package/dist/simple-tree/api/schemaFactory.d.ts +1 -1
  192. package/dist/simple-tree/api/schemaFactory.js +2 -2
  193. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  194. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
  195. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  196. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  197. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
  198. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  199. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  200. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
  201. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  202. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +3 -4
  203. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  204. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  205. package/dist/simple-tree/api/storedSchema.js +1 -2
  206. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  207. package/dist/simple-tree/api/transactionTypes.d.ts +91 -28
  208. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  209. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  210. package/dist/simple-tree/api/tree.d.ts +108 -24
  211. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  212. package/dist/simple-tree/api/tree.js.map +1 -1
  213. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  214. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  215. package/dist/simple-tree/api/typesUnsafe.d.ts +2 -2
  216. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  217. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  218. package/dist/simple-tree/core/treeNodeSchema.d.ts +7 -7
  219. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  220. package/dist/simple-tree/index.d.ts +1 -1
  221. package/dist/simple-tree/index.d.ts.map +1 -1
  222. package/dist/simple-tree/index.js +2 -2
  223. package/dist/simple-tree/index.js.map +1 -1
  224. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
  225. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  226. package/dist/simple-tree/node-kinds/array/arrayNode.js +39 -0
  227. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  228. package/dist/simple-tree/simpleSchemaFormatV1.js +1 -1
  229. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  230. package/dist/text/index.d.ts +1 -0
  231. package/dist/text/index.d.ts.map +1 -1
  232. package/dist/text/index.js +3 -1
  233. package/dist/text/index.js.map +1 -1
  234. package/dist/text/textDomainFormatted.d.ts +69 -758
  235. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  236. package/dist/text/textDomainFormatted.js +275 -322
  237. package/dist/text/textDomainFormatted.js.map +1 -1
  238. package/dist/text/textDomainFormattedDefault.d.ts +273 -0
  239. package/dist/text/textDomainFormattedDefault.d.ts.map +1 -0
  240. package/dist/text/textDomainFormattedDefault.js +94 -0
  241. package/dist/text/textDomainFormattedDefault.js.map +1 -0
  242. package/dist/treeFactory.js +1 -1
  243. package/dist/treeFactory.js.map +1 -1
  244. package/dist/util/breakable.d.ts +16 -1
  245. package/dist/util/breakable.d.ts.map +1 -1
  246. package/dist/util/breakable.js +9 -1
  247. package/dist/util/breakable.js.map +1 -1
  248. package/dist/util/compressedIds.d.ts +185 -0
  249. package/dist/util/compressedIds.d.ts.map +1 -0
  250. package/dist/util/compressedIds.js +164 -0
  251. package/dist/util/compressedIds.js.map +1 -0
  252. package/dist/util/index.d.ts +2 -1
  253. package/dist/util/index.d.ts.map +1 -1
  254. package/dist/util/index.js +10 -2
  255. package/dist/util/index.js.map +1 -1
  256. package/dist/util/nestedMap.d.ts.map +1 -1
  257. package/dist/util/nestedMap.js +16 -3
  258. package/dist/util/nestedMap.js.map +1 -1
  259. package/dist/util/nestedSet.d.ts +1 -1
  260. package/dist/util/nestedSet.d.ts.map +1 -1
  261. package/dist/util/nestedSet.js.map +1 -1
  262. package/dist/util/utils.d.ts +0 -6
  263. package/dist/util/utils.d.ts.map +1 -1
  264. package/dist/util/utils.js +1 -15
  265. package/dist/util/utils.js.map +1 -1
  266. package/lib/componentApi.d.ts +198 -0
  267. package/lib/componentApi.d.ts.map +1 -0
  268. package/lib/componentApi.js +135 -0
  269. package/lib/componentApi.js.map +1 -0
  270. package/lib/core/change-family/changeFamily.d.ts +3 -10
  271. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  272. package/lib/core/change-family/changeFamily.js.map +1 -1
  273. package/lib/core/rebase/types.d.ts +2 -2
  274. package/lib/core/rebase/types.js.map +1 -1
  275. package/lib/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  276. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  277. package/lib/entrypoints/alpha.d.ts +1 -1
  278. package/lib/entrypoints/alpha.d.ts.map +1 -1
  279. package/lib/entrypoints/alpha.js +1 -1
  280. package/lib/entrypoints/alpha.js.map +1 -1
  281. package/lib/entrypoints/beta.d.ts +1 -1
  282. package/lib/entrypoints/beta.d.ts.map +1 -1
  283. package/lib/entrypoints/beta.js.map +1 -1
  284. package/lib/entrypoints/legacy.d.ts +1 -1
  285. package/lib/entrypoints/legacy.d.ts.map +1 -1
  286. package/lib/entrypoints/legacy.js.map +1 -1
  287. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -20
  288. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  289. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +14 -33
  290. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  291. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
  292. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  293. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  294. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +73 -28
  295. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  296. package/lib/feature-libraries/chunked-forest/codec/codecs.js +75 -9
  297. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  298. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
  299. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  300. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +12 -1
  301. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  302. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  303. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  304. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  305. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  306. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
  307. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  308. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
  309. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  310. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  311. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  312. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  313. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  314. package/lib/feature-libraries/forest-summary/codec.d.ts +3 -3
  315. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  316. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  317. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  318. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  319. package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -6
  320. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  321. package/lib/feature-libraries/index.d.ts +3 -3
  322. package/lib/feature-libraries/index.d.ts.map +1 -1
  323. package/lib/feature-libraries/index.js +2 -2
  324. package/lib/feature-libraries/index.js.map +1 -1
  325. package/lib/feature-libraries/modular-schema/index.d.ts +1 -0
  326. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  327. package/lib/feature-libraries/modular-schema/index.js +1 -0
  328. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  329. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
  330. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
  331. package/lib/feature-libraries/modular-schema/minimizeModularChange.js +25 -0
  332. package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
  333. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  334. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +10 -10
  335. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  336. package/lib/feature-libraries/schemaChecker.d.ts +22 -3
  337. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
  338. package/lib/feature-libraries/schemaChecker.js +48 -5
  339. package/lib/feature-libraries/schemaChecker.js.map +1 -1
  340. package/lib/index.d.ts +4 -3
  341. package/lib/index.d.ts.map +1 -1
  342. package/lib/index.js +3 -2
  343. package/lib/index.js.map +1 -1
  344. package/lib/packageVersion.d.ts +1 -1
  345. package/lib/packageVersion.js +1 -1
  346. package/lib/packageVersion.js.map +1 -1
  347. package/lib/shared-tree/independentView.d.ts +17 -4
  348. package/lib/shared-tree/independentView.d.ts.map +1 -1
  349. package/lib/shared-tree/independentView.js +13 -10
  350. package/lib/shared-tree/independentView.js.map +1 -1
  351. package/lib/shared-tree/index.d.ts +3 -2
  352. package/lib/shared-tree/index.d.ts.map +1 -1
  353. package/lib/shared-tree/index.js +1 -0
  354. package/lib/shared-tree/index.js.map +1 -1
  355. package/lib/shared-tree/schematizingTreeView.d.ts +6 -5
  356. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  357. package/lib/shared-tree/schematizingTreeView.js +7 -4
  358. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  359. package/lib/shared-tree/serializedChange.d.ts +41 -0
  360. package/lib/shared-tree/serializedChange.d.ts.map +1 -0
  361. package/lib/shared-tree/serializedChange.js +84 -0
  362. package/lib/shared-tree/serializedChange.js.map +1 -0
  363. package/lib/shared-tree/sharedTree.d.ts +18 -0
  364. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  365. package/lib/shared-tree/sharedTree.js +10 -5
  366. package/lib/shared-tree/sharedTree.js.map +1 -1
  367. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +7 -0
  368. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  369. package/lib/shared-tree/sharedTreeChangeFamily.js +7 -1
  370. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  371. package/lib/shared-tree/transactionMinimize.d.ts +35 -0
  372. package/lib/shared-tree/transactionMinimize.d.ts.map +1 -0
  373. package/lib/shared-tree/transactionMinimize.js +62 -0
  374. package/lib/shared-tree/transactionMinimize.js.map +1 -0
  375. package/lib/shared-tree/transactionPostProcessor.d.ts +28 -0
  376. package/lib/shared-tree/transactionPostProcessor.d.ts.map +1 -0
  377. package/lib/shared-tree/transactionPostProcessor.js +23 -0
  378. package/lib/shared-tree/transactionPostProcessor.js.map +1 -0
  379. package/lib/shared-tree/treeAlpha.js +3 -3
  380. package/lib/shared-tree/treeAlpha.js.map +1 -1
  381. package/lib/shared-tree/treeCheckout.d.ts +19 -13
  382. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  383. package/lib/shared-tree/treeCheckout.js +36 -53
  384. package/lib/shared-tree/treeCheckout.js.map +1 -1
  385. package/lib/shared-tree/unhydratedTreeContext.d.ts +5 -5
  386. package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  387. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
  388. package/lib/shared-tree-core/editManager.d.ts +6 -3
  389. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  390. package/lib/shared-tree-core/editManager.js +36 -15
  391. package/lib/shared-tree-core/editManager.js.map +1 -1
  392. package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -2
  393. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  394. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  395. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
  396. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  397. package/lib/shared-tree-core/editManagerCodecsCommons.js +3 -5
  398. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  399. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
  400. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  401. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  402. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
  403. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  404. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  405. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
  406. package/lib/shared-tree-core/editManagerFormatCommons.js +1 -1
  407. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  408. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  409. package/lib/shared-tree-core/editManagerSummarizer.d.ts +5 -9
  410. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  411. package/lib/shared-tree-core/editManagerSummarizer.js +5 -10
  412. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  413. package/lib/shared-tree-core/index.d.ts +1 -1
  414. package/lib/shared-tree-core/index.d.ts.map +1 -1
  415. package/lib/shared-tree-core/index.js +1 -1
  416. package/lib/shared-tree-core/index.js.map +1 -1
  417. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  418. package/lib/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  419. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  420. package/lib/shared-tree-core/messageFormat.d.ts +1 -1
  421. package/lib/shared-tree-core/messageFormat.js +1 -1
  422. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  423. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
  424. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  425. package/lib/shared-tree-core/messageFormatVSharedBranches.js +1 -0
  426. package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  427. package/lib/shared-tree-core/messageTypes.d.ts +1 -0
  428. package/lib/shared-tree-core/messageTypes.d.ts.map +1 -1
  429. package/lib/shared-tree-core/messageTypes.js.map +1 -1
  430. package/lib/shared-tree-core/sharedTreeCore.d.ts +9 -3
  431. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  432. package/lib/shared-tree-core/sharedTreeCore.js +28 -13
  433. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  434. package/lib/shared-tree-core/transaction.d.ts +84 -9
  435. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  436. package/lib/shared-tree-core/transaction.js +87 -6
  437. package/lib/shared-tree-core/transaction.js.map +1 -1
  438. package/lib/simple-tree/api/index.d.ts +2 -2
  439. package/lib/simple-tree/api/index.d.ts.map +1 -1
  440. package/lib/simple-tree/api/index.js +1 -1
  441. package/lib/simple-tree/api/index.js.map +1 -1
  442. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +9 -24
  443. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  444. package/lib/simple-tree/api/schemaCompatibilityTester.js +29 -42
  445. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  446. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  447. package/lib/simple-tree/api/schemaCreationUtilities.js +3 -3
  448. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  449. package/lib/simple-tree/api/schemaFactory.d.ts +1 -1
  450. package/lib/simple-tree/api/schemaFactory.js +2 -2
  451. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  452. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
  453. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  454. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  455. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
  456. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  457. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  458. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
  459. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  460. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +4 -5
  461. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  462. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  463. package/lib/simple-tree/api/storedSchema.js +2 -3
  464. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  465. package/lib/simple-tree/api/transactionTypes.d.ts +91 -28
  466. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  467. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  468. package/lib/simple-tree/api/tree.d.ts +108 -24
  469. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  470. package/lib/simple-tree/api/tree.js.map +1 -1
  471. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  472. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  473. package/lib/simple-tree/api/typesUnsafe.d.ts +2 -2
  474. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  475. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  476. package/lib/simple-tree/core/treeNodeSchema.d.ts +7 -7
  477. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  478. package/lib/simple-tree/index.d.ts +1 -1
  479. package/lib/simple-tree/index.d.ts.map +1 -1
  480. package/lib/simple-tree/index.js +1 -1
  481. package/lib/simple-tree/index.js.map +1 -1
  482. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
  483. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  484. package/lib/simple-tree/node-kinds/array/arrayNode.js +39 -0
  485. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  486. package/lib/simple-tree/simpleSchemaFormatV1.js +1 -1
  487. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  488. package/lib/text/index.d.ts +1 -0
  489. package/lib/text/index.d.ts.map +1 -1
  490. package/lib/text/index.js +1 -0
  491. package/lib/text/index.js.map +1 -1
  492. package/lib/text/textDomainFormatted.d.ts +69 -758
  493. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  494. package/lib/text/textDomainFormatted.js +277 -324
  495. package/lib/text/textDomainFormatted.js.map +1 -1
  496. package/lib/text/textDomainFormattedDefault.d.ts +273 -0
  497. package/lib/text/textDomainFormattedDefault.d.ts.map +1 -0
  498. package/lib/text/textDomainFormattedDefault.js +91 -0
  499. package/lib/text/textDomainFormattedDefault.js.map +1 -0
  500. package/lib/treeFactory.js +1 -1
  501. package/lib/treeFactory.js.map +1 -1
  502. package/lib/util/breakable.d.ts +16 -1
  503. package/lib/util/breakable.d.ts.map +1 -1
  504. package/lib/util/breakable.js +9 -1
  505. package/lib/util/breakable.js.map +1 -1
  506. package/lib/util/compressedIds.d.ts +185 -0
  507. package/lib/util/compressedIds.d.ts.map +1 -0
  508. package/lib/util/compressedIds.js +154 -0
  509. package/lib/util/compressedIds.js.map +1 -0
  510. package/lib/util/index.d.ts +2 -1
  511. package/lib/util/index.d.ts.map +1 -1
  512. package/lib/util/index.js +2 -1
  513. package/lib/util/index.js.map +1 -1
  514. package/lib/util/nestedMap.d.ts.map +1 -1
  515. package/lib/util/nestedMap.js +17 -4
  516. package/lib/util/nestedMap.js.map +1 -1
  517. package/lib/util/nestedSet.d.ts +1 -1
  518. package/lib/util/nestedSet.d.ts.map +1 -1
  519. package/lib/util/nestedSet.js.map +1 -1
  520. package/lib/util/utils.d.ts +0 -6
  521. package/lib/util/utils.d.ts.map +1 -1
  522. package/lib/util/utils.js +0 -13
  523. package/lib/util/utils.js.map +1 -1
  524. package/package.json +23 -23
  525. package/src/componentApi.ts +354 -0
  526. package/src/core/change-family/changeFamily.ts +3 -12
  527. package/src/core/rebase/types.ts +2 -2
  528. package/src/core/schema-stored/storedSchemaRepository.ts +2 -2
  529. package/src/entrypoints/alpha.ts +15 -8
  530. package/src/entrypoints/beta.ts +8 -0
  531. package/src/entrypoints/legacy.ts +8 -0
  532. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +22 -72
  533. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -2
  534. package/src/feature-libraries/chunked-forest/codec/codecs.ts +110 -41
  535. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +32 -4
  536. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -0
  537. package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +7 -19
  538. package/src/feature-libraries/chunked-forest/index.ts +3 -0
  539. package/src/feature-libraries/forest-summary/codec.ts +5 -3
  540. package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -5
  541. package/src/feature-libraries/index.ts +5 -0
  542. package/src/feature-libraries/modular-schema/index.ts +1 -0
  543. package/src/feature-libraries/modular-schema/minimizeModularChange.ts +33 -0
  544. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +13 -9
  545. package/src/feature-libraries/schemaChecker.ts +86 -9
  546. package/src/index.ts +16 -8
  547. package/src/packageVersion.ts +1 -1
  548. package/src/shared-tree/independentView.ts +40 -15
  549. package/src/shared-tree/index.ts +4 -0
  550. package/src/shared-tree/schematizingTreeView.ts +40 -30
  551. package/src/shared-tree/serializedChange.ts +127 -0
  552. package/src/shared-tree/sharedTree.ts +32 -4
  553. package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
  554. package/src/shared-tree/transactionMinimize.ts +74 -0
  555. package/src/shared-tree/transactionPostProcessor.ts +40 -0
  556. package/src/shared-tree/treeAlpha.ts +3 -3
  557. package/src/shared-tree/treeCheckout.ts +103 -101
  558. package/src/shared-tree/unhydratedTreeContext.ts +18 -15
  559. package/src/shared-tree-core/editManager.ts +42 -6
  560. package/src/shared-tree-core/editManagerCodecs.ts +3 -2
  561. package/src/shared-tree-core/editManagerCodecsCommons.ts +10 -14
  562. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +3 -2
  563. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +3 -2
  564. package/src/shared-tree-core/editManagerFormatCommons.ts +1 -1
  565. package/src/shared-tree-core/editManagerSummarizer.ts +5 -9
  566. package/src/shared-tree-core/index.ts +8 -5
  567. package/src/shared-tree-core/messageCodecVSharedBranches.ts +8 -1
  568. package/src/shared-tree-core/messageFormat.ts +1 -1
  569. package/src/shared-tree-core/messageFormatVSharedBranches.ts +10 -0
  570. package/src/shared-tree-core/messageTypes.ts +1 -0
  571. package/src/shared-tree-core/sharedTreeCore.ts +36 -12
  572. package/src/shared-tree-core/transaction.ts +165 -18
  573. package/src/simple-tree/api/index.ts +14 -10
  574. package/src/simple-tree/api/schemaCompatibilityTester.ts +36 -48
  575. package/src/simple-tree/api/schemaCreationUtilities.ts +3 -3
  576. package/src/simple-tree/api/schemaFactory.ts +2 -2
  577. package/src/simple-tree/api/schemaFactoryAlpha.ts +56 -15
  578. package/src/simple-tree/api/schemaFactoryBeta.ts +0 -3
  579. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +4 -5
  580. package/src/simple-tree/api/storedSchema.ts +2 -3
  581. package/src/simple-tree/api/transactionTypes.ts +111 -39
  582. package/src/simple-tree/api/tree.ts +165 -49
  583. package/src/simple-tree/api/treeBeta.ts +2 -0
  584. package/src/simple-tree/api/typesUnsafe.ts +2 -1
  585. package/src/simple-tree/core/treeNodeSchema.ts +7 -7
  586. package/src/simple-tree/index.ts +13 -9
  587. package/src/simple-tree/node-kinds/array/arrayNode.ts +168 -4
  588. package/src/simple-tree/simpleSchemaFormatV1.ts +1 -1
  589. package/src/text/index.ts +1 -0
  590. package/src/text/textDomainFormatted.ts +520 -415
  591. package/src/text/textDomainFormattedDefault.ts +150 -0
  592. package/src/treeFactory.ts +1 -1
  593. package/src/util/breakable.ts +8 -1
  594. package/src/util/compressedIds.ts +304 -0
  595. package/src/util/index.ts +18 -1
  596. package/src/util/nestedMap.ts +21 -4
  597. package/src/util/nestedSet.ts +1 -1
  598. package/src/util/utils.ts +0 -18
@@ -21,15 +21,17 @@ export declare enum TransactionResult {
21
21
  }
22
22
  /**
23
23
  * A simple API for managing transactions.
24
+ * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.
24
25
  */
25
- export interface Transactor {
26
+ export interface Transactor<TOptions> {
26
27
  /**
27
28
  * Start a new transaction.
29
+ * @param options - Options controlling how the transaction is committed.
28
30
  * @remarks
29
31
  * If a transaction is already in progress when this new transaction starts, then this transaction will be "nested" inside of it,
30
32
  * i.e. the outer transaction will still be in progress after this new transaction is committed or aborted.
31
33
  */
32
- start(): void;
34
+ start(options?: TOptions): void;
33
35
  /**
34
36
  * Close this transaction by squashing its edits and committing them as a single edit.
35
37
  * @remarks If this is the root checkout and there are no ongoing transactions remaining, the squashed edit will be submitted to Fluid.
@@ -68,8 +70,9 @@ export interface TransactionEvents {
68
70
  }
69
71
  /**
70
72
  * Callbacks for transaction lifecycle events.
73
+ * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.
71
74
  */
72
- export interface Callbacks {
75
+ export interface Callbacks<TOptions> {
73
76
  /**
74
77
  * Called when the current transaction is popped from the {@link TransactionStack | stack}.
75
78
  */
@@ -83,24 +86,28 @@ export interface Callbacks {
83
86
  * Put another way, a transaction always results in a call to exactly one `OnPush` callback - whichever is closest to the transaction.
84
87
  * The event "bubbles up" to (and no further past) its first registered callback.
85
88
  */
86
- readonly onPush?: OnPush;
89
+ readonly onPush?: OnPush<TOptions>;
87
90
  }
88
91
  /**
89
92
  * A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.
90
93
  * @remarks This function may return other functions that will be called when the transaction is popped from the stack or a nested transaction is pushed onto the stack.
91
94
  * This function runs just before the transaction begins, so if this is the beginning of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.
95
+ * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.
96
+ * @param options - The options passed to {@link Transactor.start | start}.
92
97
  */
93
- export type OnPush = () => Callbacks | void;
98
+ export type OnPush<TOptions> = (options?: TOptions) => Callbacks<TOptions> | void;
94
99
  /**
95
100
  * A function that will be called when a transaction is popped from the {@link TransactionStack | stack}.
96
101
  * @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.
102
+ * @param result - The result of the transaction.
97
103
  */
98
104
  export type OnPop = (result: TransactionResult) => void;
99
105
  /**
100
106
  * An implementation of {@link Transactor} that uses a stack to manage transactions.
101
107
  * @remarks Using a stack allows transactions to nest - i.e. an inner transaction may be started while an outer transaction is already in progress.
108
+ * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.
102
109
  */
103
- export declare class TransactionStack implements Transactor, IDisposable {
110
+ export declare class TransactionStack<TOptions> implements Transactor<TOptions>, IDisposable {
104
111
  #private;
105
112
  get events(): Listenable<TransactionEvents>;
106
113
  get disposed(): boolean;
@@ -108,9 +115,9 @@ export declare class TransactionStack implements Transactor, IDisposable {
108
115
  * Construct a new {@link TransactionStack}.
109
116
  * @param onPush - A {@link OnPush | function} that will be called when a transaction begins.
110
117
  */
111
- constructor(onPush?: OnPush);
118
+ constructor(onPush?: OnPush<TOptions>);
112
119
  get size(): number;
113
- start(): void;
120
+ start(options?: TOptions): void;
114
121
  commit(): void;
115
122
  abort(): void;
116
123
  dispose(): void;
@@ -125,13 +132,77 @@ export declare class TransactionStack implements Transactor, IDisposable {
125
132
  * This will be `undefined` if no such change is necessary.
126
133
  */
127
134
  export type OnPopWithViewUpdate<TChange> = (result: TransactionResult, viewUpdate: TChange | undefined) => void;
135
+ /**
136
+ * Informs the caller of {@link ChangeProcessor} what context it should be invoked for.
137
+ * @remarks This is purely a recommendation to the caller of the processor and
138
+ * not a strict rule.
139
+ */
140
+ export declare enum ChangeProcessorApplicability {
141
+ /**
142
+ * Invoke the processor if no later (outer) instance of this change processor
143
+ * may be applied to related changes before changes are "visible".
144
+ *
145
+ * @remarks
146
+ * This designation is meant for processors that only need to be applied
147
+ * once to a set of related changes independent of scope or nesting,
148
+ * with the understanding that the processor should still be applied no
149
+ * later than when the changes are "visible" (e.g. committed to a branch).
150
+ * For example, a processor that removes extraneous information from a
151
+ * change (e.g. data for nodes that were both created and removed within a
152
+ * transaction) only needs to be applied once to the squashed change
153
+ * produced by the outermost transaction.
154
+ */
155
+ IfOutermost = 0,
156
+ /**
157
+ * Invoke the processor in all contexts.
158
+ */
159
+ Always = 1
160
+ }
161
+ /**
162
+ * Processes a change altering its representation.
163
+ *
164
+ * @remarks
165
+ * A change processor receives a change and returns a change with the
166
+ * same observable effect but otherwise transformed.
167
+ *
168
+ * Currently this is the internal counterpart of the type-erased post-processor
169
+ * exposed on the public transaction API. The public boundary type-erases this
170
+ * (see the conversion helpers in the `shared-tree` layer) so that its internal
171
+ * change representation does not leak into the public API.
172
+ */
173
+ export interface ChangeProcessor<TChange> {
174
+ /**
175
+ * Informs what context it should be invoked for.
176
+ */
177
+ readonly applicability: ChangeProcessorApplicability;
178
+ /**
179
+ * Processes the given change, returning a change with the same observable effect.
180
+ */
181
+ readonly processChange: (change: TChange) => TChange;
182
+ }
183
+ /**
184
+ * Options for {@link Transactor.start | starting} a transaction.
185
+ */
186
+ export interface SquashingTransactionOptions<TChange> {
187
+ /**
188
+ * An optional {@link ChangeProcessor} applied to the squashed change produced when a transaction that was started
189
+ * with this option is committed.
190
+ *
191
+ * @remarks
192
+ * When omitted, the transaction's edits are squashed without any post-processing.
193
+ *
194
+ * How often the processor is invoked across nested transactions is governed by its
195
+ * {@link ChangeProcessor.applicability | applicability}.
196
+ */
197
+ readonly postProcessor?: ChangeProcessor<TChange>;
198
+ }
128
199
  /**
129
200
  * An implementation of {@link Transactor} that {@link TransactionStack | uses a stack} and a {@link SharedTreeBranch | branch} to manage transactions.
130
201
  * @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.
131
202
  * This class provides conveniences for interacting with the {@link SquashingTransactionStack.activeBranch | active branch} in a way that is stable across transaction boundaries.
132
203
  * For example, see {@link SquashingTransactionStack.activeBranchEditor | activeBranchEditor} and {@link SquashingTransactionStack.activeBranchEvents | activeBranchEvents}.
133
204
  */
134
- export declare class SquashingTransactionStack<TEditor extends ChangeFamilyEditor, TChange> extends TransactionStack {
205
+ export declare class SquashingTransactionStack<TEditor extends ChangeFamilyEditor, TChange> extends TransactionStack<SquashingTransactionOptions<TChange>> {
135
206
  #private;
136
207
  readonly branch: SharedTreeBranch<TEditor, TChange>;
137
208
  /**
@@ -154,6 +225,10 @@ export declare class SquashingTransactionStack<TEditor extends ChangeFamilyEdito
154
225
  * Construct a new {@link SquashingTransactionStack}.
155
226
  * @param branch - The {@link SquashingTransactionStack.branch | branch} that will be forked off of when a transaction begins.
156
227
  * @param onPush - A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.
228
+ * @remarks To post-process the squashed change produced when a transaction is committed (for example, to "minimize"
229
+ * it so that it contains no extraneous information), start the transaction with a
230
+ * {@link SquashingTransactionOptions.postProcessor | post-processor}. The post-processor is injected via the transaction
231
+ * options rather than baked into this stack, so different transactions may supply different post-processors (or none).
157
232
  */
158
233
  constructor(branch: SharedTreeBranch<TEditor, TChange>, mintRevisionTag: () => RevisionTag, onPush?: () => OnPopWithViewUpdate<TChange> | void);
159
234
  /** Updates the transaction branch (and therefore the active branch) and rebinds the branch events. */
@@ -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,EAON,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;;;;;OAKG;IACH,KAAK,IAAI,IAAI,CAAC;IACd;;;OAGG;IACH,MAAM,IAAI,IAAI,CAAC;IACf;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IACd;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;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;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;AACH,MAAM,WAAW,2BAA2B,CAAC,OAAO;IACnD;;;;;;;;;OASG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;CAClD;AAED;;;;;GAKG;AACH,qBAAa,yBAAyB,CACrC,OAAO,SAAS,kBAAkB,EAClC,OAAO,CACN,SAAQ,gBAAgB,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC;;aAiE9C,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC;IA9D3D;;;;OAIG;IACH,SAAgB,kBAAkB,UAI/B;IAEH;;OAEG;IACH,IAAW,YAAY,IAAI,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAE5D;IAED;;;;OAIG;IACH,IAAW,kBAAkB,IAAI,UAAU,CAAC,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAqBpF;IAQD;;;;;;;;OAQG;gBAEc,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,EAC1D,eAAe,EAAE,MAAM,WAAW,EAClC,MAAM,CAAC,EAAE,MAAM,mBAAmB,CAAC,OAAO,CAAC,GAAG,IAAI;IAyNnD,sGAAsG;IACtG,OAAO,CAAC,oBAAoB;CAY5B"}
@@ -27,6 +27,7 @@ export var TransactionResult;
27
27
  /**
28
28
  * An implementation of {@link Transactor} that uses a stack to manage transactions.
29
29
  * @remarks Using a stack allows transactions to nest - i.e. an inner transaction may be started while an outer transaction is already in progress.
30
+ * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.
30
31
  */
31
32
  export class TransactionStack {
32
33
  get events() {
@@ -50,11 +51,11 @@ export class TransactionStack {
50
51
  this.ensureNotDisposed();
51
52
  return __classPrivateFieldGet(this, _TransactionStack_stack, "f").length;
52
53
  }
53
- start() {
54
+ start(options) {
54
55
  this.ensureNotDisposed();
55
56
  const last = getLast(__classPrivateFieldGet(this, _TransactionStack_stack, "f"));
56
57
  const onPushCurrent = last === undefined ? __classPrivateFieldGet(this, _TransactionStack_onPush, "f") : last.callbacks.onPush;
57
- const { onPush, onPop } = onPushCurrent?.() ?? {};
58
+ const { onPush, onPop } = onPushCurrent?.(options) ?? {};
58
59
  __classPrivateFieldGet(this, _TransactionStack_stack, "f").push({
59
60
  callbacks: { onPop, onPush: onPush ?? onPushCurrent },
60
61
  });
@@ -90,6 +91,33 @@ export class TransactionStack {
90
91
  }
91
92
  }
92
93
  _TransactionStack_stack = new WeakMap(), _TransactionStack_onPush = new WeakMap(), _TransactionStack_events = new WeakMap(), _TransactionStack_disposed = new WeakMap();
94
+ /**
95
+ * Informs the caller of {@link ChangeProcessor} what context it should be invoked for.
96
+ * @remarks This is purely a recommendation to the caller of the processor and
97
+ * not a strict rule.
98
+ */
99
+ export var ChangeProcessorApplicability;
100
+ (function (ChangeProcessorApplicability) {
101
+ /**
102
+ * Invoke the processor if no later (outer) instance of this change processor
103
+ * may be applied to related changes before changes are "visible".
104
+ *
105
+ * @remarks
106
+ * This designation is meant for processors that only need to be applied
107
+ * once to a set of related changes independent of scope or nesting,
108
+ * with the understanding that the processor should still be applied no
109
+ * later than when the changes are "visible" (e.g. committed to a branch).
110
+ * For example, a processor that removes extraneous information from a
111
+ * change (e.g. data for nodes that were both created and removed within a
112
+ * transaction) only needs to be applied once to the squashed change
113
+ * produced by the outermost transaction.
114
+ */
115
+ ChangeProcessorApplicability[ChangeProcessorApplicability["IfOutermost"] = 0] = "IfOutermost";
116
+ /**
117
+ * Invoke the processor in all contexts.
118
+ */
119
+ ChangeProcessorApplicability[ChangeProcessorApplicability["Always"] = 1] = "Always";
120
+ })(ChangeProcessorApplicability || (ChangeProcessorApplicability = {}));
93
121
  /**
94
122
  * An implementation of {@link Transactor} that {@link TransactionStack | uses a stack} and a {@link SharedTreeBranch | branch} to manage transactions.
95
123
  * @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.
@@ -130,11 +158,30 @@ export class SquashingTransactionStack extends TransactionStack {
130
158
  * Construct a new {@link SquashingTransactionStack}.
131
159
  * @param branch - The {@link SquashingTransactionStack.branch | branch} that will be forked off of when a transaction begins.
132
160
  * @param onPush - A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.
161
+ * @remarks To post-process the squashed change produced when a transaction is committed (for example, to "minimize"
162
+ * it so that it contains no extraneous information), start the transaction with a
163
+ * {@link SquashingTransactionOptions.postProcessor | post-processor}. The post-processor is injected via the transaction
164
+ * options rather than baked into this stack, so different transactions may supply different post-processors (or none).
133
165
  */
134
166
  constructor(branch, mintRevisionTag, onPush) {
167
+ // A stack of the post-processors to apply when each in-progress transaction commits, ordered from outermost to
168
+ // innermost. Each in-progress transaction contributes exactly one entry: either the processor to apply when it
169
+ // commits, or `undefined` when none should be applied.
170
+ const postProcessorStack = [];
171
+ // Determines the entry to push for a transaction that was started with the given `requested` processor (if any).
172
+ // A processor with "outermost" applicability that is already active in an enclosing transaction resolves to
173
+ // `undefined` so that it is only applied once (at the outermost transaction that supplied it).
174
+ const resolvePostProcessor = (requested) => {
175
+ if (requested?.applicability === ChangeProcessorApplicability.IfOutermost &&
176
+ postProcessorStack.includes(requested)) {
177
+ return undefined;
178
+ }
179
+ return requested;
180
+ };
135
181
  super(
136
182
  // Invoked when an outer transaction starts
137
- () => {
183
+ (startOptions) => {
184
+ postProcessorStack.push(resolvePostProcessor(startOptions?.postProcessor));
138
185
  // Keep track of the commit that each transaction was on when it started
139
186
  const startHead = this.activeBranch.getHead();
140
187
  const rebaser = this.branch.changeFamily.rebaser;
@@ -148,6 +195,7 @@ export class SquashingTransactionStack extends TransactionStack {
148
195
  // Invoked when an outer transaction ends
149
196
  const onOuterTransactionPop = (result) => {
150
197
  assert(this.size === 0, 0xcae /* The outer transaction should be ending */);
198
+ const postProcessor = postProcessorStack.pop();
151
199
  transactionBranch.editor.exitTransaction();
152
200
  const sourcePath = [];
153
201
  const targetPath = [];
@@ -176,16 +224,29 @@ export class SquashingTransactionStack extends TransactionStack {
176
224
  }
177
225
  // Squash all the new commits on the transaction branch into a new commit on the original branch
178
226
  const squash = rebaser.compose(transactionSteps);
227
+ // Apply this transaction's post-processor (if any) to the squashed change (for example, to
228
+ // "minimize" it so that it contains no extraneous information).
229
+ const change = postProcessor === undefined ? squash : postProcessor.processChange(squash);
230
+ if (change !== squash) {
231
+ // The post-processor produced a change that differs from the
232
+ // one that was applied to the view as the transaction's edits
233
+ // were made. Roll back the transaction's changes on the transaction
234
+ // branch (which rolls back the view) and apply the post-processed
235
+ // change in their place so that the view fully reflects the modified
236
+ // `change`.
237
+ transactionBranch.removeAfter(startHead);
238
+ transactionBranch.apply(tagChange(change, transactionRevision));
239
+ }
179
240
  if (targetPath.length === 0) {
180
241
  // No changes were made on the original branch since the transaction began
181
242
  // The transaction commit can be applied directly
182
- this.branch.apply(tagChange(squash, transactionRevision));
243
+ this.branch.apply(tagChange(change, transactionRevision));
183
244
  // The view is already up-to-date so there's nothing more to do
184
245
  }
185
246
  else {
186
247
  // Some changes were made on `branch` since the transaction began
187
248
  const unrebasedHead = mintCommit(startHead, {
188
- change: squash,
249
+ change,
189
250
  revision: transactionRevision,
190
251
  });
191
252
  // We need to rebase the transaction commit on top of the new changes
@@ -213,13 +274,15 @@ export class SquashingTransactionStack extends TransactionStack {
213
274
  outerOnPop?.(result, viewUpdate);
214
275
  };
215
276
  // Invoked when a nested transaction begins
216
- const onNestedTransactionPush = () => {
277
+ const onNestedTransactionPush = (nestedStartOptions) => {
278
+ postProcessorStack.push(resolvePostProcessor(nestedStartOptions?.postProcessor));
217
279
  const nestedStartHead = this.activeBranch.getHead();
218
280
  const nestedOuterOnPop = onPush?.();
219
281
  transactionBranch.editor.enterTransaction();
220
282
  return {
221
283
  // Invoked when a nested transaction ends
222
284
  onPop: (result) => {
285
+ const nestedPostProcessor = postProcessorStack.pop();
223
286
  transactionBranch.editor.exitTransaction();
224
287
  switch (result) {
225
288
  case TransactionResult.Abort: {
@@ -228,6 +291,24 @@ export class SquashingTransactionStack extends TransactionStack {
228
291
  break;
229
292
  }
230
293
  case TransactionResult.Commit: {
294
+ // When this nested transaction supplied a post-processor that should be applied here, squash its
295
+ // edits into a single (post-processed) commit on the transaction branch rather than leaving them to
296
+ // be squashed only when the outermost transaction is committed.
297
+ if (nestedPostProcessor !== undefined) {
298
+ const nestedSteps = [];
299
+ findAncestor([transactionBranch.getHead(), nestedSteps], (c) => c === nestedStartHead);
300
+ if (nestedSteps.length > 0) {
301
+ assert(transactionRevision !== undefined, 0xd07 /* Expected transaction revision in the presence of transaction steps */);
302
+ const squash = rebaser.compose(nestedSteps);
303
+ const processedSquash = nestedPostProcessor.processChange(squash);
304
+ // Roll back the transaction branch to the nested start head and apply the
305
+ // processed change if it differs from the original change.
306
+ if (processedSquash !== squash) {
307
+ transactionBranch.removeAfter(nestedStartHead);
308
+ transactionBranch.apply(tagChange(processedSquash, transactionRevision));
309
+ }
310
+ }
311
+ }
231
312
  break;
232
313
  }
233
314
  default: {
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/shared-tree-core/transaction.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EACN,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,SAAS,GAIT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIxD;;;GAGG;AACH,MAAM,CAAN,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC5B;;OAEG;IACH,2DAAK,CAAA;IACL;;OAEG;IACH,6DAAM,CAAA;AACP,CAAC,EATW,iBAAiB,KAAjB,iBAAiB,QAS5B;AA4FD;;;GAGG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E,MAAM,EAAE,uBAAuB,EAAE,CAAC;QAC1E,CAAC,CACD,CAAC;QApJc,WAAM,GAAN,MAAM,CAAoC;QA5D3D,+DAAwD;QAExD;;;;WAIG;QACa,uBAAkB,GAAG,IAAI,KAAK,CAAU,EAAwB,EAAE;YACjF,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE;gBACvB,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC;YAC3D,CAAC;SACD,CAAC,CAAC;QAoCM,wDAAsB,IAAI,GAAG,EAKnC,EAAC;IA6JJ,CAAC;IAED,sGAAsG;IAC9F,oBAAoB,CAC3B,iBAAiE;QAEjE,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC;QAC1C,uBAAA,IAAI,gDAAsB,iBAAiB,MAAA,CAAC;QAC5C,KAAK,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,uBAAA,IAAI,qDAAoB,EAAE,CAAC;YAC/D,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;gBAClC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;gBAChD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAClD,CAAC;QACF,CAAC;IACF,CAAC;CACD","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, Listenable } from \"@fluidframework/core-interfaces\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tdiffHistories,\n\tfindAncestor,\n\tfindCommonAncestor,\n\tmintCommit,\n\trebaseBranch,\n\ttagChange,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n} from \"../core/index.js\";\nimport { getLast, getOrCreate } from \"../util/index.js\";\n\nimport type { SharedTreeBranch, SharedTreeBranchEvents } from \"./branch.js\";\n\n/**\n * Describes the result of a transaction.\n * Transactions may either succeed and commit, or fail and abort.\n */\nexport enum TransactionResult {\n\t/**\n\t * Indicates the transaction failed.\n\t */\n\tAbort,\n\t/**\n\t * Indicates the transaction succeeded.\n\t */\n\tCommit,\n}\n\n/**\n * A simple API for managing transactions.\n */\nexport interface Transactor {\n\t/**\n\t * Start a new transaction.\n\t * @remarks\n\t * If a transaction is already in progress when this new transaction starts, then this transaction will be \"nested\" inside of it,\n\t * i.e. the outer transaction will still be in progress after this new transaction is committed or aborted.\n\t */\n\tstart(): void;\n\t/**\n\t * Close this transaction by squashing its edits and committing them as a single edit.\n\t * @remarks If this is the root checkout and there are no ongoing transactions remaining, the squashed edit will be submitted to Fluid.\n\t */\n\tcommit(): void;\n\t/**\n\t * Close this transaction and revert the state of the tree to what it was before this transaction began.\n\t */\n\tabort(): void;\n\t/**\n\t * The number of transactions currently in progress, including any nested transactions.\n\t * @remarks This is 0 when no transaction is in progress, 1 when a single transaction is in progress, 2 when a transaction is nested inside another, etc.\n\t */\n\tsize: number;\n\t/**\n\t * Provides events for changes in transaction progress.\n\t */\n\tevents: Listenable<TransactionEvents>;\n}\n\nexport interface TransactionEvents {\n\t/**\n\t * Raised just after a transaction has begun.\n\t * @remarks When this event fires, {@link Transactor.size} will be greater than 0 because the transaction has already begun.\n\t */\n\tstarted(): void;\n\t/**\n\t * Raised just before a transaction is aborted.\n\t * @remarks When this event fires, {@link Transactor.size} will still be greater than 0 because the transaction has not yet ended.\n\t */\n\taborting(): void;\n\t/**\n\t * Raised just before a transaction is committed.\n\t * @remarks When this event fires, {@link Transactor.size} will still be greater than 0 because the transaction has not yet ended.\n\t */\n\tcommitting(): void;\n}\n\n/**\n * Callbacks for transaction lifecycle events.\n */\nexport interface Callbacks {\n\t/**\n\t * Called when the current transaction is popped from the {@link TransactionStack | stack}.\n\t */\n\treadonly onPop?: OnPop;\n\t/**\n\t * Called when a nested transaction is pushed onto the {@link TransactionStack | stack}.\n\t * @remarks\n\t * Transactions may be arbitrarily nested (by {@link TransactionStack.start | start}ing a transaction within a transaction that is already in progress).\n\t * The `OnPush` callback for an (outer) transaction may optionally return another `OnPush` callback that is associated with any nested (inner) transaction(s).\n\t * In that case, the inner `OnPush` will be called when those inner transactions are pushed and the outer `OnPush` will not be called.\n\t * Put another way, a transaction always results in a call to exactly one `OnPush` callback - whichever is closest to the transaction.\n\t * The event \"bubbles up\" to (and no further past) its first registered callback.\n\t */\n\treadonly onPush?: OnPush;\n}\n\n/**\n * A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.\n * @remarks This function may return other functions that will be called when the transaction is popped from the stack or a nested transaction is pushed onto the stack.\n * This function runs just before the transaction begins, so if this is the beginning of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.\n */\nexport type OnPush = () => Callbacks | void;\n\n/**\n * A function that will be called when a transaction is popped from the {@link TransactionStack | stack}.\n * @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.\n */\nexport type OnPop = (result: TransactionResult) => void;\n\n/**\n * A frame in the transaction stack.\n */\ninterface TransactionStackFrame {\n\t/** The callbacks provided when this transaction frame was pushed onto the stack. */\n\treadonly callbacks: Callbacks;\n}\n\n/**\n * An implementation of {@link Transactor} that uses a stack to manage transactions.\n * @remarks Using a stack allows transactions to nest - i.e. an inner transaction may be started while an outer transaction is already in progress.\n */\nexport class TransactionStack implements Transactor, IDisposable {\n\treadonly #stack: TransactionStackFrame[] = [];\n\treadonly #onPush?: OnPush;\n\n\treadonly #events = createEmitter<TransactionEvents>();\n\tpublic get events(): Listenable<TransactionEvents> {\n\t\treturn this.#events;\n\t}\n\n\t#disposed = false;\n\tpublic get disposed(): boolean {\n\t\treturn this.#disposed;\n\t}\n\n\t/**\n\t * Construct a new {@link TransactionStack}.\n\t * @param onPush - A {@link OnPush | function} that will be called when a transaction begins.\n\t */\n\tpublic constructor(onPush?: OnPush) {\n\t\tthis.#onPush = onPush;\n\t}\n\n\tpublic get size(): number {\n\t\tthis.ensureNotDisposed();\n\t\treturn this.#stack.length;\n\t}\n\n\tpublic start(): void {\n\t\tthis.ensureNotDisposed();\n\t\tconst last = getLast(this.#stack);\n\t\tconst onPushCurrent = last === undefined ? this.#onPush : last.callbacks.onPush;\n\t\tconst { onPush, onPop } = onPushCurrent?.() ?? {};\n\t\tthis.#stack.push({\n\t\t\tcallbacks: { onPop, onPush: onPush ?? onPushCurrent },\n\t\t});\n\t\tthis.#events.emit(\"started\");\n\t}\n\n\tpublic commit(): void {\n\t\tthis.ensureNotDisposed();\n\t\tif (this.size === 0) {\n\t\t\tthrow new UsageError(\"No transaction to commit\");\n\t\t}\n\t\tthis.#events.emit(\"committing\");\n\t\tthis.#stack.pop()?.callbacks.onPop?.(TransactionResult.Commit);\n\t}\n\n\tpublic abort(): void {\n\t\tthis.ensureNotDisposed();\n\t\tif (this.size === 0) {\n\t\t\tthrow new UsageError(\"No transaction to abort\");\n\t\t}\n\t\tthis.#events.emit(\"aborting\");\n\t\tthis.#stack.pop()?.callbacks.onPop?.(TransactionResult.Abort);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.ensureNotDisposed();\n\t\twhile (this.size > 0) {\n\t\t\tthis.abort();\n\t\t}\n\t\tthis.#disposed = true;\n\t}\n\n\tprivate ensureNotDisposed(): void {\n\t\tif (this.disposed) {\n\t\t\tthrow new UsageError(\"Transactor is disposed\");\n\t\t}\n\t}\n}\n\n/**\n * A function that will be called when a transaction is popped from the {@link SquashingTransactionStack | stack}.\n * @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.\n * @param result - The result of the transaction.\n * @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.\n * This is needed in asynchronous transactions where new commits have been added to the branch while the transaction was in progress.\n * This will be `undefined` if no such change is necessary.\n */\nexport type OnPopWithViewUpdate<TChange> = (\n\tresult: TransactionResult,\n\tviewUpdate: TChange | undefined,\n) => void;\n\n/**\n * An implementation of {@link Transactor} that {@link TransactionStack | uses a stack} and a {@link SharedTreeBranch | branch} to manage transactions.\n * @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.\n * This class provides conveniences for interacting with the {@link SquashingTransactionStack.activeBranch | active branch} in a way that is stable across transaction boundaries.\n * For example, see {@link SquashingTransactionStack.activeBranchEditor | activeBranchEditor} and {@link SquashingTransactionStack.activeBranchEvents | activeBranchEvents}.\n */\nexport class SquashingTransactionStack<\n\tTEditor extends ChangeFamilyEditor,\n\tTChange,\n> extends TransactionStack {\n\t#transactionBranch?: SharedTreeBranch<TEditor, TChange>;\n\n\t/**\n\t * An editor for whichever branch is currently the {@link SquashingTransactionStack.activeBranch | active branch}.\n\t * @remarks This editor can safely be held on to across transaction boundaries, as it will properly delegate to the correct branch.\n\t * In contrast, it is not safe to hold onto e.g. `activeBranch.editor` across transaction boundaries, since the active branch may change.\n\t */\n\tpublic readonly activeBranchEditor = new Proxy<TEditor>({} as unknown as TEditor, {\n\t\tget: (_, p, receiver) => {\n\t\t\treturn Reflect.get(this.activeBranch.editor, p, receiver);\n\t\t},\n\t});\n\n\t/**\n\t * Get the \"active branch\" for this transactor - either the transaction branch if a transaction is in progress, or the original branch otherwise.\n\t */\n\tpublic get activeBranch(): SharedTreeBranch<TEditor, TChange> {\n\t\treturn this.#transactionBranch ?? this.branch;\n\t}\n\n\t/**\n\t * Provides events for changes in the {@link SquashingTransactionStack.activeBranch | active branch}.\n\t * @remarks When the active branch changes, the listeners for these events will automatically be transferred to the new active branch.\n\t * In contrast, binding an event to the {@link SquashingTransactionStack.activeBranch | active branch} directly will not automatically transfer the listener when the active branch changes.\n\t */\n\tpublic get activeBranchEvents(): Listenable<SharedTreeBranchEvents<TEditor, TChange>> {\n\t\tconst off = (\n\t\t\teventName: keyof SharedTreeBranchEvents<TEditor, TChange>,\n\t\t\tlistener: SharedTreeBranchEvents<TEditor, TChange>[typeof eventName],\n\t\t): void => {\n\t\t\tthis.activeBranch.events.off(eventName, listener);\n\t\t\tconst listeners = this.#activeBranchEvents.get(eventName);\n\t\t\tif (listeners?.delete(listener) === true && listeners.size === 0) {\n\t\t\t\tthis.#activeBranchEvents.delete(eventName);\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\ton: (eventName, listener) => {\n\t\t\t\tconst listeners = getOrCreate(this.#activeBranchEvents, eventName, () => new Set());\n\t\t\t\tlisteners.add(listener);\n\t\t\t\tthis.activeBranch.events.on(eventName, listener);\n\t\t\t\treturn () => off(eventName, listener);\n\t\t\t},\n\t\t\toff,\n\t\t};\n\t}\n\treadonly #activeBranchEvents = new Map<\n\t\tkeyof SharedTreeBranchEvents<TEditor, TChange>,\n\t\tSet<\n\t\t\tSharedTreeBranchEvents<TEditor, TChange>[keyof SharedTreeBranchEvents<TEditor, TChange>]\n\t\t>\n\t>();\n\n\t/**\n\t * Construct a new {@link SquashingTransactionStack}.\n\t * @param branch - The {@link SquashingTransactionStack.branch | branch} that will be forked off of when a transaction begins.\n\t * @param onPush - A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.\n\t */\n\tpublic constructor(\n\t\tpublic readonly branch: SharedTreeBranch<TEditor, TChange>,\n\t\tmintRevisionTag: () => RevisionTag,\n\t\tonPush?: () => OnPopWithViewUpdate<TChange> | void,\n\t) {\n\t\tsuper(\n\t\t\t// Invoked when an outer transaction starts\n\t\t\t(): Callbacks => {\n\t\t\t\t// Keep track of the commit that each transaction was on when it started\n\t\t\t\tconst startHead = this.activeBranch.getHead();\n\t\t\t\tconst rebaser = this.branch.changeFamily.rebaser;\n\t\t\t\tconst outerOnPop = onPush?.();\n\t\t\t\tlet transactionRevision: RevisionTag | undefined;\n\t\t\t\tconst transactionBranch = this.branch.fork(\n\t\t\t\t\tstartHead,\n\t\t\t\t\t// Lazily mint the revision tag for the transaction when it is first needed\n\t\t\t\t\t() => (transactionRevision ??= mintRevisionTag()),\n\t\t\t\t);\n\t\t\t\tthis.setTransactionBranch(transactionBranch);\n\t\t\t\ttransactionBranch.editor.enterTransaction();\n\n\t\t\t\t// Invoked when an outer transaction ends\n\t\t\t\tconst onOuterTransactionPop: OnPop = (result) => {\n\t\t\t\t\tassert(this.size === 0, 0xcae /* The outer transaction should be ending */);\n\t\t\t\t\ttransactionBranch.editor.exitTransaction();\n\n\t\t\t\t\tconst sourcePath: GraphCommit<TChange>[] = [];\n\t\t\t\t\tconst targetPath: GraphCommit<TChange>[] = [];\n\t\t\t\t\tconst ancestor = findCommonAncestor(\n\t\t\t\t\t\t[startHead, sourcePath],\n\t\t\t\t\t\t[branch.getHead(), targetPath],\n\t\t\t\t\t);\n\t\t\t\t\tassert(ancestor !== undefined, 0xcce /* branches must be related */);\n\n\t\t\t\t\tconst transactionSteps: GraphCommit<TChange>[] = [];\n\t\t\t\t\tfindAncestor(\n\t\t\t\t\t\t[transactionBranch.getHead(), transactionSteps],\n\t\t\t\t\t\t(c) => c === startHead,\n\t\t\t\t\t);\n\n\t\t\t\t\tlet viewUpdate: TChange | undefined;\n\t\t\t\t\tswitch (result) {\n\t\t\t\t\t\tcase TransactionResult.Abort: {\n\t\t\t\t\t\t\t// When a transaction is aborted, roll back all the transaction's changes on the current branch.\n\t\t\t\t\t\t\t// It is important that this happens before and separately from updating the view because the `TreeCheckout` needs to\n\t\t\t\t\t\t\t// revert some internal (state to match what it was before the transaction began) before applying the view update (if any).\n\t\t\t\t\t\t\ttransactionBranch.removeAfter(startHead);\n\t\t\t\t\t\t\t// If changes were made on `branch` since the transaction began, the view will need to be updated to reflect those changes.\n\t\t\t\t\t\t\tif (targetPath.length > 0) {\n\t\t\t\t\t\t\t\tviewUpdate = diffHistories(\n\t\t\t\t\t\t\t\t\trebaser,\n\t\t\t\t\t\t\t\t\tstartHead,\n\t\t\t\t\t\t\t\t\tthis.branch.getHead(),\n\t\t\t\t\t\t\t\t\tmintRevisionTag,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TransactionResult.Commit: {\n\t\t\t\t\t\t\tif (transactionSteps.length > 0) {\n\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\ttransactionRevision !== undefined,\n\t\t\t\t\t\t\t\t\t0xccf /* Expected transaction revision in the presence of transaction steps */,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tfor (const commit of transactionSteps) {\n\t\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\t\tcommit.revision === transactionRevision,\n\t\t\t\t\t\t\t\t\t\t0xcaf /* Unexpected commit in transaction */,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Squash all the new commits on the transaction branch into a new commit on the original branch\n\t\t\t\t\t\t\t\tconst squash = rebaser.compose(transactionSteps);\n\n\t\t\t\t\t\t\t\tif (targetPath.length === 0) {\n\t\t\t\t\t\t\t\t\t// No changes were made on the original branch since the transaction began\n\t\t\t\t\t\t\t\t\t// The transaction commit can be applied directly\n\t\t\t\t\t\t\t\t\tthis.branch.apply(tagChange(squash, transactionRevision));\n\t\t\t\t\t\t\t\t\t// The view is already up-to-date so there's nothing more to do\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Some changes were made on `branch` since the transaction began\n\t\t\t\t\t\t\t\t\tconst unrebasedHead = mintCommit(startHead, {\n\t\t\t\t\t\t\t\t\t\tchange: squash,\n\t\t\t\t\t\t\t\t\t\trevision: transactionRevision,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t// We need to rebase the transaction commit on top of the new changes\n\t\t\t\t\t\t\t\t\tconst rebased = rebaseBranch(\n\t\t\t\t\t\t\t\t\t\tmintRevisionTag,\n\t\t\t\t\t\t\t\t\t\trebaser,\n\t\t\t\t\t\t\t\t\t\tunrebasedHead,\n\t\t\t\t\t\t\t\t\t\tbranch.getHead(),\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\t\trebased.newSourceHead.revision === transactionRevision,\n\t\t\t\t\t\t\t\t\t\t0xcd0 /* The transaction commit should be rebased to the tip */,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tthis.branch.apply(rebased.newSourceHead);\n\t\t\t\t\t\t\t\t\tviewUpdate = rebased.sourceChange;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (targetPath.length > 0) {\n\t\t\t\t\t\t\t\t\t// Changes were made on `branch` since the transaction began.\n\t\t\t\t\t\t\t\t\t// The view will need to be updated to reflect those changes.\n\t\t\t\t\t\t\t\t\tviewUpdate = diffHistories(\n\t\t\t\t\t\t\t\t\t\trebaser,\n\t\t\t\t\t\t\t\t\t\tstartHead,\n\t\t\t\t\t\t\t\t\t\tthis.branch.getHead(),\n\t\t\t\t\t\t\t\t\t\tmintRevisionTag,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\tunreachableCase(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ttransactionBranch.dispose();\n\t\t\t\t\tthis.setTransactionBranch(undefined);\n\t\t\t\t\touterOnPop?.(result, viewUpdate);\n\t\t\t\t};\n\t\t\t\t// Invoked when a nested transaction begins\n\t\t\t\tconst onNestedTransactionPush: OnPush = () => {\n\t\t\t\t\tconst nestedStartHead = this.activeBranch.getHead();\n\t\t\t\t\tconst nestedOuterOnPop = onPush?.();\n\t\t\t\t\ttransactionBranch.editor.enterTransaction();\n\t\t\t\t\treturn {\n\t\t\t\t\t\t// Invoked when a nested transaction ends\n\t\t\t\t\t\tonPop: (result) => {\n\t\t\t\t\t\t\ttransactionBranch.editor.exitTransaction();\n\t\t\t\t\t\t\tswitch (result) {\n\t\t\t\t\t\t\t\tcase TransactionResult.Abort: {\n\t\t\t\t\t\t\t\t\t// When a transaction is aborted, roll back all the transaction's changes on the current branch\n\t\t\t\t\t\t\t\t\ttransactionBranch.removeAfter(nestedStartHead);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase TransactionResult.Commit: {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\t\tunreachableCase(result);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tnestedOuterOnPop?.(result, undefined);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t\treturn { onPop: onOuterTransactionPop, onPush: onNestedTransactionPush };\n\t\t\t},\n\t\t);\n\t}\n\n\t/** Updates the transaction branch (and therefore the active branch) and rebinds the branch events. */\n\tprivate setTransactionBranch(\n\t\ttransactionBranch: SharedTreeBranch<TEditor, TChange> | undefined,\n\t): void {\n\t\tconst oldActiveBranch = this.activeBranch;\n\t\tthis.#transactionBranch = transactionBranch;\n\t\tfor (const [eventName, listeners] of this.#activeBranchEvents) {\n\t\t\tfor (const listener of listeners) {\n\t\t\t\toldActiveBranch.events.off(eventName, listener);\n\t\t\t\tthis.activeBranch.events.on(eventName, listener);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/shared-tree-core/transaction.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OA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,CAAC;wBACD,gBAAgB,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;oBACvC,CAAC;iBACD,CAAC;YACH,CAAC,CAAC;YACF,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;QAC1E,CAAC,CACD,CAAC;QAxNc,WAAM,GAAN,MAAM,CAAoC;QAhE3D,+DAAwD;QAExD;;;;WAIG;QACa,uBAAkB,GAAG,IAAI,KAAK,CAAU,EAAwB,EAAE;YACjF,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE;gBACvB,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC;YAC3D,CAAC;SACD,CAAC,CAAC;QAoCM,wDAAsB,IAAI,GAAG,EAKnC,EAAC;IAqOJ,CAAC;IAED,sGAAsG;IAC9F,oBAAoB,CAC3B,iBAAiE;QAEjE,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC;QAC1C,uBAAA,IAAI,gDAAsB,iBAAiB,MAAA,CAAC;QAC5C,KAAK,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,uBAAA,IAAI,qDAAoB,EAAE,CAAC;YAC/D,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;gBAClC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;gBAChD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAClD,CAAC;QACF,CAAC;IACF,CAAC;CACD","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, Listenable } from \"@fluidframework/core-interfaces\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tdiffHistories,\n\tfindAncestor,\n\tfindCommonAncestor,\n\tmintCommit,\n\trebaseBranch,\n\ttagChange,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n} from \"../core/index.js\";\nimport { getLast, getOrCreate } from \"../util/index.js\";\n\nimport type { SharedTreeBranch, SharedTreeBranchEvents } from \"./branch.js\";\n\n/**\n * Describes the result of a transaction.\n * Transactions may either succeed and commit, or fail and abort.\n */\nexport enum TransactionResult {\n\t/**\n\t * Indicates the transaction failed.\n\t */\n\tAbort,\n\t/**\n\t * Indicates the transaction succeeded.\n\t */\n\tCommit,\n}\n\n/**\n * A simple API for managing transactions.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n */\nexport interface Transactor<TOptions> {\n\t/**\n\t * Start a new transaction.\n\t * @param options - Options controlling how the transaction is committed.\n\t * @remarks\n\t * If a transaction is already in progress when this new transaction starts, then this transaction will be \"nested\" inside of it,\n\t * i.e. the outer transaction will still be in progress after this new transaction is committed or aborted.\n\t */\n\tstart(options?: TOptions): void;\n\t/**\n\t * Close this transaction by squashing its edits and committing them as a single edit.\n\t * @remarks If this is the root checkout and there are no ongoing transactions remaining, the squashed edit will be submitted to Fluid.\n\t */\n\tcommit(): void;\n\t/**\n\t * Close this transaction and revert the state of the tree to what it was before this transaction began.\n\t */\n\tabort(): void;\n\t/**\n\t * The number of transactions currently in progress, including any nested transactions.\n\t * @remarks This is 0 when no transaction is in progress, 1 when a single transaction is in progress, 2 when a transaction is nested inside another, etc.\n\t */\n\tsize: number;\n\t/**\n\t * Provides events for changes in transaction progress.\n\t */\n\tevents: Listenable<TransactionEvents>;\n}\n\nexport interface TransactionEvents {\n\t/**\n\t * Raised just after a transaction has begun.\n\t * @remarks When this event fires, {@link Transactor.size} will be greater than 0 because the transaction has already begun.\n\t */\n\tstarted(): void;\n\t/**\n\t * Raised just before a transaction is aborted.\n\t * @remarks When this event fires, {@link Transactor.size} will still be greater than 0 because the transaction has not yet ended.\n\t */\n\taborting(): void;\n\t/**\n\t * Raised just before a transaction is committed.\n\t * @remarks When this event fires, {@link Transactor.size} will still be greater than 0 because the transaction has not yet ended.\n\t */\n\tcommitting(): void;\n}\n\n/**\n * Callbacks for transaction lifecycle events.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n */\nexport interface Callbacks<TOptions> {\n\t/**\n\t * Called when the current transaction is popped from the {@link TransactionStack | stack}.\n\t */\n\treadonly onPop?: OnPop;\n\t/**\n\t * Called when a nested transaction is pushed onto the {@link TransactionStack | stack}.\n\t * @remarks\n\t * Transactions may be arbitrarily nested (by {@link TransactionStack.start | start}ing a transaction within a transaction that is already in progress).\n\t * The `OnPush` callback for an (outer) transaction may optionally return another `OnPush` callback that is associated with any nested (inner) transaction(s).\n\t * In that case, the inner `OnPush` will be called when those inner transactions are pushed and the outer `OnPush` will not be called.\n\t * Put another way, a transaction always results in a call to exactly one `OnPush` callback - whichever is closest to the transaction.\n\t * The event \"bubbles up\" to (and no further past) its first registered callback.\n\t */\n\treadonly onPush?: OnPush<TOptions>;\n}\n\n/**\n * A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.\n * @remarks This function may return other functions that will be called when the transaction is popped from the stack or a nested transaction is pushed onto the stack.\n * This function runs just before the transaction begins, so if this is the beginning of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n * @param options - The options passed to {@link Transactor.start | start}.\n */\nexport type OnPush<TOptions> = (options?: TOptions) => Callbacks<TOptions> | void;\n\n/**\n * A function that will be called when a transaction is popped from the {@link TransactionStack | stack}.\n * @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.\n * @param result - The result of the transaction.\n */\nexport type OnPop = (result: TransactionResult) => void;\n\n/**\n * A frame in the transaction stack.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n */\ninterface TransactionStackFrame<TOptions> {\n\t/** The callbacks provided when this transaction frame was pushed onto the stack. */\n\treadonly callbacks: Callbacks<TOptions>;\n}\n\n/**\n * An implementation of {@link Transactor} that uses a stack to manage transactions.\n * @remarks Using a stack allows transactions to nest - i.e. an inner transaction may be started while an outer transaction is already in progress.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n */\nexport class TransactionStack<TOptions> implements Transactor<TOptions>, IDisposable {\n\treadonly #stack: TransactionStackFrame<TOptions>[] = [];\n\treadonly #onPush?: OnPush<TOptions>;\n\n\treadonly #events = createEmitter<TransactionEvents>();\n\tpublic get events(): Listenable<TransactionEvents> {\n\t\treturn this.#events;\n\t}\n\n\t#disposed = false;\n\tpublic get disposed(): boolean {\n\t\treturn this.#disposed;\n\t}\n\n\t/**\n\t * Construct a new {@link TransactionStack}.\n\t * @param onPush - A {@link OnPush | function} that will be called when a transaction begins.\n\t */\n\tpublic constructor(onPush?: OnPush<TOptions>) {\n\t\tthis.#onPush = onPush;\n\t}\n\n\tpublic get size(): number {\n\t\tthis.ensureNotDisposed();\n\t\treturn this.#stack.length;\n\t}\n\n\tpublic start(options?: TOptions): void {\n\t\tthis.ensureNotDisposed();\n\t\tconst last = getLast(this.#stack);\n\t\tconst onPushCurrent = last === undefined ? this.#onPush : last.callbacks.onPush;\n\t\tconst { onPush, onPop } = onPushCurrent?.(options) ?? {};\n\t\tthis.#stack.push({\n\t\t\tcallbacks: { onPop, onPush: onPush ?? onPushCurrent },\n\t\t});\n\t\tthis.#events.emit(\"started\");\n\t}\n\n\tpublic commit(): void {\n\t\tthis.ensureNotDisposed();\n\t\tif (this.size === 0) {\n\t\t\tthrow new UsageError(\"No transaction to commit\");\n\t\t}\n\t\tthis.#events.emit(\"committing\");\n\t\tthis.#stack.pop()?.callbacks.onPop?.(TransactionResult.Commit);\n\t}\n\n\tpublic abort(): void {\n\t\tthis.ensureNotDisposed();\n\t\tif (this.size === 0) {\n\t\t\tthrow new UsageError(\"No transaction to abort\");\n\t\t}\n\t\tthis.#events.emit(\"aborting\");\n\t\tthis.#stack.pop()?.callbacks.onPop?.(TransactionResult.Abort);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.ensureNotDisposed();\n\t\twhile (this.size > 0) {\n\t\t\tthis.abort();\n\t\t}\n\t\tthis.#disposed = true;\n\t}\n\n\tprivate ensureNotDisposed(): void {\n\t\tif (this.disposed) {\n\t\t\tthrow new UsageError(\"Transactor is disposed\");\n\t\t}\n\t}\n}\n\n/**\n * A function that will be called when a transaction is popped from the {@link SquashingTransactionStack | stack}.\n * @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.\n * @param result - The result of the transaction.\n * @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.\n * This is needed in asynchronous transactions where new commits have been added to the branch while the transaction was in progress.\n * This will be `undefined` if no such change is necessary.\n */\nexport type OnPopWithViewUpdate<TChange> = (\n\tresult: TransactionResult,\n\tviewUpdate: TChange | undefined,\n) => void;\n\n/**\n * Informs the caller of {@link ChangeProcessor} what context it should be invoked for.\n * @remarks This is purely a recommendation to the caller of the processor and\n * not a strict rule.\n */\nexport enum ChangeProcessorApplicability {\n\t/**\n\t * Invoke the processor if no later (outer) instance of this change processor\n\t * may be applied to related changes before changes are \"visible\".\n\t *\n\t * @remarks\n\t * This designation is meant for processors that only need to be applied\n\t * once to a set of related changes independent of scope or nesting,\n\t * with the understanding that the processor should still be applied no\n\t * later than when the changes are \"visible\" (e.g. committed to a branch).\n\t * For example, a processor that removes extraneous information from a\n\t * change (e.g. data for nodes that were both created and removed within a\n\t * transaction) only needs to be applied once to the squashed change\n\t * produced by the outermost transaction.\n\t */\n\tIfOutermost,\n\t/**\n\t * Invoke the processor in all contexts.\n\t */\n\tAlways,\n}\n\n/**\n * Processes a change altering its representation.\n *\n * @remarks\n * A change processor receives a change and returns a change with the\n * same observable effect but otherwise transformed.\n *\n * Currently this is the internal counterpart of the type-erased post-processor\n * exposed on the public transaction API. The public boundary type-erases this\n * (see the conversion helpers in the `shared-tree` layer) so that its internal\n * change representation does not leak into the public API.\n */\nexport interface ChangeProcessor<TChange> {\n\t/**\n\t * Informs what context it should be invoked for.\n\t */\n\treadonly applicability: ChangeProcessorApplicability;\n\t/**\n\t * Processes the given change, returning a change with the same observable effect.\n\t */\n\treadonly processChange: (change: TChange) => TChange;\n}\n\n/**\n * Options for {@link Transactor.start | starting} a transaction.\n */\nexport interface SquashingTransactionOptions<TChange> {\n\t/**\n\t * An optional {@link ChangeProcessor} applied to the squashed change produced when a transaction that was started\n\t * with this option is committed.\n\t *\n\t * @remarks\n\t * When omitted, the transaction's edits are squashed without any post-processing.\n\t *\n\t * How often the processor is invoked across nested transactions is governed by its\n\t * {@link ChangeProcessor.applicability | applicability}.\n\t */\n\treadonly postProcessor?: ChangeProcessor<TChange>;\n}\n\n/**\n * An implementation of {@link Transactor} that {@link TransactionStack | uses a stack} and a {@link SharedTreeBranch | branch} to manage transactions.\n * @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.\n * This class provides conveniences for interacting with the {@link SquashingTransactionStack.activeBranch | active branch} in a way that is stable across transaction boundaries.\n * For example, see {@link SquashingTransactionStack.activeBranchEditor | activeBranchEditor} and {@link SquashingTransactionStack.activeBranchEvents | activeBranchEvents}.\n */\nexport class SquashingTransactionStack<\n\tTEditor extends ChangeFamilyEditor,\n\tTChange,\n> extends TransactionStack<SquashingTransactionOptions<TChange>> {\n\t#transactionBranch?: SharedTreeBranch<TEditor, TChange>;\n\n\t/**\n\t * An editor for whichever branch is currently the {@link SquashingTransactionStack.activeBranch | active branch}.\n\t * @remarks This editor can safely be held on to across transaction boundaries, as it will properly delegate to the correct branch.\n\t * In contrast, it is not safe to hold onto e.g. `activeBranch.editor` across transaction boundaries, since the active branch may change.\n\t */\n\tpublic readonly activeBranchEditor = new Proxy<TEditor>({} as unknown as TEditor, {\n\t\tget: (_, p, receiver) => {\n\t\t\treturn Reflect.get(this.activeBranch.editor, p, receiver);\n\t\t},\n\t});\n\n\t/**\n\t * Get the \"active branch\" for this transactor - either the transaction branch if a transaction is in progress, or the original branch otherwise.\n\t */\n\tpublic get activeBranch(): SharedTreeBranch<TEditor, TChange> {\n\t\treturn this.#transactionBranch ?? this.branch;\n\t}\n\n\t/**\n\t * Provides events for changes in the {@link SquashingTransactionStack.activeBranch | active branch}.\n\t * @remarks When the active branch changes, the listeners for these events will automatically be transferred to the new active branch.\n\t * In contrast, binding an event to the {@link SquashingTransactionStack.activeBranch | active branch} directly will not automatically transfer the listener when the active branch changes.\n\t */\n\tpublic get activeBranchEvents(): Listenable<SharedTreeBranchEvents<TEditor, TChange>> {\n\t\tconst off = (\n\t\t\teventName: keyof SharedTreeBranchEvents<TEditor, TChange>,\n\t\t\tlistener: SharedTreeBranchEvents<TEditor, TChange>[typeof eventName],\n\t\t): void => {\n\t\t\tthis.activeBranch.events.off(eventName, listener);\n\t\t\tconst listeners = this.#activeBranchEvents.get(eventName);\n\t\t\tif (listeners?.delete(listener) === true && listeners.size === 0) {\n\t\t\t\tthis.#activeBranchEvents.delete(eventName);\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\ton: (eventName, listener) => {\n\t\t\t\tconst listeners = getOrCreate(this.#activeBranchEvents, eventName, () => new Set());\n\t\t\t\tlisteners.add(listener);\n\t\t\t\tthis.activeBranch.events.on(eventName, listener);\n\t\t\t\treturn () => off(eventName, listener);\n\t\t\t},\n\t\t\toff,\n\t\t};\n\t}\n\treadonly #activeBranchEvents = new Map<\n\t\tkeyof SharedTreeBranchEvents<TEditor, TChange>,\n\t\tSet<\n\t\t\tSharedTreeBranchEvents<TEditor, TChange>[keyof SharedTreeBranchEvents<TEditor, TChange>]\n\t\t>\n\t>();\n\n\t/**\n\t * Construct a new {@link SquashingTransactionStack}.\n\t * @param branch - The {@link SquashingTransactionStack.branch | branch} that will be forked off of when a transaction begins.\n\t * @param onPush - A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.\n\t * @remarks To post-process the squashed change produced when a transaction is committed (for example, to \"minimize\"\n\t * it so that it contains no extraneous information), start the transaction with a\n\t * {@link SquashingTransactionOptions.postProcessor | post-processor}. The post-processor is injected via the transaction\n\t * options rather than baked into this stack, so different transactions may supply different post-processors (or none).\n\t */\n\tpublic constructor(\n\t\tpublic readonly branch: SharedTreeBranch<TEditor, TChange>,\n\t\tmintRevisionTag: () => RevisionTag,\n\t\tonPush?: () => OnPopWithViewUpdate<TChange> | void,\n\t) {\n\t\t// A stack of the post-processors to apply when each in-progress transaction commits, ordered from outermost to\n\t\t// innermost. Each in-progress transaction contributes exactly one entry: either the processor to apply when it\n\t\t// commits, or `undefined` when none should be applied.\n\t\tconst postProcessorStack: (ChangeProcessor<TChange> | undefined)[] = [];\n\t\t// Determines the entry to push for a transaction that was started with the given `requested` processor (if any).\n\t\t// A processor with \"outermost\" applicability that is already active in an enclosing transaction resolves to\n\t\t// `undefined` so that it is only applied once (at the outermost transaction that supplied it).\n\t\tconst resolvePostProcessor = (\n\t\t\trequested: ChangeProcessor<TChange> | undefined,\n\t\t): ChangeProcessor<TChange> | undefined => {\n\t\t\tif (\n\t\t\t\trequested?.applicability === ChangeProcessorApplicability.IfOutermost &&\n\t\t\t\tpostProcessorStack.includes(requested)\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn requested;\n\t\t};\n\n\t\tsuper(\n\t\t\t// Invoked when an outer transaction starts\n\t\t\t(\n\t\t\t\tstartOptions?: SquashingTransactionOptions<TChange>,\n\t\t\t): Callbacks<SquashingTransactionOptions<TChange>> => {\n\t\t\t\tpostProcessorStack.push(resolvePostProcessor(startOptions?.postProcessor));\n\t\t\t\t// Keep track of the commit that each transaction was on when it started\n\t\t\t\tconst startHead = this.activeBranch.getHead();\n\t\t\t\tconst rebaser = this.branch.changeFamily.rebaser;\n\t\t\t\tconst outerOnPop = onPush?.();\n\t\t\t\tlet transactionRevision: RevisionTag | undefined;\n\t\t\t\tconst transactionBranch = this.branch.fork(\n\t\t\t\t\tstartHead,\n\t\t\t\t\t// Lazily mint the revision tag for the transaction when it is first needed\n\t\t\t\t\t() => (transactionRevision ??= mintRevisionTag()),\n\t\t\t\t);\n\t\t\t\tthis.setTransactionBranch(transactionBranch);\n\t\t\t\ttransactionBranch.editor.enterTransaction();\n\n\t\t\t\t// Invoked when an outer transaction ends\n\t\t\t\tconst onOuterTransactionPop: OnPop = (result) => {\n\t\t\t\t\tassert(this.size === 0, 0xcae /* The outer transaction should be ending */);\n\t\t\t\t\tconst postProcessor = postProcessorStack.pop();\n\t\t\t\t\ttransactionBranch.editor.exitTransaction();\n\n\t\t\t\t\tconst sourcePath: GraphCommit<TChange>[] = [];\n\t\t\t\t\tconst targetPath: GraphCommit<TChange>[] = [];\n\t\t\t\t\tconst ancestor = findCommonAncestor(\n\t\t\t\t\t\t[startHead, sourcePath],\n\t\t\t\t\t\t[branch.getHead(), targetPath],\n\t\t\t\t\t);\n\t\t\t\t\tassert(ancestor !== undefined, 0xcce /* branches must be related */);\n\n\t\t\t\t\tconst transactionSteps: GraphCommit<TChange>[] = [];\n\t\t\t\t\tfindAncestor(\n\t\t\t\t\t\t[transactionBranch.getHead(), transactionSteps],\n\t\t\t\t\t\t(c) => c === startHead,\n\t\t\t\t\t);\n\n\t\t\t\t\tlet viewUpdate: TChange | undefined;\n\t\t\t\t\tswitch (result) {\n\t\t\t\t\t\tcase TransactionResult.Abort: {\n\t\t\t\t\t\t\t// When a transaction is aborted, roll back all the transaction's changes on the current branch.\n\t\t\t\t\t\t\t// It is important that this happens before and separately from updating the view because the `TreeCheckout` needs to\n\t\t\t\t\t\t\t// revert some internal (state to match what it was before the transaction began) before applying the view update (if any).\n\t\t\t\t\t\t\ttransactionBranch.removeAfter(startHead);\n\t\t\t\t\t\t\t// If changes were made on `branch` since the transaction began, the view will need to be updated to reflect those changes.\n\t\t\t\t\t\t\tif (targetPath.length > 0) {\n\t\t\t\t\t\t\t\tviewUpdate = diffHistories(\n\t\t\t\t\t\t\t\t\trebaser,\n\t\t\t\t\t\t\t\t\tstartHead,\n\t\t\t\t\t\t\t\t\tthis.branch.getHead(),\n\t\t\t\t\t\t\t\t\tmintRevisionTag,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TransactionResult.Commit: {\n\t\t\t\t\t\t\tif (transactionSteps.length > 0) {\n\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\ttransactionRevision !== undefined,\n\t\t\t\t\t\t\t\t\t0xccf /* Expected transaction revision in the presence of transaction steps */,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tfor (const commit of transactionSteps) {\n\t\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\t\tcommit.revision === transactionRevision,\n\t\t\t\t\t\t\t\t\t\t0xcaf /* Unexpected commit in transaction */,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Squash all the new commits on the transaction branch into a new commit on the original branch\n\t\t\t\t\t\t\t\tconst squash = rebaser.compose(transactionSteps);\n\t\t\t\t\t\t\t\t// Apply this transaction's post-processor (if any) to the squashed change (for example, to\n\t\t\t\t\t\t\t\t// \"minimize\" it so that it contains no extraneous information).\n\t\t\t\t\t\t\t\tconst change =\n\t\t\t\t\t\t\t\t\tpostProcessor === undefined ? squash : postProcessor.processChange(squash);\n\n\t\t\t\t\t\t\t\tif (change !== squash) {\n\t\t\t\t\t\t\t\t\t// The post-processor produced a change that differs from the\n\t\t\t\t\t\t\t\t\t// one that was applied to the view as the transaction's edits\n\t\t\t\t\t\t\t\t\t// were made. Roll back the transaction's changes on the transaction\n\t\t\t\t\t\t\t\t\t// branch (which rolls back the view) and apply the post-processed\n\t\t\t\t\t\t\t\t\t// change in their place so that the view fully reflects the modified\n\t\t\t\t\t\t\t\t\t// `change`.\n\t\t\t\t\t\t\t\t\ttransactionBranch.removeAfter(startHead);\n\t\t\t\t\t\t\t\t\ttransactionBranch.apply(tagChange(change, transactionRevision));\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (targetPath.length === 0) {\n\t\t\t\t\t\t\t\t\t// No changes were made on the original branch since the transaction began\n\t\t\t\t\t\t\t\t\t// The transaction commit can be applied directly\n\t\t\t\t\t\t\t\t\tthis.branch.apply(tagChange(change, transactionRevision));\n\t\t\t\t\t\t\t\t\t// The view is already up-to-date so there's nothing more to do\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Some changes were made on `branch` since the transaction began\n\t\t\t\t\t\t\t\t\tconst unrebasedHead = mintCommit(startHead, {\n\t\t\t\t\t\t\t\t\t\tchange,\n\t\t\t\t\t\t\t\t\t\trevision: transactionRevision,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t// We need to rebase the transaction commit on top of the new changes\n\t\t\t\t\t\t\t\t\tconst rebased = rebaseBranch(\n\t\t\t\t\t\t\t\t\t\tmintRevisionTag,\n\t\t\t\t\t\t\t\t\t\trebaser,\n\t\t\t\t\t\t\t\t\t\tunrebasedHead,\n\t\t\t\t\t\t\t\t\t\tbranch.getHead(),\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\t\trebased.newSourceHead.revision === transactionRevision,\n\t\t\t\t\t\t\t\t\t\t0xcd0 /* The transaction commit should be rebased to the tip */,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tthis.branch.apply(rebased.newSourceHead);\n\t\t\t\t\t\t\t\t\tviewUpdate = rebased.sourceChange;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (targetPath.length > 0) {\n\t\t\t\t\t\t\t\t\t// Changes were made on `branch` since the transaction began.\n\t\t\t\t\t\t\t\t\t// The view will need to be updated to reflect those changes.\n\t\t\t\t\t\t\t\t\tviewUpdate = diffHistories(\n\t\t\t\t\t\t\t\t\t\trebaser,\n\t\t\t\t\t\t\t\t\t\tstartHead,\n\t\t\t\t\t\t\t\t\t\tthis.branch.getHead(),\n\t\t\t\t\t\t\t\t\t\tmintRevisionTag,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\tunreachableCase(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ttransactionBranch.dispose();\n\t\t\t\t\tthis.setTransactionBranch(undefined);\n\t\t\t\t\touterOnPop?.(result, viewUpdate);\n\t\t\t\t};\n\t\t\t\t// Invoked when a nested transaction begins\n\t\t\t\tconst onNestedTransactionPush: OnPush<SquashingTransactionOptions<TChange>> = (\n\t\t\t\t\tnestedStartOptions,\n\t\t\t\t) => {\n\t\t\t\t\tpostProcessorStack.push(resolvePostProcessor(nestedStartOptions?.postProcessor));\n\t\t\t\t\tconst nestedStartHead = this.activeBranch.getHead();\n\t\t\t\t\tconst nestedOuterOnPop = onPush?.();\n\t\t\t\t\ttransactionBranch.editor.enterTransaction();\n\t\t\t\t\treturn {\n\t\t\t\t\t\t// Invoked when a nested transaction ends\n\t\t\t\t\t\tonPop: (result) => {\n\t\t\t\t\t\t\tconst nestedPostProcessor = postProcessorStack.pop();\n\t\t\t\t\t\t\ttransactionBranch.editor.exitTransaction();\n\t\t\t\t\t\t\tswitch (result) {\n\t\t\t\t\t\t\t\tcase TransactionResult.Abort: {\n\t\t\t\t\t\t\t\t\t// When a transaction is aborted, roll back all the transaction's changes on the current branch\n\t\t\t\t\t\t\t\t\ttransactionBranch.removeAfter(nestedStartHead);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase TransactionResult.Commit: {\n\t\t\t\t\t\t\t\t\t// When this nested transaction supplied a post-processor that should be applied here, squash its\n\t\t\t\t\t\t\t\t\t// edits into a single (post-processed) commit on the transaction branch rather than leaving them to\n\t\t\t\t\t\t\t\t\t// be squashed only when the outermost transaction is committed.\n\t\t\t\t\t\t\t\t\tif (nestedPostProcessor !== undefined) {\n\t\t\t\t\t\t\t\t\t\tconst nestedSteps: GraphCommit<TChange>[] = [];\n\t\t\t\t\t\t\t\t\t\tfindAncestor(\n\t\t\t\t\t\t\t\t\t\t\t[transactionBranch.getHead(), nestedSteps],\n\t\t\t\t\t\t\t\t\t\t\t(c) => c === nestedStartHead,\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tif (nestedSteps.length > 0) {\n\t\t\t\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\t\t\t\ttransactionRevision !== undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t0xd07 /* Expected transaction revision in the presence of transaction steps */,\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tconst squash = rebaser.compose(nestedSteps);\n\t\t\t\t\t\t\t\t\t\t\tconst processedSquash = nestedPostProcessor.processChange(squash);\n\t\t\t\t\t\t\t\t\t\t\t// Roll back the transaction branch to the nested start head and apply the\n\t\t\t\t\t\t\t\t\t\t\t// processed change if it differs from the original change.\n\t\t\t\t\t\t\t\t\t\t\tif (processedSquash !== squash) {\n\t\t\t\t\t\t\t\t\t\t\t\ttransactionBranch.removeAfter(nestedStartHead);\n\t\t\t\t\t\t\t\t\t\t\t\ttransactionBranch.apply(\n\t\t\t\t\t\t\t\t\t\t\t\t\ttagChange(processedSquash, transactionRevision),\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\t\tunreachableCase(result);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tnestedOuterOnPop?.(result, undefined);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t\treturn { onPop: onOuterTransactionPop, onPush: onNestedTransactionPush };\n\t\t\t},\n\t\t);\n\t}\n\n\t/** Updates the transaction branch (and therefore the active branch) and rebinds the branch events. */\n\tprivate setTransactionBranch(\n\t\ttransactionBranch: SharedTreeBranch<TEditor, TChange> | undefined,\n\t): void {\n\t\tconst oldActiveBranch = this.activeBranch;\n\t\tthis.#transactionBranch = transactionBranch;\n\t\tfor (const [eventName, listeners] of this.#activeBranchEvents) {\n\t\t\tfor (const listener of listeners) {\n\t\t\t\toldActiveBranch.events.off(eventName, listener);\n\t\t\t\tthis.activeBranch.events.on(eventName, listener);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -22,7 +22,7 @@ export { type JsonSchemaId, type JsonSchemaType, type JsonObjectNodeSchema, type
22
22
  export type { TreeSchemaEncodingOptions } from "./getJsonSchema.js";
23
23
  export { getJsonSchema } from "./getJsonSchema.js";
24
24
  export { getSimpleSchema } from "./getSimpleSchema.js";
25
- export { SchemaCompatibilityTester } from "./schemaCompatibilityTester.js";
25
+ export { checkSchemaCompatibility } from "./schemaCompatibilityTester.js";
26
26
  export type { Unenforced, FieldSchemaAlphaUnsafe, ArrayNodeCustomizableSchemaUnsafe, MapNodeCustomizableSchemaUnsafe, System_Unsafe, TreeRecordNodeUnsafe, UnannotateAllowedTypeUnsafe, AnnotatedAllowedTypeUnsafe, AnnotatedAllowedTypesUnsafe, AllowedTypesFullUnsafe, AllowedTypesFullFromMixedUnsafe, UnannotateAllowedTypesListUnsafe, AnnotateAllowedTypesListUnsafe, FieldHasDefaultAlphaUnsafe, InsertableObjectFromSchemaRecordAlphaUnsafe, } from "./typesUnsafe.js";
27
27
  export { type VerboseTreeNode, type VerboseTree, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, replaceVerboseTreeHandles, } from "./verboseTree.js";
28
28
  export { type TreeEncodingOptions, customFromCursorStored, type CustomTreeNode, type CustomTreeValue, tryStoredSchemaAsArray, replaceHandles, type HandleConverter, KeyEncodingOptions, type TreeParsingOptions, } from "./customTree.js";
@@ -32,7 +32,7 @@ export { type ArrayNodeDeltaOp, type ArrayNodeInsertOp, type ArrayNodeRemoveOp,
32
32
  export { createTreeIndex, type TreeIndexKey } from "./simpleTreeIndex.js";
33
33
  export { createIdentifierIndex, type IdentifierIndex, } from "./identifierIndex.js";
34
34
  export { extractPersistedSchema, comparePersistedSchema, } from "./storedSchema.js";
35
- export { type TransactionConstraint, type TransactionConstraintAlpha, type NodeInDocumentConstraint, type NoChangeConstraint, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, type WithValue, rollback, } from "./transactionTypes.js";
35
+ export { type NoChangeConstraint, type NodeInDocumentConstraint, rollback, type RunTransactionParamsAlpha, type RunTransactionParamsBeta, type TransactionCallbackStatusAlpha, type TransactionCallbackStatusBeta, type TransactionConstraint, type TransactionConstraintAlpha, type TransactionPostProcessor, type TransactionResultFailed, type TransactionResultSuccess, type TransactionValueResult, type TransactionVoidResult, type VoidTransactionCallbackStatusAlpha, type VoidTransactionCallbackStatusBeta, type WithValue, } from "./transactionTypes.js";
36
36
  export { generateSchemaFromSimpleSchema } from "./schemaFromSimple.js";
37
37
  export type { TreeChangeEvents } from "./treeChangeEvents.js";
38
38
  export { incrementalEncodingPolicyForAllowedTypes, incrementalSummaryHint, } from "./incrementalAllowedTypes.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;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AC;AACtC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,GACjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,EACjC,kBAAkB,EAClB,2BAA2B,EAC3B,KAAK,kBAAkB,EACvB,KAAK,kCAAkC,GACvC,MAAM,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACX,sBAAsB,EACtB,yBAAyB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,qBAAqB,EACrB,0BAA0B,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACX,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,yBAAyB,EACzB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,KAAK,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EACN,aAAa,EACb,MAAM,EACN,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EACN,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,KAAK,YAAY,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,kBAAkB,EAClB,8BAA8B,GAC9B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,YAAY,EACZ,UAAU,EACV,wBAAwB,GACxB,MAAM,yBAAyB,CAAC;AACjC,Y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,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,kCAAkC,EACvC,KAAK,iCAAiC,EACtC,KAAK,SAAS,GACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACN,wCAAwC,EACxC,sBAAsB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,GACjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,EACjC,kBAAkB,EAClB,2BAA2B,EAC3B,KAAK,kBAAkB,EACvB,KAAK,kCAAkC,GACvC,MAAM,mCAAmC,CAAC"}
@@ -16,7 +16,7 @@ export { createFromCursor } from "./create.js";
16
16
  export { trackDirtyNodes, } from "./dirtyIndex.js";
17
17
  export { getJsonSchema } from "./getJsonSchema.js";
18
18
  export { getSimpleSchema } from "./getSimpleSchema.js";
19
- export { SchemaCompatibilityTester } from "./schemaCompatibilityTester.js";
19
+ export { checkSchemaCompatibility } from "./schemaCompatibilityTester.js";
20
20
  export { applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, replaceVerboseTreeHandles, } from "./verboseTree.js";
21
21
  export { customFromCursorStored, tryStoredSchemaAsArray, replaceHandles, KeyEncodingOptions, } from "./customTree.js";
22
22
  export { conciseFromCursor, replaceConciseTreeHandles, } from "./conciseTree.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACN,qBAAqB,EACrB,0BAA0B,GAC1B,MAAM,oBAAoB,CAAC;AAe5B,OAAO,EAAE,eAAe,EAAE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E,OAAO,EACN,qBAAqB,GAErB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACN,sBAAsB,EACtB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAaN,QAAQ,GACR,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EACN,wCAAwC,EACxC,sBAAsB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,GACjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,EACjC,kBAAkB,EAClB,2BAA2B,GAG3B,MAAM,mCAAmC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tITreeViewConfiguration,\n\tITreeConfigurationOptions,\n} from \"./configuration.js\";\nexport {\n\tTreeViewConfiguration,\n\tTreeViewConfigurationAlpha,\n} from \"./configuration.js\";\nexport type {\n\tITree,\n\tTreeView,\n\tViewableTree,\n\tTreeViewEvents,\n\tSchemaCompatibilityStatus,\n\tTreeViewAlpha,\n\tTreeViewBeta,\n\tTreeBranch,\n\tTreeBranchAlpha,\n\tTreeBranchEvents,\n\tTreeContextAlpha,\n\tITreeAlpha,\n} from \"./tree.js\";\nexport { asTreeViewAlpha } from \"./tree.js\";\nexport { type SchemaStatics, schemaStatics } from \"./schemaStatics.js\";\nexport {\n\tSchemaFactory,\n\tscoped,\n\ttype ScopedSchemaName,\n\ttype ObjectSchemaOptionsAlpha,\n\ttype ObjectSchemaOptions,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaOptionsAlpha,\n\ttype SchemaFactory_base,\n} from \"./schemaFactory.js\";\nexport { SchemaFactoryBeta, type SchemaStaticsBeta } from \"./schemaFactoryBeta.js\";\nexport {\n\tSchemaFactoryAlpha,\n\ttype SchemaStaticsAlpha,\n\ttype NodeProvider,\n} from \"./schemaFactoryAlpha.js\";\nexport {\n\teraseSchemaDetails,\n\teraseSchemaDetailsSubclassable,\n} from \"./eraseSchemaDetails.js\";\nexport type {\n\tErasedSchema,\n\tErasedNode,\n\tErasedSchemaSubclassable,\n} from \"./eraseSchemaDetails.js\";\nexport type {\n\tValidateRecursiveSchema,\n\tFixRecursiveArraySchema,\n\tValidateRecursiveSchemaTemplate,\n\tFixRecursiveRecursionLimit,\n} from \"./schemaFactoryRecursive.js\";\nexport { allowUnused } from \"./schemaFactoryRecursive.js\";\nexport {\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\tcreateCustomizedFluidFrameworkScopedFactory,\n} from \"./schemaCreationUtilities.js\";\nexport {\n\tdeltaMarksToArrayOps,\n\tgetIdentifierFromNode,\n\tgetPropertyKeyFromStoredKey,\n\tgetStoredKey,\n\ttreeNodeApi,\n\ttype TreeNodeApi,\n\ttryGetSchema,\n} from \"./treeNodeApi.js\";\nexport { createFromCursor } from \"./create.js\";\nexport {\n\ttype DirtyTreeStatus,\n\ttrackDirtyNodes,\n\ttype DirtyTreeMap,\n} from \"./dirtyIndex.js\";\nexport {\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n\ttype JsonRecordNodeSchema,\n\ttype JsonStringKeyPatternProperties,\n} from \"./jsonSchema.js\";\nexport type { TreeSchemaEncodingOptions } from \"./getJsonSchema.js\";\nexport { getJsonSchema } from \"./getJsonSchema.js\";\nexport { getSimpleSchema } from \"./getSimpleSchema.js\";\nexport { SchemaCompatibilityTester } from \"./schemaCompatibilityTester.js\";\nexport type {\n\tUnenforced,\n\tFieldSchemaAlphaUnsafe,\n\tArrayNodeCustomizableSchemaUnsafe,\n\tMapNodeCustomizableSchemaUnsafe,\n\tSystem_Unsafe,\n\tTreeRecordNodeUnsafe,\n\tUnannotateAllowedTypeUnsafe,\n\tAnnotatedAllowedTypeUnsafe,\n\tAnnotatedAllowedTypesUnsafe,\n\tAllowedTypesFullUnsafe,\n\tAllowedTypesFullFromMixedUnsafe,\n\tUnannotateAllowedTypesListUnsafe,\n\tAnnotateAllowedTypesListUnsafe,\n\tFieldHasDefaultAlphaUnsafe,\n\tInsertableObjectFromSchemaRecordAlphaUnsafe,\n} from \"./typesUnsafe.js\";\n\nexport {\n\ttype VerboseTreeNode,\n\ttype VerboseTree,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n\treplaceVerboseTreeHandles,\n} from \"./verboseTree.js\";\n\nexport {\n\ttype TreeEncodingOptions,\n\tcustomFromCursorStored,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttryStoredSchemaAsArray,\n\treplaceHandles,\n\ttype HandleConverter,\n\tKeyEncodingOptions,\n\ttype TreeParsingOptions,\n} from \"./customTree.js\";\n\nexport {\n\ttype ConciseTree,\n\tconciseFromCursor,\n\treplaceConciseTreeHandles,\n} from \"./conciseTree.js\";\n\nexport {\n\tborrowCursorFromTreeNodeOrValue,\n\texportConcise,\n\timportConcise,\n\ttype NodeChangedData,\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n} from \"./treeBeta.js\";\nexport {\n\ttype ArrayNodeDeltaOp,\n\ttype ArrayNodeInsertOp,\n\ttype ArrayNodeRemoveOp,\n\ttype ArrayNodeRetainOp,\n\ttype ArrayNodeTreeChangedDeltaOp,\n\ttype ArrayNodeTreeChangedRetainOp,\n\ttype NodeChangedDataAlpha,\n\ttype NodeChangedDataDelta,\n\ttype NodeChangedDataProperties,\n\ttype NodeChangedDataTreeDelta,\n\ttype TreeChangeEventsAlpha,\n} from \"./treeAlpha.js\";\nexport { createTreeIndex, type TreeIndexKey } from \"./simpleTreeIndex.js\";\nexport {\n\tcreateIdentifierIndex,\n\ttype IdentifierIndex,\n} from \"./identifierIndex.js\";\n\nexport {\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n} from \"./storedSchema.js\";\n\nexport {\n\ttype TransactionConstraint,\n\ttype TransactionConstraintAlpha,\n\ttype NodeInDocumentConstraint,\n\ttype NoChangeConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\ttype WithValue,\n\trollback,\n} from \"./transactionTypes.js\";\n\nexport { generateSchemaFromSimpleSchema } from \"./schemaFromSimple.js\";\nexport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\nexport {\n\tincrementalEncodingPolicyForAllowedTypes,\n\tincrementalSummaryHint,\n} from \"./incrementalAllowedTypes.js\";\nexport {\n\tencodeSchemaCompatibilitySnapshot,\n\tdecodeSchemaCompatibilitySnapshot,\n} from \"./simpleSchemaCodec.js\";\nexport {\n\texportCompatibilitySchemaSnapshot,\n\timportCompatibilitySchemaSnapshot,\n\tcheckCompatibility,\n\tsnapshotSchemaCompatibility,\n\ttype SnapshotFileSystem,\n\ttype SnapshotSchemaCompatibilityOptions,\n} from \"./snapshotCompatibilityChecker.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACN,qBAAqB,EACrB,0BAA0B,GAC1B,MAAM,oBAAoB,CAAC;AAe5B,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAsB,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EACN,aAAa,EACb,MAAM,GAON,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAA0B,MAAM,wB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,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EACN,wCAAwC,EACxC,sBAAsB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,GACjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,EACjC,kBAAkB,EAClB,2BAA2B,GAG3B,MAAM,mCAAmC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tITreeViewConfiguration,\n\tITreeConfigurationOptions,\n} from \"./configuration.js\";\nexport {\n\tTreeViewConfiguration,\n\tTreeViewConfigurationAlpha,\n} from \"./configuration.js\";\nexport type {\n\tITree,\n\tTreeView,\n\tViewableTree,\n\tTreeViewEvents,\n\tSchemaCompatibilityStatus,\n\tTreeViewAlpha,\n\tTreeViewBeta,\n\tTreeBranch,\n\tTreeBranchAlpha,\n\tTreeBranchEvents,\n\tTreeContextAlpha,\n\tITreeAlpha,\n} from \"./tree.js\";\nexport { asTreeViewAlpha } from \"./tree.js\";\nexport { type SchemaStatics, schemaStatics } from \"./schemaStatics.js\";\nexport {\n\tSchemaFactory,\n\tscoped,\n\ttype ScopedSchemaName,\n\ttype ObjectSchemaOptionsAlpha,\n\ttype ObjectSchemaOptions,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaOptionsAlpha,\n\ttype SchemaFactory_base,\n} from \"./schemaFactory.js\";\nexport { SchemaFactoryBeta, type SchemaStaticsBeta } from \"./schemaFactoryBeta.js\";\nexport {\n\tSchemaFactoryAlpha,\n\ttype SchemaStaticsAlpha,\n\ttype NodeProvider,\n} from \"./schemaFactoryAlpha.js\";\nexport {\n\teraseSchemaDetails,\n\teraseSchemaDetailsSubclassable,\n} from \"./eraseSchemaDetails.js\";\nexport type {\n\tErasedSchema,\n\tErasedNode,\n\tErasedSchemaSubclassable,\n} from \"./eraseSchemaDetails.js\";\nexport type {\n\tValidateRecursiveSchema,\n\tFixRecursiveArraySchema,\n\tValidateRecursiveSchemaTemplate,\n\tFixRecursiveRecursionLimit,\n} from \"./schemaFactoryRecursive.js\";\nexport { allowUnused } from \"./schemaFactoryRecursive.js\";\nexport {\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\tcreateCustomizedFluidFrameworkScopedFactory,\n} from \"./schemaCreationUtilities.js\";\nexport {\n\tdeltaMarksToArrayOps,\n\tgetIdentifierFromNode,\n\tgetPropertyKeyFromStoredKey,\n\tgetStoredKey,\n\ttreeNodeApi,\n\ttype TreeNodeApi,\n\ttryGetSchema,\n} from \"./treeNodeApi.js\";\nexport { createFromCursor } from \"./create.js\";\nexport {\n\ttype DirtyTreeStatus,\n\ttrackDirtyNodes,\n\ttype DirtyTreeMap,\n} from \"./dirtyIndex.js\";\nexport {\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n\ttype JsonRecordNodeSchema,\n\ttype JsonStringKeyPatternProperties,\n} from \"./jsonSchema.js\";\nexport type { TreeSchemaEncodingOptions } from \"./getJsonSchema.js\";\nexport { getJsonSchema } from \"./getJsonSchema.js\";\nexport { getSimpleSchema } from \"./getSimpleSchema.js\";\nexport { checkSchemaCompatibility } from \"./schemaCompatibilityTester.js\";\nexport type {\n\tUnenforced,\n\tFieldSchemaAlphaUnsafe,\n\tArrayNodeCustomizableSchemaUnsafe,\n\tMapNodeCustomizableSchemaUnsafe,\n\tSystem_Unsafe,\n\tTreeRecordNodeUnsafe,\n\tUnannotateAllowedTypeUnsafe,\n\tAnnotatedAllowedTypeUnsafe,\n\tAnnotatedAllowedTypesUnsafe,\n\tAllowedTypesFullUnsafe,\n\tAllowedTypesFullFromMixedUnsafe,\n\tUnannotateAllowedTypesListUnsafe,\n\tAnnotateAllowedTypesListUnsafe,\n\tFieldHasDefaultAlphaUnsafe,\n\tInsertableObjectFromSchemaRecordAlphaUnsafe,\n} from \"./typesUnsafe.js\";\n\nexport {\n\ttype VerboseTreeNode,\n\ttype VerboseTree,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n\treplaceVerboseTreeHandles,\n} from \"./verboseTree.js\";\n\nexport {\n\ttype TreeEncodingOptions,\n\tcustomFromCursorStored,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttryStoredSchemaAsArray,\n\treplaceHandles,\n\ttype HandleConverter,\n\tKeyEncodingOptions,\n\ttype TreeParsingOptions,\n} from \"./customTree.js\";\n\nexport {\n\ttype ConciseTree,\n\tconciseFromCursor,\n\treplaceConciseTreeHandles,\n} from \"./conciseTree.js\";\n\nexport {\n\tborrowCursorFromTreeNodeOrValue,\n\texportConcise,\n\timportConcise,\n\ttype NodeChangedData,\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n} from \"./treeBeta.js\";\nexport {\n\ttype ArrayNodeDeltaOp,\n\ttype ArrayNodeInsertOp,\n\ttype ArrayNodeRemoveOp,\n\ttype ArrayNodeRetainOp,\n\ttype ArrayNodeTreeChangedDeltaOp,\n\ttype ArrayNodeTreeChangedRetainOp,\n\ttype NodeChangedDataAlpha,\n\ttype NodeChangedDataDelta,\n\ttype NodeChangedDataProperties,\n\ttype NodeChangedDataTreeDelta,\n\ttype TreeChangeEventsAlpha,\n} from \"./treeAlpha.js\";\nexport { createTreeIndex, type TreeIndexKey } from \"./simpleTreeIndex.js\";\nexport {\n\tcreateIdentifierIndex,\n\ttype IdentifierIndex,\n} from \"./identifierIndex.js\";\n\nexport {\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n} from \"./storedSchema.js\";\n\nexport {\n\ttype NoChangeConstraint,\n\ttype NodeInDocumentConstraint,\n\trollback,\n\ttype RunTransactionParamsAlpha,\n\ttype RunTransactionParamsBeta,\n\ttype TransactionCallbackStatusAlpha,\n\ttype TransactionCallbackStatusBeta,\n\ttype TransactionConstraint,\n\ttype TransactionConstraintAlpha,\n\ttype TransactionPostProcessor,\n\ttype TransactionResultFailed,\n\ttype TransactionResultSuccess,\n\ttype TransactionValueResult,\n\ttype TransactionVoidResult,\n\ttype VoidTransactionCallbackStatusAlpha,\n\ttype VoidTransactionCallbackStatusBeta,\n\ttype WithValue,\n} from \"./transactionTypes.js\";\n\nexport { generateSchemaFromSimpleSchema } from \"./schemaFromSimple.js\";\nexport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\nexport {\n\tincrementalEncodingPolicyForAllowedTypes,\n\tincrementalSummaryHint,\n} from \"./incrementalAllowedTypes.js\";\nexport {\n\tencodeSchemaCompatibilitySnapshot,\n\tdecodeSchemaCompatibilitySnapshot,\n} from \"./simpleSchemaCodec.js\";\nexport {\n\texportCompatibilitySchemaSnapshot,\n\timportCompatibilitySchemaSnapshot,\n\tcheckCompatibility,\n\tsnapshotSchemaCompatibility,\n\ttype SnapshotFileSystem,\n\ttype SnapshotSchemaCompatibilityOptions,\n} from \"./snapshotCompatibilityChecker.js\";\n"]}