@fluidframework/tree 2.103.0 → 2.111.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 (530) hide show
  1. package/.vscode/settings.json +1 -0
  2. package/CHANGELOG.md +109 -0
  3. package/api-report/tree.alpha.api.md +60 -34
  4. package/api-report/tree.beta.api.md +49 -3
  5. package/api-report/tree.legacy.beta.api.md +49 -3
  6. package/dist/codec/versioned/format.js +2 -24
  7. package/dist/codec/versioned/format.js.map +1 -1
  8. package/dist/core/change-family/changeFamily.d.ts +3 -10
  9. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  10. package/dist/core/change-family/changeFamily.js.map +1 -1
  11. package/dist/core/rebase/types.d.ts +2 -2
  12. package/dist/core/rebase/types.js +2 -24
  13. package/dist/core/rebase/types.js.map +1 -1
  14. package/dist/core/schema-stored/formatV1.js +2 -24
  15. package/dist/core/schema-stored/formatV1.js.map +1 -1
  16. package/dist/core/schema-stored/formatV2.js +2 -24
  17. package/dist/core/schema-stored/formatV2.js.map +1 -1
  18. package/dist/core/schema-stored/index.js +3 -25
  19. package/dist/core/schema-stored/index.js.map +1 -1
  20. package/dist/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  21. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  22. package/dist/core/tree/anchorSet.js +4 -8
  23. package/dist/core/tree/anchorSet.js.map +1 -1
  24. package/dist/core/tree/detachedFieldIndexFormatCommon.js +2 -24
  25. package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  26. package/dist/core/tree/detachedFieldIndexFormatV2.js +2 -24
  27. package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  28. package/dist/core/tree/persistedTreeTextFormat.js +2 -24
  29. package/dist/core/tree/persistedTreeTextFormat.js.map +1 -1
  30. package/dist/entrypoints/alpha.d.ts +1 -1
  31. package/dist/entrypoints/alpha.d.ts.map +1 -1
  32. package/dist/entrypoints/alpha.js.map +1 -1
  33. package/dist/entrypoints/beta.d.ts +1 -1
  34. package/dist/entrypoints/beta.d.ts.map +1 -1
  35. package/dist/entrypoints/beta.js.map +1 -1
  36. package/dist/entrypoints/internal.js +2 -15
  37. package/dist/entrypoints/internal.js.map +1 -1
  38. package/dist/entrypoints/legacy.d.ts +1 -1
  39. package/dist/entrypoints/legacy.d.ts.map +1 -1
  40. package/dist/entrypoints/legacy.js.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/chunkedForest.js +7 -11
  42. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +19 -14
  44. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +13 -32
  46. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +85 -28
  48. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  49. package/dist/feature-libraries/chunked-forest/codec/codecs.js +83 -9
  50. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  51. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
  52. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  53. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +11 -0
  54. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  55. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js +2 -24
  56. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js +2 -24
  58. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -1
  59. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js +2 -24
  60. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js +2 -24
  62. package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  66. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  67. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
  68. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  69. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
  70. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  71. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  72. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  73. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  74. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  75. package/dist/feature-libraries/flex-tree/lazyEntity.js +9 -19
  76. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  77. package/dist/feature-libraries/flex-tree/lazyNode.js +3 -13
  78. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  79. package/dist/feature-libraries/forest-summary/codec.d.ts +3 -3
  80. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  81. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  82. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  83. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  84. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -6
  85. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  86. package/dist/feature-libraries/forest-summary/formatCommon.js +2 -24
  87. package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  88. package/dist/feature-libraries/index.d.ts +1 -1
  89. package/dist/feature-libraries/index.d.ts.map +1 -1
  90. package/dist/feature-libraries/index.js +4 -25
  91. package/dist/feature-libraries/index.js.map +1 -1
  92. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js +2 -24
  93. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
  94. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  95. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +9 -9
  96. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  97. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  98. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +10 -30
  99. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  100. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -24
  101. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  102. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +2 -24
  103. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
  104. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +0 -5
  105. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  106. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  107. package/dist/feature-libraries/object-forest/objectForest.js +11 -55
  108. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  109. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js +2 -24
  110. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js.map +1 -1
  111. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js +2 -24
  112. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js.map +1 -1
  113. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js +2 -24
  114. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  115. package/dist/feature-libraries/schema-index/formatV1.js +2 -24
  116. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
  117. package/dist/feature-libraries/schema-index/formatV2.js +2 -24
  118. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
  119. package/dist/feature-libraries/sequence-field/formatV1.js +2 -24
  120. package/dist/feature-libraries/sequence-field/formatV1.js.map +1 -1
  121. package/dist/feature-libraries/sequence-field/formatV2.js +2 -24
  122. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  123. package/dist/feature-libraries/sequence-field/formatV3.js +2 -24
  124. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -1
  125. package/dist/index.d.ts +2 -2
  126. package/dist/index.d.ts.map +1 -1
  127. package/dist/index.js +4 -25
  128. package/dist/index.js.map +1 -1
  129. package/dist/packageVersion.d.ts +1 -1
  130. package/dist/packageVersion.js +1 -1
  131. package/dist/packageVersion.js.map +1 -1
  132. package/dist/shared-tree/independentView.d.ts.map +1 -1
  133. package/dist/shared-tree/independentView.js +4 -7
  134. package/dist/shared-tree/independentView.js.map +1 -1
  135. package/dist/shared-tree/index.d.ts +1 -1
  136. package/dist/shared-tree/index.d.ts.map +1 -1
  137. package/dist/shared-tree/index.js.map +1 -1
  138. package/dist/shared-tree/schematizingTreeView.d.ts +6 -5
  139. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  140. package/dist/shared-tree/schematizingTreeView.js +7 -41
  141. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  142. package/dist/shared-tree/sharedTree.d.ts +5 -1
  143. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  144. package/dist/shared-tree/sharedTree.js +13 -49
  145. package/dist/shared-tree/sharedTree.js.map +1 -1
  146. package/dist/shared-tree/sharedTreeChangeFormat.js +2 -24
  147. package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
  148. package/dist/shared-tree/transactionPostProcessor.d.ts +28 -0
  149. package/dist/shared-tree/transactionPostProcessor.d.ts.map +1 -0
  150. package/dist/shared-tree/transactionPostProcessor.js +28 -0
  151. package/dist/shared-tree/transactionPostProcessor.js.map +1 -0
  152. package/dist/shared-tree/treeAlpha.js +3 -3
  153. package/dist/shared-tree/treeAlpha.js.map +1 -1
  154. package/dist/shared-tree/treeCheckout.d.ts +28 -15
  155. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  156. package/dist/shared-tree/treeCheckout.js +124 -145
  157. package/dist/shared-tree/treeCheckout.js.map +1 -1
  158. package/dist/shared-tree/unhydratedTreeContext.d.ts +5 -5
  159. package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  160. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
  161. package/dist/shared-tree-core/branch.js +13 -17
  162. package/dist/shared-tree-core/branch.js.map +1 -1
  163. package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -2
  164. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  165. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  166. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
  167. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  168. package/dist/shared-tree-core/editManagerCodecsCommons.js +2 -4
  169. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  170. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
  171. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  172. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  173. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
  174. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  175. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  176. package/dist/shared-tree-core/editManagerFormatCommons.js +2 -24
  177. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  178. package/dist/shared-tree-core/editManagerFormatV1toV4.js +2 -24
  179. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  180. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +2 -24
  181. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
  182. package/dist/shared-tree-core/editManagerSummarizer.d.ts +5 -9
  183. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  184. package/dist/shared-tree-core/editManagerSummarizer.js +5 -10
  185. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  186. package/dist/shared-tree-core/index.d.ts +1 -1
  187. package/dist/shared-tree-core/index.d.ts.map +1 -1
  188. package/dist/shared-tree-core/index.js +3 -2
  189. package/dist/shared-tree-core/index.js.map +1 -1
  190. package/dist/shared-tree-core/messageCodecVSharedBranches.js +2 -24
  191. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  192. package/dist/shared-tree-core/messageFormatV1ToV4.js +2 -24
  193. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  194. package/dist/shared-tree-core/messageFormatVSharedBranches.js +2 -24
  195. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  196. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  197. package/dist/shared-tree-core/sharedTreeCore.js +9 -44
  198. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  199. package/dist/shared-tree-core/transaction.d.ts +84 -9
  200. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  201. package/dist/shared-tree-core/transaction.js +94 -37
  202. package/dist/shared-tree-core/transaction.js.map +1 -1
  203. package/dist/simple-tree/api/index.d.ts +1 -1
  204. package/dist/simple-tree/api/index.d.ts.map +1 -1
  205. package/dist/simple-tree/api/index.js.map +1 -1
  206. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  207. package/dist/simple-tree/api/schemaCreationUtilities.js +3 -3
  208. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  209. package/dist/simple-tree/api/schemaFactory.d.ts +1 -1
  210. package/dist/simple-tree/api/schemaFactory.js +2 -2
  211. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  212. package/dist/simple-tree/api/simpleSchemaCodec.js +2 -24
  213. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  214. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
  215. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +4 -26
  216. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  217. package/dist/simple-tree/api/transactionTypes.d.ts +91 -28
  218. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  219. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  220. package/dist/simple-tree/api/tree.d.ts +96 -22
  221. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  222. package/dist/simple-tree/api/tree.js.map +1 -1
  223. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  224. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  225. package/dist/simple-tree/core/treeNodeKernel.js +83 -93
  226. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  227. package/dist/simple-tree/core/treeNodeSchema.d.ts +7 -7
  228. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  229. package/dist/simple-tree/core/unhydratedFlexTree.js +6 -10
  230. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  231. package/dist/simple-tree/index.d.ts +1 -1
  232. package/dist/simple-tree/index.d.ts.map +1 -1
  233. package/dist/simple-tree/index.js.map +1 -1
  234. package/dist/simple-tree/leafNodeSchema.js +2 -12
  235. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  236. package/dist/simple-tree/node-kinds/array/arrayNode.js +2 -6
  237. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  238. package/dist/simple-tree/simpleSchemaFormatV1.js +2 -24
  239. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  240. package/dist/tableSchema.d.ts +50 -4
  241. package/dist/tableSchema.d.ts.map +1 -1
  242. package/dist/tableSchema.js +202 -106
  243. package/dist/tableSchema.js.map +1 -1
  244. package/dist/text/index.d.ts +1 -0
  245. package/dist/text/index.d.ts.map +1 -1
  246. package/dist/text/index.js +3 -1
  247. package/dist/text/index.js.map +1 -1
  248. package/dist/text/textDomainFormatted.d.ts +69 -758
  249. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  250. package/dist/text/textDomainFormatted.js +275 -322
  251. package/dist/text/textDomainFormatted.js.map +1 -1
  252. package/dist/text/textDomainFormattedDefault.d.ts +273 -0
  253. package/dist/text/textDomainFormattedDefault.d.ts.map +1 -0
  254. package/dist/text/textDomainFormattedDefault.js +94 -0
  255. package/dist/text/textDomainFormattedDefault.js.map +1 -0
  256. package/dist/util/arrayUtilities.d.ts +20 -0
  257. package/dist/util/arrayUtilities.d.ts.map +1 -1
  258. package/dist/util/arrayUtilities.js +24 -1
  259. package/dist/util/arrayUtilities.js.map +1 -1
  260. package/dist/util/compressedIds.d.ts +118 -0
  261. package/dist/util/compressedIds.d.ts.map +1 -0
  262. package/dist/util/compressedIds.js +133 -0
  263. package/dist/util/compressedIds.js.map +1 -0
  264. package/dist/util/index.d.ts +2 -1
  265. package/dist/util/index.d.ts.map +1 -1
  266. package/dist/util/index.js +11 -2
  267. package/dist/util/index.js.map +1 -1
  268. package/dist/util/rangeMap.d.ts +13 -0
  269. package/dist/util/rangeMap.d.ts.map +1 -1
  270. package/dist/util/rangeMap.js +69 -8
  271. package/dist/util/rangeMap.js.map +1 -1
  272. package/dist/util/typeboxBrand.js +2 -24
  273. package/dist/util/typeboxBrand.js.map +1 -1
  274. package/dist/util/utils.js +2 -24
  275. package/dist/util/utils.js.map +1 -1
  276. package/eslint.config.mts +0 -30
  277. package/lib/core/change-family/changeFamily.d.ts +3 -10
  278. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  279. package/lib/core/change-family/changeFamily.js.map +1 -1
  280. package/lib/core/rebase/types.d.ts +2 -2
  281. package/lib/core/rebase/types.js.map +1 -1
  282. package/lib/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  283. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  284. package/lib/core/tree/anchorSet.js +1 -5
  285. package/lib/core/tree/anchorSet.js.map +1 -1
  286. package/lib/entrypoints/alpha.d.ts +1 -1
  287. package/lib/entrypoints/alpha.d.ts.map +1 -1
  288. package/lib/entrypoints/alpha.js.map +1 -1
  289. package/lib/entrypoints/beta.d.ts +1 -1
  290. package/lib/entrypoints/beta.d.ts.map +1 -1
  291. package/lib/entrypoints/beta.js.map +1 -1
  292. package/lib/entrypoints/legacy.d.ts +1 -1
  293. package/lib/entrypoints/legacy.d.ts.map +1 -1
  294. package/lib/entrypoints/legacy.js.map +1 -1
  295. package/lib/feature-libraries/chunked-forest/chunkedForest.js +1 -5
  296. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  297. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +19 -14
  298. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  299. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +14 -33
  300. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  301. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +85 -28
  302. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  303. package/lib/feature-libraries/chunked-forest/codec/codecs.js +82 -9
  304. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  305. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
  306. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  307. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +12 -1
  308. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  309. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  310. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  311. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  312. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  313. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
  314. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  315. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
  316. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  317. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  318. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  319. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  320. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  321. package/lib/feature-libraries/flex-tree/lazyEntity.js +1 -11
  322. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  323. package/lib/feature-libraries/flex-tree/lazyNode.js +1 -11
  324. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  325. package/lib/feature-libraries/forest-summary/codec.d.ts +3 -3
  326. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  327. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  328. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  329. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  330. package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -6
  331. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  332. package/lib/feature-libraries/index.d.ts +1 -1
  333. package/lib/feature-libraries/index.d.ts.map +1 -1
  334. package/lib/feature-libraries/index.js +1 -1
  335. package/lib/feature-libraries/index.js.map +1 -1
  336. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  337. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +10 -10
  338. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  339. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  340. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +10 -30
  341. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  342. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +0 -5
  343. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  344. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  345. package/lib/feature-libraries/object-forest/objectForest.js +1 -45
  346. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  347. package/lib/index.d.ts +2 -2
  348. package/lib/index.d.ts.map +1 -1
  349. package/lib/index.js +1 -1
  350. package/lib/index.js.map +1 -1
  351. package/lib/packageVersion.d.ts +1 -1
  352. package/lib/packageVersion.js +1 -1
  353. package/lib/packageVersion.js.map +1 -1
  354. package/lib/shared-tree/independentView.d.ts.map +1 -1
  355. package/lib/shared-tree/independentView.js +5 -8
  356. package/lib/shared-tree/independentView.js.map +1 -1
  357. package/lib/shared-tree/index.d.ts +1 -1
  358. package/lib/shared-tree/index.d.ts.map +1 -1
  359. package/lib/shared-tree/index.js.map +1 -1
  360. package/lib/shared-tree/schematizingTreeView.d.ts +6 -5
  361. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  362. package/lib/shared-tree/schematizingTreeView.js +4 -38
  363. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  364. package/lib/shared-tree/sharedTree.d.ts +5 -1
  365. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  366. package/lib/shared-tree/sharedTree.js +9 -45
  367. package/lib/shared-tree/sharedTree.js.map +1 -1
  368. package/lib/shared-tree/transactionPostProcessor.d.ts +28 -0
  369. package/lib/shared-tree/transactionPostProcessor.d.ts.map +1 -0
  370. package/lib/shared-tree/transactionPostProcessor.js +23 -0
  371. package/lib/shared-tree/transactionPostProcessor.js.map +1 -0
  372. package/lib/shared-tree/treeAlpha.js +3 -3
  373. package/lib/shared-tree/treeAlpha.js.map +1 -1
  374. package/lib/shared-tree/treeCheckout.d.ts +28 -15
  375. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  376. package/lib/shared-tree/treeCheckout.js +80 -101
  377. package/lib/shared-tree/treeCheckout.js.map +1 -1
  378. package/lib/shared-tree/unhydratedTreeContext.d.ts +5 -5
  379. package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  380. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
  381. package/lib/shared-tree-core/branch.js +1 -5
  382. package/lib/shared-tree-core/branch.js.map +1 -1
  383. package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -2
  384. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  385. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  386. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
  387. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  388. package/lib/shared-tree-core/editManagerCodecsCommons.js +3 -5
  389. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  390. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
  391. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  392. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  393. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
  394. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  395. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  396. package/lib/shared-tree-core/editManagerSummarizer.d.ts +5 -9
  397. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  398. package/lib/shared-tree-core/editManagerSummarizer.js +5 -10
  399. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  400. package/lib/shared-tree-core/index.d.ts +1 -1
  401. package/lib/shared-tree-core/index.d.ts.map +1 -1
  402. package/lib/shared-tree-core/index.js +1 -1
  403. package/lib/shared-tree-core/index.js.map +1 -1
  404. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  405. package/lib/shared-tree-core/sharedTreeCore.js +4 -39
  406. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  407. package/lib/shared-tree-core/transaction.d.ts +84 -9
  408. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  409. package/lib/shared-tree-core/transaction.js +74 -17
  410. package/lib/shared-tree-core/transaction.js.map +1 -1
  411. package/lib/simple-tree/api/index.d.ts +1 -1
  412. package/lib/simple-tree/api/index.d.ts.map +1 -1
  413. package/lib/simple-tree/api/index.js.map +1 -1
  414. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  415. package/lib/simple-tree/api/schemaCreationUtilities.js +3 -3
  416. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  417. package/lib/simple-tree/api/schemaFactory.d.ts +1 -1
  418. package/lib/simple-tree/api/schemaFactory.js +2 -2
  419. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  420. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
  421. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +2 -2
  422. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  423. package/lib/simple-tree/api/transactionTypes.d.ts +91 -28
  424. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  425. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  426. package/lib/simple-tree/api/tree.d.ts +96 -22
  427. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  428. package/lib/simple-tree/api/tree.js.map +1 -1
  429. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  430. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  431. package/lib/simple-tree/core/treeNodeKernel.js +1 -11
  432. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  433. package/lib/simple-tree/core/treeNodeSchema.d.ts +7 -7
  434. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  435. package/lib/simple-tree/core/unhydratedFlexTree.js +1 -5
  436. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  437. package/lib/simple-tree/index.d.ts +1 -1
  438. package/lib/simple-tree/index.d.ts.map +1 -1
  439. package/lib/simple-tree/index.js.map +1 -1
  440. package/lib/simple-tree/leafNodeSchema.js +1 -11
  441. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  442. package/lib/simple-tree/node-kinds/array/arrayNode.js +1 -5
  443. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  444. package/lib/tableSchema.d.ts +50 -4
  445. package/lib/tableSchema.d.ts.map +1 -1
  446. package/lib/tableSchema.js +171 -75
  447. package/lib/tableSchema.js.map +1 -1
  448. package/lib/text/index.d.ts +1 -0
  449. package/lib/text/index.d.ts.map +1 -1
  450. package/lib/text/index.js +1 -0
  451. package/lib/text/index.js.map +1 -1
  452. package/lib/text/textDomainFormatted.d.ts +69 -758
  453. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  454. package/lib/text/textDomainFormatted.js +277 -324
  455. package/lib/text/textDomainFormatted.js.map +1 -1
  456. package/lib/text/textDomainFormattedDefault.d.ts +273 -0
  457. package/lib/text/textDomainFormattedDefault.d.ts.map +1 -0
  458. package/lib/text/textDomainFormattedDefault.js +91 -0
  459. package/lib/text/textDomainFormattedDefault.js.map +1 -0
  460. package/lib/util/arrayUtilities.d.ts +20 -0
  461. package/lib/util/arrayUtilities.d.ts.map +1 -1
  462. package/lib/util/arrayUtilities.js +22 -0
  463. package/lib/util/arrayUtilities.js.map +1 -1
  464. package/lib/util/compressedIds.d.ts +118 -0
  465. package/lib/util/compressedIds.d.ts.map +1 -0
  466. package/lib/util/compressedIds.js +124 -0
  467. package/lib/util/compressedIds.js.map +1 -0
  468. package/lib/util/index.d.ts +2 -1
  469. package/lib/util/index.d.ts.map +1 -1
  470. package/lib/util/index.js +2 -1
  471. package/lib/util/index.js.map +1 -1
  472. package/lib/util/rangeMap.d.ts +13 -0
  473. package/lib/util/rangeMap.d.ts.map +1 -1
  474. package/lib/util/rangeMap.js +69 -8
  475. package/lib/util/rangeMap.js.map +1 -1
  476. package/package.json +25 -24
  477. package/src/core/change-family/changeFamily.ts +3 -12
  478. package/src/core/rebase/types.ts +2 -2
  479. package/src/core/schema-stored/storedSchemaRepository.ts +2 -2
  480. package/src/entrypoints/alpha.ts +12 -8
  481. package/src/entrypoints/beta.ts +8 -0
  482. package/src/entrypoints/legacy.ts +8 -0
  483. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +35 -64
  484. package/src/feature-libraries/chunked-forest/codec/codecs.ts +138 -42
  485. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +32 -4
  486. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -0
  487. package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +7 -19
  488. package/src/feature-libraries/chunked-forest/index.ts +3 -0
  489. package/src/feature-libraries/forest-summary/codec.ts +5 -3
  490. package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -5
  491. package/src/feature-libraries/index.ts +3 -0
  492. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +13 -9
  493. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +14 -47
  494. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +0 -5
  495. package/src/index.ts +13 -8
  496. package/src/packageVersion.ts +1 -1
  497. package/src/shared-tree/independentView.ts +5 -10
  498. package/src/shared-tree/index.ts +1 -0
  499. package/src/shared-tree/schematizingTreeView.ts +29 -25
  500. package/src/shared-tree/sharedTree.ts +18 -10
  501. package/src/shared-tree/transactionPostProcessor.ts +40 -0
  502. package/src/shared-tree/treeAlpha.ts +3 -3
  503. package/src/shared-tree/treeCheckout.ts +120 -95
  504. package/src/shared-tree/unhydratedTreeContext.ts +18 -15
  505. package/src/shared-tree-core/editManagerCodecs.ts +3 -2
  506. package/src/shared-tree-core/editManagerCodecsCommons.ts +10 -14
  507. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +3 -2
  508. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +3 -2
  509. package/src/shared-tree-core/editManagerSummarizer.ts +5 -9
  510. package/src/shared-tree-core/index.ts +8 -5
  511. package/src/shared-tree-core/sharedTreeCore.ts +3 -2
  512. package/src/shared-tree-core/transaction.ts +148 -18
  513. package/src/simple-tree/api/index.ts +13 -9
  514. package/src/simple-tree/api/schemaCreationUtilities.ts +3 -3
  515. package/src/simple-tree/api/schemaFactory.ts +2 -2
  516. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +2 -2
  517. package/src/simple-tree/api/transactionTypes.ts +111 -39
  518. package/src/simple-tree/api/tree.ts +152 -47
  519. package/src/simple-tree/api/treeBeta.ts +2 -0
  520. package/src/simple-tree/core/treeNodeSchema.ts +7 -7
  521. package/src/simple-tree/index.ts +12 -8
  522. package/src/tableSchema.ts +306 -80
  523. package/src/text/index.ts +1 -0
  524. package/src/text/textDomainFormatted.ts +520 -415
  525. package/src/text/textDomainFormattedDefault.ts +150 -0
  526. package/src/util/arrayUtilities.ts +35 -0
  527. package/src/util/compressedIds.ts +216 -0
  528. package/src/util/index.ts +17 -0
  529. package/src/util/rangeMap.ts +108 -9
  530. package/tsconfig.json +5 -0
