@fluidframework/tree 2.11.0 → 2.12.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 (537) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-report/tree.alpha.api.md +2 -2
  3. package/api-report/tree.beta.api.md +1 -1
  4. package/api-report/tree.legacy.alpha.api.md +1 -1
  5. package/api-report/tree.legacy.public.api.md +1 -1
  6. package/api-report/tree.public.api.md +1 -1
  7. package/dist/core/index.d.ts +2 -2
  8. package/dist/core/index.d.ts.map +1 -1
  9. package/dist/core/index.js +5 -3
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/core/rebase/utils.d.ts.map +1 -1
  12. package/dist/core/rebase/utils.js +2 -9
  13. package/dist/core/rebase/utils.js.map +1 -1
  14. package/dist/core/schema-stored/format.d.ts +0 -3
  15. package/dist/core/schema-stored/format.d.ts.map +1 -1
  16. package/dist/core/schema-stored/format.js.map +1 -1
  17. package/dist/core/schema-stored/schema.d.ts +12 -10
  18. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  19. package/dist/core/schema-stored/schema.js +3 -5
  20. package/dist/core/schema-stored/schema.js.map +1 -1
  21. package/dist/core/schema-view/index.d.ts +1 -1
  22. package/dist/core/schema-view/index.d.ts.map +1 -1
  23. package/dist/core/schema-view/index.js +1 -2
  24. package/dist/core/schema-view/index.js.map +1 -1
  25. package/dist/core/schema-view/view.d.ts +0 -7
  26. package/dist/core/schema-view/view.d.ts.map +1 -1
  27. package/dist/core/schema-view/view.js +1 -12
  28. package/dist/core/schema-view/view.js.map +1 -1
  29. package/dist/{feature-libraries/chunked-forest → core/tree}/chunk.d.ts +2 -1
  30. package/dist/core/tree/chunk.d.ts.map +1 -0
  31. package/dist/{feature-libraries/chunked-forest → core/tree}/chunk.js +2 -2
  32. package/dist/core/tree/chunk.js.map +1 -0
  33. package/dist/core/tree/index.d.ts +1 -0
  34. package/dist/core/tree/index.d.ts.map +1 -1
  35. package/dist/core/tree/index.js +5 -1
  36. package/dist/core/tree/index.js.map +1 -1
  37. package/dist/core/tree/treeTextFormat.d.ts +0 -5
  38. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  39. package/dist/core/tree/treeTextFormat.js.map +1 -1
  40. package/dist/core/tree/types.d.ts +0 -5
  41. package/dist/core/tree/types.d.ts.map +1 -1
  42. package/dist/core/tree/types.js +0 -1
  43. package/dist/core/tree/types.js.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts +1 -2
  45. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/basicChunk.js +14 -14
  47. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -2
  49. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -3
  51. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -2
  53. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  55. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts +1 -2
  56. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -2
  59. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  62. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  64. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts +1 -1
  65. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/emptyChunk.js +2 -3
  67. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  69. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/index.js +5 -5
  71. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  73. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  74. package/dist/feature-libraries/chunked-forest/sequenceChunk.js +2 -2
  75. package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -2
  77. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/uniformChunk.js +13 -13
  79. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  80. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  81. package/dist/feature-libraries/default-schema/defaultSchema.js +1 -0
  82. package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  83. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  84. package/dist/feature-libraries/default-schema/schemaChecker.js +2 -1
  85. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  86. package/dist/feature-libraries/index.d.ts +1 -1
  87. package/dist/feature-libraries/index.d.ts.map +1 -1
  88. package/dist/feature-libraries/index.js +6 -2
  89. package/dist/feature-libraries/index.js.map +1 -1
  90. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +8 -1
  91. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  92. package/dist/feature-libraries/indexing/anchorTreeIndex.js +31 -5
  93. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  94. package/dist/feature-libraries/modular-schema/discrepancies.d.ts +84 -24
  95. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  96. package/dist/feature-libraries/modular-schema/discrepancies.js +32 -33
  97. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  98. package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
  99. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  100. package/dist/feature-libraries/modular-schema/index.js +5 -1
  101. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  102. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +0 -1
  103. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  104. package/dist/feature-libraries/modular-schema/isNeverTree.js +0 -1
  105. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  106. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  107. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  108. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  109. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  110. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +12 -12
  111. package/dist/feature-libraries/sequence-field/formatV1.d.ts +99 -99
  112. package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  113. package/dist/feature-libraries/sequence-field/formatV2.d.ts +76 -76
  114. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  115. package/dist/feature-libraries/sequence-field/formatV3.d.ts +54 -54
  116. package/dist/feature-libraries/sequence-field/types.d.ts +0 -1
  117. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  118. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  119. package/dist/index.d.ts +4 -5
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +1 -14
  122. package/dist/index.js.map +1 -1
  123. package/dist/packageVersion.d.ts +1 -1
  124. package/dist/packageVersion.js +1 -1
  125. package/dist/packageVersion.js.map +1 -1
  126. package/dist/shared-tree/index.d.ts +1 -1
  127. package/dist/shared-tree/index.d.ts.map +1 -1
  128. package/dist/shared-tree/index.js.map +1 -1
  129. package/dist/shared-tree/schematizeTree.d.ts +1 -1
  130. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  131. package/dist/shared-tree/schematizeTree.js +6 -6
  132. package/dist/shared-tree/schematizeTree.js.map +1 -1
  133. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  134. package/dist/shared-tree/schematizingTreeView.js +8 -12
  135. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  136. package/dist/shared-tree/sharedTree.d.ts +25 -7
  137. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  138. package/dist/shared-tree/sharedTree.js +104 -15
  139. package/dist/shared-tree/sharedTree.js.map +1 -1
  140. package/dist/shared-tree/treeCheckout.d.ts +35 -12
  141. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  142. package/dist/shared-tree/treeCheckout.js +159 -127
  143. package/dist/shared-tree/treeCheckout.js.map +1 -1
  144. package/dist/shared-tree-core/branch.d.ts +13 -35
  145. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  146. package/dist/shared-tree-core/branch.js +12 -77
  147. package/dist/shared-tree-core/branch.js.map +1 -1
  148. package/dist/shared-tree-core/branchCommitEnricher.d.ts +7 -1
  149. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  150. package/dist/shared-tree-core/branchCommitEnricher.js +16 -18
  151. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  152. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  153. package/dist/shared-tree-core/editManager.js +2 -2
  154. package/dist/shared-tree-core/editManager.js.map +1 -1
  155. package/dist/shared-tree-core/index.d.ts +3 -3
  156. package/dist/shared-tree-core/index.d.ts.map +1 -1
  157. package/dist/shared-tree-core/index.js +2 -2
  158. package/dist/shared-tree-core/index.js.map +1 -1
  159. package/dist/shared-tree-core/sharedTreeCore.d.ts +2 -9
  160. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  161. package/dist/shared-tree-core/sharedTreeCore.js +4 -16
  162. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  163. package/dist/shared-tree-core/transaction.d.ts +38 -0
  164. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  165. package/dist/shared-tree-core/transaction.js +118 -6
  166. package/dist/shared-tree-core/transaction.js.map +1 -1
  167. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  168. package/dist/simple-tree/api/conciseTree.js +1 -1
  169. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  170. package/dist/simple-tree/api/create.d.ts.map +1 -1
  171. package/dist/simple-tree/api/create.js +5 -1
  172. package/dist/simple-tree/api/create.js.map +1 -1
  173. package/dist/simple-tree/api/customTree.d.ts +14 -2
  174. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  175. package/dist/simple-tree/api/customTree.js +53 -3
  176. package/dist/simple-tree/api/customTree.js.map +1 -1
  177. package/dist/simple-tree/api/index.d.ts +2 -2
  178. package/dist/simple-tree/api/index.d.ts.map +1 -1
  179. package/dist/simple-tree/api/index.js +4 -1
  180. package/dist/simple-tree/api/index.js.map +1 -1
  181. package/dist/simple-tree/api/schemaFactory.d.ts +48 -0
  182. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  183. package/dist/simple-tree/api/schemaFactory.js +5 -2
  184. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  185. package/dist/simple-tree/api/simpleSchema.d.ts +3 -1
  186. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
  187. package/dist/simple-tree/api/simpleSchema.js.map +1 -1
  188. package/dist/simple-tree/api/simpleTreeIndex.js +3 -1
  189. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  190. package/dist/simple-tree/api/storedSchema.d.ts +4 -4
  191. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  192. package/dist/simple-tree/api/storedSchema.js +8 -21
  193. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  194. package/dist/simple-tree/api/tree.d.ts +1 -0
  195. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  196. package/dist/simple-tree/api/tree.js.map +1 -1
  197. package/dist/simple-tree/api/verboseTree.js +1 -1
  198. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  199. package/dist/simple-tree/api/view.d.ts +14 -9
  200. package/dist/simple-tree/api/view.d.ts.map +1 -1
  201. package/dist/simple-tree/api/view.js +129 -40
  202. package/dist/simple-tree/api/view.js.map +1 -1
  203. package/dist/simple-tree/index.d.ts +2 -2
  204. package/dist/simple-tree/index.d.ts.map +1 -1
  205. package/dist/simple-tree/index.js +5 -2
  206. package/dist/simple-tree/index.js.map +1 -1
  207. package/dist/simple-tree/leafNodeSchema.d.ts +0 -15
  208. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  209. package/dist/simple-tree/leafNodeSchema.js +0 -15
  210. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  211. package/dist/simple-tree/objectNode.d.ts +8 -3
  212. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  213. package/dist/simple-tree/objectNode.js +18 -2
  214. package/dist/simple-tree/objectNode.js.map +1 -1
  215. package/dist/simple-tree/objectNodeTypes.d.ts +4 -0
  216. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
  217. package/dist/simple-tree/objectNodeTypes.js.map +1 -1
  218. package/dist/simple-tree/schemaTypes.d.ts +4 -2
  219. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  220. package/dist/simple-tree/schemaTypes.js.map +1 -1
  221. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  222. package/dist/simple-tree/toStoredSchema.js +18 -13
  223. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  224. package/dist/util/brand.d.ts +0 -2
  225. package/dist/util/brand.d.ts.map +1 -1
  226. package/dist/util/brand.js +0 -1
  227. package/dist/util/brand.js.map +1 -1
  228. package/dist/util/index.d.ts +1 -1
  229. package/dist/util/index.d.ts.map +1 -1
  230. package/dist/util/index.js +2 -1
  231. package/dist/util/index.js.map +1 -1
  232. package/dist/util/typeCheck.d.ts +0 -2
  233. package/dist/util/typeCheck.d.ts.map +1 -1
  234. package/dist/util/typeCheck.js.map +1 -1
  235. package/dist/util/utils.d.ts +13 -0
  236. package/dist/util/utils.d.ts.map +1 -1
  237. package/dist/util/utils.js +23 -1
  238. package/dist/util/utils.js.map +1 -1
  239. package/lib/core/index.d.ts +2 -2
  240. package/lib/core/index.d.ts.map +1 -1
  241. package/lib/core/index.js +2 -2
  242. package/lib/core/index.js.map +1 -1
  243. package/lib/core/rebase/utils.d.ts.map +1 -1
  244. package/lib/core/rebase/utils.js +3 -10
  245. package/lib/core/rebase/utils.js.map +1 -1
  246. package/lib/core/schema-stored/format.d.ts +0 -3
  247. package/lib/core/schema-stored/format.d.ts.map +1 -1
  248. package/lib/core/schema-stored/format.js.map +1 -1
  249. package/lib/core/schema-stored/schema.d.ts +12 -10
  250. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  251. package/lib/core/schema-stored/schema.js +3 -5
  252. package/lib/core/schema-stored/schema.js.map +1 -1
  253. package/lib/core/schema-view/index.d.ts +1 -1
  254. package/lib/core/schema-view/index.d.ts.map +1 -1
  255. package/lib/core/schema-view/index.js +1 -1
  256. package/lib/core/schema-view/index.js.map +1 -1
  257. package/lib/core/schema-view/view.d.ts +0 -7
  258. package/lib/core/schema-view/view.d.ts.map +1 -1
  259. package/lib/core/schema-view/view.js +0 -11
  260. package/lib/core/schema-view/view.js.map +1 -1
  261. package/lib/{feature-libraries/chunked-forest → core/tree}/chunk.d.ts +2 -1
  262. package/lib/core/tree/chunk.d.ts.map +1 -0
  263. package/lib/{feature-libraries/chunked-forest → core/tree}/chunk.js +1 -1
  264. package/lib/core/tree/chunk.js.map +1 -0
  265. package/lib/core/tree/index.d.ts +1 -0
  266. package/lib/core/tree/index.d.ts.map +1 -1
  267. package/lib/core/tree/index.js +1 -0
  268. package/lib/core/tree/index.js.map +1 -1
  269. package/lib/core/tree/treeTextFormat.d.ts +0 -5
  270. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  271. package/lib/core/tree/treeTextFormat.js.map +1 -1
  272. package/lib/core/tree/types.d.ts +0 -5
  273. package/lib/core/tree/types.d.ts.map +1 -1
  274. package/lib/core/tree/types.js +0 -1
  275. package/lib/core/tree/types.js.map +1 -1
  276. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts +1 -2
  277. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  278. package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -1
  279. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  280. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +1 -2
  281. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  282. package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -2
  283. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  284. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -2
  285. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  286. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  287. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts +1 -2
  288. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts.map +1 -1
  289. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  290. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -2
  291. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  292. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  293. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  294. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  295. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  296. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts +1 -1
  297. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  298. package/lib/feature-libraries/chunked-forest/emptyChunk.js +1 -2
  299. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  300. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  301. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  302. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  303. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  304. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  305. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  306. package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -1
  307. package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  308. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -2
  309. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  310. package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  311. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  312. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  313. package/lib/feature-libraries/default-schema/defaultSchema.js +1 -0
  314. package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  315. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  316. package/lib/feature-libraries/default-schema/schemaChecker.js +2 -1
  317. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  318. package/lib/feature-libraries/index.d.ts +1 -1
  319. package/lib/feature-libraries/index.d.ts.map +1 -1
  320. package/lib/feature-libraries/index.js +1 -1
  321. package/lib/feature-libraries/index.js.map +1 -1
  322. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +8 -1
  323. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  324. package/lib/feature-libraries/indexing/anchorTreeIndex.js +31 -5
  325. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  326. package/lib/feature-libraries/modular-schema/discrepancies.d.ts +84 -24
  327. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  328. package/lib/feature-libraries/modular-schema/discrepancies.js +25 -28
  329. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  330. package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
  331. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  332. package/lib/feature-libraries/modular-schema/index.js +1 -1
  333. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  334. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +0 -1
  335. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  336. package/lib/feature-libraries/modular-schema/isNeverTree.js +0 -1
  337. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  338. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  339. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  340. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  341. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  342. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +12 -12
  343. package/lib/feature-libraries/sequence-field/formatV1.d.ts +99 -99
  344. package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  345. package/lib/feature-libraries/sequence-field/formatV2.d.ts +76 -76
  346. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  347. package/lib/feature-libraries/sequence-field/formatV3.d.ts +54 -54
  348. package/lib/feature-libraries/sequence-field/types.d.ts +0 -1
  349. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  350. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  351. package/lib/index.d.ts +4 -5
  352. package/lib/index.d.ts.map +1 -1
  353. package/lib/index.js +2 -3
  354. package/lib/index.js.map +1 -1
  355. package/lib/packageVersion.d.ts +1 -1
  356. package/lib/packageVersion.js +1 -1
  357. package/lib/packageVersion.js.map +1 -1
  358. package/lib/shared-tree/index.d.ts +1 -1
  359. package/lib/shared-tree/index.d.ts.map +1 -1
  360. package/lib/shared-tree/index.js.map +1 -1
  361. package/lib/shared-tree/schematizeTree.d.ts +1 -1
  362. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  363. package/lib/shared-tree/schematizeTree.js +7 -7
  364. package/lib/shared-tree/schematizeTree.js.map +1 -1
  365. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  366. package/lib/shared-tree/schematizingTreeView.js +10 -14
  367. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  368. package/lib/shared-tree/sharedTree.d.ts +25 -7
  369. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  370. package/lib/shared-tree/sharedTree.js +105 -16
  371. package/lib/shared-tree/sharedTree.js.map +1 -1
  372. package/lib/shared-tree/treeCheckout.d.ts +35 -12
  373. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  374. package/lib/shared-tree/treeCheckout.js +161 -129
  375. package/lib/shared-tree/treeCheckout.js.map +1 -1
  376. package/lib/shared-tree-core/branch.d.ts +13 -35
  377. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  378. package/lib/shared-tree-core/branch.js +12 -76
  379. package/lib/shared-tree-core/branch.js.map +1 -1
  380. package/lib/shared-tree-core/branchCommitEnricher.d.ts +7 -1
  381. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  382. package/lib/shared-tree-core/branchCommitEnricher.js +16 -18
  383. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  384. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  385. package/lib/shared-tree-core/editManager.js +3 -3
  386. package/lib/shared-tree-core/editManager.js.map +1 -1
  387. package/lib/shared-tree-core/index.d.ts +3 -3
  388. package/lib/shared-tree-core/index.d.ts.map +1 -1
  389. package/lib/shared-tree-core/index.js +2 -2
  390. package/lib/shared-tree-core/index.js.map +1 -1
  391. package/lib/shared-tree-core/sharedTreeCore.d.ts +2 -9
  392. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  393. package/lib/shared-tree-core/sharedTreeCore.js +4 -16
  394. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  395. package/lib/shared-tree-core/transaction.d.ts +38 -0
  396. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  397. package/lib/shared-tree-core/transaction.js +112 -1
  398. package/lib/shared-tree-core/transaction.js.map +1 -1
  399. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  400. package/lib/simple-tree/api/conciseTree.js +2 -2
  401. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  402. package/lib/simple-tree/api/create.d.ts.map +1 -1
  403. package/lib/simple-tree/api/create.js +5 -1
  404. package/lib/simple-tree/api/create.js.map +1 -1
  405. package/lib/simple-tree/api/customTree.d.ts +14 -2
  406. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  407. package/lib/simple-tree/api/customTree.js +50 -2
  408. package/lib/simple-tree/api/customTree.js.map +1 -1
  409. package/lib/simple-tree/api/index.d.ts +2 -2
  410. package/lib/simple-tree/api/index.d.ts.map +1 -1
  411. package/lib/simple-tree/api/index.js +2 -1
  412. package/lib/simple-tree/api/index.js.map +1 -1
  413. package/lib/simple-tree/api/schemaFactory.d.ts +48 -0
  414. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  415. package/lib/simple-tree/api/schemaFactory.js +4 -1
  416. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  417. package/lib/simple-tree/api/simpleSchema.d.ts +3 -1
  418. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
  419. package/lib/simple-tree/api/simpleSchema.js.map +1 -1
  420. package/lib/simple-tree/api/simpleTreeIndex.js +3 -1
  421. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  422. package/lib/simple-tree/api/storedSchema.d.ts +4 -4
  423. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  424. package/lib/simple-tree/api/storedSchema.js +5 -18
  425. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  426. package/lib/simple-tree/api/tree.d.ts +1 -0
  427. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  428. package/lib/simple-tree/api/tree.js.map +1 -1
  429. package/lib/simple-tree/api/verboseTree.js +2 -2
  430. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  431. package/lib/simple-tree/api/view.d.ts +14 -9
  432. package/lib/simple-tree/api/view.d.ts.map +1 -1
  433. package/lib/simple-tree/api/view.js +131 -42
  434. package/lib/simple-tree/api/view.js.map +1 -1
  435. package/lib/simple-tree/index.d.ts +2 -2
  436. package/lib/simple-tree/index.d.ts.map +1 -1
  437. package/lib/simple-tree/index.js +2 -2
  438. package/lib/simple-tree/index.js.map +1 -1
  439. package/lib/simple-tree/leafNodeSchema.d.ts +0 -15
  440. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  441. package/lib/simple-tree/leafNodeSchema.js +0 -15
  442. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  443. package/lib/simple-tree/objectNode.d.ts +8 -3
  444. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  445. package/lib/simple-tree/objectNode.js +16 -1
  446. package/lib/simple-tree/objectNode.js.map +1 -1
  447. package/lib/simple-tree/objectNodeTypes.d.ts +4 -0
  448. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
  449. package/lib/simple-tree/objectNodeTypes.js.map +1 -1
  450. package/lib/simple-tree/schemaTypes.d.ts +4 -2
  451. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  452. package/lib/simple-tree/schemaTypes.js.map +1 -1
  453. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  454. package/lib/simple-tree/toStoredSchema.js +19 -14
  455. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  456. package/lib/util/brand.d.ts +0 -2
  457. package/lib/util/brand.d.ts.map +1 -1
  458. package/lib/util/brand.js +0 -1
  459. package/lib/util/brand.js.map +1 -1
  460. package/lib/util/index.d.ts +1 -1
  461. package/lib/util/index.d.ts.map +1 -1
  462. package/lib/util/index.js +1 -1
  463. package/lib/util/index.js.map +1 -1
  464. package/lib/util/typeCheck.d.ts +0 -2
  465. package/lib/util/typeCheck.d.ts.map +1 -1
  466. package/lib/util/typeCheck.js.map +1 -1
  467. package/lib/util/utils.d.ts +13 -0
  468. package/lib/util/utils.d.ts.map +1 -1
  469. package/lib/util/utils.js +21 -0
  470. package/lib/util/utils.js.map +1 -1
  471. package/package.json +22 -22
  472. package/src/core/index.ts +5 -1
  473. package/src/core/rebase/utils.ts +17 -20
  474. package/src/core/schema-stored/format.ts +0 -3
  475. package/src/core/schema-stored/schema.ts +13 -10
  476. package/src/core/schema-view/index.ts +0 -1
  477. package/src/core/schema-view/view.ts +0 -11
  478. package/src/{feature-libraries/chunked-forest → core/tree}/chunk.ts +4 -4
  479. package/src/core/tree/index.ts +8 -0
  480. package/src/core/tree/treeTextFormat.ts +0 -5
  481. package/src/core/tree/types.ts +0 -5
  482. package/src/feature-libraries/chunked-forest/basicChunk.ts +4 -2
  483. package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -1
  484. package/src/feature-libraries/chunked-forest/chunkedForest.ts +2 -1
  485. package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +1 -2
  486. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +6 -2
  487. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
  488. package/src/feature-libraries/chunked-forest/emptyChunk.ts +4 -2
  489. package/src/feature-libraries/chunked-forest/index.ts +1 -1
  490. package/src/feature-libraries/chunked-forest/sequenceChunk.ts +1 -1
  491. package/src/feature-libraries/chunked-forest/uniformChunk.ts +4 -1
  492. package/src/feature-libraries/default-schema/defaultSchema.ts +1 -0
  493. package/src/feature-libraries/default-schema/schemaChecker.ts +4 -1
  494. package/src/feature-libraries/index.ts +13 -0
  495. package/src/feature-libraries/indexing/anchorTreeIndex.ts +34 -5
  496. package/src/feature-libraries/modular-schema/discrepancies.ts +76 -38
  497. package/src/feature-libraries/modular-schema/index.ts +13 -0
  498. package/src/feature-libraries/modular-schema/isNeverTree.ts +0 -2
  499. package/src/feature-libraries/sequence-field/types.ts +0 -1
  500. package/src/index.ts +1 -29
  501. package/src/packageVersion.ts +1 -1
  502. package/src/shared-tree/index.ts +1 -0
  503. package/src/shared-tree/schematizeTree.ts +6 -10
  504. package/src/shared-tree/schematizingTreeView.ts +11 -21
  505. package/src/shared-tree/sharedTree.ts +173 -41
  506. package/src/shared-tree/treeCheckout.ts +224 -175
  507. package/src/shared-tree-core/branch.ts +29 -122
  508. package/src/shared-tree-core/branchCommitEnricher.ts +19 -20
  509. package/src/shared-tree-core/editManager.ts +3 -8
  510. package/src/shared-tree-core/index.ts +2 -1
  511. package/src/shared-tree-core/sharedTreeCore.ts +8 -19
  512. package/src/shared-tree-core/transaction.ts +145 -0
  513. package/src/simple-tree/api/conciseTree.ts +2 -2
  514. package/src/simple-tree/api/create.ts +5 -1
  515. package/src/simple-tree/api/customTree.ts +69 -1
  516. package/src/simple-tree/api/index.ts +12 -2
  517. package/src/simple-tree/api/schemaFactory.ts +62 -1
  518. package/src/simple-tree/api/simpleSchema.ts +3 -1
  519. package/src/simple-tree/api/simpleTreeIndex.ts +2 -0
  520. package/src/simple-tree/api/storedSchema.ts +7 -22
  521. package/src/simple-tree/api/tree.ts +6 -0
  522. package/src/simple-tree/api/verboseTree.ts +2 -2
  523. package/src/simple-tree/api/view.ts +197 -51
  524. package/src/simple-tree/index.ts +6 -0
  525. package/src/simple-tree/leafNodeSchema.ts +0 -19
  526. package/src/simple-tree/objectNode.ts +26 -2
  527. package/src/simple-tree/objectNodeTypes.ts +5 -0
  528. package/src/simple-tree/schemaTypes.ts +7 -2
  529. package/src/simple-tree/toStoredSchema.ts +25 -19
  530. package/src/util/brand.ts +0 -2
  531. package/src/util/index.ts +1 -0
  532. package/src/util/typeCheck.ts +0 -2
  533. package/src/util/utils.ts +26 -0
  534. package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
  535. package/dist/feature-libraries/chunked-forest/chunk.js.map +0 -1
  536. package/lib/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
  537. package/lib/feature-libraries/chunked-forest/chunk.js.map +0 -1
