@fluidframework/tree 2.41.0-338401 → 2.41.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 (974) hide show
  1. package/CHANGELOG.md +341 -0
  2. package/api-report/tree.alpha.api.md +10 -0
  3. package/dist/alpha.d.ts +1 -0
  4. package/dist/codec/codec.d.ts +10 -0
  5. package/dist/codec/codec.d.ts.map +1 -1
  6. package/dist/codec/codec.js +13 -3
  7. package/dist/codec/codec.js.map +1 -1
  8. package/dist/core/index.d.ts +1 -1
  9. package/dist/core/index.d.ts.map +1 -1
  10. package/dist/core/index.js +2 -1
  11. package/dist/core/index.js.map +1 -1
  12. package/dist/core/rebase/types.d.ts +2 -2
  13. package/dist/core/rebase/types.js +2 -2
  14. package/dist/core/rebase/types.js.map +1 -1
  15. package/dist/core/rebase/utils.d.ts +0 -2
  16. package/dist/core/rebase/utils.d.ts.map +1 -1
  17. package/dist/core/rebase/utils.js +6 -10
  18. package/dist/core/rebase/utils.js.map +1 -1
  19. package/dist/core/schema-stored/formatV1.d.ts +0 -1
  20. package/dist/core/schema-stored/formatV1.d.ts.map +1 -1
  21. package/dist/core/schema-stored/formatV1.js +1 -2
  22. package/dist/core/schema-stored/formatV1.js.map +1 -1
  23. package/dist/core/schema-stored/index.d.ts +1 -1
  24. package/dist/core/schema-stored/index.d.ts.map +1 -1
  25. package/dist/core/schema-stored/index.js +2 -1
  26. package/dist/core/schema-stored/index.js.map +1 -1
  27. package/dist/core/schema-stored/schema.d.ts +6 -0
  28. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  29. package/dist/core/schema-stored/schema.js +8 -1
  30. package/dist/core/schema-stored/schema.js.map +1 -1
  31. package/dist/core/tree/anchorSet.d.ts +2 -1
  32. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  33. package/dist/core/tree/anchorSet.js +2 -1
  34. package/dist/core/tree/anchorSet.js.map +1 -1
  35. package/dist/core/tree/pathTree.d.ts +12 -11
  36. package/dist/core/tree/pathTree.d.ts.map +1 -1
  37. package/dist/core/tree/pathTree.js +8 -7
  38. package/dist/core/tree/pathTree.js.map +1 -1
  39. package/dist/core/tree/treeTextFormat.d.ts +1 -1
  40. package/dist/core/tree/treeTextFormat.js +1 -1
  41. package/dist/core/tree/treeTextFormat.js.map +1 -1
  42. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
  43. package/dist/feature-libraries/chunked-forest/chunkedForest.js +1 -1
  44. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  45. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +1 -1
  46. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  47. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  48. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  49. package/dist/feature-libraries/default-schema/index.js +2 -2
  50. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  51. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +15 -15
  52. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  53. package/dist/feature-libraries/default-schema/schemaChecker.js +50 -35
  54. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  55. package/dist/feature-libraries/flex-tree/context.d.ts +18 -2
  56. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  57. package/dist/feature-libraries/flex-tree/context.js +22 -6
  58. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  59. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +3 -2
  60. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  61. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +3 -2
  62. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  63. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  64. package/dist/feature-libraries/flex-tree/lazyField.js +1 -1
  65. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  66. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  67. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  68. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -1
  69. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  70. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  71. package/dist/feature-libraries/index.d.ts +2 -2
  72. package/dist/feature-libraries/index.d.ts.map +1 -1
  73. package/dist/feature-libraries/index.js +3 -4
  74. package/dist/feature-libraries/index.js.map +1 -1
  75. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -2
  76. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  77. package/dist/feature-libraries/indexing/anchorTreeIndex.js +15 -15
  78. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  79. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  80. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  81. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +1 -1
  82. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  83. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  84. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +1 -1
  85. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +1 -1
  86. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
  87. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  88. package/dist/feature-libraries/modular-schema/genericFieldKind.js +2 -2
  89. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  90. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  91. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  92. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  93. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  94. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +0 -2
  95. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  96. package/dist/feature-libraries/modular-schema/isNeverTree.js +0 -2
  97. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  98. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  99. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  100. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -0
  101. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  102. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +2 -0
  103. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  104. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  105. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  106. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -1
  107. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js +8 -3
  108. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  109. package/dist/feature-libraries/object-forest/objectForest.d.ts +22 -5
  110. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  111. package/dist/feature-libraries/object-forest/objectForest.js +296 -207
  112. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  113. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +2 -2
  114. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  115. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +3 -2
  116. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  117. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  118. package/dist/feature-libraries/schema-index/codec.d.ts +6 -12
  119. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  120. package/dist/feature-libraries/schema-index/codec.js +8 -15
  121. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  122. package/dist/feature-libraries/schema-index/formatV1.d.ts +2 -2
  123. package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  124. package/dist/feature-libraries/schema-index/formatV1.js +1 -1
  125. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
  126. package/dist/feature-libraries/schema-index/index.d.ts +1 -1
  127. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  128. package/dist/feature-libraries/schema-index/index.js +1 -2
  129. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  130. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +1 -1
  131. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  132. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  133. package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
  134. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -1
  135. package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  136. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  137. package/dist/feature-libraries/sequence-field/prune.d.ts.map +1 -1
  138. package/dist/feature-libraries/sequence-field/prune.js.map +1 -1
  139. package/dist/feature-libraries/sequence-field/rebase.js +1 -1
  140. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  141. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +1 -1
  142. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +1 -1
  143. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -1
  144. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  145. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  146. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +1 -1
  147. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  148. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  149. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  150. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
  151. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  152. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  153. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  154. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +1 -1
  155. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  156. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +2 -2
  157. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  158. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +1 -1
  159. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  160. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  161. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +1 -1
  162. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  163. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  164. package/dist/feature-libraries/sequence-field/utils.d.ts +7 -5
  165. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  166. package/dist/feature-libraries/sequence-field/utils.js +7 -5
  167. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  168. package/dist/feature-libraries/treeCursorUtils.js +2 -2
  169. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  170. package/dist/feature-libraries/treeTextCursor.d.ts +1 -1
  171. package/dist/feature-libraries/treeTextCursor.js +1 -1
  172. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  173. package/dist/index.d.ts +2 -2
  174. package/dist/index.d.ts.map +1 -1
  175. package/dist/index.js +2 -6
  176. package/dist/index.js.map +1 -1
  177. package/dist/packageVersion.d.ts +1 -1
  178. package/dist/packageVersion.d.ts.map +1 -1
  179. package/dist/packageVersion.js +1 -1
  180. package/dist/packageVersion.js.map +1 -1
  181. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  182. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  183. package/dist/shared-tree/independentView.d.ts +1 -1
  184. package/dist/shared-tree/independentView.d.ts.map +1 -1
  185. package/dist/shared-tree/independentView.js +8 -3
  186. package/dist/shared-tree/independentView.js.map +1 -1
  187. package/dist/shared-tree/index.d.ts +1 -1
  188. package/dist/shared-tree/index.d.ts.map +1 -1
  189. package/dist/shared-tree/index.js.map +1 -1
  190. package/dist/shared-tree/schematizeTree.d.ts +1 -1
  191. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  192. package/dist/shared-tree/schematizeTree.js.map +1 -1
  193. package/dist/shared-tree/schematizingTreeView.d.ts +1 -1
  194. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  195. package/dist/shared-tree/schematizingTreeView.js +1 -1
  196. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  197. package/dist/shared-tree/sharedTree.d.ts +3 -3
  198. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  199. package/dist/shared-tree/sharedTree.js +8 -8
  200. package/dist/shared-tree/sharedTree.js.map +1 -1
  201. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
  202. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  203. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  204. package/dist/shared-tree/tree.js +1 -1
  205. package/dist/shared-tree/tree.js.map +1 -1
  206. package/dist/shared-tree/treeAlpha.d.ts +76 -2
  207. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  208. package/dist/shared-tree/treeAlpha.js +62 -16
  209. package/dist/shared-tree/treeAlpha.js.map +1 -1
  210. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  211. package/dist/shared-tree/treeCheckout.js +3 -2
  212. package/dist/shared-tree/treeCheckout.js.map +1 -1
  213. package/dist/shared-tree-core/branch.d.ts +2 -2
  214. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  215. package/dist/shared-tree-core/branch.js +2 -2
  216. package/dist/shared-tree-core/branch.js.map +1 -1
  217. package/dist/shared-tree-core/branchCommitEnricher.d.ts +1 -1
  218. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  219. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  220. package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  221. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  222. package/dist/shared-tree-core/editManager.d.ts +3 -1
  223. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  224. package/dist/shared-tree-core/editManager.js +4 -2
  225. package/dist/shared-tree-core/editManager.js.map +1 -1
  226. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  227. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  228. package/dist/shared-tree-core/editManagerSummarizer.d.ts +1 -1
  229. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  230. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  231. package/dist/shared-tree-core/messageCodecs.d.ts +1 -1
  232. package/dist/shared-tree-core/messageCodecs.js +1 -1
  233. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  234. package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  235. package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
  236. package/dist/shared-tree-core/sharedTreeCore.d.ts +2 -2
  237. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  238. package/dist/shared-tree-core/sharedTreeCore.js +4 -4
  239. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  240. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  241. package/dist/shared-tree-core/transaction.js +1 -1
  242. package/dist/shared-tree-core/transaction.js.map +1 -1
  243. package/dist/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  244. package/dist/shared-tree-core/transactionEnricher.js.map +1 -1
  245. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  246. package/dist/simple-tree/api/conciseTree.js +1 -1
  247. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  248. package/dist/simple-tree/api/configuration.js +4 -4
  249. package/dist/simple-tree/api/configuration.js.map +1 -1
  250. package/dist/simple-tree/api/create.d.ts +2 -26
  251. package/dist/simple-tree/api/create.d.ts.map +1 -1
  252. package/dist/simple-tree/api/create.js +4 -41
  253. package/dist/simple-tree/api/create.js.map +1 -1
  254. package/dist/simple-tree/api/customTree.d.ts +1 -1
  255. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  256. package/dist/simple-tree/api/customTree.js +24 -24
  257. package/dist/simple-tree/api/customTree.js.map +1 -1
  258. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  259. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  260. package/dist/simple-tree/api/identifierIndex.js +2 -2
  261. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  262. package/dist/simple-tree/api/index.d.ts +2 -3
  263. package/dist/simple-tree/api/index.d.ts.map +1 -1
  264. package/dist/simple-tree/api/index.js +2 -9
  265. package/dist/simple-tree/api/index.js.map +1 -1
  266. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  267. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  268. package/dist/simple-tree/api/schemaFactory.d.ts +5 -5
  269. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  270. package/dist/simple-tree/api/schemaFactory.js +8 -8
  271. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  272. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +1 -3
  273. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  274. package/dist/simple-tree/api/schemaFactoryAlpha.js +4 -6
  275. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  276. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  277. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  278. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  279. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  280. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  281. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
  282. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  283. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +4 -6
  284. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  285. package/dist/simple-tree/api/storedSchema.d.ts +1 -1
  286. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  287. package/dist/simple-tree/api/storedSchema.js +7 -6
  288. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  289. package/dist/simple-tree/api/tree.d.ts +2 -2
  290. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  291. package/dist/simple-tree/api/tree.js.map +1 -1
  292. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  293. package/dist/simple-tree/api/treeBeta.js +1 -1
  294. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  295. package/dist/simple-tree/api/treeNodeApi.d.ts +30 -3
  296. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  297. package/dist/simple-tree/api/treeNodeApi.js +40 -28
  298. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  299. package/dist/simple-tree/api/typesUnsafe.d.ts +1 -1
  300. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  301. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  302. package/dist/simple-tree/api/verboseTree.js +3 -3
  303. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  304. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  305. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +4 -6
  306. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  307. package/dist/simple-tree/core/context.d.ts.map +1 -1
  308. package/dist/simple-tree/core/context.js.map +1 -1
  309. package/dist/simple-tree/core/getOrCreateNode.d.ts +1 -1
  310. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  311. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  312. package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
  313. package/dist/simple-tree/core/treeNode.js +1 -1
  314. package/dist/simple-tree/core/treeNode.js.map +1 -1
  315. package/dist/simple-tree/core/treeNodeKernel.d.ts +3 -3
  316. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  317. package/dist/simple-tree/core/treeNodeKernel.js +2 -2
  318. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  319. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  320. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  321. package/dist/simple-tree/core/types.d.ts.map +1 -1
  322. package/dist/simple-tree/core/types.js.map +1 -1
  323. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  324. package/dist/simple-tree/core/unhydratedFlexTree.js +21 -21
  325. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  326. package/dist/simple-tree/core/withType.d.ts +1 -1
  327. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  328. package/dist/simple-tree/core/withType.js.map +1 -1
  329. package/dist/simple-tree/createContext.d.ts.map +1 -1
  330. package/dist/simple-tree/createContext.js.map +1 -1
  331. package/dist/simple-tree/getTreeNodeForField.d.ts.map +1 -1
  332. package/dist/simple-tree/getTreeNodeForField.js.map +1 -1
  333. package/dist/simple-tree/index.d.ts +2 -9
  334. package/dist/simple-tree/index.d.ts.map +1 -1
  335. package/dist/simple-tree/index.js +13 -21
  336. package/dist/simple-tree/index.js.map +1 -1
  337. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  338. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  339. package/dist/simple-tree/{arrayNode.d.ts → node-kinds/array/arrayNode.d.ts} +3 -3
  340. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -0
  341. package/dist/simple-tree/{arrayNode.js → node-kinds/array/arrayNode.js} +9 -9
  342. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -0
  343. package/dist/simple-tree/{arrayNodeTypes.d.ts → node-kinds/array/arrayNodeTypes.d.ts} +3 -3
  344. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -0
  345. package/dist/simple-tree/{arrayNodeTypes.js → node-kinds/array/arrayNodeTypes.js} +1 -1
  346. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -0
  347. package/dist/simple-tree/node-kinds/array/index.d.ts +7 -0
  348. package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -0
  349. package/dist/simple-tree/node-kinds/array/index.js +16 -0
  350. package/dist/simple-tree/node-kinds/array/index.js.map +1 -0
  351. package/dist/simple-tree/node-kinds/index.d.ts +8 -0
  352. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -0
  353. package/dist/simple-tree/node-kinds/index.js +26 -0
  354. package/dist/simple-tree/node-kinds/index.js.map +1 -0
  355. package/dist/simple-tree/node-kinds/map/index.d.ts +7 -0
  356. package/dist/simple-tree/node-kinds/map/index.d.ts.map +1 -0
  357. package/dist/simple-tree/node-kinds/map/index.js +13 -0
  358. package/dist/simple-tree/node-kinds/map/index.js.map +1 -0
  359. package/{lib/simple-tree → dist/simple-tree/node-kinds/map}/mapNode.d.ts +3 -3
  360. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -0
  361. package/dist/simple-tree/{mapNode.js → node-kinds/map/mapNode.js} +8 -8
  362. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -0
  363. package/dist/simple-tree/{mapNodeTypes.d.ts → node-kinds/map/mapNodeTypes.d.ts} +3 -3
  364. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -0
  365. package/dist/simple-tree/{mapNodeTypes.js → node-kinds/map/mapNodeTypes.js} +1 -1
  366. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -0
  367. package/dist/simple-tree/node-kinds/object/index.d.ts +7 -0
  368. package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -0
  369. package/dist/simple-tree/node-kinds/object/index.js +16 -0
  370. package/dist/simple-tree/node-kinds/object/index.js.map +1 -0
  371. package/{lib/simple-tree → dist/simple-tree/node-kinds/object}/objectNode.d.ts +17 -6
  372. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -0
  373. package/dist/simple-tree/{objectNode.js → node-kinds/object/objectNode.js} +47 -24
  374. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -0
  375. package/{lib/simple-tree → dist/simple-tree/node-kinds/object}/objectNodeTypes.d.ts +5 -5
  376. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -0
  377. package/dist/simple-tree/{objectNodeTypes.js → node-kinds/object/objectNodeTypes.js} +1 -1
  378. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -0
  379. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  380. package/dist/simple-tree/schemaTypes.d.ts +2 -2
  381. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  382. package/dist/simple-tree/schemaTypes.js.map +1 -1
  383. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  384. package/dist/simple-tree/simpleSchema.js.map +1 -1
  385. package/dist/simple-tree/toMapTree.d.ts +1 -16
  386. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  387. package/dist/simple-tree/toMapTree.js +41 -1
  388. package/dist/simple-tree/toMapTree.js.map +1 -1
  389. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  390. package/dist/simple-tree/toStoredSchema.js +1 -1
  391. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  392. package/dist/simple-tree/treeNodeValid.d.ts +1 -1
  393. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  394. package/dist/simple-tree/treeNodeValid.js +10 -10
  395. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  396. package/dist/simple-tree/walkFieldSchema.d.ts.map +1 -1
  397. package/dist/simple-tree/walkFieldSchema.js.map +1 -1
  398. package/dist/tableSchema.d.ts +10 -10
  399. package/dist/treeFactory.d.ts +1 -1
  400. package/dist/treeFactory.js +1 -1
  401. package/dist/treeFactory.js.map +1 -1
  402. package/dist/util/bTreeUtils.d.ts.map +1 -1
  403. package/dist/util/bTreeUtils.js.map +1 -1
  404. package/dist/util/breakable.d.ts +23 -4
  405. package/dist/util/breakable.d.ts.map +1 -1
  406. package/dist/util/breakable.js +12 -3
  407. package/dist/util/breakable.js.map +1 -1
  408. package/docs/SharedTree Philosophy.md +5 -5
  409. package/lib/alpha.d.ts +1 -0
  410. package/lib/codec/codec.d.ts +10 -0
  411. package/lib/codec/codec.d.ts.map +1 -1
  412. package/lib/codec/codec.js +13 -3
  413. package/lib/codec/codec.js.map +1 -1
  414. package/lib/core/index.d.ts +1 -1
  415. package/lib/core/index.d.ts.map +1 -1
  416. package/lib/core/index.js +1 -1
  417. package/lib/core/index.js.map +1 -1
  418. package/lib/core/rebase/types.d.ts +2 -2
  419. package/lib/core/rebase/types.js +2 -2
  420. package/lib/core/rebase/types.js.map +1 -1
  421. package/lib/core/rebase/utils.d.ts +0 -2
  422. package/lib/core/rebase/utils.d.ts.map +1 -1
  423. package/lib/core/rebase/utils.js +6 -10
  424. package/lib/core/rebase/utils.js.map +1 -1
  425. package/lib/core/schema-stored/formatV1.d.ts +0 -1
  426. package/lib/core/schema-stored/formatV1.d.ts.map +1 -1
  427. package/lib/core/schema-stored/formatV1.js +0 -1
  428. package/lib/core/schema-stored/formatV1.js.map +1 -1
  429. package/lib/core/schema-stored/index.d.ts +1 -1
  430. package/lib/core/schema-stored/index.d.ts.map +1 -1
  431. package/lib/core/schema-stored/index.js +1 -1
  432. package/lib/core/schema-stored/index.js.map +1 -1
  433. package/lib/core/schema-stored/schema.d.ts +6 -0
  434. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  435. package/lib/core/schema-stored/schema.js +7 -0
  436. package/lib/core/schema-stored/schema.js.map +1 -1
  437. package/lib/core/tree/anchorSet.d.ts +2 -1
  438. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  439. package/lib/core/tree/anchorSet.js +2 -1
  440. package/lib/core/tree/anchorSet.js.map +1 -1
  441. package/lib/core/tree/pathTree.d.ts +12 -11
  442. package/lib/core/tree/pathTree.d.ts.map +1 -1
  443. package/lib/core/tree/pathTree.js +8 -7
  444. package/lib/core/tree/pathTree.js.map +1 -1
  445. package/lib/core/tree/treeTextFormat.d.ts +1 -1
  446. package/lib/core/tree/treeTextFormat.js +1 -1
  447. package/lib/core/tree/treeTextFormat.js.map +1 -1
  448. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
  449. package/lib/feature-libraries/chunked-forest/chunkedForest.js +1 -1
  450. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  451. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +1 -1
  452. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  453. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  454. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  455. package/lib/feature-libraries/default-schema/index.js +1 -1
  456. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  457. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +15 -15
  458. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  459. package/lib/feature-libraries/default-schema/schemaChecker.js +49 -34
  460. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  461. package/lib/feature-libraries/flex-tree/context.d.ts +18 -2
  462. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  463. package/lib/feature-libraries/flex-tree/context.js +23 -7
  464. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  465. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +3 -2
  466. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  467. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +3 -2
  468. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  469. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  470. package/lib/feature-libraries/flex-tree/lazyField.js +1 -1
  471. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  472. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  473. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  474. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -1
  475. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  476. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  477. package/lib/feature-libraries/index.d.ts +2 -2
  478. package/lib/feature-libraries/index.d.ts.map +1 -1
  479. package/lib/feature-libraries/index.js +2 -2
  480. package/lib/feature-libraries/index.js.map +1 -1
  481. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -2
  482. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  483. package/lib/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  484. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  485. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  486. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  487. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +1 -1
  488. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  489. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  490. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +1 -1
  491. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +1 -1
  492. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
  493. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  494. package/lib/feature-libraries/modular-schema/genericFieldKind.js +2 -2
  495. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  496. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  497. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  498. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  499. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  500. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +0 -2
  501. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  502. package/lib/feature-libraries/modular-schema/isNeverTree.js +0 -2
  503. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  504. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  505. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  506. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -0
  507. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  508. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +2 -0
  509. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  510. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  511. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  512. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -1
  513. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +8 -3
  514. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  515. package/lib/feature-libraries/object-forest/objectForest.d.ts +22 -5
  516. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  517. package/lib/feature-libraries/object-forest/objectForest.js +299 -209
  518. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  519. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +2 -2
  520. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  521. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +4 -3
  522. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  523. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  524. package/lib/feature-libraries/schema-index/codec.d.ts +6 -12
  525. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  526. package/lib/feature-libraries/schema-index/codec.js +8 -15
  527. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  528. package/lib/feature-libraries/schema-index/formatV1.d.ts +2 -2
  529. package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  530. package/lib/feature-libraries/schema-index/formatV1.js +2 -2
  531. package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
  532. package/lib/feature-libraries/schema-index/index.d.ts +1 -1
  533. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  534. package/lib/feature-libraries/schema-index/index.js +1 -1
  535. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  536. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +1 -1
  537. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  538. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  539. package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
  540. package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -1
  541. package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  542. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  543. package/lib/feature-libraries/sequence-field/prune.d.ts.map +1 -1
  544. package/lib/feature-libraries/sequence-field/prune.js.map +1 -1
  545. package/lib/feature-libraries/sequence-field/rebase.js +1 -1
  546. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  547. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +1 -1
  548. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +1 -1
  549. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -1
  550. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  551. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  552. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +1 -1
  553. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  554. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  555. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  556. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
  557. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  558. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  559. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  560. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +1 -1
  561. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  562. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +2 -2
  563. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  564. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +1 -1
  565. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  566. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  567. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +1 -1
  568. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  569. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  570. package/lib/feature-libraries/sequence-field/utils.d.ts +7 -5
  571. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  572. package/lib/feature-libraries/sequence-field/utils.js +7 -5
  573. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  574. package/lib/feature-libraries/treeCursorUtils.js +2 -2
  575. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  576. package/lib/feature-libraries/treeTextCursor.d.ts +1 -1
  577. package/lib/feature-libraries/treeTextCursor.js +1 -1
  578. package/lib/feature-libraries/treeTextCursor.js.map +1 -1
  579. package/lib/index.d.ts +2 -2
  580. package/lib/index.d.ts.map +1 -1
  581. package/lib/index.js +0 -2
  582. package/lib/index.js.map +1 -1
  583. package/lib/packageVersion.d.ts +1 -1
  584. package/lib/packageVersion.d.ts.map +1 -1
  585. package/lib/packageVersion.js +1 -1
  586. package/lib/packageVersion.js.map +1 -1
  587. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  588. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  589. package/lib/shared-tree/independentView.d.ts +1 -1
  590. package/lib/shared-tree/independentView.d.ts.map +1 -1
  591. package/lib/shared-tree/independentView.js +10 -5
  592. package/lib/shared-tree/independentView.js.map +1 -1
  593. package/lib/shared-tree/index.d.ts +1 -1
  594. package/lib/shared-tree/index.d.ts.map +1 -1
  595. package/lib/shared-tree/index.js +1 -1
  596. package/lib/shared-tree/index.js.map +1 -1
  597. package/lib/shared-tree/schematizeTree.d.ts +1 -1
  598. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  599. package/lib/shared-tree/schematizeTree.js.map +1 -1
  600. package/lib/shared-tree/schematizingTreeView.d.ts +1 -1
  601. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  602. package/lib/shared-tree/schematizingTreeView.js +1 -1
  603. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  604. package/lib/shared-tree/sharedTree.d.ts +3 -3
  605. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  606. package/lib/shared-tree/sharedTree.js +10 -10
  607. package/lib/shared-tree/sharedTree.js.map +1 -1
  608. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
  609. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  610. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  611. package/lib/shared-tree/tree.js +1 -1
  612. package/lib/shared-tree/tree.js.map +1 -1
  613. package/lib/shared-tree/treeAlpha.d.ts +76 -2
  614. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  615. package/lib/shared-tree/treeAlpha.js +50 -4
  616. package/lib/shared-tree/treeAlpha.js.map +1 -1
  617. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  618. package/lib/shared-tree/treeCheckout.js +3 -2
  619. package/lib/shared-tree/treeCheckout.js.map +1 -1
  620. package/lib/shared-tree-core/branch.d.ts +2 -2
  621. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  622. package/lib/shared-tree-core/branch.js +2 -2
  623. package/lib/shared-tree-core/branch.js.map +1 -1
  624. package/lib/shared-tree-core/branchCommitEnricher.d.ts +1 -1
  625. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  626. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  627. package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  628. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  629. package/lib/shared-tree-core/editManager.d.ts +3 -1
  630. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  631. package/lib/shared-tree-core/editManager.js +4 -2
  632. package/lib/shared-tree-core/editManager.js.map +1 -1
  633. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  634. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  635. package/lib/shared-tree-core/editManagerSummarizer.d.ts +1 -1
  636. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  637. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  638. package/lib/shared-tree-core/messageCodecs.d.ts +1 -1
  639. package/lib/shared-tree-core/messageCodecs.js +1 -1
  640. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  641. package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  642. package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
  643. package/lib/shared-tree-core/sharedTreeCore.d.ts +2 -2
  644. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  645. package/lib/shared-tree-core/sharedTreeCore.js +4 -4
  646. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  647. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  648. package/lib/shared-tree-core/transaction.js +1 -1
  649. package/lib/shared-tree-core/transaction.js.map +1 -1
  650. package/lib/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  651. package/lib/shared-tree-core/transactionEnricher.js.map +1 -1
  652. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  653. package/lib/simple-tree/api/conciseTree.js +1 -1
  654. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  655. package/lib/simple-tree/api/configuration.js +1 -1
  656. package/lib/simple-tree/api/configuration.js.map +1 -1
  657. package/lib/simple-tree/api/create.d.ts +2 -26
  658. package/lib/simple-tree/api/create.d.ts.map +1 -1
  659. package/lib/simple-tree/api/create.js +2 -37
  660. package/lib/simple-tree/api/create.js.map +1 -1
  661. package/lib/simple-tree/api/customTree.d.ts +1 -1
  662. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  663. package/lib/simple-tree/api/customTree.js +3 -3
  664. package/lib/simple-tree/api/customTree.js.map +1 -1
  665. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  666. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  667. package/lib/simple-tree/api/identifierIndex.js +1 -1
  668. package/lib/simple-tree/api/identifierIndex.js.map +1 -1
  669. package/lib/simple-tree/api/index.d.ts +2 -3
  670. package/lib/simple-tree/api/index.d.ts.map +1 -1
  671. package/lib/simple-tree/api/index.js +2 -5
  672. package/lib/simple-tree/api/index.js.map +1 -1
  673. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  674. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  675. package/lib/simple-tree/api/schemaFactory.d.ts +5 -5
  676. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  677. package/lib/simple-tree/api/schemaFactory.js +5 -5
  678. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  679. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +1 -3
  680. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  681. package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -3
  682. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  683. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  684. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  685. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  686. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  687. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  688. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
  689. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  690. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +1 -3
  691. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  692. package/lib/simple-tree/api/storedSchema.d.ts +1 -1
  693. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  694. package/lib/simple-tree/api/storedSchema.js +3 -2
  695. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  696. package/lib/simple-tree/api/tree.d.ts +2 -2
  697. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  698. package/lib/simple-tree/api/tree.js.map +1 -1
  699. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  700. package/lib/simple-tree/api/treeBeta.js +1 -1
  701. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  702. package/lib/simple-tree/api/treeNodeApi.d.ts +30 -3
  703. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  704. package/lib/simple-tree/api/treeNodeApi.js +37 -26
  705. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  706. package/lib/simple-tree/api/typesUnsafe.d.ts +1 -1
  707. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  708. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  709. package/lib/simple-tree/api/verboseTree.js +1 -1
  710. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  711. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  712. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +1 -3
  713. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  714. package/lib/simple-tree/core/context.d.ts.map +1 -1
  715. package/lib/simple-tree/core/context.js.map +1 -1
  716. package/lib/simple-tree/core/getOrCreateNode.d.ts +1 -1
  717. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  718. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  719. package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
  720. package/lib/simple-tree/core/treeNode.js +1 -1
  721. package/lib/simple-tree/core/treeNode.js.map +1 -1
  722. package/lib/simple-tree/core/treeNodeKernel.d.ts +3 -3
  723. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  724. package/lib/simple-tree/core/treeNodeKernel.js +2 -2
  725. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  726. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  727. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  728. package/lib/simple-tree/core/types.d.ts.map +1 -1
  729. package/lib/simple-tree/core/types.js.map +1 -1
  730. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  731. package/lib/simple-tree/core/unhydratedFlexTree.js +3 -3
  732. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  733. package/lib/simple-tree/core/withType.d.ts +1 -1
  734. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  735. package/lib/simple-tree/core/withType.js.map +1 -1
  736. package/lib/simple-tree/createContext.d.ts.map +1 -1
  737. package/lib/simple-tree/createContext.js.map +1 -1
  738. package/lib/simple-tree/getTreeNodeForField.d.ts.map +1 -1
  739. package/lib/simple-tree/getTreeNodeForField.js.map +1 -1
  740. package/lib/simple-tree/index.d.ts +2 -9
  741. package/lib/simple-tree/index.d.ts.map +1 -1
  742. package/lib/simple-tree/index.js +2 -6
  743. package/lib/simple-tree/index.js.map +1 -1
  744. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  745. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  746. package/lib/simple-tree/{arrayNode.d.ts → node-kinds/array/arrayNode.d.ts} +3 -3
  747. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -0
  748. package/lib/simple-tree/{arrayNode.js → node-kinds/array/arrayNode.js} +9 -9
  749. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -0
  750. package/lib/simple-tree/{arrayNodeTypes.d.ts → node-kinds/array/arrayNodeTypes.d.ts} +3 -3
  751. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -0
  752. package/lib/simple-tree/{arrayNodeTypes.js → node-kinds/array/arrayNodeTypes.js} +1 -1
  753. package/{dist/simple-tree → lib/simple-tree/node-kinds/array}/arrayNodeTypes.js.map +1 -1
  754. package/lib/simple-tree/node-kinds/array/index.d.ts +7 -0
  755. package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -0
  756. package/lib/simple-tree/node-kinds/array/index.js +7 -0
  757. package/lib/simple-tree/node-kinds/array/index.js.map +1 -0
  758. package/lib/simple-tree/node-kinds/index.d.ts +8 -0
  759. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -0
  760. package/lib/simple-tree/node-kinds/index.js +8 -0
  761. package/lib/simple-tree/node-kinds/index.js.map +1 -0
  762. package/lib/simple-tree/node-kinds/map/index.d.ts +7 -0
  763. package/lib/simple-tree/node-kinds/map/index.d.ts.map +1 -0
  764. package/lib/simple-tree/node-kinds/map/index.js +7 -0
  765. package/lib/simple-tree/node-kinds/map/index.js.map +1 -0
  766. package/{dist/simple-tree → lib/simple-tree/node-kinds/map}/mapNode.d.ts +3 -3
  767. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -0
  768. package/lib/simple-tree/{mapNode.js → node-kinds/map/mapNode.js} +8 -8
  769. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -0
  770. package/lib/simple-tree/{mapNodeTypes.d.ts → node-kinds/map/mapNodeTypes.d.ts} +3 -3
  771. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -0
  772. package/lib/simple-tree/{mapNodeTypes.js → node-kinds/map/mapNodeTypes.js} +1 -1
  773. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -0
  774. package/lib/simple-tree/node-kinds/object/index.d.ts +7 -0
  775. package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -0
  776. package/lib/simple-tree/node-kinds/object/index.js +7 -0
  777. package/lib/simple-tree/node-kinds/object/index.js.map +1 -0
  778. package/{dist/simple-tree → lib/simple-tree/node-kinds/object}/objectNode.d.ts +17 -6
  779. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -0
  780. package/lib/simple-tree/{objectNode.js → node-kinds/object/objectNode.js} +35 -13
  781. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -0
  782. package/{dist/simple-tree → lib/simple-tree/node-kinds/object}/objectNodeTypes.d.ts +5 -5
  783. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -0
  784. package/lib/simple-tree/{objectNodeTypes.js → node-kinds/object/objectNodeTypes.js} +1 -1
  785. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -0
  786. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  787. package/lib/simple-tree/schemaTypes.d.ts +2 -2
  788. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  789. package/lib/simple-tree/schemaTypes.js.map +1 -1
  790. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  791. package/lib/simple-tree/simpleSchema.js.map +1 -1
  792. package/lib/simple-tree/toMapTree.d.ts +1 -16
  793. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  794. package/lib/simple-tree/toMapTree.js +41 -1
  795. package/lib/simple-tree/toMapTree.js.map +1 -1
  796. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  797. package/lib/simple-tree/toStoredSchema.js +1 -1
  798. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  799. package/lib/simple-tree/treeNodeValid.d.ts +1 -1
  800. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  801. package/lib/simple-tree/treeNodeValid.js +2 -2
  802. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  803. package/lib/simple-tree/walkFieldSchema.d.ts.map +1 -1
  804. package/lib/simple-tree/walkFieldSchema.js.map +1 -1
  805. package/lib/tableSchema.d.ts +10 -10
  806. package/lib/treeFactory.d.ts +1 -1
  807. package/lib/treeFactory.js +1 -1
  808. package/lib/treeFactory.js.map +1 -1
  809. package/lib/util/bTreeUtils.d.ts.map +1 -1
  810. package/lib/util/bTreeUtils.js.map +1 -1
  811. package/lib/util/breakable.d.ts +23 -4
  812. package/lib/util/breakable.d.ts.map +1 -1
  813. package/lib/util/breakable.js +12 -3
  814. package/lib/util/breakable.js.map +1 -1
  815. package/package.json +21 -21
  816. package/src/codec/codec.ts +13 -3
  817. package/src/core/index.ts +1 -0
  818. package/src/core/rebase/types.ts +2 -2
  819. package/src/core/rebase/utils.ts +10 -10
  820. package/src/core/schema-stored/formatV1.ts +0 -2
  821. package/src/core/schema-stored/index.ts +1 -0
  822. package/src/core/schema-stored/schema.ts +7 -0
  823. package/src/core/tree/anchorSet.ts +2 -1
  824. package/src/core/tree/pathTree.ts +12 -11
  825. package/src/core/tree/treeTextFormat.ts +1 -1
  826. package/src/feature-libraries/chunked-forest/chunkedForest.ts +1 -1
  827. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +1 -1
  828. package/src/feature-libraries/default-schema/index.ts +1 -1
  829. package/src/feature-libraries/default-schema/schemaChecker.ts +44 -29
  830. package/src/feature-libraries/flex-tree/context.ts +29 -8
  831. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +3 -2
  832. package/src/feature-libraries/flex-tree/lazyField.ts +1 -1
  833. package/src/feature-libraries/flex-tree/utilities.ts +1 -1
  834. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -1
  835. package/src/feature-libraries/index.ts +1 -2
  836. package/src/feature-libraries/indexing/anchorTreeIndex.ts +4 -2
  837. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +1 -0
  838. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +1 -1
  839. package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +1 -1
  840. package/src/feature-libraries/modular-schema/genericFieldKind.ts +4 -2
  841. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +1 -0
  842. package/src/feature-libraries/modular-schema/genericFieldKindTypes.ts +1 -0
  843. package/src/feature-libraries/modular-schema/isNeverTree.ts +0 -2
  844. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +1 -1
  845. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2 -0
  846. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +1 -0
  847. package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +11 -5
  848. package/src/feature-libraries/object-forest/objectForest.ts +65 -7
  849. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +5 -8
  850. package/src/feature-libraries/schema-index/codec.ts +13 -21
  851. package/src/feature-libraries/schema-index/formatV1.ts +2 -2
  852. package/src/feature-libraries/schema-index/index.ts +0 -1
  853. package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -1
  854. package/src/feature-libraries/sequence-field/formatV3.ts +1 -0
  855. package/src/feature-libraries/sequence-field/markQueue.ts +1 -0
  856. package/src/feature-libraries/sequence-field/prune.ts +1 -0
  857. package/src/feature-libraries/sequence-field/rebase.ts +1 -1
  858. package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +1 -1
  859. package/src/feature-libraries/sequence-field/replaceRevisions.ts +3 -1
  860. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +2 -2
  861. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +3 -3
  862. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +3 -3
  863. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +2 -2
  864. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +1 -1
  865. package/src/feature-libraries/sequence-field/utils.ts +7 -5
  866. package/src/feature-libraries/treeCursorUtils.ts +2 -2
  867. package/src/feature-libraries/treeTextCursor.ts +1 -1
  868. package/src/index.ts +1 -4
  869. package/src/packageVersion.ts +1 -1
  870. package/src/shared-tree/checkoutFlexTreeView.ts +1 -0
  871. package/src/shared-tree/independentView.ts +10 -3
  872. package/src/shared-tree/index.ts +4 -1
  873. package/src/shared-tree/schematizeTree.ts +2 -1
  874. package/src/shared-tree/schematizingTreeView.ts +2 -2
  875. package/src/shared-tree/sharedTree.ts +26 -19
  876. package/src/shared-tree/sharedTreeChangeFamily.ts +1 -1
  877. package/src/shared-tree/tree.ts +1 -1
  878. package/src/shared-tree/treeAlpha.ts +142 -18
  879. package/src/shared-tree/treeCheckout.ts +3 -2
  880. package/src/shared-tree-core/branch.ts +3 -4
  881. package/src/shared-tree-core/branchCommitEnricher.ts +3 -1
  882. package/src/shared-tree-core/defaultResubmitMachine.ts +2 -0
  883. package/src/shared-tree-core/editManager.ts +4 -2
  884. package/src/shared-tree-core/editManagerCodecs.ts +1 -0
  885. package/src/shared-tree-core/editManagerSummarizer.ts +1 -1
  886. package/src/shared-tree-core/messageCodecs.ts +1 -1
  887. package/src/shared-tree-core/sequenceIdUtils.ts +1 -0
  888. package/src/shared-tree-core/sharedTreeCore.ts +5 -5
  889. package/src/shared-tree-core/transaction.ts +4 -2
  890. package/src/shared-tree-core/transactionEnricher.ts +2 -0
  891. package/src/simple-tree/api/conciseTree.ts +3 -2
  892. package/src/simple-tree/api/configuration.ts +1 -1
  893. package/src/simple-tree/api/create.ts +3 -80
  894. package/src/simple-tree/api/customTree.ts +4 -4
  895. package/src/simple-tree/api/getSimpleSchema.ts +1 -0
  896. package/src/simple-tree/api/identifierIndex.ts +1 -1
  897. package/src/simple-tree/api/index.ts +1 -10
  898. package/src/simple-tree/api/schemaCompatibilityTester.ts +2 -0
  899. package/src/simple-tree/api/schemaFactory.ts +28 -23
  900. package/src/simple-tree/api/schemaFactoryAlpha.ts +8 -6
  901. package/src/simple-tree/api/schemaFactoryRecursive.ts +3 -3
  902. package/src/simple-tree/api/schemaFromSimple.ts +3 -1
  903. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -3
  904. package/src/simple-tree/api/storedSchema.ts +5 -4
  905. package/src/simple-tree/api/tree.ts +3 -4
  906. package/src/simple-tree/api/treeBeta.ts +3 -2
  907. package/src/simple-tree/api/treeNodeApi.ts +89 -40
  908. package/src/simple-tree/api/typesUnsafe.ts +1 -1
  909. package/src/simple-tree/api/verboseTree.ts +1 -1
  910. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +1 -3
  911. package/src/simple-tree/core/context.ts +1 -0
  912. package/src/simple-tree/core/getOrCreateNode.ts +2 -1
  913. package/src/simple-tree/core/treeNode.ts +1 -1
  914. package/src/simple-tree/core/treeNodeKernel.ts +10 -8
  915. package/src/simple-tree/core/treeNodeSchema.ts +1 -0
  916. package/src/simple-tree/core/types.ts +1 -1
  917. package/src/simple-tree/core/unhydratedFlexTree.ts +4 -3
  918. package/src/simple-tree/core/withType.ts +1 -1
  919. package/src/simple-tree/createContext.ts +1 -0
  920. package/src/simple-tree/getTreeNodeForField.ts +2 -0
  921. package/src/simple-tree/index.ts +14 -21
  922. package/src/simple-tree/leafNodeSchema.ts +1 -0
  923. package/src/simple-tree/{arrayNode.ts → node-kinds/array/arrayNode.ts} +10 -10
  924. package/src/simple-tree/{arrayNodeTypes.ts → node-kinds/array/arrayNodeTypes.ts} +3 -3
  925. package/src/simple-tree/node-kinds/array/index.ts +18 -0
  926. package/src/simple-tree/node-kinds/index.ts +40 -0
  927. package/src/simple-tree/node-kinds/map/index.ts +16 -0
  928. package/src/simple-tree/{mapNode.ts → node-kinds/map/mapNode.ts} +10 -10
  929. package/src/simple-tree/{mapNodeTypes.ts → node-kinds/map/mapNodeTypes.ts} +3 -3
  930. package/src/simple-tree/node-kinds/object/index.ts +17 -0
  931. package/src/simple-tree/{objectNode.ts → node-kinds/object/objectNode.ts} +63 -34
  932. package/src/simple-tree/{objectNodeTypes.ts → node-kinds/object/objectNodeTypes.ts} +5 -5
  933. package/src/simple-tree/prepareForInsertion.ts +1 -1
  934. package/src/simple-tree/schemaTypes.ts +4 -3
  935. package/src/simple-tree/simpleSchema.ts +1 -0
  936. package/src/simple-tree/toMapTree.ts +11 -30
  937. package/src/simple-tree/toStoredSchema.ts +3 -2
  938. package/src/simple-tree/treeNodeValid.ts +3 -3
  939. package/src/simple-tree/walkFieldSchema.ts +0 -1
  940. package/src/treeFactory.ts +1 -1
  941. package/src/util/bTreeUtils.ts +1 -0
  942. package/src/util/breakable.ts +19 -4
  943. package/dist/simple-tree/api/testRecursiveDomain.d.ts +0 -62
  944. package/dist/simple-tree/api/testRecursiveDomain.d.ts.map +0 -1
  945. package/dist/simple-tree/api/testRecursiveDomain.js +0 -45
  946. package/dist/simple-tree/api/testRecursiveDomain.js.map +0 -1
  947. package/dist/simple-tree/arrayNode.d.ts.map +0 -1
  948. package/dist/simple-tree/arrayNode.js.map +0 -1
  949. package/dist/simple-tree/arrayNodeTypes.d.ts.map +0 -1
  950. package/dist/simple-tree/mapNode.d.ts.map +0 -1
  951. package/dist/simple-tree/mapNode.js.map +0 -1
  952. package/dist/simple-tree/mapNodeTypes.d.ts.map +0 -1
  953. package/dist/simple-tree/mapNodeTypes.js.map +0 -1
  954. package/dist/simple-tree/objectNode.d.ts.map +0 -1
  955. package/dist/simple-tree/objectNode.js.map +0 -1
  956. package/dist/simple-tree/objectNodeTypes.d.ts.map +0 -1
  957. package/dist/simple-tree/objectNodeTypes.js.map +0 -1
  958. package/lib/simple-tree/api/testRecursiveDomain.d.ts +0 -62
  959. package/lib/simple-tree/api/testRecursiveDomain.d.ts.map +0 -1
  960. package/lib/simple-tree/api/testRecursiveDomain.js +0 -41
  961. package/lib/simple-tree/api/testRecursiveDomain.js.map +0 -1
  962. package/lib/simple-tree/arrayNode.d.ts.map +0 -1
  963. package/lib/simple-tree/arrayNode.js.map +0 -1
  964. package/lib/simple-tree/arrayNodeTypes.d.ts.map +0 -1
  965. package/lib/simple-tree/arrayNodeTypes.js.map +0 -1
  966. package/lib/simple-tree/mapNode.d.ts.map +0 -1
  967. package/lib/simple-tree/mapNode.js.map +0 -1
  968. package/lib/simple-tree/mapNodeTypes.d.ts.map +0 -1
  969. package/lib/simple-tree/mapNodeTypes.js.map +0 -1
  970. package/lib/simple-tree/objectNode.d.ts.map +0 -1
  971. package/lib/simple-tree/objectNode.js.map +0 -1
  972. package/lib/simple-tree/objectNodeTypes.d.ts.map +0 -1
  973. package/lib/simple-tree/objectNodeTypes.js.map +0 -1
  974. package/src/simple-tree/api/testRecursiveDomain.ts +0 -53