@@ -3,20 +3,10 @@
3
3
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
4
  * Licensed under the MIT License.
5
5
  */
6
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
8
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
9
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
10
- };
11
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12
- if (kind === "m") throw new TypeError("Private method is not writable");
13
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
14
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
15
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
16
- };
17
6
  var _TransactionStack_stack, _TransactionStack_onPush, _TransactionStack_events, _TransactionStack_disposed, _SquashingTransactionStack_transactionBranch, _SquashingTransactionStack_activeBranchEvents;
18
7
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.SquashingTransactionStack = exports.TransactionStack = exports.TransactionResult = void 0;
8
+ exports.SquashingTransactionStack = exports.ChangeProcessorApplicability = exports.TransactionStack = exports.TransactionResult = void 0;
9
+ const tslib_1 = require("tslib");
20
10
  const client_utils_1 = require("@fluid-internal/client-utils");
21
11
  const internal_1 = require("@fluidframework/core-utils/internal");
22
12
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
@@ -40,13 +30,14 @@ var TransactionResult;
40
30
  /**
41
31
  * An implementation of {@link Transactor} that uses a stack to manage transactions.
42
32
  * @remarks Using a stack allows transactions to nest - i.e. an inner transaction may be started while an outer transaction is already in progress.
33
+ * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.
43
34
  */