@@ -41,17 +41,17 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
41
41
  return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
42
42
  };
43
43
  import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
44
- import { createEmitter } from "@fluid-internal/client-utils";
45
44
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
46
45
  import { noopValidator } from "../codec/index.js";
47
- import { RevisionTagCodec, TreeStoredSchemaRepository, makeDetachedFieldIndex, moveToDetachedField, } from "../core/index.js";
48
- import { DetachedFieldIndexSummarizer, ForestSummarizer, SchemaSummarizer, TreeCompressionStrategy, buildChunkedForest, buildForest, defaultSchemaPolicy, jsonableTreeFromFieldCursor, makeFieldBatchCodec, makeMitigatedChangeFamily, makeTreeChunker, } from "../feature-libraries/index.js";
46
+ import { LeafNodeStoredSchema, MapNodeStoredSchema, ObjectNodeStoredSchema, RevisionTagCodec, TreeStoredSchemaRepository, makeDetachedFieldIndex, moveToDetachedField, } from "../core/index.js";
47
+ import { DetachedFieldIndexSummarizer, FieldKinds, ForestSummarizer, SchemaSummarizer, TreeCompressionStrategy, buildChunkedForest, buildForest, defaultSchemaPolicy, jsonableTreeFromFieldCursor, makeFieldBatchCodec, makeMitigatedChangeFamily, makeTreeChunker, } from "../feature-libraries/index.js";
49
48
  import { DefaultResubmitMachine, SharedTreeCore, } from "../shared-tree-core/index.js";