@@ -3,6 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
6
+ import type { IIdCompressor } from "@fluidframework/id-compressor";
6
7
  import type { ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions/internal";
7
8
  import type { IJsonCodec } from "../codec/index.js";
8
9
  import type { ChangeFamily, ChangeFamilyEditor, SchemaAndPolicy } from "../core/index.js";
@@ -10,7 +11,6 @@ import type { JsonCompatibleReadOnly } from "../util/index.js";
10
11
  import type { EditManager, SummaryData } from "./editManager.js";
11
12
  import type { EditManagerEncodingContext } from "./editManagerCodecs.js";
12
13
  import type { Summarizable, SummaryElementParser, SummaryElementStringifier } from "./sharedTreeCore.js";
13
- import type { IIdCompressor } from "@fluidframework/id-compressor";
14
14
  /**
15
15
  * Provides methods for summarizing and loading an `EditManager`
16
16
  */
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerSummarizer.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EACX,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,8CAA8C,CAAC;AAGtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EACX,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAInE;;GAEG;AACH,qBAAa,qBAAqB,CAAC,UAA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AIjC,OAAO,CAAC,aAAa;IAUR,IAAI,CAChB,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,oBAAoB,GACzB,OAAO,CAAC,IAAI,CAAC;CAehB"}
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerSummarizer.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerSummarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,kEAA6D;AAM7D,0EAAsF;AAetF,MAAM,SAAS,GAAG,QAAQ,CAAC;AAE3B;;GAEG;AACH,MAAa,qBAAqB;IAGjC,YACkB,WAIhB,EACgB,KAKhB,EACgB,YAA2B,EAC3B,eAAiC;QAZjC,gBAAW,GAAX,WAAW,CAI3B;QACgB,UAAK,GAAL,KAAK,CAKrB;QACgB,iBAAY,GAAZ,YAAY,CAAe;QAC3B,oBAAe,GAAf,eAAe,CAAkB;QAfnC,QAAG,GAAG,aAAa,CAAC;IAgBjC,CAAC;IAEG,gBAAgB,CACtB,SAAoC,EACpC,QAAkB,EAClB,UAAoB,EACpB,gBAAoC;QAEpC,OAAO,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAEM,KAAK,CAAC,SAAS,CACrB,SAAoC,EACpC,QAAkB,EAClB,UAAoB,EACpB,gBAAoC;QAEpC,OAAO,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAEO,aAAa,CAAC,SAAoC;QACzD,MAAM,OAAO,GACZ,IAAI,CAAC,eAAe,KAAK,SAAS;YACjC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE;YACnE,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC;QACxC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,EAAE,OAAO,CAAC,CAAC;QACrF,MAAM,UAAU,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;QAC7C,OAAO,IAAA,kCAAuB,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,IAAI,CAChB,QAAgC,EAChC,KAA2B;QAE3B,MAAM,YAAY,GAAoB,MAAM,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAEzE,gEAAgE;QAChE,wEAAwE;QACxE,gDAAgD;QAChD,IAAA,iBAAM,EACL,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAC1B,KAAK,CAAC,mFAAmF,CACzF,CAAC;QAEF,MAAM,OAAO,GAAG,KAAK,CAAC,IAAA,6BAAc,EAAC,YAAY,EAAE,OAAO,CAAC,CAA2B,CAAC;QACvF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QAC7E,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CACD;AAjED,sDAiEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { createSingleBlobSummary } from \"@fluidframework/shared-object-base/internal\";\n\nimport type { IJsonCodec } from \"../codec/index.js\";\nimport type { ChangeFamily, ChangeFamilyEditor, SchemaAndPolicy } from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport type { EditManager, SummaryData } from \"./editManager.js\";\nimport type { EditManagerEncodingContext } from \"./editManagerCodecs.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"./sharedTreeCore.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nconst stringKey = \"String\";\n\n/**\n * Provides methods for summarizing and loading an `EditManager`\n */\nexport class EditManagerSummarizer<TChangeset> implements Summarizable {\n\tpublic readonly key = \"EditManager\";\n\n\tpublic constructor(\n\t\tprivate readonly editManager: EditManager<\n\t\t\tChangeFamilyEditor,\n\t\t\tTChangeset,\n\t\t\tChangeFamily<ChangeFamilyEditor, TChangeset>\n\t\t>,\n\t\tprivate readonly codec: IJsonCodec<\n\t\t\tSummaryData<TChangeset>,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tEditManagerEncodingContext\n\t\t>,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\tprivate readonly schemaAndPolicy?: SchemaAndPolicy,\n\t) {}\n\n\tpublic getAttachSummary(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\treturn this.summarizeCore(stringify);\n\t}\n\n\tpublic async summarize(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\treturn this.summarizeCore(stringify);\n\t}\n\n\tprivate summarizeCore(stringify: SummaryElementStringifier): ISummaryTreeWithStats {\n\t\tconst context: EditManagerEncodingContext =\n\t\t\tthis.schemaAndPolicy !== undefined\n\t\t\t\t? { schema: this.schemaAndPolicy, idCompressor: this.idCompressor }\n\t\t\t\t: { idCompressor: this.idCompressor };\n\t\tconst jsonCompatible = this.codec.encode(this.editManager.getSummaryData(), context);\n\t\tconst dataString = stringify(jsonCompatible);\n\t\treturn createSingleBlobSummary(stringKey, dataString);\n\t}\n\n\tpublic async load(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\tconst schemaBuffer: ArrayBufferLike = await services.readBlob(stringKey);\n\n\t\t// After the awaits, validate that the data is in a clean state.\n\t\t// This detects any data that could have been accidentally added through\n\t\t// invalid means and is about to be overwritten.\n\t\tassert(\n\t\t\tthis.editManager.isEmpty(),\n\t\t\t0x42c /* There should not already be stored EditManager data when loading from summary */,\n\t\t);\n\n\t\tconst summary = parse(bufferToString(schemaBuffer, \"utf-8\")) as JsonCompatibleReadOnly;\n\t\tconst data = this.codec.decode(summary, { idCompressor: this.idCompressor });\n\t\tthis.editManager.loadSummaryData(data);\n\t}\n}\n"]}
1
+ {"version":3,"file":"editManagerSummarizer.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerSummarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,kEAA6D;AAO7D,0EAAsF;AActF,MAAM,SAAS,GAAG,QAAQ,CAAC;AAE3B;;GAEG;AACH,MAAa,qBAAqB;IAGjC,YACkB,WAIhB,EACgB,KAKhB,EACgB,YAA2B,EAC3B,eAAiC;QAZjC,gBAAW,GAAX,WAAW,CAI3B;QACgB,UAAK,GAAL,KAAK,CAKrB;QACgB,iBAAY,GAAZ,YAAY,CAAe;QAC3B,oBAAe,GAAf,eAAe,CAAkB;QAfnC,QAAG,GAAG,aAAa,CAAC;IAgBjC,CAAC;IAEG,gBAAgB,CACtB,SAAoC,EACpC,QAAkB,EAClB,UAAoB,EACpB,gBAAoC;QAEpC,OAAO,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAEM,KAAK,CAAC,SAAS,CACrB,SAAoC,EACpC,QAAkB,EAClB,UAAoB,EACpB,gBAAoC;QAEpC,OAAO,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAEO,aAAa,CAAC,SAAoC;QACzD,MAAM,OAAO,GACZ,IAAI,CAAC,eAAe,KAAK,SAAS;YACjC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE;YACnE,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC;QACxC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,EAAE,OAAO,CAAC,CAAC;QACrF,MAAM,UAAU,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;QAC7C,OAAO,IAAA,kCAAuB,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,IAAI,CAChB,QAAgC,EAChC,KAA2B;QAE3B,MAAM,YAAY,GAAoB,MAAM,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAEzE,gEAAgE;QAChE,wEAAwE;QACxE,gDAAgD;QAChD,IAAA,iBAAM,EACL,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAC1B,KAAK,CAAC,mFAAmF,CACzF,CAAC;QAEF,MAAM,OAAO,GAAG,KAAK,CAAC,IAAA,6BAAc,EAAC,YAAY,EAAE,OAAO,CAAC,CAA2B,CAAC;QACvF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QAC7E,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CACD;AAjED,sDAiEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type {\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { createSingleBlobSummary } from \"@fluidframework/shared-object-base/internal\";\n\nimport type { IJsonCodec } from \"../codec/index.js\";\nimport type { ChangeFamily, ChangeFamilyEditor, SchemaAndPolicy } from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport type { EditManager, SummaryData } from \"./editManager.js\";\nimport type { EditManagerEncodingContext } from \"./editManagerCodecs.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"./sharedTreeCore.js\";\n\nconst stringKey = \"String\";\n\n/**\n * Provides methods for summarizing and loading an `EditManager`\n */\nexport class EditManagerSummarizer<TChangeset> implements Summarizable {\n\tpublic readonly key = \"EditManager\";\n\n\tpublic constructor(\n\t\tprivate readonly editManager: EditManager<\n\t\t\tChangeFamilyEditor,\n\t\t\tTChangeset,\n\t\t\tChangeFamily<ChangeFamilyEditor, TChangeset>\n\t\t>,\n\t\tprivate readonly codec: IJsonCodec<\n\t\t\tSummaryData<TChangeset>,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tEditManagerEncodingContext\n\t\t>,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\tprivate readonly schemaAndPolicy?: SchemaAndPolicy,\n\t) {}\n\n\tpublic getAttachSummary(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\treturn this.summarizeCore(stringify);\n\t}\n\n\tpublic async summarize(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\treturn this.summarizeCore(stringify);\n\t}\n\n\tprivate summarizeCore(stringify: SummaryElementStringifier): ISummaryTreeWithStats {\n\t\tconst context: EditManagerEncodingContext =\n\t\t\tthis.schemaAndPolicy !== undefined\n\t\t\t\t? { schema: this.schemaAndPolicy, idCompressor: this.idCompressor }\n\t\t\t\t: { idCompressor: this.idCompressor };\n\t\tconst jsonCompatible = this.codec.encode(this.editManager.getSummaryData(), context);\n\t\tconst dataString = stringify(jsonCompatible);\n\t\treturn createSingleBlobSummary(stringKey, dataString);\n\t}\n\n\tpublic async load(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\tconst schemaBuffer: ArrayBufferLike = await services.readBlob(stringKey);\n\n\t\t// After the awaits, validate that the data is in a clean state.\n\t\t// This detects any data that could have been accidentally added through\n\t\t// invalid means and is about to be overwritten.\n\t\tassert(\n\t\t\tthis.editManager.isEmpty(),\n\t\t\t0x42c /* There should not already be stored EditManager data when loading from summary */,\n\t\t);\n\n\t\tconst summary = parse(bufferToString(schemaBuffer, \"utf-8\")) as JsonCompatibleReadOnly;\n\t\tconst data = this.codec.decode(summary, { idCompressor: this.idCompressor });\n\t\tthis.editManager.loadSummaryData(data);\n\t}\n}\n"]}
@@ -13,7 +13,7 @@ export interface MessageEncodingContext {
13
13
  }