44
35
  class TransactionStack {
45
36
  get events() {
46
- return __classPrivateFieldGet(this, _TransactionStack_events, "f");
37
+ return tslib_1.__classPrivateFieldGet(this, _TransactionStack_events, "f");
47
38
  }
48
39
  get disposed() {
49
- return __classPrivateFieldGet(this, _TransactionStack_disposed, "f");
40
+ return tslib_1.__classPrivateFieldGet(this, _TransactionStack_disposed, "f");
50
41
  }
51
42
  /**
52
43
  * Construct a new {@link TransactionStack}.
@@ -57,44 +48,44 @@ class TransactionStack {
57
48
  _TransactionStack_onPush.set(this, void 0);
58
49
  _TransactionStack_events.set(this, (0, client_utils_1.createEmitter)());
59
50
  _TransactionStack_disposed.set(this, false);
60
- __classPrivateFieldSet(this, _TransactionStack_onPush, onPush, "f");
51
+ tslib_1.__classPrivateFieldSet(this, _TransactionStack_onPush, onPush, "f");
61
52
  }
62
53
  get size() {
63
54
  this.ensureNotDisposed();
64
- return __classPrivateFieldGet(this, _TransactionStack_stack, "f").length;
55
+ return tslib_1.__classPrivateFieldGet(this, _TransactionStack_stack, "f").length;
65
56
  }
66
- start() {
57
+ start(options) {
67
58
  this.ensureNotDisposed();
68
- const last = (0, index_js_2.getLast)(__classPrivateFieldGet(this, _TransactionStack_stack, "f"));
69
- const onPushCurrent = last === undefined ? __classPrivateFieldGet(this, _TransactionStack_onPush, "f") : last.callbacks.onPush;
70
- const { onPush, onPop } = onPushCurrent?.() ?? {};
71
- __classPrivateFieldGet(this, _TransactionStack_stack, "f").push({
59
+ const last = (0, index_js_2.getLast)(tslib_1.__classPrivateFieldGet(this, _TransactionStack_stack, "f"));
60
+ const onPushCurrent = last === undefined ? tslib_1.__classPrivateFieldGet(this, _TransactionStack_onPush, "f") : last.callbacks.onPush;
61
+ const { onPush, onPop } = onPushCurrent?.(options) ?? {};
62
+ tslib_1.__classPrivateFieldGet(this, _TransactionStack_stack, "f").push({
72
63
  callbacks: { onPop, onPush: onPush ?? onPushCurrent },
73
64
  });
74
- __classPrivateFieldGet(this, _TransactionStack_events, "f").emit("started");
65
+ tslib_1.__classPrivateFieldGet(this, _TransactionStack_events, "f").emit("started");
75
66
  }
76
67
  commit() {
77
68
  this.ensureNotDisposed();
78
69
  if (this.size === 0) {
79
70
  throw new internal_2.UsageError("No transaction to commit");
80
71
  }
81
- __classPrivateFieldGet(this, _TransactionStack_events, "f").emit("committing");
82
- __classPrivateFieldGet(this, _TransactionStack_stack, "f").pop()?.callbacks.onPop?.(TransactionResult.Commit);
72
+ tslib_1.__classPrivateFieldGet(this, _TransactionStack_events, "f").emit("committing");
73
+ tslib_1.__classPrivateFieldGet(this, _TransactionStack_stack, "f").pop()?.callbacks.onPop?.(TransactionResult.Commit);
83
74
  }
84
75
  abort() {
85
76
  this.ensureNotDisposed();
86
77
  if (this.size === 0) {
87
78
  throw new internal_2.UsageError("No transaction to abort");
88
79
  }
89
- __classPrivateFieldGet(this, _TransactionStack_events, "f").emit("aborting");
90
- __classPrivateFieldGet(this, _TransactionStack_stack, "f").pop()?.callbacks.onPop?.(TransactionResult.Abort);
80
+ tslib_1.__classPrivateFieldGet(this, _TransactionStack_events, "f").emit("aborting");
81
+ tslib_1.__classPrivateFieldGet(this, _TransactionStack_stack, "f").pop()?.callbacks.onPop?.(TransactionResult.Abort);
91
82
  }
92
83
  dispose() {
93
84
  this.ensureNotDisposed();
94
85
  while (this.size > 0) {
95
86
  this.abort();
96
87
  }
97
- __classPrivateFieldSet(this, _TransactionStack_disposed, true, "f");
88
+ tslib_1.__classPrivateFieldSet(this, _TransactionStack_disposed, true, "f");
98
89
  }
99
90
  ensureNotDisposed() {
100
91
  if (this.disposed) {
@@ -104,6 +95,33 @@ class TransactionStack {
104
95
  }
105
96
  exports.TransactionStack = TransactionStack;
106
97
  _TransactionStack_stack = new WeakMap(), _TransactionStack_onPush = new WeakMap(), _TransactionStack_events = new WeakMap(), _TransactionStack_disposed = new WeakMap();
98
+ /**
99
+ * Informs the caller of {@link ChangeProcessor} what context it should be invoked for.
100
+ * @remarks This is purely a recommendation to the caller of the processor and
101
+ * not a strict rule.
102
+ */
103
+ var ChangeProcessorApplicability;
104
+ (function (ChangeProcessorApplicability) {
105
+ /**
106
+ * Invoke the processor if no later (outer) instance of this change processor
107
+ * may be applied to related changes before changes are "visible".
108
+ *
109
+ * @remarks
110
+ * This designation is meant for processors that only need to be applied
111
+ * once to a set of related changes independent of scope or nesting,
112
+ * with the understanding that the processor should still be applied no
113
+ * later than when the changes are "visible" (e.g. committed to a branch).
114
+ * For example, a processor that removes extraneous information from a
115
+ * change (e.g. data for nodes that were both created and removed within a
116
+ * transaction) only needs to be applied once to the squashed change
117
+ * produced by the outermost transaction.
118
+ */
119
+ ChangeProcessorApplicability[ChangeProcessorApplicability["IfOutermost"] = 0] = "IfOutermost";
120
+ /**
121
+ * Invoke the processor in all contexts.
122
+ */
123
+ ChangeProcessorApplicability[ChangeProcessorApplicability["Always"] = 1] = "Always";
124
+ })(ChangeProcessorApplicability || (exports.ChangeProcessorApplicability = ChangeProcessorApplicability = {}));
107
125
  /**
108
126
  * An implementation of {@link Transactor} that {@link TransactionStack | uses a stack} and a {@link SharedTreeBranch | branch} to manage transactions.
109
127
  * @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.
@@ -115,7 +133,7 @@ class SquashingTransactionStack extends TransactionStack {
115
133
  * Get the "active branch" for this transactor - either the transaction branch if a transaction is in progress, or the original branch otherwise.
116
134
  */
117
135
  get activeBranch() {
118
- return __classPrivateFieldGet(this, _SquashingTransactionStack_transactionBranch, "f") ?? this.branch;
136
+ return tslib_1.__classPrivateFieldGet(this, _SquashingTransactionStack_transactionBranch, "f") ?? this.branch;
119
137
  }
120
138
  /**
121
139
  * Provides events for changes in the {@link SquashingTransactionStack.activeBranch | active branch}.
@@ -125,14 +143,14 @@ class SquashingTransactionStack extends TransactionStack {
125
143
  get activeBranchEvents() {
126
144
  const off = (eventName, listener) => {
127
145
  this.activeBranch.events.off(eventName, listener);
128
- const listeners = __classPrivateFieldGet(this, _SquashingTransactionStack_activeBranchEvents, "f").get(eventName);
146
+ const listeners = tslib_1.__classPrivateFieldGet(this, _SquashingTransactionStack_activeBranchEvents, "f").get(eventName);
129
147
  if (listeners?.delete(listener) === true && listeners.size === 0) {
130
- __classPrivateFieldGet(this, _SquashingTransactionStack_activeBranchEvents, "f").delete(eventName);
148
+ tslib_1.__classPrivateFieldGet(this, _SquashingTransactionStack_activeBranchEvents, "f").delete(eventName);
131
149
  }
132
150
  };
133
151
  return {
134
152
  on: (eventName, listener) => {
135
- const listeners = (0, index_js_2.getOrCreate)(__classPrivateFieldGet(this, _SquashingTransactionStack_activeBranchEvents, "f"), eventName, () => new Set());
153
+ const listeners = (0, index_js_2.getOrCreate)(tslib_1.__classPrivateFieldGet(this, _SquashingTransactionStack_activeBranchEvents, "f"), eventName, () => new Set());
136
154
  listeners.add(listener);
137
155
  this.activeBranch.events.on(eventName, listener);
138
156
  return () => off(eventName, listener);
@@ -144,11 +162,30 @@ class SquashingTransactionStack extends TransactionStack {
144
162
  * Construct a new {@link SquashingTransactionStack}.
145
163
  * @param branch - The {@link SquashingTransactionStack.branch | branch} that will be forked off of when a transaction begins.
146
164
  * @param onPush - A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.
165
+ * @remarks To post-process the squashed change produced when a transaction is committed (for example, to "minimize"
166
+ * it so that it contains no extraneous information), start the transaction with a
167
+ * {@link SquashingTransactionOptions.postProcessor | post-processor}. The post-processor is injected via the transaction
168
+ * options rather than baked into this stack, so different transactions may supply different post-processors (or none).
147
169
  */
148
170
  constructor(branch, mintRevisionTag, onPush) {
171
+ // A stack of the post-processors to apply when each in-progress transaction commits, ordered from outermost to
172
+ // innermost. Each in-progress transaction contributes exactly one entry: either the processor to apply when it
173
+ // commits, or `undefined` when none should be applied.
174
+ const postProcessorStack = [];
175
+ // Determines the entry to push for a transaction that was started with the given `requested` processor (if any).
176
+ // A processor with "outermost" applicability that is already active in an enclosing transaction resolves to
177
+ // `undefined` so that it is only applied once (at the outermost transaction that supplied it).
178
+ const resolvePostProcessor = (requested) => {
179
+ if (requested?.applicability === ChangeProcessorApplicability.IfOutermost &&
180
+ postProcessorStack.includes(requested)) {
181
+ return undefined;
182
+ }
183
+ return requested;
184
+ };
149
185
  super(
150
186
  // Invoked when an outer transaction starts
151
- () => {
187
+ (startOptions) => {
188
+ postProcessorStack.push(resolvePostProcessor(startOptions?.postProcessor));
152
189
  // Keep track of the commit that each transaction was on when it started
153
190
  const startHead = this.activeBranch.getHead();
154
191
  const rebaser = this.branch.changeFamily.rebaser;
@@ -162,6 +199,7 @@ class SquashingTransactionStack extends TransactionStack {
162
199
  // Invoked when an outer transaction ends
163
200
  const onOuterTransactionPop = (result) => {
164
201
  (0, internal_1.assert)(this.size === 0, 0xcae /* The outer transaction should be ending */);
202
+ const postProcessor = postProcessorStack.pop();
165
203
  transactionBranch.editor.exitTransaction();
166
204
  const sourcePath = [];
167
205
  const targetPath = [];
@@ -190,16 +228,19 @@ class SquashingTransactionStack extends TransactionStack {
190
228
  }
191
229
  // Squash all the new commits on the transaction branch into a new commit on the original branch
192
230
  const squash = rebaser.compose(transactionSteps);
231
+ // Apply this transaction's post-processor (if any) to the squashed change (for example, to
232
+ // "minimize" it so that it contains no extraneous information).
233
+ const change = postProcessor === undefined ? squash : postProcessor.processChange(squash);
193
234
  if (targetPath.length === 0) {
194
235
  // No changes were made on the original branch since the transaction began
195
236
  // The transaction commit can be applied directly
196
- this.branch.apply((0, index_js_1.tagChange)(squash, transactionRevision));
237
+ this.branch.apply((0, index_js_1.tagChange)(change, transactionRevision));
197
238
  // The view is already up-to-date so there's nothing more to do
198
239
  }
199
240
  else {
200
241
  // Some changes were made on `branch` since the transaction began
201
242
  const unrebasedHead = (0, index_js_1.mintCommit)(startHead, {
202
- change: squash,
243
+ change,
203
244
  revision: transactionRevision,
204
245
  });
205
246
  // We need to rebase the transaction commit on top of the new changes
@@ -227,13 +268,15 @@ class SquashingTransactionStack extends TransactionStack {
227
268
  outerOnPop?.(result, viewUpdate);
228
269
  };
229
270
  // Invoked when a nested transaction begins
230
- const onNestedTransactionPush = () => {
271
+ const onNestedTransactionPush = (nestedStartOptions) => {
272
+ postProcessorStack.push(resolvePostProcessor(nestedStartOptions?.postProcessor));
231
273
  const nestedStartHead = this.activeBranch.getHead();
232
274
  const nestedOuterOnPop = onPush?.();
233
275
  transactionBranch.editor.enterTransaction();
234
276
  return {
235
277
  // Invoked when a nested transaction ends
236
278
  onPop: (result) => {
279
+ const nestedPostProcessor = postProcessorStack.pop();
237
280
  transactionBranch.editor.exitTransaction();
238
281
  switch (result) {
239
282
  case TransactionResult.Abort: {
@@ -242,6 +285,20 @@ class SquashingTransactionStack extends TransactionStack {
242
285
  break;
243
286
  }
244
287
  case TransactionResult.Commit: {
288
+ // When this nested transaction supplied a post-processor that should be applied here, squash its
289
+ // edits into a single (post-processed) commit on the transaction branch rather than leaving them to
290
+ // be squashed only when the outermost transaction is committed.
291
+ if (nestedPostProcessor !== undefined) {
292
+ const nestedSteps = [];
293
+ (0, index_js_1.findAncestor)([transactionBranch.getHead(), nestedSteps], (c) => c === nestedStartHead);
294
+ if (nestedSteps.length > 0) {
295
+ (0, internal_1.assert)(transactionRevision !== undefined, 0xd07 /* Expected transaction revision in the presence of transaction steps */);
296
+ const squash = rebaser.compose(nestedSteps);
297
+ const processedSquash = nestedPostProcessor.processChange(squash);
298
+ transactionBranch.removeAfter(nestedStartHead);
299
+ transactionBranch.apply((0, index_js_1.tagChange)(processedSquash, transactionRevision));
300
+ }
301
+ }
245
302
  break;
246
303
  }
247
304
  default: {
@@ -271,8 +328,8 @@ class SquashingTransactionStack extends TransactionStack {
271
328
  /** Updates the transaction branch (and therefore the active branch) and rebinds the branch events. */
272
329
  setTransactionBranch(transactionBranch) {
273
330
  const oldActiveBranch = this.activeBranch;
274
- __classPrivateFieldSet(this, _SquashingTransactionStack_transactionBranch, transactionBranch, "f");
275
- for (const [eventName, listeners] of __classPrivateFieldGet(this, _SquashingTransactionStack_activeBranchEvents, "f")) {
331
+ tslib_1.__classPrivateFieldSet(this, _SquashingTransactionStack_transactionBranch, transactionBranch, "f");
332
+ for (const [eventName, listeners] of tslib_1.__classPrivateFieldGet(this, _SquashingTransactionStack_activeBranchEvents, "f")) {
276
333
  for (const listener of listeners) {
277
334
  oldActiveBranch.events.off(eventName, listener);
278
335
  this.activeBranch.events.on(eventName, listener);
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/shared-tree-core/transaction.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,+DAA6D;AAE7D,kEAA8E;AAC9E,uEAAsE;AAEtE,+CAU0B;AAC1B,+CAAwD;AAIxD;;;GAGG;AACH,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC5B;;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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,+DAA6D;AAE7D,kEAA8E;AAC9E,uEAAsE;AAEtE,+CAU0B;AAC1B,+CAAwD;AAIxD;;;GAGG;AACH,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC5B;;OAEG;IACH,2DAAK,CAAA;IACL;;OAEG;IACH,6DAAM,CAAA;AACP,CAAC,EATW,iBAAiB,iCAAjB,iBAAiB,QAS5B;AAmGD;;;;GAIG;AACH,MAAa,gBAAgB;IAK5B,IAAW,MAAM;QAChB,OAAO,+BAAA,IAAI,gCAAQ,CAAC;IACrB,CAAC;IAGD,IAAW,QAAQ;QAClB,OAAO,+BAAA,IAAI,kCAAU,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,YAAmB,MAAyB;QAjBnC,kCAA4C,EAAE,EAAC;QAC/C,2CAA2B;QAE3B,mCAAU,IAAA,4BAAa,GAAqB,EAAC;QAKtD,qCAAY,KAAK,EAAC;QAUjB,+BAAA,IAAI,4BAAW,MAAM,MAAA,CAAC;IACvB,CAAC;IAED,IAAW,IAAI;QACd,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,OAAO,+BAAA,IAAI,+BAAO,CAAC,MAAM,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,OAAkB;QAC9B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAA,kBAAO,EAAC,+BAAA,IAAI,+BAAO,CAAC,CAAC;QAClC,MAAM,aAAa,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,+BAAA,IAAI,gCAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAChF,MAAM,EAAE,M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AwD;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;IAoNJ,CAAC;IAED,sGAAsG;IAC9F,oBAAoB,CAC3B,iBAAiE;QAEjE,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC;QAC1C,+BAAA,IAAI,gDAAsB,iBAAiB,MAAA,CAAC;QAC5C,KAAK,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,+BAAA,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;AA3RD,8DA2RC","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 (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\ttransactionBranch.removeAfter(nestedStartHead);\n\t\t\t\t\t\t\t\t\t\t\ttransactionBranch.apply(tagChange(processedSquash, transactionRevision));\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"]}
@@ -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;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,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HAAA,yBAAyB,OAAA;AAG1B,iDAUyB;AARxB,uHAAA,sBAAsB,OAAA;AAGtB,uHAAA,sBAAsB,OAAA;AACtB,+GAAA,cAAc,OAAA;AAEd,mHAAA,kBAAkB,OAAA;AAInB,mDAI0B;AAFzB,mHAAA,iBAAiB,OAAA;AACjB,2HAAA,yBAAyB,OAAA;AAG1B,6CAOuB;AANtB,8HAAA,+BAA+B,OAAA;AAC/B,4GAAA,aAAa,OAAA;AACb,4GAAA,aAAa,OAAA;AAEb,uGAAA,QAAQ,OAAA;AAgBT,2DAA0E;AAAjE,qHAAA,eAAe,OAAA;AACxB,2DAG8B;AAF7B,2HAAA,qBAAqB,OAAA;AAItB,qDAG2B;AAF1B,yHAAA,sBAAsB,OAAA;AACtB,yHAAA,sBAAsB,OAAA;AAGvB,6DAc+B;AAD9B,+GAAA,QAAQ,OAAA;AAGT,6DAAuE;AAA9D,qIAAA,8BAA8B,OAAA;AAEvC,2EAGsC;AAFrC,sJAAA,wCAAwC,OAAA;AACxC,oIAAA,sBAAsB,OAAA;AAEvB,+DAGgC;AAF/B,yIAAA,iCAAiC,OAAA;AACjC,yIAAA,iCAAiC,OAAA;AAElC,qFAO2C;AAN1C,oJAAA,iCAAiC,OAAA;AACjC,oJAAA,iCAAiC,OAAA;AACjC,qIAAA,kBAAkB,OAAA;AAClB,8IAAA,2BAA2B,OAAA","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,uDAG4B;AAF3B,yHAAA,qBAAqB,OAAA;AACrB,8HAAA,0BAA0B,OAAA;AAgB3B,qCAA4C;AAAnC,0GAAA,eAAe,OAAA;AACxB,uDAAuE;AAA1C,iHAAA,aAAa,OAAA;AAC1C,uDAS4B;AAR3B,iHAAA,aAAa,OAAA;AACb,0GAAA,MAAM,OAAA;AAQP,+DAAmF;AAA1E,yHAAA,iBAAiB,OAAA;AAC1B,iEAIiC;AAHhC,2HAAA,kBAAkB,OAAA;AAInB,iEAGiC;AAFhC,2HAAA,kBAAkB,OAAA;AAClB,uIAAA,8BAA8B,OAAA;AAa/B,yEAA0D;AAAjD,wHAAA,WAAW,OAAA;AACpB,2EAKsC;AAJrC,uHAAA,SAAS,OAAA;AACT,6HAAA,eAAe,OAAA;AACf,6HAAA,eAAe,OAAA;AACf,yJAAA,2CAA2C,OAAA;AAE5C,mDAQ0B;AAPzB,sHAAA,oBAAoB,OAAA;AACpB,uHAAA,qBAAqB,OAAA;AACrB,6HAAA,2BAA2B,OAAA;AAC3B,8GAAA,YAAY,OAAA;AACZ,6GAAA,WAAW,OAAA;AAEX,8GAAA,YAAY,OAAA;AAEb,yCAA+C;AAAtC,6GAAA,gBAAgB,OAAA;AACzB,iDAIyB;AAFxB,gHAAA,eAAe,OAAA;AAqBhB,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AACtB,2DAAuD;AAA9C,qHAAA,eAAe,OAAA;AACxB,+EAA2E;AAAlE,yIAAA,yBAAyB,OAAA;AAmBlC,mDAO0B;AAJzB,4HAAA,0BAA0B,OAAA;AAC1B,mHAAA,iBAAiB,OAAA;AACjB,mHAAA,iBAAiB,OAAA;AACjB,2HAAA,yBAAyB,OAAA;AAG1B,iDAUyB;AARxB,uHAAA,sBAAsB,OAAA;AAGtB,uHAAA,sBAAsB,OAAA;AACtB,+GAAA,cAAc,OAAA;AAEd,mHAAA,kBAAkB,OAAA;AAInB,mDAI0B;AAFzB,mHAAA,iBAAiB,OAAA;AACjB,2HAAA,yBAAyB,OAAA;AAG1B,6CAOuB;AANtB,8HAAA,+BAA+B,OAAA;AAC/B,4GAAA,aAAa,OAAA;AACb,4GAAA,aAAa,OAAA;AAEb,uGAAA,QAAQ,OAAA;AAgBT,2DAA0E;AAAjE,qHAAA,eAAe,OAAA;AACxB,2DAG8B;AAF7B,2HAAA,qBAAqB,OAAA;AAItB,qDAG2B;AAF1B,yHAAA,sBAAsB,OAAA;AACtB,yHAAA,sBAAsB,OAAA;AAGvB,6DAkB+B;AAf9B,+GAAA,QAAQ,OAAA;AAiBT,6DAAuE;AAA9D,qIAAA,8BAA8B,OAAA;AAEvC,2EAGsC;AAFrC,sJAAA,wCAAwC,OAAA;AACxC,oIAAA,sBAAsB,OAAA;AAEvB,+DAGgC;AAF/B,yIAAA,iCAAiC,OAAA;AACjC,yIAAA,iCAAiC,OAAA;AAElC,qFAO2C;AAN1C,oJAAA,iCAAiC,OAAA;AACjC,oJAAA,iCAAiC,OAAA;AACjC,qIAAA,kBAAkB,OAAA;AAClB,8IAAA,2BAA2B,OAAA","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 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"]}
@@ -18,7 +18,7 @@ export declare function singletonSchema<TScope extends string, TName extends str
18
18
  readonly value: TName;
19
19
  }, Record<string, never>, true, Record<string, never>, undefined>;
20
20
  /**
21
- * Converts an enum into a collection of schema which can be used in a union.
21
+ * Converts an enum into a collection of schemas which can be used in a union.
22
22
  *
23
23
  * @typeParam TScope - The scope of the provided factory.
24
24
  * There is a known issue where if a factory is provided that is typed as a {@link SchemaFactoryAlpha}, and its scope contains a "." character,
@@ -28,7 +28,7 @@ export declare function singletonSchema<TScope extends string, TName extends str
28
28
  * @remarks
29
29
  * The string value of the enum is used as the name of the schema: callers must ensure that it is stable and unique.
30
30
  * Numeric enums values have the value implicitly converted into a string.
31
- * Consider making a dedicated schema factory with a nested scope (for example using {@link SchemaFactoryBeta.scopedFactory}) to avoid the enum members colliding with other schema.
31
+ * Consider making a dedicated schema factory with a nested scope (for example using {@link SchemaFactoryBeta.scopedFactory}) to avoid the enum members colliding with other schemas.
32
32
  * @example
33
33
  * ```typescript
34
34
  * const schemaFactory = new SchemaFactory("com.myApp");
@@ -79,7 +79,7 @@ export declare function adaptEnum<TScope extends string, const TEnum extends Rec
79
79
  */
80
80
  export declare function enumEntries(enumObject: Record<string, string | number>): [string, string | number][];
81
81
  /**
82
- * Converts an array of distinct strings into a collection of schema which can be used like an enum style union.
82
+ * Converts an array of distinct strings into a collection of schemas which can be used like an enum style union.
83
83
  * @remarks
84
84
  * The returned collection is also a function which can be used to convert strings into {@link Unhydrated} nodes in the union.
85
85
  * Each node type has a `.value` getter which returns the associated string.
@@ -51,7 +51,7 @@ function singletonSchema(factory, name) {
51
51
  }
52
52
  exports.singletonSchema = singletonSchema;
53
53
  /**
54
- * Converts an enum into a collection of schema which can be used in a union.
54
+ * Converts an enum into a collection of schemas which can be used in a union.
55
55
  *
56
56
  * @typeParam TScope - The scope of the provided factory.
57
57
  * There is a known issue where if a factory is provided that is typed as a {@link SchemaFactoryAlpha}, and its scope contains a "." character,
@@ -61,7 +61,7 @@ exports.singletonSchema = singletonSchema;
61
61
  * @remarks
62
62
  * The string value of the enum is used as the name of the schema: callers must ensure that it is stable and unique.
63
63
  * Numeric enums values have the value implicitly converted into a string.
64
- * Consider making a dedicated schema factory with a nested scope (for example using {@link SchemaFactoryBeta.scopedFactory}) to avoid the enum members colliding with other schema.
64
+ * Consider making a dedicated schema factory with a nested scope (for example using {@link SchemaFactoryBeta.scopedFactory}) to avoid the enum members colliding with other schemas.
65
65
  * @example
66
66
  * ```typescript
67
67
  * const schemaFactory = new SchemaFactory("com.myApp");
@@ -156,7 +156,7 @@ function enumEntries(enumObject) {
156
156
  }
157
157
  exports.enumEntries = enumEntries;
158
158
  /**
159
- * Converts an array of distinct strings into a collection of schema which can be used like an enum style union.
159
+ * Converts an array of distinct strings into a collection of schemas which can be used like an enum style union.
160
160
  * @remarks
161
161
  * The returned collection is also a function which can be used to convert strings into {@link Unhydrated} nodes in the union.
162
162
  * Each node type has a `.value` getter which returns the associated string.