49
+ import { NodeKind, tryStoredSchemaAsArray, customFromCursorStored, FieldKind, } from "../simple-tree/index.js";
50
50
  import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
51
51
  import { SharedTreeReadonlyChangeEnricher } from "./sharedTreeChangeEnricher.js";
52
52
  import { SharedTreeChangeFamily } from "./sharedTreeChangeFamily.js";
53
- import { createTreeCheckout, } from "./treeCheckout.js";
54
- import { breakingClass, throwIfBroken } from "../util/index.js";
53
+ import { createTreeCheckout } from "./treeCheckout.js";
54
+ import { breakingClass, fail, throwIfBroken } from "../util/index.js";
55
55
  const formatVersionToTopLevelCodecVersions = new Map([
56
56
  [
57
57
  1,
@@ -153,8 +153,7 @@ let SharedTree = (() => {
153
153
  });
154
154
  const changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);
155
155
  super([schemaSummarizer, forestSummarizer, removedRootsSummarizer], changeFamily, options, codecVersions, id, runtime, attributes, telemetryContextPrefix, schema, defaultSchemaPolicy, new DefaultResubmitMachine((change) => changeFamily.rebaser.invert(change, true, this.mintRevisionTag()), changeEnricher), changeEnricher);
156
- this._events = __runInitializers(this, _instanceExtraInitializers);
157
- this._events = createEmitter();
156
+ this.checkout = __runInitializers(this, _instanceExtraInitializers);
158
157
  const localBranch = this.getLocalBranch();
159
158
  this.checkout = createTreeCheckout(runtime.idCompressor, this.mintRevisionTag, revisionTagCodec, {
160
159
  branch: localBranch,
@@ -162,7 +161,6 @@ let SharedTree = (() => {
162
161
  schema,
163
162
  forest,
164
163
  fieldBatchCodec,
165
- events: this._events,
166
164
  removedRoots,
167
165
  chunkCompressionStrategy: options.treeEncodeType,
168
166
  logger: this.logger,
@@ -186,6 +184,41 @@ let SharedTree = (() => {
186
184
  this.commitEnricher.commitTransaction();
187
185
  }
188
186
  });
187
+ this.checkout.events.on("beforeBatch", (event) => {
188
+ if (event.type === "append" && this.isAttached()) {
189
+ if (this.checkout.transaction.isInProgress()) {
190
+ this.commitEnricher.addTransactionCommits(event.newCommits);
191
+ }
192
+ }
193
+ });
194
+ }
195
+ exportVerbose() {
196
+ const cursor = this.checkout.forest.allocateCursor("contentSnapshot");
197
+ try {
198
+ moveToDetachedField(this.checkout.forest, cursor);
199
+ const length = cursor.getFieldLength();
200
+ if (length === 0) {
201
+ return undefined;
202
+ }
203
+ else if (length === 1) {
204
+ cursor.enterNode(0);
205
+ return verboseFromCursor(cursor, this.storedSchema.nodeSchema);
206
+ }
207
+ else {
208
+ fail("Invalid document root length");
209
+ }
210
+ }
211
+ finally {
212
+ cursor.free();
213
+ }
214
+ }
215
+ exportSimpleSchema() {
216
+ return {
217
+ ...exportSimpleFieldSchemaStored(this.storedSchema.rootFieldSchema),
218
+ definitions: new Map([...this.storedSchema.nodeSchema].map(([key, schema]) => {
219
+ return [key, exportSimpleNodeSchemaStored(schema)];
220
+ })),
221
+ };
189
222
  }
190
223
  contentSnapshot() {
191
224
  const cursor = this.checkout.forest.allocateCursor("contentSnapshot");
@@ -206,14 +239,7 @@ let SharedTree = (() => {
206
239
  }
207
240
  async loadCore(services) {
208
241
  await super.loadCore(services);
209
- this.checkout.setTipRevisionForLoadedData(this.trunkHeadRevision);
210
- this._events.emit("afterBatch");
211
- }
212
- submitCommit(...args) {
213
- // We do not submit ops for changes that are part of a transaction.
214
- if (!this.checkout.transaction.isInProgress()) {
215
- super.submitCommit(...args);
216
- }
242
+ this.checkout.load();
217
243
  }
218
244
  didAttach() {
219
245
  if (this.checkout.transaction.isInProgress()) {
@@ -227,6 +253,16 @@ let SharedTree = (() => {
227
253
  assert(!this.checkout.transaction.isInProgress(), 0x674 /* Unexpected transaction is open while applying stashed ops */);
228
254
  super.applyStashedOp(...args);
229
255
  }
256
+ submitCommit(commit, schemaAndPolicy, isResubmit) {
257
+ assert(!this.checkout.transaction.isInProgress(), "Cannot submit a commit while a transaction is in progress");
258
+ if (isResubmit) {
259
+ return super.submitCommit(commit, schemaAndPolicy, isResubmit);
260
+ }
261
+ // Refrain from submitting new commits until they are validated by the checkout.
262
+ // This is not a strict requirement for correctness in our system, but in the event that there is a bug when applying commits to the checkout
263
+ // that causes a crash (e.g. in the forest), this will at least prevent this client from sending the problematic commit to any other clients.
264
+ this.checkout.onCommitValid(commit, () => super.submitCommit(commit, schemaAndPolicy, isResubmit));
265
+ }
230
266
  };
231
267
  __setFunctionName(_classThis, "SharedTree");
232
268
  (() => {
@@ -319,4 +355,57 @@ export class SharedTreeFactory {
319
355
  return tree;
320
356
  }
321
357
  }
358
+ function verboseFromCursor(reader, schema) {
359
+ const fields = customFromCursorStored(reader, schema, verboseFromCursor);
360
+ const nodeSchema = schema.get(reader.type) ?? fail("missing schema for type in cursor");
361
+ if (nodeSchema instanceof LeafNodeStoredSchema) {
362
+ return fields;
363
+ }
364
+ return {
365
+ type: reader.type,
366
+ fields: fields,
367
+ };
368
+ }
369
+ function exportSimpleFieldSchemaStored(schema) {
370
+ let kind;
371
+ switch (schema.kind) {
372
+ case FieldKinds.identifier.identifier:
373
+ kind = FieldKind.Identifier;
374
+ break;
375
+ case FieldKinds.optional.identifier:
376
+ kind = FieldKind.Optional;
377
+ break;
378
+ case FieldKinds.required.identifier:
379
+ kind = FieldKind.Required;
380
+ break;
381
+ case FieldKinds.forbidden.identifier:
382
+ kind = FieldKind.Optional;
383
+ assert(schema.types.size === 0, 0xa94 /* invalid forbidden field */);
384
+ break;
385
+ default:
386
+ fail("invalid field kind");
387
+ }
388
+ return { kind, allowedTypes: schema.types };
389
+ }
390
+ function exportSimpleNodeSchemaStored(schema) {
391
+ const arrayTypes = tryStoredSchemaAsArray(schema);
392
+ if (arrayTypes !== undefined) {
393
+ return { kind: NodeKind.Array, allowedTypes: arrayTypes };
394
+ }
395
+ if (schema instanceof ObjectNodeStoredSchema) {
396
+ const fields = {};
397
+ for (const [key, field] of schema.objectNodeFields) {
398
+ fields[key] = exportSimpleFieldSchemaStored(field);
399
+ }
400
+ return { kind: NodeKind.Object, fields };
401
+ }
402
+ if (schema instanceof MapNodeStoredSchema) {
403
+ assert(schema.mapFields.kind === FieldKinds.optional.identifier, 0xa95 /* Invalid map schema */);
404
+ return { kind: NodeKind.Map, allowedTypes: schema.mapFields.types };
405
+ }
406
+ if (schema instanceof LeafNodeStoredSchema) {
407
+ return { kind: NodeKind.Leaf, leafKind: schema.leafValue };
408
+ }
409
+ fail("invalid schema kind");
410
+ }
322
411
  //# sourceMappingURL=sharedTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTree.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAM9E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAS7D,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAsB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAGN,gBAAgB,EAGhB,0BAA0B,EAE1B,sBAAsB,EACtB,mBAAmB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,4BAA4B,EAC5B,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,2BAA2B,EAC3B,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,GACf,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,sBAAsB,EAEtB,cAAc,GACd,MAAM,8BAA8B,CAAC;AAWtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AAC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X;AAbD,WAAY,UAAU;IACrB;;OAEG;IACH,qDAAa,CAAA;IACb;;OAEG;IACH,qDAAa,CAAA;IACb;;OAEG;IACH,qDAAa,CAAA;AACd,CAAC,EAbW,UAAU,KAAV,UAAU,QAarB;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAgC;IACpE,aAAa,EAAE,aAAa;IAC5B,MAAM,EAAE,UAAU,CAAC,SAAS;IAC5B,cAAc,EAAE,uBAAuB,CAAC,UAAU;IAClD,aAAa,EAAE,uBAAuB,CAAC,EAAE;CACzC,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAS7B,YAAoC,UAA6B,EAAE;QAA/B,YAAO,GAAP,OAAO,CAAwB;QARnD,SAAI,GAAW,wCAAwC,CAAC;QAExD,eAAU,GAAuB;YAChD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,qBAAqB,EAAE,OAAO;YAC9B,cAAc,EAAE,OAAO;SACvB,CAAC;IAEoE,CAAC;IAEhE,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,iBAA+C;QAE/C,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1E,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;CACD","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 type {\n\tHasListeners,\n\tIEmitter,\n\tListenable,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type { ISharedObject } from \"@fluidframework/shared-object-base/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type ICodecOptions, noopValidator } from \"../codec/index.js\";\nimport {\n\ttype IEditableForest,\n\ttype JsonableTree,\n\tRevisionTagCodec,\n\ttype TaggedChange,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\ttype TreeStoredSchemaSubscription,\n\tmakeDetachedFieldIndex,\n\tmoveToDetachedField,\n} from \"../core/index.js\";\n\nimport {\n\tDetachedFieldIndexSummarizer,\n\tForestSummarizer,\n\tSchemaSummarizer,\n\tTreeCompressionStrategy,\n\tbuildChunkedForest,\n\tbuildForest,\n\tdefaultSchemaPolicy,\n\tjsonableTreeFromFieldCursor,\n\tmakeFieldBatchCodec,\n\tmakeMitigatedChangeFamily,\n\tmakeTreeChunker,\n} from \"../feature-libraries/index.js\";\nimport {\n\tDefaultResubmitMachine,\n\ttype ExplicitCoreCodecVersions,\n\tSharedTreeCore,\n} from \"../shared-tree-core/index.js\";\nimport type {\n\tITree,\n\tImplicitFieldSchema,\n\tReadSchema,\n\tTreeView,\n\tTreeViewAlpha,\n\tTreeViewConfiguration,\n\tUnsafeUnknownSchema,\n} from \"../simple-tree/index.js\";\n\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { SharedTreeReadonlyChangeEnricher } from \"./sharedTreeChangeEnricher.js\";\nimport { SharedTreeChangeFamily } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport {\n\ttype CheckoutEvents,\n\ttype TreeCheckout,\n\ttype BranchableTree,\n\tcreateTreeCheckout,\n} from \"./treeCheckout.js\";\nimport { breakingClass, throwIfBroken } from \"../util/index.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\n/**\n * Copy of data from an {@link ISharedTree} at some point in time.\n * @remarks\n * This is unrelated to Fluids concept of \"snapshots\".\n * @internal\n */\nexport interface SharedTreeContentSnapshot {\n\t/**\n\t * The schema stored in the document.\n\t *\n\t * @remarks\n\t * Edits to the schema can mutate the schema stored of the tree which took this snapshot (but this snapshot will remain the same)\n\t * This is mainly useful for debugging cases where schematize reports an incompatible view schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\t/**\n\t * All {@link TreeStatus.InDocument} content.\n\t */\n\treadonly tree: JsonableTree[];\n\t/**\n\t * All {@link TreeStatus.Removed} content.\n\t */\n\treadonly removed: [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * {@link ITree} extended with some non-public APIs.\n * @internal\n */\nexport interface ISharedTree extends ISharedObject, ITree {\n\t/**\n\t * Provides a copy of the current content of the tree.\n\t * This can be useful for inspecting the tree when no suitable view schema is available.\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t *\n\t * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.\n\t */\n\tcontentSnapshot(): SharedTreeContentSnapshot;\n}\n\n/**\n * Has an entry for each codec which writes an explicit version into its data.\n *\n * This is used to map the single API entrypoint controlling the format {@link SharedTreeOptions.formatVersion}\n * to a list of write versions that for each codec that should be used for that format.\n *\n * Note that all explicitly versioned codecs should be using the format version from the data to read encoded data.\n *\n * TODO: Plumb these write versions into forest, schema, detached field index codec creation.\n */\ninterface ExplicitCodecVersions extends ExplicitCoreCodecVersions {\n\tforest: number;\n\tschema: number;\n\tdetachedFieldIndex: number;\n\tfieldBatch: number;\n}\n\nconst formatVersionToTopLevelCodecVersions = new Map<number, ExplicitCodecVersions>([\n\t[\n\t\t1,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 1, message: 1, fieldBatch: 1 },\n\t],\n\t[\n\t\t2,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 2, message: 2, fieldBatch: 1 },\n\t],\n\t[\n\t\t3,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 3, message: 3, fieldBatch: 1 },\n\t],\n\t[\n\t\t4,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 4, message: 4, fieldBatch: 1 },\n\t],\n]);\n\nfunction getCodecVersions(formatVersion: number): ExplicitCodecVersions {\n\tconst versions = formatVersionToTopLevelCodecVersions.get(formatVersion);\n\tassert(versions !== undefined, 0x90e /* Unknown format version */);\n\treturn versions;\n}\n\n/**\n * Build and return a forest of the requested type.\n */\nexport function buildConfiguredForest(\n\ttype: ForestType,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n): IEditableForest {\n\tswitch (type) {\n\t\tcase ForestType.Optimized:\n\t\t\treturn buildChunkedForest(\n\t\t\t\tmakeTreeChunker(schema, defaultSchemaPolicy),\n\t\t\t\tundefined,\n\t\t\t\tidCompressor,\n\t\t\t);\n\t\tcase ForestType.Reference:\n\t\t\treturn buildForest();\n\t\tcase ForestType.Expensive:\n\t\t\treturn buildForest(undefined, true);\n\t\tdefault:\n\t\t\tunreachableCase(type);\n\t}\n}\n\n/**\n * Shared tree, configured with a good set of indexes and field kinds which will maintain compatibility over time.\n *\n * TODO: detail compatibility requirements.\n */\n@breakingClass\nexport class SharedTree\n\textends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>\n\timplements ISharedTree\n{\n\tprivate readonly _events: Listenable<CheckoutEvents> &\n\t\tIEmitter<CheckoutEvents> &\n\t\tHasListeners<CheckoutEvents>;\n\tpublic readonly checkout: TreeCheckout;\n\tpublic get storedSchema(): TreeStoredSchemaRepository {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t\toptionsParam: SharedTreeOptions,\n\t\ttelemetryContextPrefix: string = \"fluid_sharedTree_\",\n\t) {\n\t\tif (runtime.idCompressor === undefined) {\n\t\t\tthrow new UsageError(\"IdCompressor must be enabled to use SharedTree\");\n\t\t}\n\n\t\tconst options = { ...defaultSharedTreeOptions, ...optionsParam };\n\t\tconst codecVersions = getCodecVersions(options.formatVersion);\n\t\tconst schema = new TreeStoredSchemaRepository();\n\t\tconst forest = buildConfiguredForest(options.forest, schema, runtime.idCompressor);\n\t\tconst revisionTagCodec = new RevisionTagCodec(runtime.idCompressor);\n\t\tconst removedRoots = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\truntime.idCompressor,\n\t\t\toptions,\n\t\t);\n\t\tconst schemaSummarizer = new SchemaSummarizer(runtime, schema, options, {\n\t\t\tgetCurrentSeq: () => this.deltaManager.lastSequenceNumber,\n\t\t});\n\t\tconst fieldBatchCodec = makeFieldBatchCodec(options, codecVersions.fieldBatch);\n\n\t\tconst encoderContext = {\n\t\t\tschema: {\n\t\t\t\tschema,\n\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t},\n\t\t\tencodeType: options.treeEncodeType,\n\t\t\toriginatorId: runtime.idCompressor.localSessionId,\n\t\t\tidCompressor: runtime.idCompressor,\n\t\t};\n\t\tconst forestSummarizer = new ForestSummarizer(\n\t\t\tforest,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tencoderContext,\n\t\t\toptions,\n\t\t\truntime.idCompressor,\n\t\t);\n\t\tconst removedRootsSummarizer = new DetachedFieldIndexSummarizer(removedRoots);\n\t\tconst innerChangeFamily = new SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\toptions,\n\t\t\toptions.treeEncodeType,\n\t\t\truntime.idCompressor,\n\t\t);\n\t\tconst changeFamily = makeMitigatedChangeFamily(\n\t\t\tinnerChangeFamily,\n\t\t\tSharedTreeChangeFamily.emptyChange,\n\t\t\t(error: unknown) => {\n\t\t\t\t// TODO:6344 Add telemetry for these errors.\n\t\t\t\t// Rethrowing the error has a different effect depending on the context in which the\n\t\t\t\t// ChangeFamily was invoked:\n\t\t\t\t// - If the ChangeFamily was invoked as part of incoming op processing, rethrowing the error\n\t\t\t\t// will cause the runtime to disconnect the client, log a severe error, and not reconnect.\n\t\t\t\t// This will not cause the host application to crash because it is not on the stack at that time.\n\t\t\t\t// TODO: let the host application know that the client is now disconnected.\n\t\t\t\t// - If the ChangeFamily was invoked as part of dealing with a local change, rethrowing the\n\t\t\t\t// error will cause the host application to crash. This is not ideal, but is better than\n\t\t\t\t// letting the application either send an invalid change to the server or allowing the\n\t\t\t\t// application to continue working when its local branches contain edits that cannot be\n\t\t\t\t// reflected in its views.\n\t\t\t\t// The best course of action for a host application in such a state is to restart.\n\t\t\t\t// TODO: let the host application know about this situation and provide a way to\n\t\t\t\t// programmatically reload the SharedTree container.\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tconst changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);\n\t\tsuper(\n\t\t\t[schemaSummarizer, forestSummarizer, removedRootsSummarizer],\n\t\t\tchangeFamily,\n\t\t\toptions,\n\t\t\tcodecVersions,\n\t\t\tid,\n\t\t\truntime,\n\t\t\tattributes,\n\t\t\ttelemetryContextPrefix,\n\t\t\tschema,\n\t\t\tdefaultSchemaPolicy,\n\t\t\tnew DefaultResubmitMachine(\n\t\t\t\t(change: TaggedChange<SharedTreeChange>) =>\n\t\t\t\t\tchangeFamily.rebaser.invert(change, true, this.mintRevisionTag()),\n\t\t\t\tchangeEnricher,\n\t\t\t),\n\t\t\tchangeEnricher,\n\t\t);\n\t\tthis._events = createEmitter<CheckoutEvents>();\n\t\tconst localBranch = this.getLocalBranch();\n\t\tthis.checkout = createTreeCheckout(\n\t\t\truntime.idCompressor,\n\t\t\tthis.mintRevisionTag,\n\t\t\trevisionTagCodec,\n\t\t\t{\n\t\t\t\tbranch: localBranch,\n\t\t\t\tchangeFamily,\n\t\t\t\tschema,\n\t\t\t\tforest,\n\t\t\t\tfieldBatchCodec,\n\t\t\t\tevents: this._events,\n\t\t\t\tremovedRoots,\n\t\t\t\tchunkCompressionStrategy: options.treeEncodeType,\n\t\t\t\tlogger: this.logger,\n\t\t\t\tbreaker: this.breaker,\n\t\t\t},\n\t\t);\n\n\t\tthis.checkout.transaction.events.on(\"started\", () => {\n\t\t\tif (this.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.startTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.transaction.events.on(\"aborting\", () => {\n\t\t\tif (this.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.abortTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.transaction.events.on(\"committing\", () => {\n\t\t\tif (this.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.commitTransaction();\n\t\t\t}\n\t\t});\n\t}\n\n\t@throwIfBroken\n\tpublic contentSnapshot(): SharedTreeContentSnapshot {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\treturn {\n\t\t\t\tschema: this.storedSchema.clone(),\n\t\t\t\ttree: jsonableTreeFromFieldCursor(cursor),\n\t\t\t\tremoved: this.checkout.getRemovedRoots(),\n\t\t\t};\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t// For the new TreeViewAlpha API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\n\t// For the old TreeView API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\treturn this.checkout.viewWith(config) as SchematizingSimpleTreeView<TRoot> &\n\t\t\tTreeView<ReadSchema<TRoot>>;\n\t}\n\n\tprotected override async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tawait super.loadCore(services);\n\t\tthis.checkout.setTipRevisionForLoadedData(this.trunkHeadRevision);\n\t\tthis._events.emit(\"afterBatch\");\n\t}\n\n\tprotected override submitCommit(\n\t\t...args: Parameters<\n\t\t\tSharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>[\"submitCommit\"]\n\t\t>\n\t): void {\n\t\t// We do not submit ops for changes that are part of a transaction.\n\t\tif (!this.checkout.transaction.isInProgress()) {\n\t\t\tsuper.submitCommit(...args);\n\t\t}\n\t}\n\n\tprotected override didAttach(): void {\n\t\tif (this.checkout.transaction.isInProgress()) {\n\t\t\t// Attaching during a transaction is not currently supported.\n\t\t\t// At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Cannot attach while a transaction is in progress. Commit or abort the transaction before attaching.\",\n\t\t\t);\n\t\t}\n\t\tsuper.didAttach();\n\t}\n\n\tprotected override applyStashedOp(\n\t\t...args: Parameters<\n\t\t\tSharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>[\"applyStashedOp\"]\n\t\t>\n\t): void {\n\t\tassert(\n\t\t\t!this.checkout.transaction.isInProgress(),\n\t\t\t0x674 /* Unexpected transaction is open while applying stashed ops */,\n\t\t);\n\t\tsuper.applyStashedOp(...args);\n\t}\n}\n\n/**\n * Get a {@link BranchableTree} from a {@link ITree}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch(tree: ITree): BranchableTree;\n/**\n * Get a {@link BranchableTree} from a {@link TreeView}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * Branches are currently an unstable \"alpha\" API and are subject to change in the future.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\tview: TreeViewAlpha<T>,\n): BranchableTree;\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\ttreeOrView: ITree | TreeViewAlpha<T>,\n): BranchableTree {\n\tassert(\n\t\ttreeOrView instanceof SharedTree || treeOrView instanceof SchematizingSimpleTreeView,\n\t\t0xa48 /* Unsupported implementation */,\n\t);\n\tconst checkout: TreeCheckout = treeOrView.checkout;\n\t// This cast is safe so long as TreeCheckout supports all the operations on the branch interface.\n\treturn checkout as unknown as BranchableTree;\n}\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n */\nexport const SharedTreeFormatVersion = {\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t *\n\t * @deprecated - FF does not currently plan on supporting this format long-term.\n\t * Do not write production documents using this format, as they may not be loadable in the future.\n\t */\n\tv1: 1,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv2: 2,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv3: 3,\n} as const;\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n * @privateRemarks\n * See packages/dds/tree/docs/main/compatibility.md for information on how to add support for a new format.\n *\n * TODO: Before this gets promoted past Alpha,\n * a separate abstraction more suited for use in the public API should be adopted rather than reusing the same types used internally.\n * Such an abstraction should probably be in the form of a Fluid-Framework wide compatibility enum.\n */\nexport type SharedTreeFormatVersion = typeof SharedTreeFormatVersion;\n\n/**\n * Configuration options for SharedTree.\n * @alpha\n */\nexport type SharedTreeOptions = Partial<ICodecOptions> &\n\tPartial<SharedTreeFormatOptions> &\n\tForestOptions;\n\n/**\n * Configuration options for SharedTree's internal tree storage.\n * @alpha\n */\nexport interface ForestOptions {\n\t/**\n\t * The {@link ForestType} indicating which forest type should be created for the SharedTree.\n\t */\n\treadonly forest?: ForestType;\n}\n\n/**\n * Options for configuring the persisted format SharedTree uses.\n * @alpha\n */\nexport interface SharedTreeFormatOptions {\n\t/**\n\t * See {@link TreeCompressionStrategy}.\n\t * default: TreeCompressionStrategy.Compressed\n\t */\n\ttreeEncodeType: TreeCompressionStrategy;\n\t/**\n\t * The format version SharedTree should use to persist documents.\n\t *\n\t * This option has compatibility implications for applications using SharedTree.\n\t * Each version documents a required minimum version of \\@fluidframework/tree.\n\t * If this minimum version fails to be met, the SharedTree may fail to load.\n\t * To be safe, application authors should verify that they have saturated this version\n\t * of \\@fluidframework/tree in their ecosystem before changing the format version.\n\t *\n\t * This option defaults to SharedTreeFormatVersion.v2.\n\t */\n\tformatVersion: SharedTreeFormatVersion[keyof SharedTreeFormatVersion];\n}\n\n/**\n * Used to distinguish between different forest types.\n * @alpha\n */\nexport enum ForestType {\n\t/**\n\t * The \"ObjectForest\" forest type.\n\t */\n\tReference = 0,\n\t/**\n\t * The \"ChunkedForest\" forest type.\n\t */\n\tOptimized = 1,\n\t/**\n\t * The \"ObjectForest\" forest type with expensive asserts for debugging.\n\t */\n\tExpensive = 2,\n}\n\nexport const defaultSharedTreeOptions: Required<SharedTreeOptions> = {\n\tjsonValidator: noopValidator,\n\tforest: ForestType.Reference,\n\ttreeEncodeType: TreeCompressionStrategy.Compressed,\n\tformatVersion: SharedTreeFormatVersion.v3,\n};\n\n/**\n * A channel factory that creates {@link ISharedTree}s.\n */\nexport class SharedTreeFactory implements IChannelFactory<ISharedTree> {\n\tpublic readonly type: string = \"https://graph.microsoft.com/types/tree\";\n\n\tpublic readonly attributes: IChannelAttributes = {\n\t\ttype: this.type,\n\t\tsnapshotFormatVersion: \"0.0.0\",\n\t\tpackageVersion: \"0.0.0\",\n\t};\n\n\tpublic constructor(private readonly options: SharedTreeOptions = {}) {}\n\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tchannelAttributes: Readonly<IChannelAttributes>,\n\t): Promise<SharedTree> {\n\t\tconst tree = new SharedTree(id, runtime, channelAttributes, this.options);\n\t\tawait tree.load(services);\n\t\treturn tree;\n\t}\n\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTree {\n\t\tconst tree = new SharedTree(id, runtime, this.attributes, this.options);\n\t\ttree.initializeLocal();\n\t\treturn tree;\n\t}\n}\n"]}
1
+ {"version":3,"file":"sharedTree.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAU9E,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAsB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAKN,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAMhB,0BAA0B,EAE1B,sBAAsB,E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,CAAC,SAAS,CAAC,IAAI,KAAK,UAAU,CAAC,QAAQ,CAAC,UAAU,EACxD,KAAK,CAAC,wBAAwB,CAC9B,CAAC;QACF,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACrE,CAAC;IACD,IAAI,MAAM,YAAY,oBAAoB,EAAE,CAAC;QAC5C,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;IAC5D,CAAC;IACD,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAC7B,CAAC","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 type { IFluidHandle } from \"@fluidframework/core-interfaces/internal\";\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type { ISharedObject } from \"@fluidframework/shared-object-base/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type ICodecOptions, noopValidator } from \"../codec/index.js\";\nimport {\n\ttype GraphCommit,\n\ttype IEditableForest,\n\ttype ITreeCursor,\n\ttype JsonableTree,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tRevisionTagCodec,\n\ttype TaggedChange,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\ttype TreeStoredSchemaSubscription,\n\tmakeDetachedFieldIndex,\n\tmoveToDetachedField,\n} from \"../core/index.js\";\n\nimport {\n\tDetachedFieldIndexSummarizer,\n\tFieldKinds,\n\tForestSummarizer,\n\tSchemaSummarizer,\n\tTreeCompressionStrategy,\n\tbuildChunkedForest,\n\tbuildForest,\n\tdefaultSchemaPolicy,\n\tjsonableTreeFromFieldCursor,\n\tmakeFieldBatchCodec,\n\tmakeMitigatedChangeFamily,\n\tmakeTreeChunker,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype ClonableSchemaAndPolicy,\n\tDefaultResubmitMachine,\n\ttype ExplicitCoreCodecVersions,\n\tSharedTreeCore,\n} from \"../shared-tree-core/index.js\";\nimport {\n\ttype ITree,\n\ttype ImplicitFieldSchema,\n\tNodeKind,\n\ttype ReadSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleTreeSchema,\n\ttype TreeView,\n\ttype TreeViewAlpha,\n\ttype TreeViewConfiguration,\n\ttype UnsafeUnknownSchema,\n\ttype VerboseTree,\n\ttryStoredSchemaAsArray,\n\ttype SimpleNodeSchema,\n\tcustomFromCursorStored,\n\tFieldKind,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n} from \"../simple-tree/index.js\";\n\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { SharedTreeReadonlyChangeEnricher } from \"./sharedTreeChangeEnricher.js\";\nimport { SharedTreeChangeFamily } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport { type TreeCheckout, type BranchableTree, createTreeCheckout } from \"./treeCheckout.js\";\nimport { breakingClass, fail, throwIfBroken } from \"../util/index.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\n/**\n * Copy of data from an {@link ISharedTree} at some point in time.\n * @remarks\n * This is unrelated to Fluids concept of \"snapshots\".\n */\nexport interface SharedTreeContentSnapshot {\n\t/**\n\t * The schema stored in the document.\n\t *\n\t * @remarks\n\t * Edits to the schema can mutate the schema stored of the tree which took this snapshot (but this snapshot will remain the same)\n\t * This is mainly useful for debugging cases where schematize reports an incompatible view schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\t/**\n\t * All {@link TreeStatus.InDocument} content.\n\t */\n\treadonly tree: JsonableTree[];\n\t/**\n\t * All {@link TreeStatus.Removed} content.\n\t */\n\treadonly removed: [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * {@link ITree} extended with some non-public APIs.\n * @internal\n */\nexport interface ITreeInternal extends ISharedObject, ITree {\n\t/**\n\t * Exports root in the same format as {@link TreeAlpha.(exportVerbose:1)} using stored keys.\n\t * @privateRemarks\n\t * TODO:\n\t * This should probably get promoted to a public API on ITree eventually.\n\t */\n\texportVerbose(): VerboseTree | undefined;\n\n\t/**\n\t * Exports the SimpleTreeSchema that is stored in the tree, using stored keys for object fields.\n\t * @remarks\n\t * To get the schema using property keys, use {@link getSimpleSchema} on the view schema.\n\t */\n\texportSimpleSchema(): SimpleTreeSchema;\n}\n\n/**\n * {@link ITreeInternal} extended with some non-exported APIs.\n */\nexport interface ISharedTree extends ISharedObject, ITreeInternal {\n\t/**\n\t * Provides a copy of the current content of the tree.\n\t * This can be useful for inspecting the tree when no suitable view schema is available.\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t *\n\t * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.\n\t */\n\tcontentSnapshot(): SharedTreeContentSnapshot;\n}\n\n/**\n * Has an entry for each codec which writes an explicit version into its data.\n *\n * This is used to map the single API entrypoint controlling the format {@link SharedTreeOptions.formatVersion}\n * to a list of write versions that for each codec that should be used for that format.\n *\n * Note that all explicitly versioned codecs should be using the format version from the data to read encoded data.\n *\n * TODO: Plumb these write versions into forest, schema, detached field index codec creation.\n */\ninterface ExplicitCodecVersions extends ExplicitCoreCodecVersions {\n\tforest: number;\n\tschema: number;\n\tdetachedFieldIndex: number;\n\tfieldBatch: number;\n}\n\nconst formatVersionToTopLevelCodecVersions = new Map<number, ExplicitCodecVersions>([\n\t[\n\t\t1,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 1, message: 1, fieldBatch: 1 },\n\t],\n\t[\n\t\t2,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 2, message: 2, fieldBatch: 1 },\n\t],\n\t[\n\t\t3,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 3, message: 3, fieldBatch: 1 },\n\t],\n\t[\n\t\t4,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 4, message: 4, fieldBatch: 1 },\n\t],\n]);\n\nfunction getCodecVersions(formatVersion: number): ExplicitCodecVersions {\n\tconst versions = formatVersionToTopLevelCodecVersions.get(formatVersion);\n\tassert(versions !== undefined, 0x90e /* Unknown format version */);\n\treturn versions;\n}\n\n/**\n * Build and return a forest of the requested type.\n */\nexport function buildConfiguredForest(\n\ttype: ForestType,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n): IEditableForest {\n\tswitch (type) {\n\t\tcase ForestType.Optimized:\n\t\t\treturn buildChunkedForest(\n\t\t\t\tmakeTreeChunker(schema, defaultSchemaPolicy),\n\t\t\t\tundefined,\n\t\t\t\tidCompressor,\n\t\t\t);\n\t\tcase ForestType.Reference:\n\t\t\treturn buildForest();\n\t\tcase ForestType.Expensive:\n\t\t\treturn buildForest(undefined, true);\n\t\tdefault:\n\t\t\tunreachableCase(type);\n\t}\n}\n\n/**\n * Shared tree, configured with a good set of indexes and field kinds which will maintain compatibility over time.\n *\n * TODO: detail compatibility requirements.\n */\n@breakingClass\nexport class SharedTree\n\textends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>\n\timplements ISharedTree\n{\n\tpublic readonly checkout: TreeCheckout;\n\tpublic get storedSchema(): TreeStoredSchemaRepository {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t\toptionsParam: SharedTreeOptions,\n\t\ttelemetryContextPrefix: string = \"fluid_sharedTree_\",\n\t) {\n\t\tif (runtime.idCompressor === undefined) {\n\t\t\tthrow new UsageError(\"IdCompressor must be enabled to use SharedTree\");\n\t\t}\n\n\t\tconst options = { ...defaultSharedTreeOptions, ...optionsParam };\n\t\tconst codecVersions = getCodecVersions(options.formatVersion);\n\t\tconst schema = new TreeStoredSchemaRepository();\n\t\tconst forest = buildConfiguredForest(options.forest, schema, runtime.idCompressor);\n\t\tconst revisionTagCodec = new RevisionTagCodec(runtime.idCompressor);\n\t\tconst removedRoots = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\truntime.idCompressor,\n\t\t\toptions,\n\t\t);\n\t\tconst schemaSummarizer = new SchemaSummarizer(runtime, schema, options, {\n\t\t\tgetCurrentSeq: () => this.deltaManager.lastSequenceNumber,\n\t\t});\n\t\tconst fieldBatchCodec = makeFieldBatchCodec(options, codecVersions.fieldBatch);\n\n\t\tconst encoderContext = {\n\t\t\tschema: {\n\t\t\t\tschema,\n\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t},\n\t\t\tencodeType: options.treeEncodeType,\n\t\t\toriginatorId: runtime.idCompressor.localSessionId,\n\t\t\tidCompressor: runtime.idCompressor,\n\t\t};\n\t\tconst forestSummarizer = new ForestSummarizer(\n\t\t\tforest,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tencoderContext,\n\t\t\toptions,\n\t\t\truntime.idCompressor,\n\t\t);\n\t\tconst removedRootsSummarizer = new DetachedFieldIndexSummarizer(removedRoots);\n\t\tconst innerChangeFamily = new SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\toptions,\n\t\t\toptions.treeEncodeType,\n\t\t\truntime.idCompressor,\n\t\t);\n\t\tconst changeFamily = makeMitigatedChangeFamily(\n\t\t\tinnerChangeFamily,\n\t\t\tSharedTreeChangeFamily.emptyChange,\n\t\t\t(error: unknown) => {\n\t\t\t\t// TODO:6344 Add telemetry for these errors.\n\t\t\t\t// Rethrowing the error has a different effect depending on the context in which the\n\t\t\t\t// ChangeFamily was invoked:\n\t\t\t\t// - If the ChangeFamily was invoked as part of incoming op processing, rethrowing the error\n\t\t\t\t// will cause the runtime to disconnect the client, log a severe error, and not reconnect.\n\t\t\t\t// This will not cause the host application to crash because it is not on the stack at that time.\n\t\t\t\t// TODO: let the host application know that the client is now disconnected.\n\t\t\t\t// - If the ChangeFamily was invoked as part of dealing with a local change, rethrowing the\n\t\t\t\t// error will cause the host application to crash. This is not ideal, but is better than\n\t\t\t\t// letting the application either send an invalid change to the server or allowing the\n\t\t\t\t// application to continue working when its local branches contain edits that cannot be\n\t\t\t\t// reflected in its views.\n\t\t\t\t// The best course of action for a host application in such a state is to restart.\n\t\t\t\t// TODO: let the host application know about this situation and provide a way to\n\t\t\t\t// programmatically reload the SharedTree container.\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tconst changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);\n\t\tsuper(\n\t\t\t[schemaSummarizer, forestSummarizer, removedRootsSummarizer],\n\t\t\tchangeFamily,\n\t\t\toptions,\n\t\t\tcodecVersions,\n\t\t\tid,\n\t\t\truntime,\n\t\t\tattributes,\n\t\t\ttelemetryContextPrefix,\n\t\t\tschema,\n\t\t\tdefaultSchemaPolicy,\n\t\t\tnew DefaultResubmitMachine(\n\t\t\t\t(change: TaggedChange<SharedTreeChange>) =>\n\t\t\t\t\tchangeFamily.rebaser.invert(change, true, this.mintRevisionTag()),\n\t\t\t\tchangeEnricher,\n\t\t\t),\n\t\t\tchangeEnricher,\n\t\t);\n\t\tconst localBranch = this.getLocalBranch();\n\t\tthis.checkout = createTreeCheckout(\n\t\t\truntime.idCompressor,\n\t\t\tthis.mintRevisionTag,\n\t\t\trevisionTagCodec,\n\t\t\t{\n\t\t\t\tbranch: localBranch,\n\t\t\t\tchangeFamily,\n\t\t\t\tschema,\n\t\t\t\tforest,\n\t\t\t\tfieldBatchCodec,\n\t\t\t\tremovedRoots,\n\t\t\t\tchunkCompressionStrategy: options.treeEncodeType,\n\t\t\t\tlogger: this.logger,\n\t\t\t\tbreaker: this.breaker,\n\t\t\t},\n\t\t);\n\n\t\tthis.checkout.transaction.events.on(\"started\", () => {\n\t\t\tif (this.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.startTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.transaction.events.on(\"aborting\", () => {\n\t\t\tif (this.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.abortTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.transaction.events.on(\"committing\", () => {\n\t\t\tif (this.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.commitTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.events.on(\"beforeBatch\", (event) => {\n\t\t\tif (event.type === \"append\" && this.isAttached()) {\n\t\t\t\tif (this.checkout.transaction.isInProgress()) {\n\t\t\t\t\tthis.commitEnricher.addTransactionCommits(event.newCommits);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic exportVerbose(): VerboseTree | undefined {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\tconst length = cursor.getFieldLength();\n\t\t\tif (length === 0) {\n\t\t\t\treturn undefined;\n\t\t\t} else if (length === 1) {\n\t\t\t\tcursor.enterNode(0);\n\t\t\t\treturn verboseFromCursor(cursor, this.storedSchema.nodeSchema);\n\t\t\t} else {\n\t\t\t\tfail(\"Invalid document root length\");\n\t\t\t}\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\tpublic exportSimpleSchema(): SimpleTreeSchema {\n\t\treturn {\n\t\t\t...exportSimpleFieldSchemaStored(this.storedSchema.rootFieldSchema),\n\t\t\tdefinitions: new Map(\n\t\t\t\t[...this.storedSchema.nodeSchema].map(([key, schema]) => {\n\t\t\t\t\treturn [key, exportSimpleNodeSchemaStored(schema)];\n\t\t\t\t}),\n\t\t\t),\n\t\t};\n\t}\n\n\t@throwIfBroken\n\tpublic contentSnapshot(): SharedTreeContentSnapshot {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\treturn {\n\t\t\t\tschema: this.storedSchema.clone(),\n\t\t\t\ttree: jsonableTreeFromFieldCursor(cursor),\n\t\t\t\tremoved: this.checkout.getRemovedRoots(),\n\t\t\t};\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t// For the new TreeViewAlpha API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\n\t// For the old TreeView API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\treturn this.checkout.viewWith(config) as SchematizingSimpleTreeView<TRoot> &\n\t\t\tTreeView<ReadSchema<TRoot>>;\n\t}\n\n\tprotected override async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tawait super.loadCore(services);\n\t\tthis.checkout.load();\n\t}\n\n\tprotected override didAttach(): void {\n\t\tif (this.checkout.transaction.isInProgress()) {\n\t\t\t// Attaching during a transaction is not currently supported.\n\t\t\t// At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Cannot attach while a transaction is in progress. Commit or abort the transaction before attaching.\",\n\t\t\t);\n\t\t}\n\t\tsuper.didAttach();\n\t}\n\n\tprotected override applyStashedOp(\n\t\t...args: Parameters<\n\t\t\tSharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>[\"applyStashedOp\"]\n\t\t>\n\t): void {\n\t\tassert(\n\t\t\t!this.checkout.transaction.isInProgress(),\n\t\t\t0x674 /* Unexpected transaction is open while applying stashed ops */,\n\t\t);\n\t\tsuper.applyStashedOp(...args);\n\t}\n\n\tprotected override submitCommit(\n\t\tcommit: GraphCommit<SharedTreeChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tassert(\n\t\t\t!this.checkout.transaction.isInProgress(),\n\t\t\t\"Cannot submit a commit while a transaction is in progress\",\n\t\t);\n\t\tif (isResubmit) {\n\t\t\treturn super.submitCommit(commit, schemaAndPolicy, isResubmit);\n\t\t}\n\n\t\t// Refrain from submitting new commits until they are validated by the checkout.\n\t\t// This is not a strict requirement for correctness in our system, but in the event that there is a bug when applying commits to the checkout\n\t\t// that causes a crash (e.g. in the forest), this will at least prevent this client from sending the problematic commit to any other clients.\n\t\tthis.checkout.onCommitValid(commit, () =>\n\t\t\tsuper.submitCommit(commit, schemaAndPolicy, isResubmit),\n\t\t);\n\t}\n}\n\n/**\n * Get a {@link BranchableTree} from a {@link ITree}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch(tree: ITree): BranchableTree;\n/**\n * Get a {@link BranchableTree} from a {@link TreeView}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * Branches are currently an unstable \"alpha\" API and are subject to change in the future.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\tview: TreeViewAlpha<T>,\n): BranchableTree;\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\ttreeOrView: ITree | TreeViewAlpha<T>,\n): BranchableTree {\n\tassert(\n\t\ttreeOrView instanceof SharedTree || treeOrView instanceof SchematizingSimpleTreeView,\n\t\t0xa48 /* Unsupported implementation */,\n\t);\n\tconst checkout: TreeCheckout = treeOrView.checkout;\n\t// This cast is safe so long as TreeCheckout supports all the operations on the branch interface.\n\treturn checkout as unknown as BranchableTree;\n}\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n */\nexport const SharedTreeFormatVersion = {\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t *\n\t * @deprecated - FF does not currently plan on supporting this format long-term.\n\t * Do not write production documents using this format, as they may not be loadable in the future.\n\t */\n\tv1: 1,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv2: 2,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv3: 3,\n} as const;\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n * @privateRemarks\n * See packages/dds/tree/docs/main/compatibility.md for information on how to add support for a new format.\n *\n * TODO: Before this gets promoted past Alpha,\n * a separate abstraction more suited for use in the public API should be adopted rather than reusing the same types used internally.\n * Such an abstraction should probably be in the form of a Fluid-Framework wide compatibility enum.\n */\nexport type SharedTreeFormatVersion = typeof SharedTreeFormatVersion;\n\n/**\n * Configuration options for SharedTree.\n * @alpha\n */\nexport type SharedTreeOptions = Partial<ICodecOptions> &\n\tPartial<SharedTreeFormatOptions> &\n\tForestOptions;\n\n/**\n * Configuration options for SharedTree's internal tree storage.\n * @alpha\n */\nexport interface ForestOptions {\n\t/**\n\t * The {@link ForestType} indicating which forest type should be created for the SharedTree.\n\t */\n\treadonly forest?: ForestType;\n}\n\n/**\n * Options for configuring the persisted format SharedTree uses.\n * @alpha\n */\nexport interface SharedTreeFormatOptions {\n\t/**\n\t * See {@link TreeCompressionStrategy}.\n\t * default: TreeCompressionStrategy.Compressed\n\t */\n\ttreeEncodeType: TreeCompressionStrategy;\n\t/**\n\t * The format version SharedTree should use to persist documents.\n\t *\n\t * This option has compatibility implications for applications using SharedTree.\n\t * Each version documents a required minimum version of \\@fluidframework/tree.\n\t * If this minimum version fails to be met, the SharedTree may fail to load.\n\t * To be safe, application authors should verify that they have saturated this version\n\t * of \\@fluidframework/tree in their ecosystem before changing the format version.\n\t *\n\t * This option defaults to SharedTreeFormatVersion.v2.\n\t */\n\tformatVersion: SharedTreeFormatVersion[keyof SharedTreeFormatVersion];\n}\n\n/**\n * Used to distinguish between different forest types.\n * @alpha\n */\nexport enum ForestType {\n\t/**\n\t * The \"ObjectForest\" forest type.\n\t */\n\tReference = 0,\n\t/**\n\t * The \"ChunkedForest\" forest type.\n\t */\n\tOptimized = 1,\n\t/**\n\t * The \"ObjectForest\" forest type with expensive asserts for debugging.\n\t */\n\tExpensive = 2,\n}\n\nexport const defaultSharedTreeOptions: Required<SharedTreeOptions> = {\n\tjsonValidator: noopValidator,\n\tforest: ForestType.Reference,\n\ttreeEncodeType: TreeCompressionStrategy.Compressed,\n\tformatVersion: SharedTreeFormatVersion.v3,\n};\n\n/**\n * A channel factory that creates {@link ISharedTree}s.\n */\nexport class SharedTreeFactory implements IChannelFactory<ISharedTree> {\n\tpublic readonly type: string = \"https://graph.microsoft.com/types/tree\";\n\n\tpublic readonly attributes: IChannelAttributes = {\n\t\ttype: this.type,\n\t\tsnapshotFormatVersion: \"0.0.0\",\n\t\tpackageVersion: \"0.0.0\",\n\t};\n\n\tpublic constructor(private readonly options: SharedTreeOptions = {}) {}\n\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tchannelAttributes: Readonly<IChannelAttributes>,\n\t): Promise<SharedTree> {\n\t\tconst tree = new SharedTree(id, runtime, channelAttributes, this.options);\n\t\tawait tree.load(services);\n\t\treturn tree;\n\t}\n\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTree {\n\t\tconst tree = new SharedTree(id, runtime, this.attributes, this.options);\n\t\ttree.initializeLocal();\n\t\treturn tree;\n\t}\n}\n\nfunction verboseFromCursor(\n\treader: ITreeCursor,\n\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n): VerboseTree {\n\tconst fields = customFromCursorStored(reader, schema, verboseFromCursor);\n\tconst nodeSchema = schema.get(reader.type) ?? fail(\"missing schema for type in cursor\");\n\tif (nodeSchema instanceof LeafNodeStoredSchema) {\n\t\treturn fields as CustomTreeValue<IFluidHandle>;\n\t}\n\n\treturn {\n\t\ttype: reader.type,\n\t\tfields: fields as CustomTreeNode<IFluidHandle>,\n\t};\n}\n\nfunction exportSimpleFieldSchemaStored(schema: TreeFieldStoredSchema): SimpleFieldSchema {\n\tlet kind: FieldKind;\n\tswitch (schema.kind) {\n\t\tcase FieldKinds.identifier.identifier:\n\t\t\tkind = FieldKind.Identifier;\n\t\t\tbreak;\n\t\tcase FieldKinds.optional.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tbreak;\n\t\tcase FieldKinds.required.identifier:\n\t\t\tkind = FieldKind.Required;\n\t\t\tbreak;\n\t\tcase FieldKinds.forbidden.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tassert(schema.types.size === 0, 0xa94 /* invalid forbidden field */);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfail(\"invalid field kind\");\n\t}\n\treturn { kind, allowedTypes: schema.types };\n}\n\nfunction exportSimpleNodeSchemaStored(schema: TreeNodeStoredSchema): SimpleNodeSchema {\n\tconst arrayTypes = tryStoredSchemaAsArray(schema);\n\tif (arrayTypes !== undefined) {\n\t\treturn { kind: NodeKind.Array, allowedTypes: arrayTypes };\n\t}\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst fields: Record<string, SimpleFieldSchema> = {};\n\t\tfor (const [key, field] of schema.objectNodeFields) {\n\t\t\tfields[key] = exportSimpleFieldSchemaStored(field);\n\t\t}\n\t\treturn { kind: NodeKind.Object, fields };\n\t}\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tassert(\n\t\t\tschema.mapFields.kind === FieldKinds.optional.identifier,\n\t\t\t0xa95 /* Invalid map schema */,\n\t\t);\n\t\treturn { kind: NodeKind.Map, allowedTypes: schema.mapFields.types };\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\treturn { kind: NodeKind.Leaf, leafKind: schema.leafValue };\n\t}\n\tfail(\"invalid schema kind\");\n}\n"]}
@@ -2,12 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { HasListeners, IEmitter, Listenable } from "@fluidframework/core-interfaces/internal";
5
+ import type { Listenable } from "@fluidframework/core-interfaces/internal";
6
6
  import type { IIdCompressor } from "@fluidframework/id-compressor";
7
7
  import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
8
- import { type Anchor, type AnchorLocator, type AnchorNode, type AnchorSetRootEvents, type ChangeFamily, type CommitMetadata, type DetachedFieldIndex, type IEditableForest, type IForestSubscription, type JsonableTree, type RevisionTag, type RevisionTagCodec, type TreeStoredSchema, TreeStoredSchemaRepository, type TreeStoredSchemaSubscription, type RevertibleAlphaFactory } from "../core/index.js";
8
+ import { type Anchor, type AnchorLocator, type AnchorNode, type AnchorSetRootEvents, type ChangeFamily, type CommitMetadata, type DetachedFieldIndex, type IEditableForest, type IForestSubscription, type JsonableTree, type RevisionTag, type RevisionTagCodec, type TreeStoredSchema, TreeStoredSchemaRepository, type TreeStoredSchemaSubscription, type RevertibleAlphaFactory, type GraphCommit } from "../core/index.js";
9
9
  import { type FieldBatchCodec, type TreeCompressionStrategy } from "../feature-libraries/index.js";
10
- import { SharedTreeBranch, type Transactor } from "../shared-tree-core/index.js";
10
+ import { SharedTreeBranch, type SharedTreeBranchChange, type Transactor } from "../shared-tree-core/index.js";
11
11
  import { Breakable, disposeSymbol } from "../util/index.js";
12
12
  import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
13
13
  import type { ISharedTreeEditor, SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
@@ -18,10 +18,20 @@ import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
18
18
  * Events for {@link ITreeCheckout}.
19
19
  */
20
20
  export interface CheckoutEvents {
21
+ /**
22
+ * The view is currently in a consistent state, but a batch of changes is about to be processed.
23
+ * @remarks Once this event fires, it is not safe to access the FlexTree, Forest and AnchorSet again until the corresponding {@link CheckoutEvents.afterBatch} fires.
24
+ * Every call to `beforeBatch` will be followed by a corresponding call to `afterBatch` (before any more calls to `beforeBatch`).
25
+ * @param change - The {@link SharedTreeBranchChange | change} to the checkout's active branch that is about to be processed.
26
+ * May be empty if the changes were produced by e.g. a rebase or the initial loading of the document.
27
+ */
28
+ beforeBatch(change: SharedTreeBranchChange<SharedTreeChange>): void;
21
29
  /**
22
30
  * A batch of changes has finished processing and the view is in a consistent state.
23
- * It is once again safe to access the FlexTree, Forest and AnchorSet.
31
+ * @remarks It is once again safe to access the FlexTree, Forest and AnchorSet.
24
32
  *
33
+ * While every call to `beforeBatch` will be followed by a corresponding call to `afterBatch`, the converse is not true.
34
+ * This event may be fired without a preceding `beforeBatch` event if the checkout's branch and forest were directly updated via e.g. a summary load rather than via normal application of changes.
25
35
  * @remarks
26
36
  * This is mainly useful for knowing when to do followup work scheduled during events from Anchors.
27
37
  */
@@ -170,7 +180,6 @@ export declare function createTreeCheckout(idCompressor: IIdCompressor, mintRevi
170
180
  schema?: TreeStoredSchemaRepository;
171
181
  forest?: IEditableForest;
172
182
  fieldBatchCodec?: FieldBatchCodec;
173
- events?: Listenable<CheckoutEvents> & IEmitter<CheckoutEvents> & HasListeners<CheckoutEvents>;
174
183
  removedRoots?: DetachedFieldIndex;
175
184
  chunkCompressionStrategy?: TreeCompressionStrategy;
176
185
  logger?: ITelemetryLoggerExt;
@@ -200,13 +209,11 @@ export interface RevertMetrics {
200
209
  */
201
210
  export declare class TreeCheckout implements ITreeCheckoutFork {
202
211
  #private;
203
- private readonly _branch;
204
212
  /** True if and only if this checkout is for a forked branch and not the "main branch" of the tree. */
205
213
  readonly isBranch: boolean;
206
214
  private readonly changeFamily;
207
215
  readonly storedSchema: TreeStoredSchemaRepository;
208
216
  readonly forest: IEditableForest;
209
- readonly events: Listenable<CheckoutEvents> & IEmitter<CheckoutEvents> & HasListeners<CheckoutEvents>;
210
217
  private readonly mintRevisionTag;
211
218
  private readonly revisionTagCodec;
212
219
  private readonly idCompressor;
@@ -231,11 +238,14 @@ export declare class TreeCheckout implements ITreeCheckoutFork {
231
238
  * @privateRemarks Exposed for testing purposes.
232
239
  */
233
240
  static readonly revertTelemetryEventName = "RevertRevertible";
234
- constructor(_branch: SharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange>,
241
+ events: Listenable<CheckoutEvents>;
242
+ constructor(branch: SharedTreeBranch<SharedTreeEditBuilder, SharedTreeChange>,
235
243
  /** True if and only if this checkout is for a forked branch and not the "main branch" of the tree. */
236
- isBranch: boolean, changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange>, storedSchema: TreeStoredSchemaRepository, forest: IEditableForest, events: Listenable<CheckoutEvents> & IEmitter<CheckoutEvents> & HasListeners<CheckoutEvents>, mintRevisionTag: () => RevisionTag, revisionTagCodec: RevisionTagCodec, idCompressor: IIdCompressor, removedRoots?: DetachedFieldIndex,
244
+ isBranch: boolean, changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange>, storedSchema: TreeStoredSchemaRepository, forest: IEditableForest, mintRevisionTag: () => RevisionTag, revisionTagCodec: RevisionTagCodec, idCompressor: IIdCompressor, removedRoots?: DetachedFieldIndex,
237
245
  /** Optional logger for telemetry. */
238
246
  logger?: ITelemetryLoggerExt | undefined, breaker?: Breakable);
247
+ private readonly onAfterChange;
248
+ private readonly onAncestryTrimmed;
239
249
  private withCombinedVisitor;
240
250
  private checkNotDisposed;
241
251
  /**
@@ -265,10 +275,11 @@ export declare class TreeCheckout implements ITreeCheckoutFork {
265
275
  [disposeSymbol](): void;
266
276
  getRemovedRoots(): [string | number | undefined, number, JsonableTree][];
267
277
  /**
268
- * This sets the tip revision as the latest relevant revision for any removed roots that are loaded from a summary.
269
- * This needs to be called right after loading {@link this.removedRoots} from a summary to allow loaded data to be garbage collected.
278
+ * This must be called on the root/main checkout after loading from a summary.
279
+ * @remarks This pattern is necessary because the EditManager skips the normal process of applying commits to branches when loading a summary.
280
+ * Instead, it simply {@link SharedTreeBranch#setHead | mutates} the branches directly which does not propagate the typical events throughout the rest of the system.
270
281
  */
271
- setTipRevisionForLoadedData(revision: RevisionTag): void;
282
+ load(): void;
272
283
  private purgeRevertibles;
273
284
  private disposeRevertible;
274
285
  private revertRevertible;
@@ -277,5 +288,17 @@ export declare class TreeCheckout implements ITreeCheckoutFork {
277
288
  * `true` iff the given branch change event is due to a remote change
278
289
  */
279
290
  private isRemoteChangeEvent;
291
+ /**
292
+ * Registers a function to be called when the given commit is validated.
293
+ * @remarks A commit is validated by the checkout after it has been applied to the checkout's state (e.g. it has an effect on the forest).
294
+ * If the commit applies successfully (i.e. it does not raise any unexpected errors), the commit is considered valid and the registered function is called.
295
+ * If the commit does not apply successfully (because it causes an unexpected error), the function is not called (and the checkout will left in an error state).
296
+ *
297
+ * If the commit has already been validated when this function is called, the function is called immediately and this function returns `true`.
298
+ * Otherwise, the function is registered to be called later and this function returns `false`.
299
+ */
300
+ onCommitValid(commit: GraphCommit<SharedTreeChange>, fn: (commit: GraphCommit<SharedTreeChange>) => void): boolean;
301
+ /** Mark the given commit as "validated" according to the contract of {@link onCommitValid}(). */
302
+ private validateCommit;
280
303
  }
281
304
  //# sourceMappingURL=treeCheckout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"treeCheckout.d.ts","sourceRoot":"","sources":["../../src/shared-tree/treeCheckout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAEN,KAAK,mBAAmB,EACxB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACN,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAEjB,KAAK,cAAc,EAEnB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAEjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,0BAA0B,EAC1B,KAAK,4BAA4B,EAOjC,KAAK,sBAAsB,EAE3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAM5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,gBAAgB,EAMhB,KAAK,UAAU,EACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,aAAa,EAA0B,MAAM,kBAAkB,CAAC;AAGpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CA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