14
14
  export declare function makeMessageCodec<TChangeset>(changeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>, options: ICodecOptions, writeVersion: number): IJsonCodec<DecodedMessage<TChangeset>, JsonCompatibleReadOnly, JsonCompatibleReadOnly, MessageEncodingContext>;
15
15
  /**
16
- * @privateRemarks - Exported for testing.
16
+ * @privateRemarks Exported for testing.
17
17
  */
18
18
  export declare function makeMessageCodecs<TChangeset>(changeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>, options: ICodecOptions): ICodecFamily<DecodedMessage<TChangeset>, MessageEncodingContext>;
19
19
  //# sourceMappingURL=messageCodecs.d.ts.map
@@ -14,7 +14,7 @@ function makeMessageCodec(changeCodecs, revisionTagCodec, options, writeVersion)
14
14
  }
15
15
  exports.makeMessageCodec = makeMessageCodec;
16
16
  /**
17
- * @privateRemarks - Exported for testing.
17
+ * @privateRemarks Exported for testing.
18
18
  */
19
19
  function makeMessageCodecs(changeCodecs, revisionTagCodec, options) {
20
20
  const v1Codec = makeV1CodecWithVersion(changeCodecs.resolve(1).json, revisionTagCodec, options, 1);
@@ -1 +1 @@
1
- {"version":3,"file":"messageCodecs.js","sourceRoot":"","sources":["../../src/shared-tree-core/messageCodecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAA0D;AAE1D,gDAO2B;AAU3B,yDAA6C;AAS7C,SAAgB,gBAAgB,CAC/B,YAA6D,EAC7D,gBAKC,EACD,OAAsB,EACtB,YAAoB;IAOpB,MAAM,MAAM,GAAG,iBAAiB,CAAC,YAAY,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC;IAC1E,OAAO,IAAA,sCAA2B,EAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;AAC1E,CAAC;AAlBD,4CAkBC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAChC,YAA6D,EAC7D,gBAKC,EACD,OAAsB;IAEtB,MAAM,OAAO,GAAG,sBAAsB,CACrC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAC5B,gBAAgB,EAChB,OAAO,EACP,CAAC,CACD,CAAC;IACF,OAAO,IAAA,0BAAe,EAAC;QACtB,+EAA+E;QAC/E,CAAC,SAAS,EAAE,OAAO,CAAC;QACpB,CAAC,CAAC,EAAE,OAAO,CAAC;QACZ,CAAC,CAAC,EAAE,sBAAsB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,gBAAgB,EAAE,O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AC;YAElC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,eAAe,EAAE;gBACzD,YAAY;gBACZ,QAAQ,EAAE,SAAS;gBACnB,YAAY,EAAE,OAAO,CAAC,YAAY;aAClC,CAAC,CAAC;YAEH,OAAO;gBACN,MAAM,EAAE;oBACP,QAAQ;oBACR,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE;wBACrC,YAAY;wBACZ,QAAQ;wBACR,YAAY,EAAE,OAAO,CAAC,YAAY;qBAClC,CAAC;iBACF;gBACD,SAAS,EAAE,YAAY;aACvB,CAAC;QACH,CAAC;KACD,EACD,OAAO,CAAC,aAAa,CACrB,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type TAnySchema, Type } from \"@sinclair/typebox\";\n\nimport {\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\tmakeVersionDispatchingCodec,\n\twithSchemaValidation,\n} from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tChangeFamilyCodec,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport { Message } from \"./messageFormat.js\";\nimport type { DecodedMessage } from \"./messageTypes.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nexport interface MessageEncodingContext {\n\tidCompressor: IIdCompressor;\n\tschema?: SchemaAndPolicy;\n}\n\nexport function makeMessageCodec<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n\twriteVersion: number,\n): IJsonCodec<\n\tDecodedMessage<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tMessageEncodingContext\n> {\n\tconst family = makeMessageCodecs(changeCodecs, revisionTagCodec, options);\n\treturn makeVersionDispatchingCodec(family, { ...options, writeVersion });\n}\n\n/**\n * @privateRemarks - Exported for testing.\n */\nexport function makeMessageCodecs<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n): ICodecFamily<DecodedMessage<TChangeset>, MessageEncodingContext> {\n\tconst v1Codec = makeV1CodecWithVersion(\n\t\tchangeCodecs.resolve(1).json,\n\t\trevisionTagCodec,\n\t\toptions,\n\t\t1,\n\t);\n\treturn makeCodecFamily([\n\t\t// Back-compat: messages weren't always written with an explicit version field.\n\t\t[undefined, v1Codec],\n\t\t[1, v1Codec],\n\t\t[2, makeV1CodecWithVersion(changeCodecs.resolve(2).json, revisionTagCodec, options, 2)],\n\t\t[3, makeV1CodecWithVersion(changeCodecs.resolve(3).json, revisionTagCodec, options, 3)],\n\t\t[4, makeV1CodecWithVersion(changeCodecs.resolve(4).json, revisionTagCodec, options, 4)],\n\t]);\n}\n\nfunction makeV1CodecWithVersion<TChangeset>(\n\tchangeCodec: ChangeFamilyCodec<TChangeset>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n\tversion: 1 | 2 | 3 | 4,\n): IJsonCodec<\n\tDecodedMessage<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tMessageEncodingContext\n> {\n\treturn withSchemaValidation<\n\t\tDecodedMessage<TChangeset>,\n\t\tTAnySchema,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tMessageEncodingContext\n\t>(\n\t\tMessage(changeCodec.encodedSchema ?? Type.Any()),\n\t\t{\n\t\t\tencode: (\n\t\t\t\t{ commit, sessionId: originatorId }: DecodedMessage<TChangeset>,\n\t\t\t\tcontext: MessageEncodingContext,\n\t\t\t) => {\n\t\t\t\tconst message: Message = {\n\t\t\t\t\trevision: revisionTagCodec.encode(commit.revision, {\n\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t}),\n\t\t\t\t\toriginatorId,\n\t\t\t\t\tchangeset: changeCodec.encode(commit.change, {\n\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\tschema: context.schema,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\trevision: commit.revision,\n\t\t\t\t\t}),\n\t\t\t\t\tversion,\n\t\t\t\t};\n\t\t\t\treturn message as unknown as JsonCompatibleReadOnly;\n\t\t\t},\n\t\t\tdecode: (encoded: JsonCompatibleReadOnly, context: MessageEncodingContext) => {\n\t\t\t\tconst {\n\t\t\t\t\trevision: encodedRevision,\n\t\t\t\t\toriginatorId,\n\t\t\t\t\tchangeset,\n\t\t\t\t} = encoded as unknown as Message;\n\n\t\t\t\tconst revision = revisionTagCodec.decode(encodedRevision, {\n\t\t\t\t\toriginatorId,\n\t\t\t\t\trevision: undefined,\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\tcommit: {\n\t\t\t\t\t\trevision,\n\t\t\t\t\t\tchange: changeCodec.decode(changeset, {\n\t\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\tsessionId: originatorId,\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t\toptions.jsonValidator,\n\t);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EAAE,YAAY;aACvB,CAAC;QACH,CAAC;KACD,EACD,OAAO,CAAC,aAAa,CACrB,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type TAnySchema, Type } from \"@sinclair/typebox\";\n\nimport {\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\tmakeVersionDispatchingCodec,\n\twithSchemaValidation,\n} from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tChangeFamilyCodec,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport { Message } from \"./messageFormat.js\";\nimport type { DecodedMessage } from \"./messageTypes.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nexport interface MessageEncodingContext {\n\tidCompressor: IIdCompressor;\n\tschema?: SchemaAndPolicy;\n}\n\nexport function makeMessageCodec<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n\twriteVersion: number,\n): IJsonCodec<\n\tDecodedMessage<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tMessageEncodingContext\n> {\n\tconst family = makeMessageCodecs(changeCodecs, revisionTagCodec, options);\n\treturn makeVersionDispatchingCodec(family, { ...options, writeVersion });\n}\n\n/**\n * @privateRemarks Exported for testing.\n */\nexport function makeMessageCodecs<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n): ICodecFamily<DecodedMessage<TChangeset>, MessageEncodingContext> {\n\tconst v1Codec = makeV1CodecWithVersion(\n\t\tchangeCodecs.resolve(1).json,\n\t\trevisionTagCodec,\n\t\toptions,\n\t\t1,\n\t);\n\treturn makeCodecFamily([\n\t\t// Back-compat: messages weren't always written with an explicit version field.\n\t\t[undefined, v1Codec],\n\t\t[1, v1Codec],\n\t\t[2, makeV1CodecWithVersion(changeCodecs.resolve(2).json, revisionTagCodec, options, 2)],\n\t\t[3, makeV1CodecWithVersion(changeCodecs.resolve(3).json, revisionTagCodec, options, 3)],\n\t\t[4, makeV1CodecWithVersion(changeCodecs.resolve(4).json, revisionTagCodec, options, 4)],\n\t]);\n}\n\nfunction makeV1CodecWithVersion<TChangeset>(\n\tchangeCodec: ChangeFamilyCodec<TChangeset>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n\tversion: 1 | 2 | 3 | 4,\n): IJsonCodec<\n\tDecodedMessage<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tMessageEncodingContext\n> {\n\treturn withSchemaValidation<\n\t\tDecodedMessage<TChangeset>,\n\t\tTAnySchema,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tMessageEncodingContext\n\t>(\n\t\tMessage(changeCodec.encodedSchema ?? Type.Any()),\n\t\t{\n\t\t\tencode: (\n\t\t\t\t{ commit, sessionId: originatorId }: DecodedMessage<TChangeset>,\n\t\t\t\tcontext: MessageEncodingContext,\n\t\t\t) => {\n\t\t\t\tconst message: Message = {\n\t\t\t\t\trevision: revisionTagCodec.encode(commit.revision, {\n\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t}),\n\t\t\t\t\toriginatorId,\n\t\t\t\t\tchangeset: changeCodec.encode(commit.change, {\n\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\tschema: context.schema,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\trevision: commit.revision,\n\t\t\t\t\t}),\n\t\t\t\t\tversion,\n\t\t\t\t};\n\t\t\t\treturn message as unknown as JsonCompatibleReadOnly;\n\t\t\t},\n\t\t\tdecode: (encoded: JsonCompatibleReadOnly, context: MessageEncodingContext) => {\n\t\t\t\tconst {\n\t\t\t\t\trevision: encodedRevision,\n\t\t\t\t\toriginatorId,\n\t\t\t\t\tchangeset,\n\t\t\t\t} = encoded as unknown as Message;\n\n\t\t\t\tconst revision = revisionTagCodec.decode(encodedRevision, {\n\t\t\t\t\toriginatorId,\n\t\t\t\t\trevision: undefined,\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\tcommit: {\n\t\t\t\t\t\trevision,\n\t\t\t\t\t\tchange: changeCodec.decode(changeset, {\n\t\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\tsessionId: originatorId,\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t\toptions.jsonValidator,\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceIdUtils.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/sequenceIdUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,MAAO,UAAU,KAAK,UAAU,KAAG,MAKlB,CAAC;AACnD,eAAO,MAAM,gBAAgB,MAAO,UAAU,KAAK,UAAU,KAAG,OAC/B,CAAC;AAClC,eAAO,MAAM,aAAa,MAAO,UAAU,KAAK,UAAU,KAAG,UACtB,CAAC;AACxC,eAAO,MAAM,aAAa,MAAO,UAAU,KAAK,UAAU,KAAG,UACtB,CAAC;AACxC;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,eAAgB,UAAU,KAAG,UAc1E,CAAC"}
1
+ {"version":3,"file":"sequenceIdUtils.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/sequenceIdUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,MAAO,UAAU,KAAK,UAAU,KAAG,MAKlB,CAAC;AACnD,eAAO,MAAM,gBAAgB,MAAO,UAAU,KAAK,UAAU,KAAG,OAC/B,CAAC;AAClC,eAAO,MAAM,aAAa,MAAO,UAAU,KAAK,UAAU,KAAG,UACtB,CAAC;AACxC,eAAO,MAAM,aAAa,MAAO,UAAU,KAAK,UAAU,KAAG,UACtB,CAAC;AACxC;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,eAAgB,UAAU,KAAG,UAc1E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceIdUtils.js","sourceRoot":"","sources":["../../src/shared-tree-core/sequenceIdUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,+CAAyC;AAIzC;;;GAGG;AACI,MAAM,oBAAoB,GAAG,CAAC,CAAa,EAAE,CAAa,EAAU,EAAE,CAC5E,CAAC,CAAC,cAAc,KAAK,CAAC,CAAC,cAAc;IACpC,CAAC,CAAC,CAAC,CAAC,cAAc,GAAG,CAAC,CAAC,cAAc;IACrC,CAAC,CAAC,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,YAAY;QAClC,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAA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CAc5C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { brand } from \"../util/index.js\";\n\nimport type { SequenceId } from \"./editManagerFormat.js\";\n\n/**\n * Compares two sequenceIds. Returns a negative number if a \\< b, a positive number if a \\> b, and 0 if a === b.\n * Note that this handles cases where indexInBatch is Number.POSITIVE_INFINITY.\n */\nexport const sequenceIdComparator = (a: SequenceId, b: SequenceId): number =>\n\ta.sequenceNumber !== b.sequenceNumber\n\t\t? a.sequenceNumber - b.sequenceNumber\n\t\t: a.indexInBatch === b.indexInBatch\n\t\t\t? 0\n\t\t\t: (a.indexInBatch ?? 0) - (b.indexInBatch ?? 0);\nexport const equalSequenceIds = (a: SequenceId, b: SequenceId): boolean =>\n\tsequenceIdComparator(a, b) === 0;\nexport const minSequenceId = (a: SequenceId, b: SequenceId): SequenceId =>\n\tsequenceIdComparator(a, b) < 0 ? a : b;\nexport const maxSequenceId = (a: SequenceId, b: SequenceId): SequenceId =>\n\tsequenceIdComparator(a, b) > 0 ? a : b;\n/**\n * Returns the upper bound (maximum possible) sequenceId that can occur just before the given sequenceId.\n * Some examples:\n * 1. sequenceId = \\{ sequenceNumber: 1, indexInBatch: 2 \\}. The upper bound is \\{ sequenceNumber: 1, indexInBatch: 1 \\}.\n * 2. sequenceId = \\{ sequenceNumber: 2 \\}. The upper bound is \\{ sequenceNumber: 1, indexInBatch: Number.POSITIVE_INFINITY \\}.\n * The indexInBatch value of the previous commit will depend on how many ops were in the previous batch of messages received.\n */\nexport const getUpperBoundOfPreviousSequenceId = (sequenceId: SequenceId): SequenceId => {\n\tassert(\n\t\tsequenceId.indexInBatch === undefined || Number.isFinite(sequenceId.indexInBatch),\n\t\t0xabc /* indexInBatch must not be infinity */,\n\t);\n\treturn sequenceId.indexInBatch === undefined || sequenceId.indexInBatch === 0\n\t\t? {\n\t\t\t\tsequenceNumber: brand(sequenceId.sequenceNumber - 1),\n\t\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t\t}\n\t\t: {\n\t\t\t\tsequenceNumber: brand(sequenceId.sequenceNumber),\n\t\t\t\tindexInBatch: sequenceId.indexInBatch - 1,\n\t\t\t};\n};\n"]}
1
+ {"version":3,"file":"sequenceIdUtils.js","sourceRoot":"","sources":["../../src/shared-tree-core/sequenceIdUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,+CAAyC;AAIzC;;;GAGG;AACI,MAAM,oBAAoB,GAAG,CAAC,CAAa,EAAE,CAAa,EAAU,EAAE,CAC5E,CAAC,CAAC,cAAc,KAAK,CAAC,CAAC,cAAc;IACpC,CAAC,CAAC,CAAC,CAAC,cAAc,GAAG,CAAC,CAAC,cAAc;IACrC,CAAC,CAAC,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,YAAY;QAClC,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,CAAC;AALtC,QAAA,oBAAoB,wBAKkB;AAC5C,MAAM,gBAAgB,GAAG,CAAC,CAAa,EAAE,CAAa,EAAW,EAAE,CACzE,IAAA,4BAAoB,EAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;AADrB,QAAA,gBAAgB,oBACK;AAC3B,MAAM,aAAa,GAAG,CAAC,CAAa,EAAE,CAAa,EAAc,EAAE,CACzE,IAAA,4BAAoB,EAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAD3B,QAAA,aAAa,iBACc;AACjC,MAAM,aAAa,GAAG,CAAC,CAAa,EAAE,CAAa,EAAc,EAAE,CACzE,IAAA,4BAAoB,EAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAD3B,QAAA,aAAa,iBACc;AACxC;;;;;;GAMG;AACI,MAAM,iCAAiC,GAAG,CAAC,UAAsB,EAAc,EAAE;IACvF,IAAA,iBAAM,EACL,UAAU,CAAC,YAAY,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC,EACjF,KAAK,CAAC,uCAAuC,CAC7C,CAAC;IACF,OAAO,UAAU,CAAC,YAAY,KAAK,SAAS,IAAI,UAAU,CAAC,YAAY,KAAK,CAAC;QAC5E,CAAC,CAAC;YACA,cAAc,EAAE,IAAA,gBAAK,EAAC,UAAU,CAAC,cAAc,GAAG,CAAC,CAAC;YACpD,YAAY,EAAE,MAAM,CAAC,iBAAiB;SACtC;QACF,CAAC,CAAC;YACA,cAAc,EAAE,IAAA,gBAAK,EAAC,UAAU,CAAC,cAAc,CAAC;YAChD,YAAY,EAAE,UAAU,CAAC,YAAY,GAAG,CAAC;SACzC,CAAC;AACL,CAAC,CAAC;AAdW,QAAA,iCAAiC,qCAc5C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { brand } from \"../util/index.js\";\n\nimport type { SequenceId } from \"./editManagerFormat.js\";\n\n/**\n * Compares two sequenceIds. Returns a negative number if a \\< b, a positive number if a \\> b, and 0 if a === b.\n * Note that this handles cases where indexInBatch is Number.POSITIVE_INFINITY.\n */\nexport const sequenceIdComparator = (a: SequenceId, b: SequenceId): number =>\n\ta.sequenceNumber !== b.sequenceNumber\n\t\t? a.sequenceNumber - b.sequenceNumber\n\t\t: a.indexInBatch === b.indexInBatch\n\t\t\t? 0\n\t\t\t: (a.indexInBatch ?? 0) - (b.indexInBatch ?? 0);\nexport const equalSequenceIds = (a: SequenceId, b: SequenceId): boolean =>\n\tsequenceIdComparator(a, b) === 0;\nexport const minSequenceId = (a: SequenceId, b: SequenceId): SequenceId =>\n\tsequenceIdComparator(a, b) < 0 ? a : b;\nexport const maxSequenceId = (a: SequenceId, b: SequenceId): SequenceId =>\n\tsequenceIdComparator(a, b) > 0 ? a : b;\n/**\n * Returns the upper bound (maximum possible) sequenceId that can occur just before the given sequenceId.\n * Some examples:\n * 1. sequenceId = \\{ sequenceNumber: 1, indexInBatch: 2 \\}. The upper bound is \\{ sequenceNumber: 1, indexInBatch: 1 \\}.\n * 2. sequenceId = \\{ sequenceNumber: 2 \\}. The upper bound is \\{ sequenceNumber: 1, indexInBatch: Number.POSITIVE_INFINITY \\}.\n * The indexInBatch value of the previous commit will depend on how many ops were in the previous batch of messages received.\n */\nexport const getUpperBoundOfPreviousSequenceId = (sequenceId: SequenceId): SequenceId => {\n\tassert(\n\t\tsequenceId.indexInBatch === undefined || Number.isFinite(sequenceId.indexInBatch),\n\t\t0xabc /* indexInBatch must not be infinity */,\n\t);\n\treturn sequenceId.indexInBatch === undefined || sequenceId.indexInBatch === 0\n\t\t? {\n\t\t\t\tsequenceNumber: brand(sequenceId.sequenceNumber - 1),\n\t\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t\t}\n\t\t: {\n\t\t\t\tsequenceNumber: brand(sequenceId.sequenceNumber),\n\t\t\t\tindexInBatch: sequenceId.indexInBatch - 1,\n\t\t\t};\n};\n"]}
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import type { IFluidLoadable, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
5
6
  import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
6
7
  import type { IIdCompressor } from "@fluidframework/id-compressor";
7
8
  import type { IExperimentalIncrementalSummaryContext, IRuntimeMessageCollection, ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions/internal";
@@ -10,10 +11,9 @@ import type { ICodecOptions } from "../codec/index.js";
10
11
  import { type ChangeFamily, type ChangeFamilyEditor, type GraphCommit, type RevisionTag, type SchemaAndPolicy, type SchemaPolicy, type TreeStoredSchemaRepository } from "../core/index.js";
11
12
  import { type JsonCompatibleReadOnly, type Breakable, type WithBreakable } from "../util/index.js";
12
13
  import type { SharedTreeBranch } from "./branch.js";
14
+ import { BranchCommitEnricher } from "./branchCommitEnricher.js";
13
15
  import { type ChangeEnricherReadonlyCheckout } from "./changeEnricher.js";
14
16
  import type { ResubmitMachine } from "./resubmitMachine.js";
15
- import { BranchCommitEnricher } from "./branchCommitEnricher.js";
16
- import type { IFluidLoadable, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
17
17
  export interface ExplicitCoreCodecVersions {
18
18
  editManager: number;
19
19
  message: number;
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeCore.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/sharedTreeCore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EACX,sCAAsC,EACtC,yBAAyB,EACzB,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,8CAA8C,CAAC;AAEtD,OAAO,KAAK,EACX,YAAY,EACZ,gBAAgB,EAChB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,mBAAmB,CAAC;AACnE,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,kBAAkB,EAEvB,KAAK,WAAW,EAChB,KAAK,WAAW,EAEhB,KAAK,eAAe,EACpB,KAAK,YAAY,EAEjB,KAAK,0BAA0B,EAC/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,sBAAsB,EAE3B,KAAK,SAAS,EACd,KAAK,aAAa,EAGlB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,gBAAgB,EAAE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BAAgB,CAAC,OAAO,EAAE,OAAO,CAAC;IAIpD,SAAS,IAAI,IAAI;IAIjB,YAAY,CAAC,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IA6B7E,cAAc,CAAC,OAAO,EAAE,sBAAsB,GAAG,IAAI;CAO5D;AASD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,gBAAgB,CACf,SAAS,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,iBAAiB,EACpC,yBAAyB,CAAC,EAAE,sCAAsC,GAChE,qBAAqB,CAAC;IAEzB;;;OAGG;IACH,SAAS,CACR,SAAS,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAElC;;;;;OAKG;IACH,IAAI,CAAC,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClF;AAED;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,QAAQ,EAAE,OAAO,KAAK,MAAM,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC"}
@@ -45,16 +45,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.SharedTreeCore = void 0;
46
46
  const internal_1 = require("@fluidframework/core-utils/internal");
47
47
  const internal_2 = require("@fluidframework/runtime-utils/internal");
48
+ const internal_3 = require("@fluidframework/telemetry-utils/internal");
48
49
  const index_js_1 = require("../core/index.js");
49
50
  const index_js_2 = require("../util/index.js");
51
+ const branchCommitEnricher_js_1 = require("./branchCommitEnricher.js");
52
+ const changeEnricher_js_1 = require("./changeEnricher.js");
53
+ const defaultResubmitMachine_js_1 = require("./defaultResubmitMachine.js");
50
54
  const editManager_js_1 = require("./editManager.js");
51
55
  const editManagerCodecs_js_1 = require("./editManagerCodecs.js");
52
56
  const editManagerSummarizer_js_1 = require("./editManagerSummarizer.js");
53
57
  const messageCodecs_js_1 = require("./messageCodecs.js");
54
- const changeEnricher_js_1 = require("./changeEnricher.js");
55
- const defaultResubmitMachine_js_1 = require("./defaultResubmitMachine.js");
56
- const branchCommitEnricher_js_1 = require("./branchCommitEnricher.js");
57
- const internal_3 = require("@fluidframework/telemetry-utils/internal");
58
58
  // TODO: Organize this to be adjacent to persisted types.
59
59
  const summarizablesTreeKey = "indexes";
60
60
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeCore.js","sourceRoot":"","sources":["../../src/shared-tree-core/sharedTreeCore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA6D;AAS7D,qEAA4E;AAO5E,+CAW0B;AAC1B,+CAO0B;AAG1B,qDAA8E;AAC9E,iEAA8D;AAE9D,yEAAmE;AACnE,yDAAmF;AAEnF,2DAA8F;AAE9F,2EAAqE;AACrE,uEAAiE;AACjE,uEAA6E;AAG7E,yDAAyD;AACzD,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAWvC;;GAEG;IAEU,cAAc;4BAD1B,wBAAa;;;;;;;QAoCb;;;;;;;WAOG;QACH,YACiB,OAAkB,EAClB,YAA2C,EAC3C,UAA4B,EAC5B,kBAAyE,EACzF,MAAwC,EACxC,aAAsC,EACtC,YAA4C,EAC5C,OAAsB,EACtB,aAAwC,EACvB,YAA2B,EAC5C,MAAkC,EAClC,YAA0B,EAC1B,eAA0C,EAC1C,QAAkD,EAClC,YAA2B,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC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Q,EAAE,CAAC,CAAC;QAC1D,CAAC;;;;;qCAhNA,wBAAa;QACd,gMAAO,aAAa,6DAuBnB;QAjKF,6KA0VC;;;QA1VY,uDAAc;;;;AAAd,wCAAc;AA4V3B,SAAS,sBAAsB,CAC9B,iBAA0B;IAE1B,MAAM,eAAe,GAAG,iBAA4C,CAAC;IACrE,OAAO,eAAe,CAAC,MAAM,KAAK,SAAS,IAAI,eAAe,CAAC,MAAM,KAAK,SAAS,CAAC;AACrF,CAAC;AAsDD;;GAEG;AACH,SAAS,mBAAmB,CAC3B,OAA+B,EAC/B,GAAG,YAAsB;IAEzB,MAAM,KAAK,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAE3C,OAAO;QACN,KAAK,CAAC,QAAQ,CAAC,IAAY;YAC1B,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;QAC5C,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,IAAI;YAClB,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;QAC5C,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,IAAI;YACd,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;QACxC,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tIRuntimeMessageCollection,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\nimport type {\n\tIChannelView,\n\tIFluidSerializer,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport type { ICodecOptions, IJsonCodec } from \"../codec/index.js\";\nimport {\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\tfindAncestor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\tRevisionTagCodec,\n\ttype SchemaAndPolicy,\n\ttype SchemaPolicy,\n\ttype TaggedChange,\n\ttype TreeStoredSchemaRepository,\n} from \"../core/index.js\";\nimport {\n\ttype JsonCompatibleReadOnly,\n\tbrand,\n\ttype Breakable,\n\ttype WithBreakable,\n\tthrowIfBroken,\n\tbreakingClass,\n} from \"../util/index.js\";\n\nimport type { SharedTreeBranch } from \"./branch.js\";\nimport { EditManager, minimumPossibleSequenceNumber } from \"./editManager.js\";\nimport { makeEditManagerCodec } from \"./editManagerCodecs.js\";\nimport type { SeqNumber } from \"./editManagerFormat.js\";\nimport { EditManagerSummarizer } from \"./editManagerSummarizer.js\";\nimport { type MessageEncodingContext, makeMessageCodec } from \"./messageCodecs.js\";\nimport type { DecodedMessage } from \"./messageTypes.js\";\nimport { type ChangeEnricherReadonlyCheckout, NoOpChangeEnricher } from \"./changeEnricher.js\";\nimport type { ResubmitMachine } from \"./resubmitMachine.js\";\nimport { DefaultResubmitMachine } from \"./defaultResubmitMachine.js\";\nimport { BranchCommitEnricher } from \"./branchCommitEnricher.js\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\nimport type { IFluidLoadable, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\n\n// TODO: Organize this to be adjacent to persisted types.\nconst summarizablesTreeKey = \"indexes\";\n\nexport interface ExplicitCoreCodecVersions {\n\teditManager: number;\n\tmessage: number;\n}\n\nexport interface ClonableSchemaAndPolicy extends SchemaAndPolicy {\n\tschema: TreeStoredSchemaRepository;\n}\n\n/**\n * Generic shared tree, which needs to be configured with indexes, field kinds and other configuration.\n */\n@breakingClass\nexport class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>\n\timplements WithBreakable\n{\n\tprivate readonly editManager: EditManager<TEditor, TChange, ChangeFamily<TEditor, TChange>>;\n\tprivate readonly summarizables: readonly [EditManagerSummarizer<TChange>, ...Summarizable[]];\n\t/**\n\t * The sequence number that this instance is at.\n\t * This number is artificial in that it is made up by this instance as opposed to being provided by the runtime.\n\t * Is `undefined` after (and only after) this instance is attached.\n\t */\n\tprivate detachedRevision: SeqNumber | undefined = minimumPossibleSequenceNumber;\n\n\t/**\n\t * Used to encode/decode messages sent to/received from the Fluid runtime.\n\t *\n\t * @remarks Since there is currently only one format, this can just be cached on the class.\n\t * With more write formats active, it may make sense to keep around the \"usual\" format codec\n\t * (the one for the current persisted configuration) and resolve codecs for different versions\n\t * as necessary (e.g. an upgrade op came in, or the configuration changed within the collab window\n\t * and an op needs to be interpreted which isn't written with the current configuration).\n\t */\n\tprivate readonly messageCodec: IJsonCodec<\n\t\tDecodedMessage<TChange>,\n\t\tunknown,\n\t\tunknown,\n\t\tMessageEncodingContext\n\t>;\n\n\tprivate readonly resubmitMachine: ResubmitMachine<TChange>;\n\tpublic readonly commitEnricher: BranchCommitEnricher<TChange>;\n\n\tpublic readonly mintRevisionTag: () => RevisionTag;\n\n\tprivate readonly schemaAndPolicy: ClonableSchemaAndPolicy;\n\n\t/**\n\t * @param summarizables - Summarizers for all indexes used by this tree\n\t * @param changeFamily - The change family\n\t * @param editManager - The edit manager\n\t * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n\t * @param editor - Used to edit the state of the tree. Edits will be immediately applied locally to the tree.\n\t * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.\n\t */\n\tpublic constructor(\n\t\tpublic readonly breaker: Breakable,\n\t\tpublic readonly sharedObject: IChannelView & IFluidLoadable,\n\t\tpublic readonly serializer: IFluidSerializer,\n\t\tpublic readonly submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,\n\t\tlogger: ITelemetryBaseLogger | undefined,\n\t\tsummarizables: readonly Summarizable[],\n\t\tchangeFamily: ChangeFamily<TEditor, TChange>,\n\t\toptions: ICodecOptions,\n\t\tformatOptions: ExplicitCoreCodecVersions,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\tschema: TreeStoredSchemaRepository,\n\t\tschemaPolicy: SchemaPolicy,\n\t\tresubmitMachine?: ResubmitMachine<TChange>,\n\t\tenricher?: ChangeEnricherReadonlyCheckout<TChange>,\n\t\tpublic readonly getEditor: () => TEditor = () => this.getLocalBranch().editor,\n\t) {\n\t\tthis.schemaAndPolicy = {\n\t\t\tschema,\n\t\t\tpolicy: schemaPolicy,\n\t\t};\n\n\t\tconst rebaseLogger = createChildLogger({\n\t\t\tlogger,\n\t\t\tnamespace: \"Rebase\",\n\t\t});\n\n\t\tthis.mintRevisionTag = () => this.idCompressor.generateCompressedId();\n\t\t/**\n\t\t * A random ID that uniquely identifies this client in the collab session.\n\t\t * This is sent alongside every op to identify which client the op originated from.\n\t\t * This is used rather than the Fluid client ID because the Fluid client ID is not stable across reconnections.\n\t\t */\n\t\tconst localSessionId = idCompressor.localSessionId;\n\t\tthis.editManager = new EditManager(\n\t\t\tchangeFamily,\n\t\t\tlocalSessionId,\n\t\t\tthis.mintRevisionTag,\n\t\t\trebaseLogger,\n\t\t);\n\n\t\tthis.editManager.localBranch.events.on(\"beforeChange\", (change) => {\n\t\t\tif (this.detachedRevision === undefined) {\n\t\t\t\t// Commit enrichment is only necessary for changes that will be submitted as ops, and changes issued while detached are not submitted.\n\t\t\t\tthis.commitEnricher.processChange(change);\n\t\t\t}\n\t\t\tif (change.type === \"append\") {\n\t\t\t\tfor (const commit of change.newCommits) {\n\t\t\t\t\tthis.submitCommit(commit, this.schemaAndPolicy, false);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\t\tconst editManagerCodec = makeEditManagerCodec(\n\t\t\tthis.editManager.changeFamily.codecs,\n\t\t\trevisionTagCodec,\n\t\t\toptions,\n\t\t\tformatOptions.editManager,\n\t\t);\n\t\tthis.summarizables = [\n\t\t\tnew EditManagerSummarizer(\n\t\t\t\tthis.editManager,\n\t\t\t\teditManagerCodec,\n\t\t\t\tthis.idCompressor,\n\t\t\t\tthis.schemaAndPolicy,\n\t\t\t),\n\t\t\t...summarizables,\n\t\t];\n\t\tassert(\n\t\t\tnew Set(this.summarizables.map((e) => e.key)).size === this.summarizables.length,\n\t\t\t0x350 /* Index summary element keys must be unique */,\n\t\t);\n\n\t\tthis.messageCodec = makeMessageCodec(\n\t\t\tchangeFamily.codecs,\n\t\t\tnew RevisionTagCodec(idCompressor),\n\t\t\toptions,\n\t\t\tformatOptions.message,\n\t\t);\n\n\t\tconst changeEnricher = enricher ?? new NoOpChangeEnricher();\n\t\tthis.resubmitMachine =\n\t\t\tresubmitMachine ??\n\t\t\tnew DefaultResubmitMachine(\n\t\t\t\t(change: TaggedChange<TChange>) =>\n\t\t\t\t\tchangeFamily.rebaser.invert(change, true, this.mintRevisionTag()),\n\t\t\t\tchangeEnricher,\n\t\t\t);\n\t\tthis.commitEnricher = new BranchCommitEnricher(changeFamily.rebaser, changeEnricher);\n\t}\n\n\t// TODO: SharedObject's merging of the two summary methods into summarizeCore is not what we want here:\n\t// We might want to not subclass it, or override/reimplement most of its functionality.\n\t@throwIfBroken\n\tpublic summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tconst summarizableBuilder = new SummaryTreeBuilder();\n\t\t// Merge the summaries of all summarizables together under a single ISummaryTree\n\t\tfor (const s of this.summarizables) {\n\t\t\tsummarizableBuilder.addWithStats(\n\t\t\t\ts.key,\n\t\t\t\ts.getAttachSummary(\n\t\t\t\t\t(contents) => serializer.stringify(contents, this.sharedObject.handle),\n\t\t\t\t\tundefined,\n\t\t\t\t\tundefined,\n\t\t\t\t\ttelemetryContext,\n\t\t\t\t\tincrementalSummaryContext,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tbuilder.addWithStats(summarizablesTreeKey, summarizableBuilder.getSummaryTree());\n\t\treturn builder.getSummaryTree();\n\t}\n\n\tpublic async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tassert(\n\t\t\tthis.editManager.localBranch.getHead() === this.editManager.getTrunkHead(),\n\t\t\t0xaaa /* All local changes should be applied to the trunk before loading from summary */,\n\t\t);\n\t\tconst [editManagerSummarizer, ...summarizables] = this.summarizables;\n\t\tconst loadEditManager = this.loadSummarizable(editManagerSummarizer, services);\n\t\tconst loadSummarizables = summarizables.map(async (s) =>\n\t\t\tthis.loadSummarizable(s, services),\n\t\t);\n\n\t\tif (this.detachedRevision !== undefined) {\n\t\t\t// If we are detached but loading from a summary, then we need to update our detached revision to ensure that it is ahead of all detached revisions in the summary.\n\t\t\t// First, finish loading the edit manager so that we can inspect the sequence numbers of the commits on the trunk.\n\t\t\tawait loadEditManager;\n\t\t\t// Find the most recent detached revision in the summary trunk...\n\t\t\tlet latestDetachedSequenceNumber: SeqNumber | undefined;\n\t\t\tfindAncestor(this.editManager.getTrunkHead(), (c) => {\n\t\t\t\tconst sequenceNumber = this.editManager.getSequenceNumber(c);\n\t\t\t\tif (sequenceNumber !== undefined && sequenceNumber < 0) {\n\t\t\t\t\tlatestDetachedSequenceNumber = sequenceNumber;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t});\n\t\t\t// ...and set our detached revision to be as it would be if we had been already created that revision.\n\t\t\tthis.detachedRevision = latestDetachedSequenceNumber ?? this.detachedRevision;\n\t\t\tawait Promise.all(loadSummarizables);\n\t\t} else {\n\t\t\tawait Promise.all([loadEditManager, ...loadSummarizables]);\n\t\t}\n\t}\n\n\tprivate async loadSummarizable(\n\t\tsummarizable: Summarizable,\n\t\tservices: IChannelStorageService,\n\t): Promise<void> {\n\t\treturn summarizable.load(\n\t\t\tscopeStorageService(services, summarizablesTreeKey, summarizable.key),\n\t\t\t(contents) => this.serializer.parse(contents),\n\t\t);\n\t}\n\n\t/**\n\t * Submits an op to the Fluid runtime containing the given commit\n\t * @param commit - the commit to submit\n\t * @returns the submitted commit. This is undefined if the underlying `SharedObject` is not attached,\n\t * and may differ from `commit` due to enrichments like detached tree refreshers.\n\t */\n\tprotected submitCommit(\n\t\tcommit: GraphCommit<TChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tassert(\n\t\t\tthis.sharedObject.isAttached() === (this.detachedRevision === undefined),\n\t\t\t0x95a /* Detached revision should only be set when not attached */,\n\t\t);\n\n\t\tconst enrichedCommit =\n\t\t\tthis.detachedRevision === undefined && !isResubmit\n\t\t\t\t? this.commitEnricher.enrich(commit)\n\t\t\t\t: commit;\n\n\t\t// Edits submitted before the first attach are treated as sequenced because they will be included\n\t\t// in the attach summary that is uploaded to the service.\n\t\t// Until this attach workflow happens, this instance essentially behaves as a centralized data structure.\n\t\tif (this.detachedRevision !== undefined) {\n\t\t\tconst newRevision: SeqNumber = brand((this.detachedRevision as number) + 1);\n\t\t\tthis.detachedRevision = newRevision;\n\t\t\tthis.editManager.addSequencedChanges(\n\t\t\t\t[enrichedCommit],\n\t\t\t\tthis.editManager.localSessionId,\n\t\t\t\tnewRevision,\n\t\t\t\tthis.detachedRevision,\n\t\t\t);\n\t\t\tthis.editManager.advanceMinimumSequenceNumber(newRevision, false);\n\t\t\treturn undefined;\n\t\t}\n\t\tconst message = this.messageCodec.encode(\n\t\t\t{\n\t\t\t\tcommit: enrichedCommit,\n\t\t\t\tsessionId: this.editManager.localSessionId,\n\t\t\t},\n\t\t\t{\n\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t\tschema: schemaAndPolicy,\n\t\t\t},\n\t\t);\n\t\tthis.submitLocalMessage(message, {\n\t\t\t// Clone the schema to ensure that during resubmit the schema has not been mutated by later changes\n\t\t\tschema: schemaAndPolicy.schema.clone(),\n\t\t\tpolicy: schemaAndPolicy.policy,\n\t\t});\n\t\tthis.resubmitMachine.onCommitSubmitted(enrichedCommit);\n\t}\n\n\t/**\n\t * Process a bunch of messages from the runtime. SharedObject will call this method with a bunch of messages.\n\t */\n\tpublic processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, local, messagesContent } = messagesCollection;\n\t\tconst commits: GraphCommit<TChange>[] = [];\n\t\tlet messagesSessionId: SessionId | undefined;\n\n\t\t// Get a list of all the commits from the messages.\n\t\tfor (const messageContent of messagesContent) {\n\t\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\t\tconst { commit, sessionId } = this.messageCodec.decode(messageContent.contents, {\n\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t});\n\t\t\tcommits.push(commit);\n\n\t\t\tif (messagesSessionId !== undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tmessagesSessionId === sessionId,\n\t\t\t\t\t0xad9 /* All messages in a bunch must have the same session ID */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tmessagesSessionId = sessionId;\n\t\t}\n\n\t\tassert(messagesSessionId !== undefined, 0xada /* Messages must have a session ID */);\n\n\t\tthis.editManager.addSequencedChanges(\n\t\t\tcommits,\n\t\t\tmessagesSessionId,\n\t\t\tbrand(envelope.sequenceNumber),\n\t\t\tbrand(envelope.referenceSequenceNumber),\n\t\t);\n\n\t\t// Update the resubmit machine for each commit applied.\n\t\tfor (const _ of messagesContent) {\n\t\t\tthis.resubmitMachine.onSequencedCommitApplied(local);\n\t\t}\n\n\t\tthis.editManager.advanceMinimumSequenceNumber(brand(envelope.minimumSequenceNumber));\n\t}\n\n\tpublic getLocalBranch(): SharedTreeBranch<TEditor, TChange> {\n\t\treturn this.editManager.localBranch;\n\t}\n\n\tpublic didAttach(): void {\n\t\tthis.detachedRevision = undefined;\n\t}\n\n\tpublic reSubmitCore(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst {\n\t\t\tcommit: { revision },\n\t\t} = this.messageCodec.decode(this.serializer.decode(content), {\n\t\t\tidCompressor: this.idCompressor,\n\t\t});\n\t\tconst [commit] = this.editManager.findLocalCommit(revision);\n\t\t// If a resubmit phase is not already in progress, then this must be the first commit of a new resubmit phase.\n\t\tif (this.resubmitMachine.isInResubmitPhase === false) {\n\t\t\tconst toResubmit = this.editManager.getLocalCommits();\n\t\t\tassert(\n\t\t\t\tcommit === toResubmit[0],\n\t\t\t\t0x95d /* Resubmit phase should start with the oldest local commit */,\n\t\t\t);\n\t\t\tthis.resubmitMachine.prepareForResubmit(toResubmit);\n\t\t}\n\t\tassert(\n\t\t\tisClonableSchemaPolicy(localOpMetadata),\n\t\t\t0x95e /* Local metadata must contain schema and policy. */,\n\t\t);\n\t\tassert(\n\t\t\tthis.resubmitMachine.isInResubmitPhase !== false,\n\t\t\t0x984 /* Invalid resubmit outside of resubmit phase */,\n\t\t);\n\t\tconst enrichedCommit = this.resubmitMachine.peekNextCommit();\n\t\tthis.submitCommit(enrichedCommit, localOpMetadata, true);\n\t}\n\n\tpublic applyStashedOp(content: JsonCompatibleReadOnly): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst {\n\t\t\tcommit: { revision, change },\n\t\t} = this.messageCodec.decode(content, { idCompressor: this.idCompressor });\n\t\tthis.editManager.localBranch.apply({ change, revision });\n\t}\n}\n\nfunction isClonableSchemaPolicy(\n\tmaybeSchemaPolicy: unknown,\n): maybeSchemaPolicy is ClonableSchemaAndPolicy {\n\tconst schemaAndPolicy = maybeSchemaPolicy as ClonableSchemaAndPolicy;\n\treturn schemaAndPolicy.schema !== undefined && schemaAndPolicy.policy !== undefined;\n}\n\n/**\n * Specifies the behavior of a component that puts data in a summary.\n */\nexport interface Summarizable {\n\t/**\n\t * Field name in summary json under which this element stores its data.\n\t */\n\treadonly key: string;\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n\t * @param stringify - Serializes the contents of the component (including {@link (IFluidHandle:interface)}s) for storage.\n\t */\n\tgetAttachSummary(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): ISummaryTreeWithStats;\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n\t * @param stringify - Serializes the contents of the component (including {@link (IFluidHandle:interface)}s) for storage.\n\t */\n\tsummarize(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats>;\n\n\t/**\n\t * Allows the component to perform custom loading. The storage service is scoped to this component and therefore\n\t * paths in this component will not collide with those in other components, even if they are the same string.\n\t * @param service - Storage used by the component\n\t * @param parse - Parses serialized data from storage into runtime objects for the component\n\t */\n\tload(service: IChannelStorageService, parse: SummaryElementParser): Promise<void>;\n}\n\n/**\n * Serializes the given contents into a string acceptable for storing in summaries, i.e. all\n * Fluid handles have been replaced appropriately by an IFluidSerializer\n */\nexport type SummaryElementStringifier = (contents: unknown) => string;\n\n/**\n * Parses a serialized/summarized string into an object, rehydrating any Fluid handles as necessary\n */\nexport type SummaryElementParser = (contents: string) => unknown;\n\n/**\n * Compose an {@link IChannelStorageService} which prefixes all paths before forwarding them to the original service\n */\nfunction scopeStorageService(\n\tservice: IChannelStorageService,\n\t...pathElements: string[]\n): IChannelStorageService {\n\tconst scope = `${pathElements.join(\"/\")}/`;\n\n\treturn {\n\t\tasync readBlob(path: string): Promise<ArrayBufferLike> {\n\t\t\treturn service.readBlob(`${scope}${path}`);\n\t\t},\n\t\tasync contains(path) {\n\t\t\treturn service.contains(`${scope}${path}`);\n\t\t},\n\t\tasync list(path) {\n\t\t\treturn service.list(`${scope}${path}`);\n\t\t},\n\t};\n}\n"]}
1
+ {"version":3,"file":"sharedTreeCore.js","sourceRoot":"","sources":["../../src/shared-tree-core/sharedTreeCore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,kEAA6D;AAS7D,qEAA4E;AAK5E,uEAA6E;AAG7E,+CAW0B;AAC1B,+CAO0B;AAG1B,uEAAiE;AACjE,2DAA8F;AAC9F,2EAAqE;AACrE,qDAA8E;AAC9E,iEAA8D;AAE9D,yEAAmE;AACnE,yDAAmF;AAInF,yDAAyD;AACzD,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAWvC;;GAEG;IAEU,cAAc;4BAD1B,wBAAa;;;;;;;QAoCb;;;;;;;WAOG;QACH,YACiB,OAAkB,EAClB,YAA2C,EAC3C,UAA4B,EAC5B,kBAAyE,EACzF,MAAwC,EACxC,aAAsC,EACtC,YAA4C,EAC5C,OAAsB,EACtB,aAAwC,EACvB,YAA2B,EAC5C,MAAkC,EAClC,YAA0B,EAC1B,eAA0C,EAC1C,QAAkD,EAClC,YAA2B,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM;YAd7D,YAAO,IA5CZ,mDAAc,EA4CT,OAAO,EAAW;YAClB,iBAAY,GAAZ,YAAY,CAA+B;YAC3C,eAAU,GAAV,UAAU,CAAkB;YAC5B,uBAAkB,GAAlB,kBAAkB,CAAuD;YAMxE,iBAAY,GAAZ,YAAY,CAAe;YAK5B,cAAS,GAAT,SAAS,CAAoD;YArD9E;;;;eAIG;YACK,qBAAgB,GAA0B,8CAA6B,CAAC;YAkD/E,IAAI,CAAC,eAAe,GAAG;gBACtB,MAAM;gBACN,MAAM,EAAE,YAAY;aACpB,CAAC;YAEF,MAAM,YAAY,GAAG,IAAA,4BAAiB,EAAC;gBACtC,MAAM;gBACN,SAAS,EAAE,QAAQ;aACnB,CAAC,CAAC;YAEH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O;QACN,KAAK,CAAC,QAAQ,CAAC,IAAY;YAC1B,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;QAC5C,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,IAAI;YAClB,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;QAC5C,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,IAAI;YACd,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;QACxC,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidLoadable, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tIRuntimeMessageCollection,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\nimport type {\n\tIChannelView,\n\tIFluidSerializer,\n} from \"@fluidframework/shared-object-base/internal\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ICodecOptions, IJsonCodec } from \"../codec/index.js\";\nimport {\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\tfindAncestor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\tRevisionTagCodec,\n\ttype SchemaAndPolicy,\n\ttype SchemaPolicy,\n\ttype TaggedChange,\n\ttype TreeStoredSchemaRepository,\n} from \"../core/index.js\";\nimport {\n\ttype JsonCompatibleReadOnly,\n\tbrand,\n\ttype Breakable,\n\ttype WithBreakable,\n\tthrowIfBroken,\n\tbreakingClass,\n} from \"../util/index.js\";\n\nimport type { SharedTreeBranch } from \"./branch.js\";\nimport { BranchCommitEnricher } from \"./branchCommitEnricher.js\";\nimport { type ChangeEnricherReadonlyCheckout, NoOpChangeEnricher } from \"./changeEnricher.js\";\nimport { DefaultResubmitMachine } from \"./defaultResubmitMachine.js\";\nimport { EditManager, minimumPossibleSequenceNumber } from \"./editManager.js\";\nimport { makeEditManagerCodec } from \"./editManagerCodecs.js\";\nimport type { SeqNumber } from \"./editManagerFormat.js\";\nimport { EditManagerSummarizer } from \"./editManagerSummarizer.js\";\nimport { type MessageEncodingContext, makeMessageCodec } from \"./messageCodecs.js\";\nimport type { DecodedMessage } from \"./messageTypes.js\";\nimport type { ResubmitMachine } from \"./resubmitMachine.js\";\n\n// TODO: Organize this to be adjacent to persisted types.\nconst summarizablesTreeKey = \"indexes\";\n\nexport interface ExplicitCoreCodecVersions {\n\teditManager: number;\n\tmessage: number;\n}\n\nexport interface ClonableSchemaAndPolicy extends SchemaAndPolicy {\n\tschema: TreeStoredSchemaRepository;\n}\n\n/**\n * Generic shared tree, which needs to be configured with indexes, field kinds and other configuration.\n */\n@breakingClass\nexport class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>\n\timplements WithBreakable\n{\n\tprivate readonly editManager: EditManager<TEditor, TChange, ChangeFamily<TEditor, TChange>>;\n\tprivate readonly summarizables: readonly [EditManagerSummarizer<TChange>, ...Summarizable[]];\n\t/**\n\t * The sequence number that this instance is at.\n\t * This number is artificial in that it is made up by this instance as opposed to being provided by the runtime.\n\t * Is `undefined` after (and only after) this instance is attached.\n\t */\n\tprivate detachedRevision: SeqNumber | undefined = minimumPossibleSequenceNumber;\n\n\t/**\n\t * Used to encode/decode messages sent to/received from the Fluid runtime.\n\t *\n\t * @remarks Since there is currently only one format, this can just be cached on the class.\n\t * With more write formats active, it may make sense to keep around the \"usual\" format codec\n\t * (the one for the current persisted configuration) and resolve codecs for different versions\n\t * as necessary (e.g. an upgrade op came in, or the configuration changed within the collab window\n\t * and an op needs to be interpreted which isn't written with the current configuration).\n\t */\n\tprivate readonly messageCodec: IJsonCodec<\n\t\tDecodedMessage<TChange>,\n\t\tunknown,\n\t\tunknown,\n\t\tMessageEncodingContext\n\t>;\n\n\tprivate readonly resubmitMachine: ResubmitMachine<TChange>;\n\tpublic readonly commitEnricher: BranchCommitEnricher<TChange>;\n\n\tpublic readonly mintRevisionTag: () => RevisionTag;\n\n\tprivate readonly schemaAndPolicy: ClonableSchemaAndPolicy;\n\n\t/**\n\t * @param summarizables - Summarizers for all indexes used by this tree\n\t * @param changeFamily - The change family\n\t * @param editManager - The edit manager\n\t * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n\t * @param editor - Used to edit the state of the tree. Edits will be immediately applied locally to the tree.\n\t * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.\n\t */\n\tpublic constructor(\n\t\tpublic readonly breaker: Breakable,\n\t\tpublic readonly sharedObject: IChannelView & IFluidLoadable,\n\t\tpublic readonly serializer: IFluidSerializer,\n\t\tpublic readonly submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,\n\t\tlogger: ITelemetryBaseLogger | undefined,\n\t\tsummarizables: readonly Summarizable[],\n\t\tchangeFamily: ChangeFamily<TEditor, TChange>,\n\t\toptions: ICodecOptions,\n\t\tformatOptions: ExplicitCoreCodecVersions,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\tschema: TreeStoredSchemaRepository,\n\t\tschemaPolicy: SchemaPolicy,\n\t\tresubmitMachine?: ResubmitMachine<TChange>,\n\t\tenricher?: ChangeEnricherReadonlyCheckout<TChange>,\n\t\tpublic readonly getEditor: () => TEditor = () => this.getLocalBranch().editor,\n\t) {\n\t\tthis.schemaAndPolicy = {\n\t\t\tschema,\n\t\t\tpolicy: schemaPolicy,\n\t\t};\n\n\t\tconst rebaseLogger = createChildLogger({\n\t\t\tlogger,\n\t\t\tnamespace: \"Rebase\",\n\t\t});\n\n\t\tthis.mintRevisionTag = () => this.idCompressor.generateCompressedId();\n\t\t/**\n\t\t * A random ID that uniquely identifies this client in the collab session.\n\t\t * This is sent alongside every op to identify which client the op originated from.\n\t\t * This is used rather than the Fluid client ID because the Fluid client ID is not stable across reconnections.\n\t\t */\n\t\tconst localSessionId = idCompressor.localSessionId;\n\t\tthis.editManager = new EditManager(\n\t\t\tchangeFamily,\n\t\t\tlocalSessionId,\n\t\t\tthis.mintRevisionTag,\n\t\t\trebaseLogger,\n\t\t);\n\n\t\tthis.editManager.localBranch.events.on(\"beforeChange\", (change) => {\n\t\t\tif (this.detachedRevision === undefined) {\n\t\t\t\t// Commit enrichment is only necessary for changes that will be submitted as ops, and changes issued while detached are not submitted.\n\t\t\t\tthis.commitEnricher.processChange(change);\n\t\t\t}\n\t\t\tif (change.type === \"append\") {\n\t\t\t\tfor (const commit of change.newCommits) {\n\t\t\t\t\tthis.submitCommit(commit, this.schemaAndPolicy, false);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\t\tconst editManagerCodec = makeEditManagerCodec(\n\t\t\tthis.editManager.changeFamily.codecs,\n\t\t\trevisionTagCodec,\n\t\t\toptions,\n\t\t\tformatOptions.editManager,\n\t\t);\n\t\tthis.summarizables = [\n\t\t\tnew EditManagerSummarizer(\n\t\t\t\tthis.editManager,\n\t\t\t\teditManagerCodec,\n\t\t\t\tthis.idCompressor,\n\t\t\t\tthis.schemaAndPolicy,\n\t\t\t),\n\t\t\t...summarizables,\n\t\t];\n\t\tassert(\n\t\t\tnew Set(this.summarizables.map((e) => e.key)).size === this.summarizables.length,\n\t\t\t0x350 /* Index summary element keys must be unique */,\n\t\t);\n\n\t\tthis.messageCodec = makeMessageCodec(\n\t\t\tchangeFamily.codecs,\n\t\t\tnew RevisionTagCodec(idCompressor),\n\t\t\toptions,\n\t\t\tformatOptions.message,\n\t\t);\n\n\t\tconst changeEnricher = enricher ?? new NoOpChangeEnricher();\n\t\tthis.resubmitMachine =\n\t\t\tresubmitMachine ??\n\t\t\tnew DefaultResubmitMachine(\n\t\t\t\t(change: TaggedChange<TChange>) =>\n\t\t\t\t\tchangeFamily.rebaser.invert(change, true, this.mintRevisionTag()),\n\t\t\t\tchangeEnricher,\n\t\t\t);\n\t\tthis.commitEnricher = new BranchCommitEnricher(changeFamily.rebaser, changeEnricher);\n\t}\n\n\t// TODO: SharedObject's merging of the two summary methods into summarizeCore is not what we want here:\n\t// We might want to not subclass it, or override/reimplement most of its functionality.\n\t@throwIfBroken\n\tpublic summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tconst summarizableBuilder = new SummaryTreeBuilder();\n\t\t// Merge the summaries of all summarizables together under a single ISummaryTree\n\t\tfor (const s of this.summarizables) {\n\t\t\tsummarizableBuilder.addWithStats(\n\t\t\t\ts.key,\n\t\t\t\ts.getAttachSummary(\n\t\t\t\t\t(contents) => serializer.stringify(contents, this.sharedObject.handle),\n\t\t\t\t\tundefined,\n\t\t\t\t\tundefined,\n\t\t\t\t\ttelemetryContext,\n\t\t\t\t\tincrementalSummaryContext,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tbuilder.addWithStats(summarizablesTreeKey, summarizableBuilder.getSummaryTree());\n\t\treturn builder.getSummaryTree();\n\t}\n\n\tpublic async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tassert(\n\t\t\tthis.editManager.localBranch.getHead() === this.editManager.getTrunkHead(),\n\t\t\t0xaaa /* All local changes should be applied to the trunk before loading from summary */,\n\t\t);\n\t\tconst [editManagerSummarizer, ...summarizables] = this.summarizables;\n\t\tconst loadEditManager = this.loadSummarizable(editManagerSummarizer, services);\n\t\tconst loadSummarizables = summarizables.map(async (s) =>\n\t\t\tthis.loadSummarizable(s, services),\n\t\t);\n\n\t\tif (this.detachedRevision !== undefined) {\n\t\t\t// If we are detached but loading from a summary, then we need to update our detached revision to ensure that it is ahead of all detached revisions in the summary.\n\t\t\t// First, finish loading the edit manager so that we can inspect the sequence numbers of the commits on the trunk.\n\t\t\tawait loadEditManager;\n\t\t\t// Find the most recent detached revision in the summary trunk...\n\t\t\tlet latestDetachedSequenceNumber: SeqNumber | undefined;\n\t\t\tfindAncestor(this.editManager.getTrunkHead(), (c) => {\n\t\t\t\tconst sequenceNumber = this.editManager.getSequenceNumber(c);\n\t\t\t\tif (sequenceNumber !== undefined && sequenceNumber < 0) {\n\t\t\t\t\tlatestDetachedSequenceNumber = sequenceNumber;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t});\n\t\t\t// ...and set our detached revision to be as it would be if we had been already created that revision.\n\t\t\tthis.detachedRevision = latestDetachedSequenceNumber ?? this.detachedRevision;\n\t\t\tawait Promise.all(loadSummarizables);\n\t\t} else {\n\t\t\tawait Promise.all([loadEditManager, ...loadSummarizables]);\n\t\t}\n\t}\n\n\tprivate async loadSummarizable(\n\t\tsummarizable: Summarizable,\n\t\tservices: IChannelStorageService,\n\t): Promise<void> {\n\t\treturn summarizable.load(\n\t\t\tscopeStorageService(services, summarizablesTreeKey, summarizable.key),\n\t\t\t(contents) => this.serializer.parse(contents),\n\t\t);\n\t}\n\n\t/**\n\t * Submits an op to the Fluid runtime containing the given commit\n\t * @param commit - the commit to submit\n\t * @returns the submitted commit. This is undefined if the underlying `SharedObject` is not attached,\n\t * and may differ from `commit` due to enrichments like detached tree refreshers.\n\t */\n\tprotected submitCommit(\n\t\tcommit: GraphCommit<TChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tassert(\n\t\t\tthis.sharedObject.isAttached() === (this.detachedRevision === undefined),\n\t\t\t0x95a /* Detached revision should only be set when not attached */,\n\t\t);\n\n\t\tconst enrichedCommit =\n\t\t\tthis.detachedRevision === undefined && !isResubmit\n\t\t\t\t? this.commitEnricher.enrich(commit)\n\t\t\t\t: commit;\n\n\t\t// Edits submitted before the first attach are treated as sequenced because they will be included\n\t\t// in the attach summary that is uploaded to the service.\n\t\t// Until this attach workflow happens, this instance essentially behaves as a centralized data structure.\n\t\tif (this.detachedRevision !== undefined) {\n\t\t\tconst newRevision: SeqNumber = brand((this.detachedRevision as number) + 1);\n\t\t\tthis.detachedRevision = newRevision;\n\t\t\tthis.editManager.addSequencedChanges(\n\t\t\t\t[enrichedCommit],\n\t\t\t\tthis.editManager.localSessionId,\n\t\t\t\tnewRevision,\n\t\t\t\tthis.detachedRevision,\n\t\t\t);\n\t\t\tthis.editManager.advanceMinimumSequenceNumber(newRevision, false);\n\t\t\treturn undefined;\n\t\t}\n\t\tconst message = this.messageCodec.encode(\n\t\t\t{\n\t\t\t\tcommit: enrichedCommit,\n\t\t\t\tsessionId: this.editManager.localSessionId,\n\t\t\t},\n\t\t\t{\n\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t\tschema: schemaAndPolicy,\n\t\t\t},\n\t\t);\n\t\tthis.submitLocalMessage(message, {\n\t\t\t// Clone the schema to ensure that during resubmit the schema has not been mutated by later changes\n\t\t\tschema: schemaAndPolicy.schema.clone(),\n\t\t\tpolicy: schemaAndPolicy.policy,\n\t\t});\n\t\tthis.resubmitMachine.onCommitSubmitted(enrichedCommit);\n\t}\n\n\t/**\n\t * Process a bunch of messages from the runtime. SharedObject will call this method with a bunch of messages.\n\t */\n\tpublic processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, local, messagesContent } = messagesCollection;\n\t\tconst commits: GraphCommit<TChange>[] = [];\n\t\tlet messagesSessionId: SessionId | undefined;\n\n\t\t// Get a list of all the commits from the messages.\n\t\tfor (const messageContent of messagesContent) {\n\t\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\t\tconst { commit, sessionId } = this.messageCodec.decode(messageContent.contents, {\n\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t});\n\t\t\tcommits.push(commit);\n\n\t\t\tif (messagesSessionId !== undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tmessagesSessionId === sessionId,\n\t\t\t\t\t0xad9 /* All messages in a bunch must have the same session ID */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tmessagesSessionId = sessionId;\n\t\t}\n\n\t\tassert(messagesSessionId !== undefined, 0xada /* Messages must have a session ID */);\n\n\t\tthis.editManager.addSequencedChanges(\n\t\t\tcommits,\n\t\t\tmessagesSessionId,\n\t\t\tbrand(envelope.sequenceNumber),\n\t\t\tbrand(envelope.referenceSequenceNumber),\n\t\t);\n\n\t\t// Update the resubmit machine for each commit applied.\n\t\tfor (const _ of messagesContent) {\n\t\t\tthis.resubmitMachine.onSequencedCommitApplied(local);\n\t\t}\n\n\t\tthis.editManager.advanceMinimumSequenceNumber(brand(envelope.minimumSequenceNumber));\n\t}\n\n\tpublic getLocalBranch(): SharedTreeBranch<TEditor, TChange> {\n\t\treturn this.editManager.localBranch;\n\t}\n\n\tpublic didAttach(): void {\n\t\tthis.detachedRevision = undefined;\n\t}\n\n\tpublic reSubmitCore(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst {\n\t\t\tcommit: { revision },\n\t\t} = this.messageCodec.decode(this.serializer.decode(content), {\n\t\t\tidCompressor: this.idCompressor,\n\t\t});\n\t\tconst [commit] = this.editManager.findLocalCommit(revision);\n\t\t// If a resubmit phase is not already in progress, then this must be the first commit of a new resubmit phase.\n\t\tif (this.resubmitMachine.isInResubmitPhase === false) {\n\t\t\tconst toResubmit = this.editManager.getLocalCommits();\n\t\t\tassert(\n\t\t\t\tcommit === toResubmit[0],\n\t\t\t\t0x95d /* Resubmit phase should start with the oldest local commit */,\n\t\t\t);\n\t\t\tthis.resubmitMachine.prepareForResubmit(toResubmit);\n\t\t}\n\t\tassert(\n\t\t\tisClonableSchemaPolicy(localOpMetadata),\n\t\t\t0x95e /* Local metadata must contain schema and policy. */,\n\t\t);\n\t\tassert(\n\t\t\tthis.resubmitMachine.isInResubmitPhase !== false,\n\t\t\t0x984 /* Invalid resubmit outside of resubmit phase */,\n\t\t);\n\t\tconst enrichedCommit = this.resubmitMachine.peekNextCommit();\n\t\tthis.submitCommit(enrichedCommit, localOpMetadata, true);\n\t}\n\n\tpublic applyStashedOp(content: JsonCompatibleReadOnly): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst {\n\t\t\tcommit: { revision, change },\n\t\t} = this.messageCodec.decode(content, { idCompressor: this.idCompressor });\n\t\tthis.editManager.localBranch.apply({ change, revision });\n\t}\n}\n\nfunction isClonableSchemaPolicy(\n\tmaybeSchemaPolicy: unknown,\n): maybeSchemaPolicy is ClonableSchemaAndPolicy {\n\tconst schemaAndPolicy = maybeSchemaPolicy as ClonableSchemaAndPolicy;\n\treturn schemaAndPolicy.schema !== undefined && schemaAndPolicy.policy !== undefined;\n}\n\n/**\n * Specifies the behavior of a component that puts data in a summary.\n */\nexport interface Summarizable {\n\t/**\n\t * Field name in summary json under which this element stores its data.\n\t */\n\treadonly key: string;\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n\t * @param stringify - Serializes the contents of the component (including {@link (IFluidHandle:interface)}s) for storage.\n\t */\n\tgetAttachSummary(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): ISummaryTreeWithStats;\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n\t * @param stringify - Serializes the contents of the component (including {@link (IFluidHandle:interface)}s) for storage.\n\t */\n\tsummarize(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats>;\n\n\t/**\n\t * Allows the component to perform custom loading. The storage service is scoped to this component and therefore\n\t * paths in this component will not collide with those in other components, even if they are the same string.\n\t * @param service - Storage used by the component\n\t * @param parse - Parses serialized data from storage into runtime objects for the component\n\t */\n\tload(service: IChannelStorageService, parse: SummaryElementParser): Promise<void>;\n}\n\n/**\n * Serializes the given contents into a string acceptable for storing in summaries, i.e. all\n * Fluid handles have been replaced appropriately by an IFluidSerializer\n */\nexport type SummaryElementStringifier = (contents: unknown) => string;\n\n/**\n * Parses a serialized/summarized string into an object, rehydrating any Fluid handles as necessary\n */\nexport type SummaryElementParser = (contents: string) => unknown;\n\n/**\n * Compose an {@link IChannelStorageService} which prefixes all paths before forwarding them to the original service\n */\nfunction scopeStorageService(\n\tservice: IChannelStorageService,\n\t...pathElements: string[]\n): IChannelStorageService {\n\tconst scope = `${pathElements.join(\"/\")}/`;\n\n\treturn {\n\t\tasync readBlob(path: string): Promise<ArrayBufferLike> {\n\t\t\treturn service.readBlob(`${scope}${path}`);\n\t\t},\n\t\tasync contains(path) {\n\t\t\treturn service.contains(`${scope}${path}`);\n\t\t},\n\t\tasync list(path) {\n\t\t\treturn service.list(`${scope}${path}`);\n\t\t},\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/transaction.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,EAEN,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG5E;;;GAGG;AACH,oBAAY,iBAAiB;IAC5B;;OAEG;IACH,KAAK,IAAA;IAC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8ChB,sGAAsG;IACtG,OAAO,CAAC,oBAAoB;CAY5B"}
@@ -17,8 +17,8 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
17
17
  var _TransactionStack_stack, _TransactionStack_onPush, _TransactionStack_events, _TransactionStack_disposed, _SquashingTransactionStack_transactionBranch, _SquashingTransactionStack_activeBranchEvents;
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.SquashingTransactionStack = exports.TransactionStack = exports.TransactionResult = void 0;
20
- const internal_1 = require("@fluidframework/core-utils/internal");
21
20
  const client_utils_1 = require("@fluid-internal/client-utils");
21
+ const internal_1 = require("@fluidframework/core-utils/internal");
22
22
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
23
23
  const index_js_1 = require("../core/index.js");
24
24
  const index_js_2 = require("../util/index.js");
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/shared-tree-core/transaction.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,kEAA8E;AAC9E,+DAA6D;AAE7D,uEAAsE;AACtE,+CAK0B;AAE1B,+CAA+C;AAE/C;;;GAGG;AACH,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC5B;;OAEG;IACH,2DAAK,CAAA;IACL;;OAEG;IACH,6DAAM,CAAA;AACP,CAAC,EATW,iBAAiB,iCAAjB,iBAAiB,QAS5B;AA0ED;;;GAGG;AACH,MAAa,gBAAgB;IAK5B,IAAW,MAAM;QAChB,OAAO,uBAAA,IAAI,gCAAQ,CAAC;IACrB,CAAC;IAGD,IAAW,QAAQ;QAClB,OAAO,uBAAA,IAAI,kCAAU,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,YAAmB,MAA2B;QAjBrC,kCAA2B,EAAE,EAAC;QAC9B,2CAA6B;QAE7B,mCAAU,IAAA,4BAAa,GAAqB,EAAC;QAKtD,qCAAY,KAAK,EAAC;QAUjB,uBAAA,IAAI,4BAAW,MAAM,MAAA,CAA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;QACF,CAAC;IACF,CAAC;CACD;AAhID,8DAgIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { IDisposable, Listenable } from \"@fluidframework/core-interfaces\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport {\n\tfindAncestor,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype TaggedChange,\n} from \"../core/index.js\";\nimport type { SharedTreeBranch, SharedTreeBranchEvents } from \"./branch.js\";\nimport { getOrCreate } from \"../util/index.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 * 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\t * @remarks - Asynchronous transactions are not supported on the root checkout,\n\t * since it is always kept up-to-date with the latest remote edits and the results of this rebasing (which might invalidate\n\t * the transaction) is not visible to the application author.\n\t * Instead,\n\t *\n\t * 1. fork the root checkout\n\t * 2. run the transaction on the fork\n\t * 3. merge the fork back into the root checkout\n\t *\n\t * @privateRemarks - There is currently no enforcement that asynchronous transactions don't happen on the root checkout.\n\t * AB#6488 tracks adding some enforcement to make it more clear to application authors that this is not supported.\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 * 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 * True if there is at least one transaction currently in progress on this view, otherwise false.\n\t */\n\tisInProgress(): boolean;\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.isInProgress} will be true 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.isInProgress} will still be true 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.isInProgress} will still be true because the transaction has not yet ended.\n\t */\n\tcommitting(): void;\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 {@link OnPop | its complement} - another function that will be called when the transaction is popped from 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.isInProgress} will be false during its execution.\n */\nexport type OnPush = () => OnPop | 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.isInProgress} will be false during its execution.\n */\nexport type OnPop = (result: TransactionResult) => void;\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: (OnPop | void)[] = [];\n\treadonly #onPush?: () => OnPop | void;\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?: () => OnPop | void) {\n\t\tthis.#onPush = onPush;\n\t}\n\n\tpublic isInProgress(): boolean {\n\t\tthis.ensureNotDisposed();\n\t\treturn this.#stack.length > 0;\n\t}\n\n\tpublic start(): void {\n\t\tthis.ensureNotDisposed();\n\t\tthis.#stack.push(this.#onPush?.());\n\t\tthis.#events.emit(\"started\");\n\t}\n\n\tpublic commit(): void {\n\t\tthis.ensureNotDisposed();\n\t\tif (!this.isInProgress()) {\n\t\t\tthrow new UsageError(\"No transaction to commit\");\n\t\t}\n\t\tthis.#events.emit(\"committing\");\n\t\tthis.#stack.pop()?.(TransactionResult.Commit);\n\t}\n\n\tpublic abort(): void {\n\t\tthis.ensureNotDisposed();\n\t\tif (!this.isInProgress()) {\n\t\t\tthrow new UsageError(\"No transaction to abort\");\n\t\t}\n\t\tthis.#events.emit(\"aborting\");\n\t\tthis.#stack.pop()?.(TransactionResult.Abort);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.ensureNotDisposed();\n\t\twhile (this.isInProgress()) {\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 * 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\tpublic readonly branch: SharedTreeBranch<TEditor, 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 squash - Called once when the outer-most transaction is committed to produce a single squashed change from the transaction's commits.\n\t * The change will be applied to the original {@link SquashingTransactionStack.branch | branch}.\n\t * @param onPush - {@link OnPush | A function} that will be called when a transaction is pushed to the {@link TransactionStack | stack}.\n\t */\n\tpublic constructor(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tsquash: (commits: GraphCommit<TChange>[]) => TaggedChange<TChange>,\n\t\tonPush?: OnPush,\n\t) {\n\t\tsuper(() => {\n\t\t\t// Keep track of the commit that each transaction was on when it started\n\t\t\t// TODO:#8603: This may need to be computed differently if we allow rebasing during a transaction.\n\t\t\tconst startHead = this.activeBranch.getHead();\n\t\t\tconst onPop = onPush?.();\n\t\t\tconst transactionBranch = this.#transactionBranch ?? this.branch.fork();\n\t\t\tthis.setTransactionBranch(transactionBranch);\n\t\t\ttransactionBranch.editor.enterTransaction();\n\t\t\treturn (result) => {\n\t\t\t\tassert(this.#transactionBranch !== undefined, 0xa98 /* Expected transaction branch */);\n\t\t\t\tthis.#transactionBranch.editor.exitTransaction();\n\t\t\t\tswitch (result) {\n\t\t\t\t\tcase TransactionResult.Abort:\n\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\tthis.#transactionBranch.removeAfter(startHead);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase TransactionResult.Commit:\n\t\t\t\t\t\t// If this was the outermost transaction closing...\n\t\t\t\t\t\tif (!this.isInProgress()) {\n\t\t\t\t\t\t\tif (this.#transactionBranch.getHead() !== startHead) {\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 removedCommits: GraphCommit<TChange>[] = [];\n\t\t\t\t\t\t\t\tfindAncestor(\n\t\t\t\t\t\t\t\t\t[this.#transactionBranch.getHead(), removedCommits],\n\t\t\t\t\t\t\t\t\t(c) => c === startHead,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tbranch.apply(squash(removedCommits));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunreachableCase(result);\n\t\t\t\t}\n\t\t\t\tif (!this.isInProgress()) {\n\t\t\t\t\tthis.#transactionBranch.dispose();\n\t\t\t\t\tthis.setTransactionBranch(undefined);\n\t\t\t\t}\n\t\t\t\tonPop?.(result);\n\t\t\t};\n\t\t});\n\n\t\tthis.branch = branch;\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,+CAK0B;AAC1B,+CAA+C;AAI/C;;;GAGG;AACH,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC5B;;OAEG;IACH,2DAAK,CAAA;IACL;;OAEG;IACH,6DAAM,CAAA;AACP,CAAC,EATW,iBAAiB,iCAAjB,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CAAC,YAAY,CAAC;QAC1C,uBAAA,IAAI,gDAAsB,iBAAiB,MAAA,CAAC;QAC5C,KAAK,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,uBAAA,IAAI,qDAAoB,EAAE,CAAC;YAC/D,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;gBAClC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;gBAChD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAClD,CAAC;QACF,CAAC;IACF,CAAC;CACD;AAhID,8DAgIC","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\tfindAncestor,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype TaggedChange,\n} from \"../core/index.js\";\nimport { 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 * 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\t * @remarks - Asynchronous transactions are not supported on the root checkout,\n\t * since it is always kept up-to-date with the latest remote edits and the results of this rebasing (which might invalidate\n\t * the transaction) is not visible to the application author.\n\t * Instead,\n\t *\n\t * 1. fork the root checkout\n\t * 2. run the transaction on the fork\n\t * 3. merge the fork back into the root checkout\n\t *\n\t * @privateRemarks - There is currently no enforcement that asynchronous transactions don't happen on the root checkout.\n\t * AB#6488 tracks adding some enforcement to make it more clear to application authors that this is not supported.\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 * 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 * True if there is at least one transaction currently in progress on this view, otherwise false.\n\t */\n\tisInProgress(): boolean;\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.isInProgress} will be true 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.isInProgress} will still be true 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.isInProgress} will still be true because the transaction has not yet ended.\n\t */\n\tcommitting(): void;\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 {@link OnPop | its complement} - another function that will be called when the transaction is popped from 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.isInProgress} will be false during its execution.\n */\nexport type OnPush = () => OnPop | 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.isInProgress} will be false during its execution.\n */\nexport type OnPop = (result: TransactionResult) => void;\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: (OnPop | void)[] = [];\n\treadonly #onPush?: () => OnPop | void;\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?: () => OnPop | void) {\n\t\tthis.#onPush = onPush;\n\t}\n\n\tpublic isInProgress(): boolean {\n\t\tthis.ensureNotDisposed();\n\t\treturn this.#stack.length > 0;\n\t}\n\n\tpublic start(): void {\n\t\tthis.ensureNotDisposed();\n\t\tthis.#stack.push(this.#onPush?.());\n\t\tthis.#events.emit(\"started\");\n\t}\n\n\tpublic commit(): void {\n\t\tthis.ensureNotDisposed();\n\t\tif (!this.isInProgress()) {\n\t\t\tthrow new UsageError(\"No transaction to commit\");\n\t\t}\n\t\tthis.#events.emit(\"committing\");\n\t\tthis.#stack.pop()?.(TransactionResult.Commit);\n\t}\n\n\tpublic abort(): void {\n\t\tthis.ensureNotDisposed();\n\t\tif (!this.isInProgress()) {\n\t\t\tthrow new UsageError(\"No transaction to abort\");\n\t\t}\n\t\tthis.#events.emit(\"aborting\");\n\t\tthis.#stack.pop()?.(TransactionResult.Abort);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.ensureNotDisposed();\n\t\twhile (this.isInProgress()) {\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 * 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\tpublic readonly branch: SharedTreeBranch<TEditor, 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 squash - Called once when the outer-most transaction is committed to produce a single squashed change from the transaction's commits.\n\t * The change will be applied to the original {@link SquashingTransactionStack.branch | branch}.\n\t * @param onPush - {@link OnPush | A function} that will be called when a transaction is pushed to the {@link TransactionStack | stack}.\n\t */\n\tpublic constructor(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tsquash: (commits: GraphCommit<TChange>[]) => TaggedChange<TChange>,\n\t\tonPush?: OnPush,\n\t) {\n\t\tsuper(() => {\n\t\t\t// Keep track of the commit that each transaction was on when it started\n\t\t\t// TODO:#8603: This may need to be computed differently if we allow rebasing during a transaction.\n\t\t\tconst startHead = this.activeBranch.getHead();\n\t\t\tconst onPop = onPush?.();\n\t\t\tconst transactionBranch = this.#transactionBranch ?? this.branch.fork();\n\t\t\tthis.setTransactionBranch(transactionBranch);\n\t\t\ttransactionBranch.editor.enterTransaction();\n\t\t\treturn (result) => {\n\t\t\t\tassert(this.#transactionBranch !== undefined, 0xa98 /* Expected transaction branch */);\n\t\t\t\tthis.#transactionBranch.editor.exitTransaction();\n\t\t\t\tswitch (result) {\n\t\t\t\t\tcase TransactionResult.Abort:\n\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\tthis.#transactionBranch.removeAfter(startHead);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase TransactionResult.Commit:\n\t\t\t\t\t\t// If this was the outermost transaction closing...\n\t\t\t\t\t\tif (!this.isInProgress()) {\n\t\t\t\t\t\t\tif (this.#transactionBranch.getHead() !== startHead) {\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 removedCommits: GraphCommit<TChange>[] = [];\n\t\t\t\t\t\t\t\tfindAncestor(\n\t\t\t\t\t\t\t\t\t[this.#transactionBranch.getHead(), removedCommits],\n\t\t\t\t\t\t\t\t\t(c) => c === startHead,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tbranch.apply(squash(removedCommits));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunreachableCase(result);\n\t\t\t\t}\n\t\t\t\tif (!this.isInProgress()) {\n\t\t\t\t\tthis.#transactionBranch.dispose();\n\t\t\t\t\tthis.setTransactionBranch(undefined);\n\t\t\t\t}\n\t\t\t\tonPop?.(result);\n\t\t\t};\n\t\t});\n\n\t\tthis.branch = branch;\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 +1 @@
1
- {"version":3,"file":"transactionEnricher.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/transactionEnricher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAE1E;;GAEG;AACH,qBAAa,mBAAmB,CAAC,OAAO;;gBAatC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,EAC/B,QAAQ,EAAE,8BAA8B,CAAC,OAAO,CAAC;IAM3C,aAAa,IAAI,OAAO;IAIxB,gBAAgB,IAAI,IAAI;IAI/B;;;OAGG;IACI,iBAAiB,IAAI,CAAC,CAAC,QAAQ,EAAE,WAAW,KAAK,OAAO,CAAC,GAAG,SAAS;IAcrE,gBAAgB,IAAI,IAAI;IAMxB,kBAAkB,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI;CAQ7D"}
1
+ {"version":3,"file":"transactionEnricher.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/transactionEnricher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAE1E;;GAEG;AACH,qBAAa,mBAAmB,CAAC,OAAO;;gBAatC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,EAC/B,QAAQ,EAAE,8BAA8B,CAAC,OAAO,CAAC;IAM3C,aAAa,IAAI,OAAO;IAIxB,gBAAgB,IAAI,IAAI;IAI/B;;;OAGG;IACI,iBAAiB,IAAI,CAAC,CAAC,QAAQ,EAAE,WAAW,KAAK,OAAO,CAAC,GAAG,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,EAAE,CAChC,uBAAA,IAAI,oCAAS,CAAC,cAAc,CAAC,uBAAA,IAAI,oCAAS,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,QAAQ,CAAC,CAAC;QACpF,CAAC;IACF,CAAC;IAEM,gBAAgB;QACtB,MAAM,UAAU,GAAG,uBAAA,IAAI,mDAAwB,CAAC,GAAG,EAAE,CAAC;QACtD,IAAA,iBAAM,EAAC,UAAU,KAAK,SAAS,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACtE,uBAAA,IAAI,+CAAoB,CAAC,MAAM,GAAG,UAAU,CAAC;IAC9C,CAAC;IAEM,kBAAkB,CAAC,MAA4B;QACrD,IAAA,iBAAM,EACL,uBAAA,IAAI,mDAAwB,CAAC,MAAM,KAAK,CAAC,EACzC,KAAK,CAAC,qCAAqC,CAC3C,CAAC;QACF,MAAM,MAAM,GAAG,uBAAA,IAAI,qCAAU,CAAC,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtF,uBAAA,IAAI,+CAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACtD,CAAC;CACD;AA5DD,kDA4DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { ChangeRebaser, GraphCommit, RevisionTag } from \"../core/index.js\";\nimport type { ChangeEnricherReadonlyCheckout } from \"./changeEnricher.js\";\n\n/**\n * Utility for producing an enriched commit out of multiple transaction steps\n */\nexport class TransactionEnricher<TChange> {\n\treadonly #rebaser: ChangeRebaser<TChange>;\n\treadonly #enricher: ChangeEnricherReadonlyCheckout<TChange>;\n\t#transactionCommits: GraphCommit<TChange>[] = [];\n\t/**\n\t * The number of commits before the start of each active transaction scope.\n\t * For a stack of `n` transaction scopes, the array will contain `n` integers,\n\t * where the integer at index `i` is the number of commits made before the start of the `i`th transaction scope\n\t * (therefore, the first element in the array, if present, is always 0)\n\t */\n\treadonly #transactionScopesStart: number[] = [];\n\n\tpublic constructor(\n\t\trebaser: ChangeRebaser<TChange>,\n\t\tenricher: ChangeEnricherReadonlyCheckout<TChange>,\n\t) {\n\t\tthis.#rebaser = rebaser;\n\t\tthis.#enricher = enricher;\n\t}\n\n\tpublic isTransacting(): boolean {\n\t\treturn this.#transactionScopesStart.length !== 0;\n\t}\n\n\tpublic startTransaction(): void {\n\t\tthis.#transactionScopesStart.push(this.#transactionCommits.length);\n\t}\n\n\t/**\n\t * Commits the current transaction.\n\t * @returns A function which can be used to compute the composed change for that transaction's commits. Undefined if the transaction is still ongoing or contained no committed changes.\n\t */\n\tpublic commitTransaction(): ((revision: RevisionTag) => TChange) | undefined {\n\t\tconst commitsCommitted = this.#transactionScopesStart.pop();\n\t\tassert(commitsCommitted !== undefined, 0x985 /* No transaction to commit */);\n\t\tif (this.#transactionScopesStart.length === 0) {\n\t\t\tif (this.#transactionCommits.length === 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst transactionCommits = this.#transactionCommits;\n\t\t\tthis.#transactionCommits = [];\n\t\t\treturn (revision: RevisionTag) =>\n\t\t\t\tthis.#rebaser.changeRevision(this.#rebaser.compose(transactionCommits), revision);\n\t\t}\n\t}\n\n\tpublic abortTransaction(): void {\n\t\tconst scopeStart = this.#transactionScopesStart.pop();\n\t\tassert(scopeStart !== undefined, 0x986 /* No transaction to abort */);\n\t\tthis.#transactionCommits.length = scopeStart;\n\t}\n\n\tpublic addTransactionStep(commit: GraphCommit<TChange>): void {\n\t\tassert(\n\t\t\tthis.#transactionScopesStart.length !== 0,\n\t\t\t0x987 /* No transaction to add a step to */,\n\t\t);\n\t\tconst change = this.#enricher.updateChangeEnrichments(commit.change, commit.revision);\n\t\tthis.#transactionCommits.push({ ...commit, change });\n\t}\n}\n"]}
1
+ {"version":3,"file":"transactionEnricher.js","sourceRoot":"","sources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tB,MAAM,UAAU,GAAG,uBAAA,IAAI,mDAAwB,CAAC,GAAG,EAAE,CAAC;QACtD,IAAA,iBAAM,EAAC,UAAU,KAAK,SAAS,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACtE,uBAAA,IAAI,+CAAoB,CAAC,MAAM,GAAG,UAAU,CAAC;IAC9C,CAAC;IAEM,kBAAkB,CAAC,MAA4B;QACrD,IAAA,iBAAM,EACL,uBAAA,IAAI,mDAAwB,CAAC,MAAM,KAAK,CAAC,EACzC,KAAK,CAAC,qCAAqC,CAC3C,CAAC;QACF,MAAM,MAAM,GAAG,uBAAA,IAAI,qCAAU,CAAC,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtF,uBAAA,IAAI,+CAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACtD,CAAC;CACD;AA5DD,kDA4DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport type { ChangeRebaser, GraphCommit, RevisionTag } from \"../core/index.js\";\n\nimport type { ChangeEnricherReadonlyCheckout } from \"./changeEnricher.js\";\n\n/**\n * Utility for producing an enriched commit out of multiple transaction steps\n */\nexport class TransactionEnricher<TChange> {\n\treadonly #rebaser: ChangeRebaser<TChange>;\n\treadonly #enricher: ChangeEnricherReadonlyCheckout<TChange>;\n\t#transactionCommits: GraphCommit<TChange>[] = [];\n\t/**\n\t * The number of commits before the start of each active transaction scope.\n\t * For a stack of `n` transaction scopes, the array will contain `n` integers,\n\t * where the integer at index `i` is the number of commits made before the start of the `i`th transaction scope\n\t * (therefore, the first element in the array, if present, is always 0)\n\t */\n\treadonly #transactionScopesStart: number[] = [];\n\n\tpublic constructor(\n\t\trebaser: ChangeRebaser<TChange>,\n\t\tenricher: ChangeEnricherReadonlyCheckout<TChange>,\n\t) {\n\t\tthis.#rebaser = rebaser;\n\t\tthis.#enricher = enricher;\n\t}\n\n\tpublic isTransacting(): boolean {\n\t\treturn this.#transactionScopesStart.length !== 0;\n\t}\n\n\tpublic startTransaction(): void {\n\t\tthis.#transactionScopesStart.push(this.#transactionCommits.length);\n\t}\n\n\t/**\n\t * Commits the current transaction.\n\t * @returns A function which can be used to compute the composed change for that transaction's commits. Undefined if the transaction is still ongoing or contained no committed changes.\n\t */\n\tpublic commitTransaction(): ((revision: RevisionTag) => TChange) | undefined {\n\t\tconst commitsCommitted = this.#transactionScopesStart.pop();\n\t\tassert(commitsCommitted !== undefined, 0x985 /* No transaction to commit */);\n\t\tif (this.#transactionScopesStart.length === 0) {\n\t\t\tif (this.#transactionCommits.length === 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst transactionCommits = this.#transactionCommits;\n\t\t\tthis.#transactionCommits = [];\n\t\t\treturn (revision: RevisionTag) =>\n\t\t\t\tthis.#rebaser.changeRevision(this.#rebaser.compose(transactionCommits), revision);\n\t\t}\n\t}\n\n\tpublic abortTransaction(): void {\n\t\tconst scopeStart = this.#transactionScopesStart.pop();\n\t\tassert(scopeStart !== undefined, 0x986 /* No transaction to abort */);\n\t\tthis.#transactionCommits.length = scopeStart;\n\t}\n\n\tpublic addTransactionStep(commit: GraphCommit<TChange>): void {\n\t\tassert(\n\t\t\tthis.#transactionScopesStart.length !== 0,\n\t\t\t0x987 /* No transaction to add a step to */,\n\t\t);\n\t\tconst change = this.#enricher.updateChangeEnrichments(commit.change, commit.revision);\n\t\tthis.#transactionCommits.push({ ...commit, change });\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"conciseTree.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/conciseTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE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,EAAE,GACtB;IACA,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;CACnC,CAAC;AAEL;;GAEG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,oBAAoB,EAChC,OAAO,EAAE,mBAAmB,GAC1B,WAAW,CAQb;AAUD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAC1C,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,GAC1B,WAAW,CAAC,CAAC,CAAC,CAEhB"}
@@ -5,8 +5,8 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.replaceConciseTreeHandles = exports.conciseFromCursor = void 0;
8
- const customTree_js_1 = require("./customTree.js");
9
8
  const createContext_js_1 = require("../createContext.js");
9
+ const customTree_js_1 = require("./customTree.js");
10
10
  /**
11
11
  * Used to read a node cursor as a ConciseTree.
12
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"conciseTree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/conciseTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,mDAKyB;AACzB,0DAA2D;AAwB3D;;GAEG;AACH,SAAgB,iBAAiB,CAChC,MAAmB,EACnB,UAAgC,EAChC,OAA4B;IAE5B,MAAM,MAAM,GAAkC;QAC7C,aAAa,EAAE,KAAK;QACpB,GAAG,OAAO;KACV,CAAC;IAEF,MAAM,SAAS,GAAG,IAAA,uCAAoB,EAAC,UAAU,CAAC,CAAC,MAAM,CAAC;IAC1D,OAAO,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAC1D,CAAC;AAZD,8CAYC;AAED,SAAS,sBAAsB,CAC9B,MAAmB,EACnB,OAAsC,EACtC,MAA2C;IAE3C,OAAO,IAAA,gCAAgB,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,sBAAsB,CAAC,CAAC;AAC1E,CAAC;AAED;;;;GAIG;AACH,SAAgB,yBAAyB,CACxC,IAAiB,EACjB,QAA4B;IAE5B,OAAO,IAAA,8BAAc,EAAC,IAAI,EAAE,QAAQ,CAAmB,CAAC;AACzD,CAAC;AALD,8DAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\n\nimport type { ITreeCursor } from \"../../core/index.js\";\nimport type { TreeLeafValue, ImplicitAllowedTypes } from \"../schemaTypes.js\";\nimport type { TreeNodeSchema } from \"../core/index.js\";\nimport {\n\tcustomFromCursor,\n\treplaceHandles,\n\ttype TreeEncodingOptions,\n\ttype HandleConverter,\n} from \"./customTree.js\";\nimport { getUnhydratedContext } from \"../createContext.js\";\n\n/**\n * Concise encoding of a {@link TreeNode} or {@link TreeLeafValue}.\n * @remarks\n * This is \"concise\" meaning that explicit type information is omitted.\n * If the schema is compatible with {@link ITreeConfigurationOptions.preventAmbiguity},\n * types will be lossless and compatible with {@link (TreeAlpha:interface).create} (unless the options are used to customize it).\n *\n * Every {@link TreeNode} is an array or object.\n * Any IFluidHandle values have been replaced by `THandle`.\n * @privateRemarks\n * This can store all possible simple trees,\n * but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.\n * @alpha\n */\nexport type ConciseTree<THandle = IFluidHandle> =\n\t| Exclude<TreeLeafValue, IFluidHandle>\n\t| THandle\n\t| ConciseTree<THandle>[]\n\t| {\n\t\t\t[key: string]: ConciseTree<THandle>;\n\t };\n\n/**\n * Used to read a node cursor as a ConciseTree.\n */\nexport function conciseFromCursor(\n\treader: ITreeCursor,\n\trootSchema: ImplicitAllowedTypes,\n\toptions: TreeEncodingOptions,\n): ConciseTree {\n\tconst config: Required<TreeEncodingOptions> = {\n\t\tuseStoredKeys: false,\n\t\t...options,\n\t};\n\n\tconst schemaMap = getUnhydratedContext(rootSchema).schema;\n\treturn conciseFromCursorInner(reader, config, schemaMap);\n}\n\nfunction conciseFromCursorInner(\n\treader: ITreeCursor,\n\toptions: Required<TreeEncodingOptions>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n): ConciseTree {\n\treturn customFromCursor(reader, options, schema, conciseFromCursorInner);\n}\n\n/**\n * Clones tree, replacing any handles.\n * @remarks A strongly typed version of {@link replaceHandles}.\n * @alpha\n */\nexport function replaceConciseTreeHandles<T>(\n\ttree: ConciseTree,\n\treplacer: HandleConverter<T>,\n): ConciseTree<T> {\n\treturn replaceHandles(tree, replacer) as ConciseTree<T>;\n}\n"]}
1
+ {"version":3,"file":"conciseTree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/conciseTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,0DAA2D;AAG3D,mDAKyB;AAwBzB;;GAEG;AACH,SAAgB,iBAAiB,CAChC,MAAmB,EACnB,UAAgC,EAChC,OAA4B;IAE5B,MAAM,MAAM,GAAkC;QAC7C,aAAa,EAAE,KAAK;QACpB,GAAG,OAAO;KACV,CAAC;IAEF,MAAM,SAAS,GAAG,IAAA,uCAAoB,EAAC,UAAU,CAAC,CAAC,MAAM,CAAC;IAC1D,OAAO,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAC1D,CAAC;AAZD,8CAYC;AAED,SAAS,sBAAsB,CAC9B,MAAmB,EACnB,OAAsC,EACtC,MAA2C;IAE3C,OAAO,IAAA,gCAAgB,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,sBAAsB,CAAC,CAAC;AAC1E,CAAC;AAED;;;;GAIG;AACH,SAAgB,yBAAyB,CACxC,IAAiB,EACjB,QAA4B;IAE5B,OAAO,IAAA,8BAAc,EAAC,IAAI,EAAE,QAAQ,CAAmB,CAAC;AACzD,CAAC;AALD,8DAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\n\nimport type { ITreeCursor } from \"../../core/index.js\";\nimport type { TreeNodeSchema } from \"../core/index.js\";\nimport { getUnhydratedContext } from \"../createContext.js\";\nimport type { TreeLeafValue, ImplicitAllowedTypes } from \"../schemaTypes.js\";\n\nimport {\n\tcustomFromCursor,\n\treplaceHandles,\n\ttype TreeEncodingOptions,\n\ttype HandleConverter,\n} from \"./customTree.js\";\n\n/**\n * Concise encoding of a {@link TreeNode} or {@link TreeLeafValue}.\n * @remarks\n * This is \"concise\" meaning that explicit type information is omitted.\n * If the schema is compatible with {@link ITreeConfigurationOptions.preventAmbiguity},\n * types will be lossless and compatible with {@link (TreeAlpha:interface).create} (unless the options are used to customize it).\n *\n * Every {@link TreeNode} is an array or object.\n * Any IFluidHandle values have been replaced by `THandle`.\n * @privateRemarks\n * This can store all possible simple trees,\n * but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.\n * @alpha\n */\nexport type ConciseTree<THandle = IFluidHandle> =\n\t| Exclude<TreeLeafValue, IFluidHandle>\n\t| THandle\n\t| ConciseTree<THandle>[]\n\t| {\n\t\t\t[key: string]: ConciseTree<THandle>;\n\t };\n\n/**\n * Used to read a node cursor as a ConciseTree.\n */\nexport function conciseFromCursor(\n\treader: ITreeCursor,\n\trootSchema: ImplicitAllowedTypes,\n\toptions: TreeEncodingOptions,\n): ConciseTree {\n\tconst config: Required<TreeEncodingOptions> = {\n\t\tuseStoredKeys: false,\n\t\t...options,\n\t};\n\n\tconst schemaMap = getUnhydratedContext(rootSchema).schema;\n\treturn conciseFromCursorInner(reader, config, schemaMap);\n}\n\nfunction conciseFromCursorInner(\n\treader: ITreeCursor,\n\toptions: Required<TreeEncodingOptions>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n): ConciseTree {\n\treturn customFromCursor(reader, options, schema, conciseFromCursorInner);\n}\n\n/**\n * Clones tree, replacing any handles.\n * @remarks A strongly typed version of {@link replaceHandles}.\n * @alpha\n */\nexport function replaceConciseTreeHandles<T>(\n\ttree: ConciseTree,\n\treplacer: HandleConverter<T>,\n): ConciseTree<T> {\n\treturn replaceHandles(tree, replacer) as ConciseTree<T>;\n}\n"]}
@@ -11,8 +11,8 @@ const schemaTypes_js_1 = require("../schemaTypes.js");
11
11
  const index_js_1 = require("../core/index.js");
12
12
  const toStoredSchema_js_1 = require("../toStoredSchema.js");
13
13
  const leafNodeSchema_js_1 = require("../leafNodeSchema.js");
14
- const objectNodeTypes_js_1 = require("../objectNodeTypes.js");
15
- const index_js_2 = require("../../util/index.js");
14
+ const index_js_2 = require("../node-kinds/index.js");
15
+ const index_js_3 = require("../../util/index.js");
16
16
  const walkFieldSchema_js_1 = require("../walkFieldSchema.js");
17
17
  const defaultTreeConfigurationOptions = {
18
18
  enableSchemaValidation: false,
@@ -106,10 +106,10 @@ function checkUnion(union, errors) {
106
106
  if (schema instanceof leafNodeSchema_js_1.LeafNodeSchema) {
107
107
  // nothing to do
108
108
  }
109
- else if ((0, objectNodeTypes_js_1.isObjectNodeSchema)(schema)) {
109
+ else if ((0, index_js_2.isObjectNodeSchema)(schema)) {
110
110
  objects.push(schema);
111
111
  for (const key of schema.fields.keys()) {
112
- (0, index_js_2.getOrCreate)(allObjectKeys, key, () => new Set()).add(schema);
112
+ (0, index_js_3.getOrCreate)(allObjectKeys, key, () => new Set()).add(schema);
113
113
  }
114
114
  }
115
115
  else if (schema.kind === index_js_1.NodeKind.Array) {