@fluidframework/tree 2.10.0 → 2.11.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 (465) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/api-report/tree.alpha.api.md +47 -16
  3. package/api-report/tree.beta.api.md +5 -14
  4. package/api-report/tree.legacy.alpha.api.md +5 -14
  5. package/api-report/tree.legacy.public.api.md +5 -14
  6. package/api-report/tree.public.api.md +5 -14
  7. package/dist/alpha.d.ts +9 -0
  8. package/dist/core/forest/forest.d.ts +10 -2
  9. package/dist/core/forest/forest.d.ts.map +1 -1
  10. package/dist/core/forest/forest.js.map +1 -1
  11. package/dist/core/index.d.ts +2 -2
  12. package/dist/core/index.d.ts.map +1 -1
  13. package/dist/core/index.js +3 -2
  14. package/dist/core/index.js.map +1 -1
  15. package/dist/core/rebase/utils.d.ts +1 -1
  16. package/dist/core/rebase/utils.d.ts.map +1 -1
  17. package/dist/core/rebase/utils.js +11 -8
  18. package/dist/core/rebase/utils.js.map +1 -1
  19. package/dist/core/revertible.d.ts +30 -1
  20. package/dist/core/revertible.d.ts.map +1 -1
  21. package/dist/core/revertible.js.map +1 -1
  22. package/dist/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  23. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  24. package/dist/core/schema-stored/storedSchemaRepository.js +5 -5
  25. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  26. package/dist/core/tree/anchorSet.d.ts +2 -2
  27. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  28. package/dist/core/tree/anchorSet.js +21 -21
  29. package/dist/core/tree/anchorSet.js.map +1 -1
  30. package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  31. package/dist/core/tree/detachedFieldIndexCodec.js +3 -2
  32. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  33. package/dist/core/tree/index.d.ts +1 -1
  34. package/dist/core/tree/index.d.ts.map +1 -1
  35. package/dist/core/tree/index.js +2 -1
  36. package/dist/core/tree/index.js.map +1 -1
  37. package/dist/core/tree/visitorUtils.d.ts +25 -1
  38. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  39. package/dist/core/tree/visitorUtils.js +29 -1
  40. package/dist/core/tree/visitorUtils.js.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +5 -2
  42. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/chunkedForest.js +24 -14
  44. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/uniformChunk.js +2 -2
  47. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  48. package/dist/feature-libraries/flex-tree/context.d.ts +1 -1
  49. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  50. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  51. package/dist/feature-libraries/index.d.ts +1 -0
  52. package/dist/feature-libraries/index.d.ts.map +1 -1
  53. package/dist/feature-libraries/index.js +4 -1
  54. package/dist/feature-libraries/index.js.map +1 -1
  55. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +132 -0
  56. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -0
  57. package/dist/feature-libraries/indexing/anchorTreeIndex.js +361 -0
  58. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -0
  59. package/dist/feature-libraries/indexing/index.d.ts +7 -0
  60. package/dist/feature-libraries/indexing/index.d.ts.map +1 -0
  61. package/dist/feature-libraries/indexing/index.js +11 -0
  62. package/dist/feature-libraries/indexing/index.js.map +1 -0
  63. package/dist/feature-libraries/indexing/types.d.ts +32 -0
  64. package/dist/feature-libraries/indexing/types.d.ts.map +1 -0
  65. package/dist/{events/interop.js → feature-libraries/indexing/types.js} +1 -1
  66. package/dist/feature-libraries/indexing/types.js.map +1 -0
  67. package/dist/feature-libraries/object-forest/objectForest.d.ts +5 -2
  68. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  69. package/dist/feature-libraries/object-forest/objectForest.js +21 -11
  70. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  71. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  72. package/dist/feature-libraries/sequence-field/invert.js +2 -2
  73. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  74. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +3 -2
  75. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  76. package/dist/index.d.ts +4 -4
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +4 -1
  79. package/dist/index.js.map +1 -1
  80. package/dist/packageVersion.d.ts +1 -1
  81. package/dist/packageVersion.js +1 -1
  82. package/dist/packageVersion.js.map +1 -1
  83. package/dist/shared-tree/index.d.ts +1 -1
  84. package/dist/shared-tree/index.d.ts.map +1 -1
  85. package/dist/shared-tree/index.js +1 -2
  86. package/dist/shared-tree/index.js.map +1 -1
  87. package/dist/shared-tree/schematizingTreeView.d.ts +7 -1
  88. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  89. package/dist/shared-tree/schematizingTreeView.js +31 -30
  90. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  91. package/dist/shared-tree/sharedTree.d.ts +3 -0
  92. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  93. package/dist/shared-tree/sharedTree.js +56 -20
  94. package/dist/shared-tree/sharedTree.js.map +1 -1
  95. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  96. package/dist/shared-tree/sharedTreeChangeFamily.js +3 -3
  97. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  98. package/dist/shared-tree/treeCheckout.d.ts +28 -64
  99. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  100. package/dist/shared-tree/treeCheckout.js +152 -129
  101. package/dist/shared-tree/treeCheckout.js.map +1 -1
  102. package/dist/shared-tree-core/branch.d.ts +25 -81
  103. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  104. package/dist/shared-tree-core/branch.js +72 -151
  105. package/dist/shared-tree-core/branch.js.map +1 -1
  106. package/dist/shared-tree-core/branchCommitEnricher.d.ts +19 -33
  107. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  108. package/dist/shared-tree-core/branchCommitEnricher.js +73 -54
  109. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  110. package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  111. package/dist/shared-tree-core/defaultResubmitMachine.js +2 -1
  112. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  113. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  114. package/dist/shared-tree-core/editManager.js +2 -2
  115. package/dist/shared-tree-core/editManager.js.map +1 -1
  116. package/dist/shared-tree-core/index.d.ts +1 -1
  117. package/dist/shared-tree-core/index.d.ts.map +1 -1
  118. package/dist/shared-tree-core/index.js +4 -3
  119. package/dist/shared-tree-core/index.js.map +1 -1
  120. package/dist/shared-tree-core/sharedTreeCore.d.ts +2 -2
  121. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  122. package/dist/shared-tree-core/sharedTreeCore.js +11 -52
  123. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  124. package/dist/shared-tree-core/transaction.d.ts +108 -0
  125. package/dist/shared-tree-core/transaction.d.ts.map +1 -0
  126. package/dist/shared-tree-core/transaction.js +99 -0
  127. package/dist/shared-tree-core/transaction.js.map +1 -0
  128. package/dist/shared-tree-core/transactionEnricher.d.ts +8 -13
  129. package/dist/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  130. package/dist/shared-tree-core/transactionEnricher.js +41 -21
  131. package/dist/shared-tree-core/transactionEnricher.js.map +1 -1
  132. package/dist/simple-tree/api/identifierIndex.d.ts +21 -0
  133. package/dist/simple-tree/api/identifierIndex.d.ts.map +1 -0
  134. package/dist/simple-tree/api/identifierIndex.js +45 -0
  135. package/dist/simple-tree/api/identifierIndex.js.map +1 -0
  136. package/dist/simple-tree/api/index.d.ts +2 -0
  137. package/dist/simple-tree/api/index.d.ts.map +1 -1
  138. package/dist/simple-tree/api/index.js +5 -1
  139. package/dist/simple-tree/api/index.js.map +1 -1
  140. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +9 -7
  141. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  142. package/dist/simple-tree/api/simpleTreeIndex.d.ts +65 -0
  143. package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -0
  144. package/dist/simple-tree/api/simpleTreeIndex.js +91 -0
  145. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -0
  146. package/dist/simple-tree/api/tree.d.ts +4 -5
  147. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  148. package/dist/simple-tree/api/tree.js.map +1 -1
  149. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  150. package/dist/simple-tree/core/index.d.ts +1 -1
  151. package/dist/simple-tree/core/index.d.ts.map +1 -1
  152. package/dist/simple-tree/core/index.js +2 -1
  153. package/dist/simple-tree/core/index.js.map +1 -1
  154. package/dist/simple-tree/core/treeNodeKernel.d.ts +6 -2
  155. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  156. package/dist/simple-tree/core/treeNodeKernel.js +53 -22
  157. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  158. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  159. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  160. package/dist/simple-tree/core/unhydratedFlexTree.js +2 -2
  161. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  162. package/dist/simple-tree/index.d.ts +1 -1
  163. package/dist/simple-tree/index.d.ts.map +1 -1
  164. package/dist/simple-tree/index.js +4 -2
  165. package/dist/simple-tree/index.js.map +1 -1
  166. package/dist/simple-tree/objectNode.d.ts +7 -2
  167. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  168. package/dist/simple-tree/objectNode.js.map +1 -1
  169. package/dist/simple-tree/toMapTree.js +3 -3
  170. package/dist/simple-tree/toMapTree.js.map +1 -1
  171. package/dist/util/index.d.ts +1 -2
  172. package/dist/util/index.d.ts.map +1 -1
  173. package/dist/util/index.js +5 -4
  174. package/dist/util/index.js.map +1 -1
  175. package/dist/util/typeCheck.d.ts +6 -1
  176. package/dist/util/typeCheck.d.ts.map +1 -1
  177. package/dist/util/typeCheck.js.map +1 -1
  178. package/dist/util/typeCheckTests.d.ts +14 -2
  179. package/dist/util/typeCheckTests.d.ts.map +1 -1
  180. package/dist/util/typeCheckTests.js.map +1 -1
  181. package/dist/util/utils.d.ts +29 -0
  182. package/dist/util/utils.d.ts.map +1 -1
  183. package/dist/util/utils.js +13 -1
  184. package/dist/util/utils.js.map +1 -1
  185. package/lib/alpha.d.ts +9 -0
  186. package/lib/core/forest/forest.d.ts +10 -2
  187. package/lib/core/forest/forest.d.ts.map +1 -1
  188. package/lib/core/forest/forest.js.map +1 -1
  189. package/lib/core/index.d.ts +2 -2
  190. package/lib/core/index.d.ts.map +1 -1
  191. package/lib/core/index.js +2 -2
  192. package/lib/core/index.js.map +1 -1
  193. package/lib/core/rebase/utils.d.ts +1 -1
  194. package/lib/core/rebase/utils.d.ts.map +1 -1
  195. package/lib/core/rebase/utils.js +11 -8
  196. package/lib/core/rebase/utils.js.map +1 -1
  197. package/lib/core/revertible.d.ts +30 -1
  198. package/lib/core/revertible.d.ts.map +1 -1
  199. package/lib/core/revertible.js.map +1 -1
  200. package/lib/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  201. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  202. package/lib/core/schema-stored/storedSchemaRepository.js +1 -1
  203. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  204. package/lib/core/tree/anchorSet.d.ts +2 -2
  205. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  206. package/lib/core/tree/anchorSet.js +1 -1
  207. package/lib/core/tree/anchorSet.js.map +1 -1
  208. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  209. package/lib/core/tree/detachedFieldIndexCodec.js +4 -3
  210. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  211. package/lib/core/tree/index.d.ts +1 -1
  212. package/lib/core/tree/index.d.ts.map +1 -1
  213. package/lib/core/tree/index.js +1 -1
  214. package/lib/core/tree/index.js.map +1 -1
  215. package/lib/core/tree/visitorUtils.d.ts +25 -1
  216. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  217. package/lib/core/tree/visitorUtils.js +27 -0
  218. package/lib/core/tree/visitorUtils.js.map +1 -1
  219. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +5 -2
  220. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  221. package/lib/feature-libraries/chunked-forest/chunkedForest.js +18 -8
  222. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  223. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  224. package/lib/feature-libraries/chunked-forest/uniformChunk.js +3 -3
  225. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  226. package/lib/feature-libraries/flex-tree/context.d.ts +1 -1
  227. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  228. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  229. package/lib/feature-libraries/index.d.ts +1 -0
  230. package/lib/feature-libraries/index.d.ts.map +1 -1
  231. package/lib/feature-libraries/index.js +1 -0
  232. package/lib/feature-libraries/index.js.map +1 -1
  233. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +132 -0
  234. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -0
  235. package/lib/feature-libraries/indexing/anchorTreeIndex.js +356 -0
  236. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -0
  237. package/lib/feature-libraries/indexing/index.d.ts +7 -0
  238. package/lib/feature-libraries/indexing/index.d.ts.map +1 -0
  239. package/lib/{events → feature-libraries/indexing}/index.js +1 -1
  240. package/lib/feature-libraries/indexing/index.js.map +1 -0
  241. package/lib/feature-libraries/indexing/types.d.ts +32 -0
  242. package/lib/feature-libraries/indexing/types.d.ts.map +1 -0
  243. package/lib/{events/interop.js → feature-libraries/indexing/types.js} +1 -1
  244. package/lib/feature-libraries/indexing/types.js.map +1 -0
  245. package/lib/feature-libraries/object-forest/objectForest.d.ts +5 -2
  246. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  247. package/lib/feature-libraries/object-forest/objectForest.js +15 -5
  248. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  249. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  250. package/lib/feature-libraries/sequence-field/invert.js +4 -4
  251. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  252. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +4 -3
  253. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  254. package/lib/index.d.ts +4 -4
  255. package/lib/index.d.ts.map +1 -1
  256. package/lib/index.js +1 -1
  257. package/lib/index.js.map +1 -1
  258. package/lib/packageVersion.d.ts +1 -1
  259. package/lib/packageVersion.js +1 -1
  260. package/lib/packageVersion.js.map +1 -1
  261. package/lib/shared-tree/index.d.ts +1 -1
  262. package/lib/shared-tree/index.d.ts.map +1 -1
  263. package/lib/shared-tree/index.js +1 -1
  264. package/lib/shared-tree/index.js.map +1 -1
  265. package/lib/shared-tree/schematizingTreeView.d.ts +7 -1
  266. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  267. package/lib/shared-tree/schematizingTreeView.js +2 -2
  268. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  269. package/lib/shared-tree/sharedTree.d.ts +3 -0
  270. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  271. package/lib/shared-tree/sharedTree.js +37 -1
  272. package/lib/shared-tree/sharedTree.js.map +1 -1
  273. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  274. package/lib/shared-tree/sharedTreeChangeFamily.js +5 -5
  275. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  276. package/lib/shared-tree/treeCheckout.d.ts +28 -64
  277. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  278. package/lib/shared-tree/treeCheckout.js +140 -116
  279. package/lib/shared-tree/treeCheckout.js.map +1 -1
  280. package/lib/shared-tree-core/branch.d.ts +25 -81
  281. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  282. package/lib/shared-tree-core/branch.js +72 -151
  283. package/lib/shared-tree-core/branch.js.map +1 -1
  284. package/lib/shared-tree-core/branchCommitEnricher.d.ts +19 -33
  285. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  286. package/lib/shared-tree-core/branchCommitEnricher.js +74 -55
  287. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  288. package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  289. package/lib/shared-tree-core/defaultResubmitMachine.js +3 -2
  290. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  291. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  292. package/lib/shared-tree-core/editManager.js +1 -1
  293. package/lib/shared-tree-core/editManager.js.map +1 -1
  294. package/lib/shared-tree-core/index.d.ts +1 -1
  295. package/lib/shared-tree-core/index.d.ts.map +1 -1
  296. package/lib/shared-tree-core/index.js +1 -1
  297. package/lib/shared-tree-core/index.js.map +1 -1
  298. package/lib/shared-tree-core/sharedTreeCore.d.ts +2 -2
  299. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  300. package/lib/shared-tree-core/sharedTreeCore.js +12 -53
  301. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  302. package/lib/shared-tree-core/transaction.d.ts +108 -0
  303. package/lib/shared-tree-core/transaction.d.ts.map +1 -0
  304. package/lib/shared-tree-core/transaction.js +95 -0
  305. package/lib/shared-tree-core/transaction.js.map +1 -0
  306. package/lib/shared-tree-core/transactionEnricher.d.ts +8 -13
  307. package/lib/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  308. package/lib/shared-tree-core/transactionEnricher.js +41 -21
  309. package/lib/shared-tree-core/transactionEnricher.js.map +1 -1
  310. package/lib/simple-tree/api/identifierIndex.d.ts +21 -0
  311. package/lib/simple-tree/api/identifierIndex.d.ts.map +1 -0
  312. package/lib/simple-tree/api/identifierIndex.js +41 -0
  313. package/lib/simple-tree/api/identifierIndex.js.map +1 -0
  314. package/lib/simple-tree/api/index.d.ts +2 -0
  315. package/lib/simple-tree/api/index.d.ts.map +1 -1
  316. package/lib/simple-tree/api/index.js +2 -0
  317. package/lib/simple-tree/api/index.js.map +1 -1
  318. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +11 -9
  319. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  320. package/lib/simple-tree/api/simpleTreeIndex.d.ts +65 -0
  321. package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -0
  322. package/lib/simple-tree/api/simpleTreeIndex.js +87 -0
  323. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -0
  324. package/lib/simple-tree/api/tree.d.ts +4 -5
  325. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  326. package/lib/simple-tree/api/tree.js.map +1 -1
  327. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  328. package/lib/simple-tree/core/index.d.ts +1 -1
  329. package/lib/simple-tree/core/index.d.ts.map +1 -1
  330. package/lib/simple-tree/core/index.js +1 -1
  331. package/lib/simple-tree/core/index.js.map +1 -1
  332. package/lib/simple-tree/core/treeNodeKernel.d.ts +6 -2
  333. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  334. package/lib/simple-tree/core/treeNodeKernel.js +31 -1
  335. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  336. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  337. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  338. package/lib/simple-tree/core/unhydratedFlexTree.js +1 -1
  339. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  340. package/lib/simple-tree/index.d.ts +1 -1
  341. package/lib/simple-tree/index.d.ts.map +1 -1
  342. package/lib/simple-tree/index.js +1 -1
  343. package/lib/simple-tree/index.js.map +1 -1
  344. package/lib/simple-tree/objectNode.d.ts +7 -2
  345. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  346. package/lib/simple-tree/objectNode.js.map +1 -1
  347. package/lib/simple-tree/toMapTree.js +5 -5
  348. package/lib/simple-tree/toMapTree.js.map +1 -1
  349. package/lib/util/index.d.ts +1 -2
  350. package/lib/util/index.d.ts.map +1 -1
  351. package/lib/util/index.js +1 -2
  352. package/lib/util/index.js.map +1 -1
  353. package/lib/util/typeCheck.d.ts +6 -1
  354. package/lib/util/typeCheck.d.ts.map +1 -1
  355. package/lib/util/typeCheck.js.map +1 -1
  356. package/lib/util/typeCheckTests.d.ts +14 -2
  357. package/lib/util/typeCheckTests.d.ts.map +1 -1
  358. package/lib/util/typeCheckTests.js.map +1 -1
  359. package/lib/util/utils.d.ts +29 -0
  360. package/lib/util/utils.d.ts.map +1 -1
  361. package/lib/util/utils.js +9 -0
  362. package/lib/util/utils.js.map +1 -1
  363. package/package.json +22 -22
  364. package/src/core/forest/forest.ts +12 -1
  365. package/src/core/index.ts +8 -1
  366. package/src/core/rebase/utils.ts +12 -10
  367. package/src/core/revertible.ts +35 -1
  368. package/src/core/schema-stored/storedSchemaRepository.ts +2 -1
  369. package/src/core/tree/anchorSet.ts +2 -1
  370. package/src/core/tree/detachedFieldIndexCodec.ts +4 -3
  371. package/src/core/tree/index.ts +1 -0
  372. package/src/core/tree/visitorUtils.ts +56 -1
  373. package/src/feature-libraries/chunked-forest/chunkedForest.ts +33 -7
  374. package/src/feature-libraries/chunked-forest/uniformChunk.ts +3 -3
  375. package/src/feature-libraries/flex-tree/context.ts +1 -1
  376. package/src/feature-libraries/index.ts +9 -0
  377. package/src/feature-libraries/indexing/anchorTreeIndex.ts +453 -0
  378. package/src/feature-libraries/indexing/index.ts +11 -0
  379. package/src/feature-libraries/indexing/types.ts +37 -0
  380. package/src/feature-libraries/object-forest/objectForest.ts +22 -4
  381. package/src/feature-libraries/sequence-field/invert.ts +4 -4
  382. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +4 -4
  383. package/src/index.ts +16 -6
  384. package/src/packageVersion.ts +1 -1
  385. package/src/shared-tree/index.ts +0 -2
  386. package/src/shared-tree/schematizingTreeView.ts +7 -7
  387. package/src/shared-tree/sharedTree.ts +60 -6
  388. package/src/shared-tree/sharedTreeChangeFamily.ts +5 -4
  389. package/src/shared-tree/treeCheckout.ts +186 -193
  390. package/src/shared-tree-core/branch.ts +93 -220
  391. package/src/shared-tree-core/branchCommitEnricher.ts +69 -64
  392. package/src/shared-tree-core/defaultResubmitMachine.ts +3 -2
  393. package/src/shared-tree-core/editManager.ts +1 -1
  394. package/src/shared-tree-core/index.ts +9 -2
  395. package/src/shared-tree-core/sharedTreeCore.ts +17 -62
  396. package/src/shared-tree-core/transaction.ts +165 -0
  397. package/src/shared-tree-core/transactionEnricher.ts +30 -24
  398. package/src/simple-tree/api/identifierIndex.ts +64 -0
  399. package/src/simple-tree/api/index.ts +5 -0
  400. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +17 -18
  401. package/src/simple-tree/api/simpleTreeIndex.ts +231 -0
  402. package/src/simple-tree/api/tree.ts +8 -5
  403. package/src/simple-tree/api/treeNodeApi.ts +1 -1
  404. package/src/simple-tree/core/index.ts +1 -0
  405. package/src/simple-tree/core/treeNodeKernel.ts +37 -2
  406. package/src/simple-tree/core/unhydratedFlexTree.ts +2 -1
  407. package/src/simple-tree/index.ts +4 -0
  408. package/src/simple-tree/objectNode.ts +19 -12
  409. package/src/simple-tree/toMapTree.ts +5 -5
  410. package/src/util/index.ts +3 -1
  411. package/src/util/typeCheck.ts +6 -1
  412. package/src/util/typeCheckTests.ts +11 -1
  413. package/src/util/utils.ts +38 -0
  414. package/dist/events/emitter.d.ts +0 -139
  415. package/dist/events/emitter.d.ts.map +0 -1
  416. package/dist/events/emitter.js +0 -165
  417. package/dist/events/emitter.js.map +0 -1
  418. package/dist/events/index.d.ts +0 -7
  419. package/dist/events/index.d.ts.map +0 -1
  420. package/dist/events/index.js +0 -11
  421. package/dist/events/index.js.map +0 -1
  422. package/dist/events/interop.d.ts +0 -30
  423. package/dist/events/interop.d.ts.map +0 -1
  424. package/dist/events/interop.js.map +0 -1
  425. package/dist/events/listeners.d.ts +0 -76
  426. package/dist/events/listeners.d.ts.map +0 -1
  427. package/dist/events/listeners.js +0 -7
  428. package/dist/events/listeners.js.map +0 -1
  429. package/dist/shared-tree-core/transactionStack.d.ts +0 -29
  430. package/dist/shared-tree-core/transactionStack.d.ts.map +0 -1
  431. package/dist/shared-tree-core/transactionStack.js +0 -41
  432. package/dist/shared-tree-core/transactionStack.js.map +0 -1
  433. package/dist/util/transactionResult.d.ts +0 -19
  434. package/dist/util/transactionResult.d.ts.map +0 -1
  435. package/dist/util/transactionResult.js +0 -23
  436. package/dist/util/transactionResult.js.map +0 -1
  437. package/lib/events/emitter.d.ts +0 -139
  438. package/lib/events/emitter.d.ts.map +0 -1
  439. package/lib/events/emitter.js +0 -160
  440. package/lib/events/emitter.js.map +0 -1
  441. package/lib/events/index.d.ts +0 -7
  442. package/lib/events/index.d.ts.map +0 -1
  443. package/lib/events/index.js.map +0 -1
  444. package/lib/events/interop.d.ts +0 -30
  445. package/lib/events/interop.d.ts.map +0 -1
  446. package/lib/events/interop.js.map +0 -1
  447. package/lib/events/listeners.d.ts +0 -76
  448. package/lib/events/listeners.d.ts.map +0 -1
  449. package/lib/events/listeners.js +0 -6
  450. package/lib/events/listeners.js.map +0 -1
  451. package/lib/shared-tree-core/transactionStack.d.ts +0 -29
  452. package/lib/shared-tree-core/transactionStack.d.ts.map +0 -1
  453. package/lib/shared-tree-core/transactionStack.js +0 -37
  454. package/lib/shared-tree-core/transactionStack.js.map +0 -1
  455. package/lib/util/transactionResult.d.ts +0 -19
  456. package/lib/util/transactionResult.d.ts.map +0 -1
  457. package/lib/util/transactionResult.js +0 -20
  458. package/lib/util/transactionResult.js.map +0 -1
  459. package/src/events/README.md +0 -3
  460. package/src/events/emitter.ts +0 -256
  461. package/src/events/index.ts +0 -19
  462. package/src/events/interop.ts +0 -38
  463. package/src/events/listeners.ts +0 -80
  464. package/src/shared-tree-core/transactionStack.ts +0 -45
  465. package/src/util/transactionResult.ts +0 -19
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceFieldToDelta.js","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/sequenceFieldToDelta.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmF;AAEnF,kDAM6B;AAE7B,oDAAwD;AAExD,6DAA2D;AAC3D,yCAAyD;AACzD,yCAOoB;AAGpB,SAAgB,oBAAoB,CACnC,MAAgB,EAChB,cAAuB;IAEvB,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,MAAM,MAAM,GAA+B,EAAE,CAAC;IAC9C,MAAM,MAAM,GAA8B,EAAE,CAAC;IAE7C,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,SAAS,GAAuB,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QAC5D,MAAM,WAAW,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,CAAC;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAI,WAAW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CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AA3KD,oDA2KC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase, oob } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype DeltaDetachedNodeChanges,\n\ttype DeltaDetachedNodeRename,\n\ttype DeltaFieldChanges,\n\ttype DeltaMark,\n\tareEqualChangeAtomIds,\n} from \"../../core/index.js\";\nimport type { Mutable } from \"../../util/index.js\";\nimport { nodeIdFromChangeAtom } from \"../deltaUtils.js\";\n\nimport { isMoveIn, isMoveOut } from \"./moveEffectTable.js\";\nimport { type MarkList, NoopMarkType } from \"./types.js\";\nimport {\n\tareInputCellsEmpty,\n\tareOutputCellsEmpty,\n\tgetDetachedNodeId,\n\tgetEndpoint,\n\tgetInputCellId,\n\tisAttachAndDetachEffect,\n} from \"./utils.js\";\nimport type { ToDelta } from \"../modular-schema/index.js\";\n\nexport function sequenceFieldToDelta(\n\tchange: MarkList,\n\tdeltaFromChild: ToDelta,\n): DeltaFieldChanges {\n\tconst local: DeltaMark[] = [];\n\tconst global: DeltaDetachedNodeChanges[] = [];\n\tconst rename: DeltaDetachedNodeRename[] = [];\n\n\tfor (const mark of change) {\n\t\tconst deltaMark: Mutable<DeltaMark> = { count: mark.count };\n\t\tconst inputCellId = getInputCellId(mark);\n\t\tconst changes = mark.changes;\n\t\tif (changes !== undefined) {\n\t\t\tconst nestedDelta = deltaFromChild(changes);\n\t\t\tif (nestedDelta.size > 0) {\n\t\t\t\tif (inputCellId === undefined) {\n\t\t\t\t\tdeltaMark.fields = nestedDelta;\n\t\t\t\t} else {\n\t\t\t\t\tglobal.push({\n\t\t\t\t\t\tid: nodeIdFromChangeAtom(inputCellId),\n\t\t\t\t\t\tfields: nestedDelta,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!areInputCellsEmpty(mark) && !areOutputCellsEmpty(mark)) {\n\t\t\t// Since each cell is associated with exactly one node,\n\t\t\t// the cell starting end ending populated means the cell content has not changed.\n\t\t\tlocal.push(deltaMark);\n\t\t} else if (isAttachAndDetachEffect(mark)) {\n\t\t\tassert(\n\t\t\t\tinputCellId !== undefined,\n\t\t\t\t0x81e /* AttachAndDetach mark should have defined input cell ID */,\n\t\t\t);\n\t\t\t// The cell starting and ending empty means the cell content has not changed,\n\t\t\t// unless transient content was inserted/attached.\n\t\t\tif (isMoveIn(mark.attach) && isMoveOut(mark.detach)) {\n\t\t\t\tassert(\n\t\t\t\t\tmark.changes === undefined,\n\t\t\t\t\t0x81f /* AttachAndDetach moves should not have changes */,\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst outputId = getDetachedNodeId(mark.detach);\n\t\t\tassert(\n\t\t\t\toutputId !== undefined,\n\t\t\t\t0x820 /* AttachAndDetach mark should have defined output cell ID */,\n\t\t\t);\n\t\t\tconst oldId = nodeIdFromChangeAtom(\n\t\t\t\tisMoveIn(mark.attach) ? getEndpoint(mark.attach) : inputCellId,\n\t\t\t);\n\t\t\tif (!areEqualChangeAtomIds(inputCellId, outputId)) {\n\t\t\t\trename.push({\n\t\t\t\t\tcount: mark.count,\n\t\t\t\t\toldId,\n\t\t\t\t\tnewId: nodeIdFromChangeAtom(outputId),\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (deltaMark.fields) {\n\t\t\t\tglobal.push({\n\t\t\t\t\tid: oldId,\n\t\t\t\t\tfields: deltaMark.fields,\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tconst type = mark.type;\n\t\t\t// Inline into `switch(mark.type)` once we upgrade to TS 4.7\n\t\t\tswitch (type) {\n\t\t\t\tcase \"MoveIn\": {\n\t\t\t\t\tlocal.push({\n\t\t\t\t\t\tattach: nodeIdFromChangeAtom(getEndpoint(mark)),\n\t\t\t\t\t\tcount: mark.count,\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"Remove\": {\n\t\t\t\t\tconst newDetachId = getDetachedNodeId(mark);\n\t\t\t\t\tif (inputCellId === undefined) {\n\t\t\t\t\t\tdeltaMark.detach = nodeIdFromChangeAtom(newDetachId);\n\t\t\t\t\t\tlocal.push(deltaMark);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst oldId = nodeIdFromChangeAtom(inputCellId);\n\t\t\t\t\t\t// Removal of already removed content is only a no-op if the detach IDs are different.\n\t\t\t\t\t\tif (!areEqualChangeAtomIds(inputCellId, newDetachId)) {\n\t\t\t\t\t\t\trename.push({\n\t\t\t\t\t\t\t\tcount: mark.count,\n\t\t\t\t\t\t\t\toldId,\n\t\t\t\t\t\t\t\tnewId: nodeIdFromChangeAtom(newDetachId),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// In all cases, the nested changes apply\n\t\t\t\t\t\tif (deltaMark.fields) {\n\t\t\t\t\t\t\tglobal.push({\n\t\t\t\t\t\t\t\tid: oldId,\n\t\t\t\t\t\t\t\tfields: deltaMark.fields,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"MoveOut\": {\n\t\t\t\t\t// The move destination will look for the detach ID of the source, so we can ignore `finalEndpoint`.\n\t\t\t\t\tconst detachId = nodeIdFromChangeAtom(getDetachedNodeId(mark));\n\t\t\t\t\tif (inputCellId === undefined) {\n\t\t\t\t\t\tdeltaMark.detach = detachId;\n\t\t\t\t\t\tlocal.push(deltaMark);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Move sources implicitly restore their content\n\t\t\t\t\t\trename.push({\n\t\t\t\t\t\t\tcount: mark.count,\n\t\t\t\t\t\t\toldId: nodeIdFromChangeAtom(inputCellId),\n\t\t\t\t\t\t\tnewId: detachId,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"Insert\": {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tinputCellId !== undefined,\n\t\t\t\t\t\t0x821 /* Active Insert marks must have a CellId */,\n\t\t\t\t\t);\n\t\t\t\t\tconst buildId = nodeIdFromChangeAtom(inputCellId);\n\t\t\t\t\tdeltaMark.attach = buildId;\n\t\t\t\t\tif (deltaMark.fields) {\n\t\t\t\t\t\t// Nested changes are represented on the node in its starting location\n\t\t\t\t\t\tglobal.push({ id: buildId, fields: deltaMark.fields });\n\t\t\t\t\t\tdelete deltaMark.fields;\n\t\t\t\t\t}\n\t\t\t\t\tlocal.push(deltaMark);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase NoopMarkType:\n\t\t\t\t\tif (inputCellId === undefined) {\n\t\t\t\t\t\tlocal.push(deltaMark);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Rename\":\n\t\t\t\t\tassert(\n\t\t\t\t\t\tmark.cellId !== undefined,\n\t\t\t\t\t\t0x9f9 /* Renames should only target empty cells */,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(type);\n\t\t\t}\n\t\t}\n\t}\n\t// Remove trailing no-op marks\n\twhile (local.length > 0) {\n\t\tconst lastMark = local[local.length - 1] ?? oob();\n\t\tif (\n\t\t\tlastMark.attach !== undefined ||\n\t\t\tlastMark.detach !== undefined ||\n\t\t\tlastMark.fields !== undefined\n\t\t) {\n\t\t\tbreak;\n\t\t}\n\t\tlocal.pop();\n\t}\n\tconst delta: Mutable<DeltaFieldChanges> = {};\n\tif (local.length > 0) {\n\t\tdelta.local = local;\n\t}\n\tif (global.length > 0) {\n\t\tdelta.global = global;\n\t}\n\tif (rename.length > 0) {\n\t\tdelta.rename = rename;\n\t}\n\treturn delta;\n}\n"]}
1
+ {"version":3,"file":"sequenceFieldToDelta.js","sourceRoot":"","sources":["../../../src/feature-libraries/sequence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EAAC,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,IAAA,kBAAO,EAAC,KAAK,CAAC,CAAC;QAChC,IACC,QAAQ,CAAC,MAAM,KAAK,SAAS;YAC7B,QAAQ,CAAC,MAAM,KAAK,SAAS;YAC7B,QAAQ,CAAC,MAAM,KAAK,SAAS,EAC5B,CAAC;YACF,MAAM;QACP,CAAC;QACD,KAAK,CAAC,GAAG,EAAE,CAAC;IACb,CAAC;IACD,MAAM,KAAK,GAA+B,EAAE,CAAC;IAC7C,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AA3KD,oDA2KC","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\";\n\nimport {\n\ttype DeltaDetachedNodeChanges,\n\ttype DeltaDetachedNodeRename,\n\ttype DeltaFieldChanges,\n\ttype DeltaMark,\n\tareEqualChangeAtomIds,\n} from \"../../core/index.js\";\nimport { getLast, hasSome, type Mutable } from \"../../util/index.js\";\nimport { nodeIdFromChangeAtom } from \"../deltaUtils.js\";\n\nimport { isMoveIn, isMoveOut } from \"./moveEffectTable.js\";\nimport { type MarkList, NoopMarkType } from \"./types.js\";\nimport {\n\tareInputCellsEmpty,\n\tareOutputCellsEmpty,\n\tgetDetachedNodeId,\n\tgetEndpoint,\n\tgetInputCellId,\n\tisAttachAndDetachEffect,\n} from \"./utils.js\";\nimport type { ToDelta } from \"../modular-schema/index.js\";\n\nexport function sequenceFieldToDelta(\n\tchange: MarkList,\n\tdeltaFromChild: ToDelta,\n): DeltaFieldChanges {\n\tconst local: DeltaMark[] = [];\n\tconst global: DeltaDetachedNodeChanges[] = [];\n\tconst rename: DeltaDetachedNodeRename[] = [];\n\n\tfor (const mark of change) {\n\t\tconst deltaMark: Mutable<DeltaMark> = { count: mark.count };\n\t\tconst inputCellId = getInputCellId(mark);\n\t\tconst changes = mark.changes;\n\t\tif (changes !== undefined) {\n\t\t\tconst nestedDelta = deltaFromChild(changes);\n\t\t\tif (nestedDelta.size > 0) {\n\t\t\t\tif (inputCellId === undefined) {\n\t\t\t\t\tdeltaMark.fields = nestedDelta;\n\t\t\t\t} else {\n\t\t\t\t\tglobal.push({\n\t\t\t\t\t\tid: nodeIdFromChangeAtom(inputCellId),\n\t\t\t\t\t\tfields: nestedDelta,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!areInputCellsEmpty(mark) && !areOutputCellsEmpty(mark)) {\n\t\t\t// Since each cell is associated with exactly one node,\n\t\t\t// the cell starting end ending populated means the cell content has not changed.\n\t\t\tlocal.push(deltaMark);\n\t\t} else if (isAttachAndDetachEffect(mark)) {\n\t\t\tassert(\n\t\t\t\tinputCellId !== undefined,\n\t\t\t\t0x81e /* AttachAndDetach mark should have defined input cell ID */,\n\t\t\t);\n\t\t\t// The cell starting and ending empty means the cell content has not changed,\n\t\t\t// unless transient content was inserted/attached.\n\t\t\tif (isMoveIn(mark.attach) && isMoveOut(mark.detach)) {\n\t\t\t\tassert(\n\t\t\t\t\tmark.changes === undefined,\n\t\t\t\t\t0x81f /* AttachAndDetach moves should not have changes */,\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst outputId = getDetachedNodeId(mark.detach);\n\t\t\tassert(\n\t\t\t\toutputId !== undefined,\n\t\t\t\t0x820 /* AttachAndDetach mark should have defined output cell ID */,\n\t\t\t);\n\t\t\tconst oldId = nodeIdFromChangeAtom(\n\t\t\t\tisMoveIn(mark.attach) ? getEndpoint(mark.attach) : inputCellId,\n\t\t\t);\n\t\t\tif (!areEqualChangeAtomIds(inputCellId, outputId)) {\n\t\t\t\trename.push({\n\t\t\t\t\tcount: mark.count,\n\t\t\t\t\toldId,\n\t\t\t\t\tnewId: nodeIdFromChangeAtom(outputId),\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (deltaMark.fields) {\n\t\t\t\tglobal.push({\n\t\t\t\t\tid: oldId,\n\t\t\t\t\tfields: deltaMark.fields,\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tconst type = mark.type;\n\t\t\t// Inline into `switch(mark.type)` once we upgrade to TS 4.7\n\t\t\tswitch (type) {\n\t\t\t\tcase \"MoveIn\": {\n\t\t\t\t\tlocal.push({\n\t\t\t\t\t\tattach: nodeIdFromChangeAtom(getEndpoint(mark)),\n\t\t\t\t\t\tcount: mark.count,\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"Remove\": {\n\t\t\t\t\tconst newDetachId = getDetachedNodeId(mark);\n\t\t\t\t\tif (inputCellId === undefined) {\n\t\t\t\t\t\tdeltaMark.detach = nodeIdFromChangeAtom(newDetachId);\n\t\t\t\t\t\tlocal.push(deltaMark);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst oldId = nodeIdFromChangeAtom(inputCellId);\n\t\t\t\t\t\t// Removal of already removed content is only a no-op if the detach IDs are different.\n\t\t\t\t\t\tif (!areEqualChangeAtomIds(inputCellId, newDetachId)) {\n\t\t\t\t\t\t\trename.push({\n\t\t\t\t\t\t\t\tcount: mark.count,\n\t\t\t\t\t\t\t\toldId,\n\t\t\t\t\t\t\t\tnewId: nodeIdFromChangeAtom(newDetachId),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// In all cases, the nested changes apply\n\t\t\t\t\t\tif (deltaMark.fields) {\n\t\t\t\t\t\t\tglobal.push({\n\t\t\t\t\t\t\t\tid: oldId,\n\t\t\t\t\t\t\t\tfields: deltaMark.fields,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"MoveOut\": {\n\t\t\t\t\t// The move destination will look for the detach ID of the source, so we can ignore `finalEndpoint`.\n\t\t\t\t\tconst detachId = nodeIdFromChangeAtom(getDetachedNodeId(mark));\n\t\t\t\t\tif (inputCellId === undefined) {\n\t\t\t\t\t\tdeltaMark.detach = detachId;\n\t\t\t\t\t\tlocal.push(deltaMark);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Move sources implicitly restore their content\n\t\t\t\t\t\trename.push({\n\t\t\t\t\t\t\tcount: mark.count,\n\t\t\t\t\t\t\toldId: nodeIdFromChangeAtom(inputCellId),\n\t\t\t\t\t\t\tnewId: detachId,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"Insert\": {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tinputCellId !== undefined,\n\t\t\t\t\t\t0x821 /* Active Insert marks must have a CellId */,\n\t\t\t\t\t);\n\t\t\t\t\tconst buildId = nodeIdFromChangeAtom(inputCellId);\n\t\t\t\t\tdeltaMark.attach = buildId;\n\t\t\t\t\tif (deltaMark.fields) {\n\t\t\t\t\t\t// Nested changes are represented on the node in its starting location\n\t\t\t\t\t\tglobal.push({ id: buildId, fields: deltaMark.fields });\n\t\t\t\t\t\tdelete deltaMark.fields;\n\t\t\t\t\t}\n\t\t\t\t\tlocal.push(deltaMark);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase NoopMarkType:\n\t\t\t\t\tif (inputCellId === undefined) {\n\t\t\t\t\t\tlocal.push(deltaMark);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Rename\":\n\t\t\t\t\tassert(\n\t\t\t\t\t\tmark.cellId !== undefined,\n\t\t\t\t\t\t0x9f9 /* Renames should only target empty cells */,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(type);\n\t\t\t}\n\t\t}\n\t}\n\t// Remove trailing no-op marks\n\twhile (hasSome(local)) {\n\t\tconst lastMark = getLast(local);\n\t\tif (\n\t\t\tlastMark.attach !== undefined ||\n\t\t\tlastMark.detach !== undefined ||\n\t\t\tlastMark.fields !== undefined\n\t\t) {\n\t\t\tbreak;\n\t\t}\n\t\tlocal.pop();\n\t}\n\tconst delta: Mutable<DeltaFieldChanges> = {};\n\tif (local.length > 0) {\n\t\tdelta.local = local;\n\t}\n\tif (global.length > 0) {\n\t\tdelta.global = global;\n\t}\n\tif (rename.length > 0) {\n\t\tdelta.rename = rename;\n\t}\n\treturn delta;\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -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
- export { EmptyKey, type FieldKey, type TreeValue, type FieldMapObject, type NodeData, type GenericTreeNode, type JsonableTree, type GenericFieldsNode, type TreeNodeSchemaIdentifier, type TreeFieldStoredSchema, ValueSchema, TreeNodeStoredSchema, type FieldKindIdentifier, type TreeTypeSet, type TreeStoredSchema, type Revertible, CommitKind, RevertibleStatus, type CommitMetadata, type StoredSchemaCollection, type ErasedTreeNodeSchemaDataFormat, ObjectNodeStoredSchema, MapNodeStoredSchema, LeafNodeStoredSchema, type RevertibleFactory, } from "./core/index.js";
5
+ export { EmptyKey, type FieldKey, type TreeValue, type FieldMapObject, type NodeData, type GenericTreeNode, type JsonableTree, type GenericFieldsNode, type TreeNodeSchemaIdentifier, type TreeFieldStoredSchema, ValueSchema, TreeNodeStoredSchema, type FieldKindIdentifier, type TreeTypeSet, type TreeStoredSchema, type Revertible, CommitKind, RevertibleStatus, type CommitMetadata, type StoredSchemaCollection, type ErasedTreeNodeSchemaDataFormat, ObjectNodeStoredSchema, MapNodeStoredSchema, LeafNodeStoredSchema, type RevertibleFactory, type RevertibleAlphaFactory, type RevertibleAlpha, } from "./core/index.js";
6
6
  export { type Brand } from "./util/index.js";
7
- export { type Listeners, type IsListener, type Listenable, type Off, } from "./events/index.js";
8
- export { TreeStatus, TreeCompressionStrategy, } from "./feature-libraries/index.js";
7
+ export type { Listeners, IsListener, Listenable, Off, } from "@fluidframework/core-interfaces";
8
+ export { TreeStatus, TreeCompressionStrategy, type TreeIndex, type TreeIndexKey, type TreeIndexNodes, } from "./feature-libraries/index.js";
9
9
  export { type ISharedTree, type SharedTreeOptions, ForestType, type SharedTreeContentSnapshot, type SharedTreeFormatOptions, SharedTreeFormatVersion, Tree, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransaction, rollback, type ForestOptions, getBranch, type BranchableTree, type TreeBranchFork, independentInitializedView, type ViewContent, TreeAlpha, independentView, } from "./shared-tree/index.js";
10
- export { TreeArrayNode, type Unhydrated, IterableTreeArrayContent, TreeNode, type ViewableTree, type ITree, type TreeNodeSchema, TreeViewConfiguration, type ITreeViewConfiguration, type ITreeConfigurationOptions, type TreeView, type TreeViewEvents, SchemaFactory, type ImplicitFieldSchema, type TreeFieldFromImplicitField, type TreeChangeEvents, type NodeFromSchema, type TreeMapNode, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, FieldKind, FieldSchema, type FieldSchemaMetadata, type ImplicitAllowedTypes, type InsertableTreeFieldFromImplicitField, type InsertableTypedNode, NodeKind, type TreeObjectNode, type TreeNodeFromImplicitAllowedTypes, type TreeNodeSchemaClass, type SchemaCompatibilityStatus, type FieldProps, type InternalTreeNode, type WithType, type NodeChangedData, type TreeNodeApi, type TreeNodeSchemaCore, type AllowedTypes, type TreeObjectNodeUnsafe, type InsertableTreeNodeFromImplicitAllowedTypesUnsafe, type TreeArrayNodeUnsafe, type TreeMapNodeUnsafe, type InsertableObjectFromSchemaRecordUnsafe, type InsertableTreeFieldFromImplicitFieldUnsafe, type FieldSchemaUnsafe, type TreeNodeSchemaClassUnsafe, type InsertableTreeNodeFromAllowedTypesUnsafe, type typeSchemaSymbol, type TreeNodeSchemaNonClass, type ValidateRecursiveSchema, type FixRecursiveArraySchema, adaptEnum, enumFromStrings, singletonSchema, type UnsafeUnknownSchema, type TreeViewAlpha, type InsertableField, type Insertable, type InsertableContent, type FactoryContent, type FactoryContentObject, type ReadableField, type ReadSchema, test_RecursiveObject, test_RecursiveObject_base, test_RecursiveObjectPojoMode, TreeBeta, type TreeChangeEventsBeta, type VerboseTreeNode, type EncodeOptions, type ParseOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, type JsonTreeSchema, type JsonSchemaId, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonLeafNodeSchema, type JsonMapNodeSchema, type JsonArrayNodeSchema, type JsonObjectNodeSchema, type JsonFieldSchema, type JsonSchemaRef, type JsonRefPath, type JsonSchemaType, type JsonLeafSchemaType, getJsonSchema, type LazyItem, type Unenforced, type SimpleNodeSchemaBase, type SimpleTreeSchema, type SimpleNodeSchema, type SimpleFieldSchema, type SimpleLeafNodeSchema, type SimpleMapNodeSchema, type SimpleArrayNodeSchema, type SimpleObjectNodeSchema, normalizeAllowedTypes, getSimpleSchema, numberSchema, stringSchema, booleanSchema, handleSchema, nullSchema, type ReadonlyArrayNode, type InsertableTreeNodeFromAllowedTypes, type Input, type TreeBranch, type TreeBranchEvents, asTreeViewAlpha, } from "./simple-tree/index.js";
10
+ export { TreeArrayNode, type Unhydrated, IterableTreeArrayContent, TreeNode, type ViewableTree, type ITree, type TreeNodeSchema, TreeViewConfiguration, type ITreeViewConfiguration, type ITreeConfigurationOptions, type TreeView, type TreeViewEvents, SchemaFactory, type ImplicitFieldSchema, type TreeFieldFromImplicitField, type TreeChangeEvents, type NodeFromSchema, type TreeMapNode, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, FieldKind, FieldSchema, type FieldSchemaMetadata, type ImplicitAllowedTypes, type InsertableTreeFieldFromImplicitField, type InsertableTypedNode, NodeKind, type TreeObjectNode, type TreeNodeFromImplicitAllowedTypes, type TreeNodeSchemaClass, type SchemaCompatibilityStatus, type FieldProps, type InternalTreeNode, type WithType, type NodeChangedData, type TreeNodeApi, type TreeNodeSchemaCore, type AllowedTypes, type TreeObjectNodeUnsafe, type InsertableTreeNodeFromImplicitAllowedTypesUnsafe, type TreeArrayNodeUnsafe, type TreeMapNodeUnsafe, type InsertableObjectFromSchemaRecordUnsafe, type InsertableTreeFieldFromImplicitFieldUnsafe, type FieldSchemaUnsafe, type TreeNodeSchemaClassUnsafe, type InsertableTreeNodeFromAllowedTypesUnsafe, type typeSchemaSymbol, type TreeNodeSchemaNonClass, type ValidateRecursiveSchema, type FixRecursiveArraySchema, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, adaptEnum, enumFromStrings, singletonSchema, type UnsafeUnknownSchema, type TreeViewAlpha, type InsertableField, type Insertable, type InsertableContent, type FactoryContent, type FactoryContentObject, type ReadableField, type ReadSchema, test_RecursiveObject, test_RecursiveObject_base, test_RecursiveObjectPojoMode, TreeBeta, type TreeChangeEventsBeta, type VerboseTreeNode, type EncodeOptions, type ParseOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, type JsonTreeSchema, type JsonSchemaId, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonLeafNodeSchema, type JsonMapNodeSchema, type JsonArrayNodeSchema, type JsonObjectNodeSchema, type JsonFieldSchema, type JsonSchemaRef, type JsonRefPath, type JsonSchemaType, type JsonLeafSchemaType, getJsonSchema, type LazyItem, type Unenforced, type SimpleNodeSchemaBase, type SimpleTreeSchema, type SimpleNodeSchema, type SimpleFieldSchema, type SimpleLeafNodeSchema, type SimpleMapNodeSchema, type SimpleArrayNodeSchema, type SimpleObjectNodeSchema, normalizeAllowedTypes, getSimpleSchema, numberSchema, stringSchema, booleanSchema, handleSchema, nullSchema, type ReadonlyArrayNode, type InsertableTreeNodeFromAllowedTypes, type Input, type TreeBranch, type TreeBranchEvents, asTreeViewAlpha, } from "./simple-tree/index.js";
11
11
  export { SharedTree, configuredSharedTree, } from "./treeFactory.js";
12
12
  export { type ICodecOptions, type JsonValidator, type SchemaValidationFunction, FluidClientVersion, } from "./codec/index.js";
13
13
  export { noopValidator } from "./codec/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,WAAW,EACX,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,UAAU,EACV,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EACnC,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,iBAAiB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EACN,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,GAAG,GACR,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,UAAU,EACV,uBAAuB,GACvB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,UAAU,EACV,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,uBAAuB,EACvB,IAAI,EACJ,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,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BAAgB,EACrB,eAAe,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,UAAU,EACV,oBAAoB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,kBAAkB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EACN,KAAK,SAAS,EACd,WAAW,EACX,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,QAAQ,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO;AACN;;;GAGG;AACH,aAAa,GACb,CAAC;AAKF,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -27,7 +27,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
27
27
  return result;
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.InternalTypes = exports.BrandedType = exports.typeboxValidator = exports.noopValidator = exports.FluidClientVersion = exports.configuredSharedTree = exports.SharedTree = exports.asTreeViewAlpha = exports.nullSchema = exports.handleSchema = exports.booleanSchema = exports.stringSchema = exports.numberSchema = exports.getSimpleSchema = exports.normalizeAllowedTypes = exports.getJsonSchema = exports.comparePersistedSchema = exports.extractPersistedSchema = exports.TreeBeta = exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.NodeKind = exports.FieldSchema = exports.FieldKind = exports.SchemaFactory = exports.TreeViewConfiguration = exports.IterableTreeArrayContent = exports.TreeArrayNode = exports.independentView = exports.TreeAlpha = exports.independentInitializedView = exports.getBranch = exports.rollback = exports.Tree = exports.SharedTreeFormatVersion = exports.ForestType = exports.TreeCompressionStrategy = exports.TreeStatus = exports.LeafNodeStoredSchema = exports.MapNodeStoredSchema = exports.ObjectNodeStoredSchema = exports.RevertibleStatus = exports.CommitKind = exports.TreeNodeStoredSchema = exports.ValueSchema = exports.EmptyKey = void 0;
30
+ exports.typeboxValidator = exports.noopValidator = exports.FluidClientVersion = exports.configuredSharedTree = exports.SharedTree = exports.asTreeViewAlpha = exports.nullSchema = exports.handleSchema = exports.booleanSchema = exports.stringSchema = exports.numberSchema = exports.getSimpleSchema = exports.normalizeAllowedTypes = exports.getJsonSchema = exports.comparePersistedSchema = exports.extractPersistedSchema = exports.TreeBeta = exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.createIdentifierIndex = exports.createSimpleTreeIndex = exports.NodeKind = exports.FieldSchema = exports.FieldKind = exports.SchemaFactory = exports.TreeViewConfiguration = exports.IterableTreeArrayContent = exports.TreeArrayNode = exports.independentView = exports.TreeAlpha = exports.independentInitializedView = exports.getBranch = exports.rollback = exports.Tree = exports.SharedTreeFormatVersion = exports.ForestType = exports.TreeCompressionStrategy = exports.TreeStatus = exports.LeafNodeStoredSchema = exports.MapNodeStoredSchema = exports.ObjectNodeStoredSchema = exports.RevertibleStatus = exports.CommitKind = exports.TreeNodeStoredSchema = exports.ValueSchema = exports.EmptyKey = void 0;
31
+ exports.InternalTypes = exports.BrandedType = void 0;
31
32
  var index_js_1 = require("./core/index.js");
32
33
  Object.defineProperty(exports, "EmptyKey", { enumerable: true, get: function () { return index_js_1.EmptyKey; } });
33
34
  Object.defineProperty(exports, "ValueSchema", { enumerable: true, get: function () { return index_js_1.ValueSchema; } });
@@ -57,6 +58,8 @@ Object.defineProperty(exports, "SchemaFactory", { enumerable: true, get: functio
57
58
  Object.defineProperty(exports, "FieldKind", { enumerable: true, get: function () { return index_js_4.FieldKind; } });
58
59
  Object.defineProperty(exports, "FieldSchema", { enumerable: true, get: function () { return index_js_4.FieldSchema; } });
59
60
  Object.defineProperty(exports, "NodeKind", { enumerable: true, get: function () { return index_js_4.NodeKind; } });
61
+ Object.defineProperty(exports, "createSimpleTreeIndex", { enumerable: true, get: function () { return index_js_4.createSimpleTreeIndex; } });
62
+ Object.defineProperty(exports, "createIdentifierIndex", { enumerable: true, get: function () { return index_js_4.createIdentifierIndex; } });
60
63
  // experimental @alpha APIs:
61
64
  Object.defineProperty(exports, "adaptEnum", { enumerable: true, get: function () { return index_js_4.adaptEnum; } });
62
65
  Object.defineProperty(exports, "enumFromStrings", { enumerable: true, get: function () { return index_js_4.enumFromStrings; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CA0ByB;AAzBxB,oGAAA,QAAQ,OAAA;AAUR,uGAAA,WAAW,OAAA;AACX,gHAAA,oBAAoB,OAAA;AAKpB,sGAAA,UAAU,OAAA;AACV,4GAAA,gBAAgB,OAAA;AAIhB,kHAAA,sBAAsB,OAAA;AACtB,+GAAA,mBAAmB,OAAA;AACnB,gHAAA,oBAAoB,OAAA;AAYrB,yDAGsC;AAFrC,sGAAA,UAAU,OAAA;AACV,mHAAA,uBAAuB,OAAA;AAGxB,mDAoBgC;AAjB/B,sGAAA,UAAU,OAAA;AAGV,mHAAA,uBAAuB,OAAA;AACvB,gGAAA,IAAI,OAAA;AAIJ,oGAAA,QAAQ,OAAA;AAER,qGAAA,SAAS,OAAA;AAGT,sHAAA,0BAA0B,OAAA;AAE1B,qGAAA,SAAS,OAAA;AACT,2GAAA,eAAe,OAAA;AAGhB,mDA6HgC;AA5H/B,yGAAA,aAAa,OAAA;AAEb,oHAAA,wBAAwB,OAAA;AAKxB,iHAAA,qBAAqB,OAAA;AAKrB,yGAAA,aAAa,OAAA;AAQb,qGAAA,SAAS,OAAA;AACT,uGAAA,WAAW,OAAA;AAKX,oGAAA,QAAQ,OAAA;AAiCR,4BAA4B;AAC5B,qGAAA,SAAS,OAAA;AACT,2GAAA,eAAe,OAAA;AACf,2GAAA,eAAe,OAAA;AAUf,8EAA8E;AAC9E,gHAAA,oBAAoB,OAAA;AACpB,qHAAA,yBAAyB,OAAA;AACzB,wHAAA,4BAA4B,OAAA;AAC5B,YAAY;AACZ,oGAAA,QAAQ,OAAA;AAMR,kHAAA,sBAAsB,OAAA;AACtB,kHAAA,sBAAsB,OAAA;AAgBtB,yGAAA,aAAa,OAAA;AAWb,iHAAA,qBAAqB,OAAA;AACrB,2GAAA,eAAe,OAAA;AACf,wGAAA,YAAY,OAAA;AACZ,wGAAA,YAAY,OAAA;AACZ,yGAAA,aAAa,OAAA;AACb,wGAAA,YAAY,OAAA;AACZ,sGAAA,UAAU,OAAA;AAMV,2GAAA,eAAe,OAAA;AAEhB,mDAG0B;AAFzB,4GAAA,UAAU,OAAA;AACV,sHAAA,oBAAoB,OAAA;AAGrB,6CAK0B;AADzB,8GAAA,kBAAkB,OAAA;AAEnB,6CAAiD;AAAxC,yGAAA,aAAa,OAAA;AACtB,0DAAiE;AAAxD,4GAAA,gBAAgB,OAAA;AAEzB,4CAUyB;AARxB,uGAAA,WAAW,OAAA;AAUZ,kEAAoD;AAMnD,sCAAa","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tEmptyKey,\n\ttype FieldKey,\n\ttype TreeValue,\n\ttype FieldMapObject,\n\ttype NodeData,\n\ttype GenericTreeNode,\n\ttype JsonableTree,\n\ttype GenericFieldsNode,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeFieldStoredSchema,\n\tValueSchema,\n\tTreeNodeStoredSchema,\n\ttype FieldKindIdentifier,\n\ttype TreeTypeSet,\n\ttype TreeStoredSchema,\n\ttype Revertible,\n\tCommitKind,\n\tRevertibleStatus,\n\ttype CommitMetadata,\n\ttype StoredSchemaCollection,\n\ttype ErasedTreeNodeSchemaDataFormat,\n\tObjectNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tLeafNodeStoredSchema,\n\ttype RevertibleFactory,\n} from \"./core/index.js\";\nexport { type Brand } from \"./util/index.js\";\n\nexport {\n\ttype Listeners,\n\ttype IsListener,\n\ttype Listenable,\n\ttype Off,\n} from \"./events/index.js\";\n\nexport {\n\tTreeStatus,\n\tTreeCompressionStrategy,\n} from \"./feature-libraries/index.js\";\n\nexport {\n\ttype ISharedTree,\n\ttype SharedTreeOptions,\n\tForestType,\n\ttype SharedTreeContentSnapshot,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tTree,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransaction,\n\trollback,\n\ttype ForestOptions,\n\tgetBranch,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n\tindependentInitializedView,\n\ttype ViewContent,\n\tTreeAlpha,\n\tindependentView,\n} from \"./shared-tree/index.js\";\n\nexport {\n\tTreeArrayNode,\n\ttype Unhydrated,\n\tIterableTreeArrayContent,\n\tTreeNode,\n\ttype ViewableTree,\n\ttype ITree,\n\ttype TreeNodeSchema,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype ITreeConfigurationOptions,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tSchemaFactory,\n\ttype ImplicitFieldSchema,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeChangeEvents,\n\ttype NodeFromSchema,\n\ttype TreeMapNode,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeLeafValue,\n\tFieldKind,\n\tFieldSchema,\n\ttype FieldSchemaMetadata,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InsertableTypedNode,\n\tNodeKind,\n\ttype TreeObjectNode,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchemaClass,\n\ttype SchemaCompatibilityStatus,\n\ttype FieldProps,\n\ttype InternalTreeNode,\n\ttype WithType,\n\ttype NodeChangedData,\n\t// Types not really intended for public use, but used in links.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// Error: src/simple-tree/objectNode.ts:72:1 - (ae-unresolved-link) The @link reference could not be resolved: The package \"@fluidframework/tree\" does not have an export \"TreeNodeApi\"\n\ttype TreeNodeApi,\n\ttype TreeNodeSchemaCore,\n\t// Types not really intended for public use, but used in inferred types exposed in the public API.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// error TS2742: The inferred type of 'Inventory' cannot be named without a reference to '../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\n\ttype AllowedTypes,\n\ttype TreeObjectNodeUnsafe,\n\ttype InsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\ttype TreeArrayNodeUnsafe,\n\ttype TreeMapNodeUnsafe,\n\ttype InsertableObjectFromSchemaRecordUnsafe,\n\ttype InsertableTreeFieldFromImplicitFieldUnsafe,\n\ttype FieldSchemaUnsafe,\n\ttype TreeNodeSchemaClassUnsafe,\n\ttype InsertableTreeNodeFromAllowedTypesUnsafe,\n\t// System types (not in Internal types for various reasons, like doc links or cannot be named errors).\n\ttype typeSchemaSymbol,\n\ttype TreeNodeSchemaNonClass,\n\t// Recursive Schema APIs\n\ttype ValidateRecursiveSchema,\n\ttype FixRecursiveArraySchema,\n\t// experimental @alpha APIs:\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttype UnsafeUnknownSchema,\n\ttype TreeViewAlpha,\n\ttype InsertableField,\n\ttype Insertable,\n\ttype InsertableContent,\n\ttype FactoryContent,\n\ttype FactoryContentObject,\n\ttype ReadableField,\n\ttype ReadSchema,\n\t// test recursive schema for checking that d.ts files handles schema correctly\n\ttest_RecursiveObject,\n\ttest_RecursiveObject_base,\n\ttest_RecursiveObjectPojoMode,\n\t// Beta APIs\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n\ttype VerboseTreeNode,\n\ttype EncodeOptions,\n\ttype ParseOptions,\n\ttype VerboseTree,\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n\ttype ConciseTree,\n\t// Back to normal types\n\ttype JsonTreeSchema,\n\ttype JsonSchemaId,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonLeafNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonObjectNodeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonSchemaType,\n\ttype JsonLeafSchemaType,\n\tgetJsonSchema,\n\ttype LazyItem,\n\ttype Unenforced,\n\ttype SimpleNodeSchemaBase,\n\ttype SimpleTreeSchema,\n\ttype SimpleNodeSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleLeafNodeSchema,\n\ttype SimpleMapNodeSchema,\n\ttype SimpleArrayNodeSchema,\n\ttype SimpleObjectNodeSchema,\n\tnormalizeAllowedTypes,\n\tgetSimpleSchema,\n\tnumberSchema,\n\tstringSchema,\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\ttype ReadonlyArrayNode,\n\ttype InsertableTreeNodeFromAllowedTypes,\n\ttype Input,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tasTreeViewAlpha,\n} from \"./simple-tree/index.js\";\nexport {\n\tSharedTree,\n\tconfiguredSharedTree,\n} from \"./treeFactory.js\";\n\nexport {\n\ttype ICodecOptions,\n\ttype JsonValidator,\n\ttype SchemaValidationFunction,\n\tFluidClientVersion,\n} from \"./codec/index.js\";\nexport { noopValidator } from \"./codec/index.js\";\nexport { typeboxValidator } from \"./external-utilities/index.js\";\n\nexport {\n\ttype Covariant,\n\tBrandedType,\n\ttype RestrictiveReadonlyRecord,\n\ttype RestrictiveStringRecord,\n\ttype MakeNominal,\n\ttype IsUnion,\n\ttype UnionToIntersection,\n\ttype UnionToTuple,\n\ttype PopUnion,\n} from \"./util/index.js\";\n\nimport * as InternalTypes from \"./internalTypes.js\";\nexport {\n\t/**\n\t * Contains types used by the API, but which serve mechanical purposes and do not represent semantic concepts.\n\t * They are used internally to implement API aspects, but are not intended for use by external consumers.\n\t */\n\tInternalTypes,\n};\n\n// Internal/System types:\n// These would be put in `internalTypes` except doing so tents to cause errors like:\n// The inferred type of 'NodeMap' cannot be named without a reference to '../../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\nexport type { MapNodeInsertableData } from \"./simple-tree/index.js\";\n\nexport type { JsonCompatible, JsonCompatibleObject } from \"./util/index.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CA4ByB;AA3BxB,oGAAA,QAAQ,OAAA;AAUR,uGAAA,WAAW,OAAA;AACX,gHAAA,oBAAoB,OAAA;AAKpB,sGAAA,UAAU,OAAA;AACV,4GAAA,gBAAgB,OAAA;AAIhB,kHAAA,sBAAsB,OAAA;AACtB,+GAAA,mBAAmB,OAAA;AACnB,gHAAA,oBAAoB,OAAA;AAcrB,yDAMsC;AALrC,sGAAA,UAAU,OAAA;AACV,mHAAA,uBAAuB,OAAA;AAMxB,mDAoBgC;AAjB/B,sGAAA,UAAU,OAAA;AAGV,mHAAA,uBAAuB,OAAA;AACvB,gGAAA,IAAI,OAAA;AAIJ,oGAAA,QAAQ,OAAA;AAER,qGAAA,SAAS,OAAA;AAGT,sHAAA,0BAA0B,OAAA;AAE1B,qGAAA,SAAS,OAAA;AACT,2GAAA,eAAe,OAAA;AAGhB,mDAkIgC;AAjI/B,yGAAA,aAAa,OAAA;AAEb,oHAAA,wBAAwB,OAAA;AAKxB,iHAAA,qBAAqB,OAAA;AAKrB,yGAAA,aAAa,OAAA;AAQb,qGAAA,SAAS,OAAA;AACT,uGAAA,WAAW,OAAA;AAKX,oGAAA,QAAQ,OAAA;AAoCR,iHAAA,qBAAqB,OAAA;AACrB,iHAAA,qBAAqB,OAAA;AACrB,4BAA4B;AAC5B,qGAAA,SAAS,OAAA;AACT,2GAAA,eAAe,OAAA;AACf,2GAAA,eAAe,OAAA;AAUf,8EAA8E;AAC9E,gHAAA,oBAAoB,OAAA;AACpB,qHAAA,yBAAyB,OAAA;AACzB,wHAAA,4BAA4B,OAAA;AAC5B,YAAY;AACZ,oGAAA,QAAQ,OAAA;AAMR,kHAAA,sBAAsB,OAAA;AACtB,kHAAA,sBAAsB,OAAA;AAgBtB,yGAAA,aAAa,OAAA;AAWb,iHAAA,qBAAqB,OAAA;AACrB,2GAAA,eAAe,OAAA;AACf,wGAAA,YAAY,OAAA;AACZ,wGAAA,YAAY,OAAA;AACZ,yGAAA,aAAa,OAAA;AACb,wGAAA,YAAY,OAAA;AACZ,sGAAA,UAAU,OAAA;AAMV,2GAAA,eAAe,OAAA;AAEhB,mDAG0B;AAFzB,4GAAA,UAAU,OAAA;AACV,sHAAA,oBAAoB,OAAA;AAGrB,6CAK0B;AADzB,8GAAA,kBAAkB,OAAA;AAEnB,6CAAiD;AAAxC,yGAAA,aAAa,OAAA;AACtB,0DAAiE;AAAxD,4GAAA,gBAAgB,OAAA;AAEzB,4CAUyB;AARxB,uGAAA,WAAW,OAAA;AAUZ,kEAAoD;AAMnD,sCAAa","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tEmptyKey,\n\ttype FieldKey,\n\ttype TreeValue,\n\ttype FieldMapObject,\n\ttype NodeData,\n\ttype GenericTreeNode,\n\ttype JsonableTree,\n\ttype GenericFieldsNode,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeFieldStoredSchema,\n\tValueSchema,\n\tTreeNodeStoredSchema,\n\ttype FieldKindIdentifier,\n\ttype TreeTypeSet,\n\ttype TreeStoredSchema,\n\ttype Revertible,\n\tCommitKind,\n\tRevertibleStatus,\n\ttype CommitMetadata,\n\ttype StoredSchemaCollection,\n\ttype ErasedTreeNodeSchemaDataFormat,\n\tObjectNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tLeafNodeStoredSchema,\n\ttype RevertibleFactory,\n\ttype RevertibleAlphaFactory,\n\ttype RevertibleAlpha,\n} from \"./core/index.js\";\nexport { type Brand } from \"./util/index.js\";\n\nexport type {\n\tListeners,\n\tIsListener,\n\tListenable,\n\tOff,\n} from \"@fluidframework/core-interfaces\";\n\nexport {\n\tTreeStatus,\n\tTreeCompressionStrategy,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype TreeIndexNodes,\n} from \"./feature-libraries/index.js\";\n\nexport {\n\ttype ISharedTree,\n\ttype SharedTreeOptions,\n\tForestType,\n\ttype SharedTreeContentSnapshot,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tTree,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransaction,\n\trollback,\n\ttype ForestOptions,\n\tgetBranch,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n\tindependentInitializedView,\n\ttype ViewContent,\n\tTreeAlpha,\n\tindependentView,\n} from \"./shared-tree/index.js\";\n\nexport {\n\tTreeArrayNode,\n\ttype Unhydrated,\n\tIterableTreeArrayContent,\n\tTreeNode,\n\ttype ViewableTree,\n\ttype ITree,\n\ttype TreeNodeSchema,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype ITreeConfigurationOptions,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tSchemaFactory,\n\ttype ImplicitFieldSchema,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeChangeEvents,\n\ttype NodeFromSchema,\n\ttype TreeMapNode,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeLeafValue,\n\tFieldKind,\n\tFieldSchema,\n\ttype FieldSchemaMetadata,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InsertableTypedNode,\n\tNodeKind,\n\ttype TreeObjectNode,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchemaClass,\n\ttype SchemaCompatibilityStatus,\n\ttype FieldProps,\n\ttype InternalTreeNode,\n\ttype WithType,\n\ttype NodeChangedData,\n\t// Types not really intended for public use, but used in links.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// Error: src/simple-tree/objectNode.ts:72:1 - (ae-unresolved-link) The @link reference could not be resolved: The package \"@fluidframework/tree\" does not have an export \"TreeNodeApi\"\n\ttype TreeNodeApi,\n\ttype TreeNodeSchemaCore,\n\t// Types not really intended for public use, but used in inferred types exposed in the public API.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// error TS2742: The inferred type of 'Inventory' cannot be named without a reference to '../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\n\ttype AllowedTypes,\n\ttype TreeObjectNodeUnsafe,\n\ttype InsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\ttype TreeArrayNodeUnsafe,\n\ttype TreeMapNodeUnsafe,\n\ttype InsertableObjectFromSchemaRecordUnsafe,\n\ttype InsertableTreeFieldFromImplicitFieldUnsafe,\n\ttype FieldSchemaUnsafe,\n\ttype TreeNodeSchemaClassUnsafe,\n\ttype InsertableTreeNodeFromAllowedTypesUnsafe,\n\t// System types (not in Internal types for various reasons, like doc links or cannot be named errors).\n\ttype typeSchemaSymbol,\n\ttype TreeNodeSchemaNonClass,\n\t// Recursive Schema APIs\n\ttype ValidateRecursiveSchema,\n\ttype FixRecursiveArraySchema,\n\t// Index APIs\n\ttype SimpleTreeIndex,\n\ttype IdentifierIndex,\n\tcreateSimpleTreeIndex,\n\tcreateIdentifierIndex,\n\t// experimental @alpha APIs:\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttype UnsafeUnknownSchema,\n\ttype TreeViewAlpha,\n\ttype InsertableField,\n\ttype Insertable,\n\ttype InsertableContent,\n\ttype FactoryContent,\n\ttype FactoryContentObject,\n\ttype ReadableField,\n\ttype ReadSchema,\n\t// test recursive schema for checking that d.ts files handles schema correctly\n\ttest_RecursiveObject,\n\ttest_RecursiveObject_base,\n\ttest_RecursiveObjectPojoMode,\n\t// Beta APIs\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n\ttype VerboseTreeNode,\n\ttype EncodeOptions,\n\ttype ParseOptions,\n\ttype VerboseTree,\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n\ttype ConciseTree,\n\t// Back to normal types\n\ttype JsonTreeSchema,\n\ttype JsonSchemaId,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonLeafNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonObjectNodeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonSchemaType,\n\ttype JsonLeafSchemaType,\n\tgetJsonSchema,\n\ttype LazyItem,\n\ttype Unenforced,\n\ttype SimpleNodeSchemaBase,\n\ttype SimpleTreeSchema,\n\ttype SimpleNodeSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleLeafNodeSchema,\n\ttype SimpleMapNodeSchema,\n\ttype SimpleArrayNodeSchema,\n\ttype SimpleObjectNodeSchema,\n\tnormalizeAllowedTypes,\n\tgetSimpleSchema,\n\tnumberSchema,\n\tstringSchema,\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\ttype ReadonlyArrayNode,\n\ttype InsertableTreeNodeFromAllowedTypes,\n\ttype Input,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tasTreeViewAlpha,\n} from \"./simple-tree/index.js\";\nexport {\n\tSharedTree,\n\tconfiguredSharedTree,\n} from \"./treeFactory.js\";\n\nexport {\n\ttype ICodecOptions,\n\ttype JsonValidator,\n\ttype SchemaValidationFunction,\n\tFluidClientVersion,\n} from \"./codec/index.js\";\nexport { noopValidator } from \"./codec/index.js\";\nexport { typeboxValidator } from \"./external-utilities/index.js\";\n\nexport {\n\ttype Covariant,\n\tBrandedType,\n\ttype RestrictiveReadonlyRecord,\n\ttype RestrictiveStringRecord,\n\ttype MakeNominal,\n\ttype IsUnion,\n\ttype UnionToIntersection,\n\ttype UnionToTuple,\n\ttype PopUnion,\n} from \"./util/index.js\";\n\nimport * as InternalTypes from \"./internalTypes.js\";\nexport {\n\t/**\n\t * Contains types used by the API, but which serve mechanical purposes and do not represent semantic concepts.\n\t * They are used internally to implement API aspects, but are not intended for use by external consumers.\n\t */\n\tInternalTypes,\n};\n\n// Internal/System types:\n// These would be put in `internalTypes` except doing so tents to cause errors like:\n// The inferred type of 'NodeMap' cannot be named without a reference to '../../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\nexport type { MapNodeInsertableData } from \"./simple-tree/index.js\";\n\nexport type { JsonCompatible, JsonCompatibleObject } from \"./util/index.js\";\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/tree";
8
- export declare const pkgVersion = "2.10.0";
8
+ export declare const pkgVersion = "2.11.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/tree";
11
- exports.pkgVersion = "2.10.0";
11
+ exports.pkgVersion = "2.11.0";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sBAAsB,CAAC;AACjC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tree\";\nexport const pkgVersion = \"2.10.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sBAAsB,CAAC;AACjC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tree\";\nexport const pkgVersion = \"2.11.0\";\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { type ISharedTree, SharedTreeFactory, type SharedTreeOptions, SharedTree, getBranch, ForestType, type SharedTreeContentSnapshot, type SharedTreeFormatOptions, SharedTreeFormatVersion, buildConfiguredForest, defaultSharedTreeOptions, type ForestOptions, } from "./sharedTree.js";
6
- export { createTreeCheckout, TreeCheckout, type ITreeCheckout, runSynchronous, type CheckoutEvents, type ITransaction, type ITreeCheckoutFork, type BranchableTree, type TreeBranchFork, } from "./treeCheckout.js";
6
+ export { createTreeCheckout, TreeCheckout, type ITreeCheckout, type CheckoutEvents, type ITreeCheckoutFork, type BranchableTree, type TreeBranchFork, } from "./treeCheckout.js";
7
7
  export { type TreeStoredContent } from "./schematizeTree.js";
8
8
  export { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
9
9
  export { CheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,WAAW,EAChB,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,UAAU,EACV,SAAS,EACT,UAAU,EACV,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,aAAa,GAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,kBAAkB,EAClB,YAAY,EACZ,KAAK,aAAa,EAClB,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,cAAc,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EACN,OAAO,IAAI,IAAI,EACf,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,QAAQ,GACR,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EACN,0BAA0B,EAC1B,KAAK,WAAW,EAChB,eAAe,GACf,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,WAAW,EAChB,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,UAAU,EACV,SAAS,EACT,UAAU,EACV,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,aAAa,GAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,kBAAkB,EAClB,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,cAAc,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EACN,OAAO,IAAI,IAAI,EACf,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,QAAQ,GACR,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EACN,0BAA0B,EAC1B,KAAK,WAAW,EAChB,eAAe,GACf,MAAM,sBAAsB,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.independentView = exports.independentInitializedView = exports.TreeAlpha = exports.rollback = exports.Tree = exports.CheckoutFlexTreeView = exports.SchematizingSimpleTreeView = exports.runSynchronous = exports.TreeCheckout = exports.createTreeCheckout = exports.defaultSharedTreeOptions = exports.buildConfiguredForest = exports.SharedTreeFormatVersion = exports.ForestType = exports.getBranch = exports.SharedTree = exports.SharedTreeFactory = void 0;
7
+ exports.independentView = exports.independentInitializedView = exports.TreeAlpha = exports.rollback = exports.Tree = exports.CheckoutFlexTreeView = exports.SchematizingSimpleTreeView = exports.TreeCheckout = exports.createTreeCheckout = exports.defaultSharedTreeOptions = exports.buildConfiguredForest = exports.SharedTreeFormatVersion = exports.ForestType = exports.getBranch = exports.SharedTree = exports.SharedTreeFactory = void 0;
8
8
  var sharedTree_js_1 = require("./sharedTree.js");
9
9
  Object.defineProperty(exports, "SharedTreeFactory", { enumerable: true, get: function () { return sharedTree_js_1.SharedTreeFactory; } });
10
10
  Object.defineProperty(exports, "SharedTree", { enumerable: true, get: function () { return sharedTree_js_1.SharedTree; } });
@@ -16,7 +16,6 @@ Object.defineProperty(exports, "defaultSharedTreeOptions", { enumerable: true, g
16
16
  var treeCheckout_js_1 = require("./treeCheckout.js");
17
17
  Object.defineProperty(exports, "createTreeCheckout", { enumerable: true, get: function () { return treeCheckout_js_1.createTreeCheckout; } });
18
18
  Object.defineProperty(exports, "TreeCheckout", { enumerable: true, get: function () { return treeCheckout_js_1.TreeCheckout; } });
19
- Object.defineProperty(exports, "runSynchronous", { enumerable: true, get: function () { return treeCheckout_js_1.runSynchronous; } });
20
19
  var schematizingTreeView_js_1 = require("./schematizingTreeView.js");
21
20
  Object.defineProperty(exports, "SchematizingSimpleTreeView", { enumerable: true, get: function () { return schematizingTreeView_js_1.SchematizingSimpleTreeView; } });
22
21
  var checkoutFlexTreeView_js_1 = require("./checkoutFlexTreeView.js");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAayB;AAXxB,kHAAA,iBAAiB,OAAA;AAEjB,2GAAA,UAAU,OAAA;AACV,0GAAA,SAAS,OAAA;AACT,2GAAA,UAAU,OAAA;AAGV,wHAAA,uBAAuB,OAAA;AACvB,sHAAA,qBAAqB,OAAA;AACrB,yHAAA,wBAAwB,OAAA;AAIzB,qDAU2B;AAT1B,qHAAA,kBAAkB,OAAA;AAClB,+GAAA,YAAY,OAAA;AAEZ,iHAAA,cAAc,OAAA;AAUf,qEAAuE;AAA9D,qIAAA,0BAA0B,OAAA;AAEnC,qEAAiE;AAAxD,+HAAA,oBAAoB,OAAA;AAI7B,2CAOsB;AANrB,kGAAA,OAAO,OAAQ;AAKf,sGAAA,QAAQ,OAAA;AAGT,qDAA8C;AAArC,4GAAA,SAAS,OAAA;AAElB,2DAI8B;AAH7B,gIAAA,0BAA0B,OAAA;AAE1B,qHAAA,eAAe,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ISharedTree,\n\tSharedTreeFactory,\n\ttype SharedTreeOptions,\n\tSharedTree,\n\tgetBranch,\n\tForestType,\n\ttype SharedTreeContentSnapshot,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tbuildConfiguredForest,\n\tdefaultSharedTreeOptions,\n\ttype ForestOptions,\n} from \"./sharedTree.js\";\n\nexport {\n\tcreateTreeCheckout,\n\tTreeCheckout,\n\ttype ITreeCheckout,\n\trunSynchronous,\n\ttype CheckoutEvents,\n\ttype ITransaction,\n\ttype ITreeCheckoutFork,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n} from \"./treeCheckout.js\";\n\nexport { type TreeStoredContent } from \"./schematizeTree.js\";\n\nexport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\n\nexport { CheckoutFlexTreeView } from \"./checkoutFlexTreeView.js\";\n\nexport type { ISharedTreeEditor, ISchemaEditor } from \"./sharedTreeEditBuilder.js\";\n\nexport {\n\ttreeApi as Tree,\n\ttype TreeApi,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransaction,\n\trollback,\n} from \"./treeApi.js\";\n\nexport { TreeAlpha } from \"./treeApiAlpha.js\";\n\nexport {\n\tindependentInitializedView,\n\ttype ViewContent,\n\tindependentView,\n} from \"./independentView.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAayB;AAXxB,kHAAA,iBAAiB,OAAA;AAEjB,2GAAA,UAAU,OAAA;AACV,0GAAA,SAAS,OAAA;AACT,2GAAA,UAAU,OAAA;AAGV,wHAAA,uBAAuB,OAAA;AACvB,sHAAA,qBAAqB,OAAA;AACrB,yHAAA,wBAAwB,OAAA;AAIzB,qDAQ2B;AAP1B,qHAAA,kBAAkB,OAAA;AAClB,+GAAA,YAAY,OAAA;AAUb,qEAAuE;AAA9D,qIAAA,0BAA0B,OAAA;AAEnC,qEAAiE;AAAxD,+HAAA,oBAAoB,OAAA;AAI7B,2CAOsB;AANrB,kGAAA,OAAO,OAAQ;AAKf,sGAAA,QAAQ,OAAA;AAGT,qDAA8C;AAArC,4GAAA,SAAS,OAAA;AAElB,2DAI8B;AAH7B,gIAAA,0BAA0B,OAAA;AAE1B,qHAAA,eAAe,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ISharedTree,\n\tSharedTreeFactory,\n\ttype SharedTreeOptions,\n\tSharedTree,\n\tgetBranch,\n\tForestType,\n\ttype SharedTreeContentSnapshot,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tbuildConfiguredForest,\n\tdefaultSharedTreeOptions,\n\ttype ForestOptions,\n} from \"./sharedTree.js\";\n\nexport {\n\tcreateTreeCheckout,\n\tTreeCheckout,\n\ttype ITreeCheckout,\n\ttype CheckoutEvents,\n\ttype ITreeCheckoutFork,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n} from \"./treeCheckout.js\";\n\nexport { type TreeStoredContent } from \"./schematizeTree.js\";\n\nexport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\n\nexport { CheckoutFlexTreeView } from \"./checkoutFlexTreeView.js\";\n\nexport type { ISharedTreeEditor, ISchemaEditor } from \"./sharedTreeEditBuilder.js\";\n\nexport {\n\ttreeApi as Tree,\n\ttype TreeApi,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransaction,\n\trollback,\n} from \"./treeApi.js\";\n\nexport { TreeAlpha } from \"./treeApiAlpha.js\";\n\nexport {\n\tindependentInitializedView,\n\ttype ViewContent,\n\tindependentView,\n} from \"./independentView.js\";\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type HasListeners, type IEmitter, type Listenable } from "../events/index.js";
5
+ import type { HasListeners, IEmitter, Listenable } from "@fluidframework/core-interfaces/internal";
6
6
  import { type NodeKeyManager, type FullSchemaPolicy } from "../feature-libraries/index.js";
7
7
  import { type ImplicitFieldSchema, type SchemaCompatibilityStatus, type TreeView, type TreeViewEvents, ViewSchema, type TreeViewConfiguration, type TreeViewAlpha, type InsertableField, type ReadableField, type ReadSchema, type UnsafeUnknownSchema, type TreeBranch, type TreeBranchEvents } from "../simple-tree/index.js";
8
8
  import { Breakable, type WithBreakable } from "../util/index.js";
@@ -78,6 +78,12 @@ export declare class SchematizingSimpleTreeView<in out TRootSchema extends Impli
78
78
  merge(context: TreeBranch, disposeMerged?: boolean): void;
79
79
  rebaseOnto(context: TreeBranch): void;
80
80
  }
81
+ /**
82
+ * Get the {@link TreeCheckout} associated with a given {@link TreeBranch}.
83
+ * @remarks Currently, all contexts are also {@link SchematizingSimpleTreeView}s.
84
+ * Other checkout implementations (e.g. not associated with a view) may be supported in the future.
85
+ */
86
+ export declare function getCheckout(context: TreeBranch): TreeCheckout;
81
87
  /**
82
88
  * Creates a view that self-disposes whenenever the stored schema changes.
83
89
  * This may only be called when the schema is already known to be compatible (typically via ensureSchema).
@@ -1 +1 @@
1
- {"version":3,"file":"schematizingTreeView.d.ts","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,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a;IAWrB,OAAO,CAAC,WAAW;IAUnB,IAAW,aAAa,IAAI,yBAAyB,CAKpD;IAEM,OAAO,IAAI,IAAI;IAYtB,IAAW,IAAI,IAAI,aAAa,CAAC,WAAW,CAAC,CAS5C;IAED,IAAW,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,WAAW,CAAC,EAapD;IAIM,IAAI,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC;IAInE,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,aAAa,UAAO,GAAG,IAAI;IAItD,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;CAK5C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,YAAY,CAK7D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,aAAa,EACvB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,MAAM,IAAI,EACrB,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,gBAAgB,GAC5B,oBAAoB,CAiBtB"}
@@ -42,17 +42,17 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
42
42
  return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.requireSchema = exports.SchematizingSimpleTreeView = exports.ViewSlot = void 0;
45
+ exports.requireSchema = exports.getCheckout = exports.SchematizingSimpleTreeView = exports.ViewSlot = void 0;
46
+ const client_utils_1 = require("@fluid-internal/client-utils");
46
47
  const internal_1 = require("@fluidframework/core-utils/internal");
47
48
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
48
49
  const index_js_1 = require("../core/index.js");
49
- const index_js_2 = require("../events/index.js");
50
- const index_js_3 = require("../feature-libraries/index.js");
51
- const index_js_4 = require("../simple-tree/index.js");
52
- const index_js_5 = require("../util/index.js");
50
+ const index_js_2 = require("../feature-libraries/index.js");
51
+ const index_js_3 = require("../simple-tree/index.js");
52
+ const index_js_4 = require("../util/index.js");
53
53
  const schematizeTree_js_1 = require("./schematizeTree.js");
54
54
  const checkoutFlexTreeView_js_1 = require("./checkoutFlexTreeView.js");
55
- const index_js_6 = require("../simple-tree/index.js");
55
+ const index_js_5 = require("../simple-tree/index.js");
56
56
  /**
57
57
  * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already
58
58
  * exists and error if creating a second.
@@ -62,18 +62,18 @@ exports.ViewSlot = (0, index_js_1.anchorSlot)();
62
62
  * Implementation of TreeView wrapping a FlexTreeView.
63
63
  */
64
64
  let SchematizingSimpleTreeView = (() => {
65
- let _classDecorators = [index_js_5.breakingClass];
65
+ let _classDecorators = [index_js_4.breakingClass];
66
66
  let _classDescriptor;
67
67
  let _classExtraInitializers = [];
68
68
  let _classThis;
69
69
  var SchematizingSimpleTreeView = _classThis = class {
70
- constructor(checkout, config, nodeKeyManager, breaker = new index_js_5.Breakable("SchematizingSimpleTreeView"), onDispose) {
70
+ constructor(checkout, config, nodeKeyManager, breaker = new index_js_4.Breakable("SchematizingSimpleTreeView"), onDispose) {
71
71
  this.checkout = checkout;
72
72
  this.config = config;
73
73
  this.nodeKeyManager = nodeKeyManager;
74
74
  this.breaker = breaker;
75
75
  this.onDispose = onDispose;
76
- this.events = (0, index_js_2.createEmitter)();
76
+ this.events = (0, client_utils_1.createEmitter)();
77
77
  this.unregisterCallbacks = new Set();
78
78
  this.disposed = false;
79
79
  /**
@@ -88,12 +88,12 @@ let SchematizingSimpleTreeView = (() => {
88
88
  }
89
89
  checkout.forest.anchors.slots.set(exports.ViewSlot, this);
90
90
  const policy = {
91
- ...index_js_3.defaultSchemaPolicy,
91
+ ...index_js_2.defaultSchemaPolicy,
92
92
  validateSchema: config.enableSchemaValidation,
93
93
  };
94
- this.rootFieldSchema = (0, index_js_4.normalizeFieldSchema)(config.schema);
95
- this.schemaPolicy = index_js_3.defaultSchemaPolicy;
96
- this.viewSchema = new index_js_4.ViewSchema(policy, {}, (0, index_js_4.toStoredSchema)(this.rootFieldSchema));
94
+ this.rootFieldSchema = (0, index_js_3.normalizeFieldSchema)(config.schema);
95
+ this.schemaPolicy = index_js_2.defaultSchemaPolicy;
96
+ this.viewSchema = new index_js_3.ViewSchema(policy, {}, (0, index_js_3.toStoredSchema)(this.rootFieldSchema));
97
97
  // This must be initialized before `update` can be called.
98
98
  this.currentCompatibility = {
99
99
  canView: false,
@@ -108,7 +108,7 @@ let SchematizingSimpleTreeView = (() => {
108
108
  }));
109
109
  }
110
110
  hasRootSchema(schema) {
111
- return (0, index_js_6.areImplicitFieldSchemaEqual)(this.rootFieldSchema, schema);
111
+ return (0, index_js_5.areImplicitFieldSchemaEqual)(this.rootFieldSchema, schema);
112
112
  }
113
113
  get schema() {
114
114
  return this.config.schema;
@@ -120,17 +120,17 @@ let SchematizingSimpleTreeView = (() => {
120
120
  throw new internal_2.UsageError("Tree cannot be initialized more than once.");
121
121
  }
122
122
  this.runSchemaEdit(() => {
123
- const mapTree = (0, index_js_4.mapTreeFromNodeData)(content, this.rootFieldSchema, this.nodeKeyManager, {
123
+ const mapTree = (0, index_js_3.mapTreeFromNodeData)(content, this.rootFieldSchema, this.nodeKeyManager, {
124
124
  schema: this.checkout.storedSchema,
125
125
  policy: {
126
- ...index_js_3.defaultSchemaPolicy,
126
+ ...index_js_2.defaultSchemaPolicy,
127
127
  validateSchema: this.config.enableSchemaValidation,
128
128
  },
129
129
  });
130
- (0, index_js_4.prepareContentForHydration)(mapTree, this.checkout.forest);
130
+ (0, index_js_3.prepareContentForHydration)(mapTree, this.checkout.forest);
131
131
  (0, schematizeTree_js_1.initialize)(this.checkout, {
132
132
  schema: this.viewSchema.schema,
133
- initialTree: mapTree === undefined ? undefined : (0, index_js_3.cursorForMapTreeNode)(mapTree),
133
+ initialTree: mapTree === undefined ? undefined : (0, index_js_2.cursorForMapTreeNode)(mapTree),
134
134
  });
135
135
  });
136
136
  }
@@ -181,7 +181,7 @@ let SchematizingSimpleTreeView = (() => {
181
181
  */
182
182
  update() {
183
183
  this.disposeView();
184
- const compatibility = (0, index_js_4.comparePersistedSchemaInternal)(this.checkout.storedSchema, this.viewSchema, (0, schematizeTree_js_1.canInitialize)(this.checkout));
184
+ const compatibility = (0, index_js_3.comparePersistedSchemaInternal)(this.checkout.storedSchema, this.viewSchema, (0, schematizeTree_js_1.canInitialize)(this.checkout));
185
185
  let lastRoot = this.compatibility.canView && this.view !== undefined ? this.root : undefined;
186
186
  this.currentCompatibility = compatibility;
187
187
  if (compatibility.canView) {
@@ -211,18 +211,18 @@ let SchematizingSimpleTreeView = (() => {
211
211
  };
212
212
  const view = requireSchema(this.checkout, this.viewSchema, onViewDispose, this.nodeKeyManager, this.schemaPolicy);
213
213
  this.view = view;
214
- (0, internal_1.assert)(!this.checkout.forest.anchors.slots.has(index_js_6.SimpleContextSlot), 0xa47 /* extra simple tree context */);
215
- this.checkout.forest.anchors.slots.set(index_js_6.SimpleContextSlot, new index_js_6.HydratedContext(this.rootFieldSchema.allowedTypeSet, view.context));
214
+ (0, internal_1.assert)(!this.checkout.forest.anchors.slots.has(index_js_5.SimpleContextSlot), 0xa47 /* extra simple tree context */);
215
+ this.checkout.forest.anchors.slots.set(index_js_5.SimpleContextSlot, new index_js_5.HydratedContext(this.rootFieldSchema.allowedTypeSet, view.context));
216
216
  const unregister = this.checkout.storedSchema.events.on("afterSchemaChange", () => {
217
217
  unregister();
218
218
  this.unregisterCallbacks.delete(unregister);
219
- view[index_js_5.disposeSymbol]();
219
+ view[index_js_4.disposeSymbol]();
220
220
  });
221
221
  this.unregisterCallbacks.add(unregister);
222
222
  }
223
223
  else {
224
224
  this.view = undefined;
225
- this.checkout.forest.anchors.slots.delete(index_js_6.SimpleContextSlot);
225
+ this.checkout.forest.anchors.slots.delete(index_js_5.SimpleContextSlot);
226
226
  const unregister = this.checkout.storedSchema.events.on("afterSchemaChange", () => {
227
227
  unregister();
228
228
  this.unregisterCallbacks.delete(unregister);
@@ -248,12 +248,12 @@ let SchematizingSimpleTreeView = (() => {
248
248
  }
249
249
  disposeView() {
250
250
  if (this.view !== undefined) {
251
- this.view[index_js_5.disposeSymbol]();
251
+ this.view[index_js_4.disposeSymbol]();
252
252
  this.view = undefined;
253
- this.checkout.forest.anchors.slots.delete(index_js_6.SimpleContextSlot);
253
+ this.checkout.forest.anchors.slots.delete(index_js_5.SimpleContextSlot);
254
254
  this.unregisterCallbacks.forEach((unregister) => unregister());
255
255
  }
256
- this.checkout.forest.anchors.slots.delete(index_js_6.SimpleContextSlot);
256
+ this.checkout.forest.anchors.slots.delete(index_js_5.SimpleContextSlot);
257
257
  }
258
258
  get compatibility() {
259
259
  if (!this.currentCompatibility) {
@@ -278,7 +278,7 @@ let SchematizingSimpleTreeView = (() => {
278
278
  throw new internal_2.UsageError("Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.");
279
279
  }
280
280
  const view = this.getView();
281
- return (0, index_js_4.getTreeNodeForField)(view.flexTree);
281
+ return (0, index_js_3.getTreeNodeForField)(view.flexTree);
282
282
  }
283
283
  set root(newRoot) {
284
284
  this.breaker.use();
@@ -286,7 +286,7 @@ let SchematizingSimpleTreeView = (() => {
286
286
  throw new internal_2.UsageError("Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.");
287
287
  }
288
288
  const view = this.getView();
289
- (0, index_js_4.setField)(view.context.root, this.rootFieldSchema, newRoot);
289
+ (0, index_js_3.setField)(view.context.root, this.rootFieldSchema, newRoot);
290
290
  }
291
291
  // #region Branching
292
292
  fork() {
@@ -321,20 +321,21 @@ function getCheckout(context) {
321
321
  }
322
322
  throw new internal_2.UsageError("Unsupported context implementation");
323
323
  }
324
+ exports.getCheckout = getCheckout;
324
325
  /**
325
326
  * Creates a view that self-disposes whenenever the stored schema changes.
326
327
  * This may only be called when the schema is already known to be compatible (typically via ensureSchema).
327
328
  */
328
329
  function requireSchema(checkout, viewSchema, onDispose, nodeKeyManager, schemaPolicy) {
329
330
  const slots = checkout.forest.anchors.slots;
330
- (0, internal_1.assert)(!slots.has(index_js_3.ContextSlot), 0x8c2 /* Cannot create second view from checkout */);
331
+ (0, internal_1.assert)(!slots.has(index_js_2.ContextSlot), 0x8c2 /* Cannot create second view from checkout */);
331
332
  {
332
333
  const compatibility = viewSchema.checkCompatibility(checkout.storedSchema);
333
334
  (0, internal_1.assert)(compatibility.write === index_js_1.Compatibility.Compatible &&
334
335
  compatibility.read === index_js_1.Compatibility.Compatible, 0x8c3 /* requireSchema invoked with incompatible schema */);
335
336
  }
336
337
  const view = new checkoutFlexTreeView_js_1.CheckoutFlexTreeView(checkout, schemaPolicy, nodeKeyManager, onDispose);
337
- (0, internal_1.assert)(slots.has(index_js_3.ContextSlot), 0x90d /* Context should be tracked in slot */);
338
+ (0, internal_1.assert)(slots.has(index_js_2.ContextSlot), 0x90d /* Context should be tracked in slot */);
338
339
  return view;
339
340
  }
340
341
  exports.requireSchema = requireSchema;
@@ -1 +1 @@
1
- {"version":3,"file":"schematizingTreeView.js","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAEtE,+CAK0B;AAC1B,iDAK4B;AAC5B,4DAMuC;AACvC,sDAuBiC;AACjC,+CAA+F;AAE/F,2DAA8E;AAE9E,uEAAiE;AACjE,sDAIiC;AACjC;;;GAGG;AACU,QAAA,QAAQ,GAAG,IAAA,qBAAU,GAAiC,CAAC;AAEpE;;GAEG;IAEU,0BAA0B;4BADtC,wBAAa;;;;;QAoCb,YACiB,QAAsB,EACtB,MAAsD,EACtD,cAA8B,EAC9B,UAAqB,IAAI,oBAAS,CAAC,4BAA4B,CAAC,EAC/D,SAAsB;YAJvB,aAAQ,GAAR,QAAQ,CAAc;YACtB,WAAM,GAAN,MAAM,CAAgD;YACtD,mBAAc,GAAd,cAAc,CA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AAuC,CAAC,CAAC;IAE9E,OAAO,IAAI,CAAC;AACb,CAAC;AAvBD,sCAuBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tAllowedUpdateType,\n\tanchorSlot,\n\tCompatibility,\n\ttype SchemaPolicy,\n} from \"../core/index.js\";\nimport {\n\ttype HasListeners,\n\ttype IEmitter,\n\ttype Listenable,\n\tcreateEmitter,\n} from \"../events/index.js\";\nimport {\n\ttype NodeKeyManager,\n\tdefaultSchemaPolicy,\n\tContextSlot,\n\tcursorForMapTreeNode,\n\ttype FullSchemaPolicy,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype FieldSchema,\n\ttype ImplicitFieldSchema,\n\ttype SchemaCompatibilityStatus,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tgetTreeNodeForField,\n\tsetField,\n\tnormalizeFieldSchema,\n\tViewSchema,\n\ttype InsertableContent,\n\ttype TreeViewConfiguration,\n\tmapTreeFromNodeData,\n\tprepareContentForHydration,\n\tcomparePersistedSchemaInternal,\n\ttoStoredSchema,\n\ttype TreeViewAlpha,\n\ttype InsertableField,\n\ttype ReadableField,\n\ttype ReadSchema,\n\ttype UnsafeUnknownSchema,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n} from \"../simple-tree/index.js\";\nimport { Breakable, breakingClass, disposeSymbol, type WithBreakable } from \"../util/index.js\";\n\nimport { canInitialize, ensureSchema, initialize } from \"./schematizeTree.js\";\nimport type { ITreeCheckout, TreeCheckout } from \"./treeCheckout.js\";\nimport { CheckoutFlexTreeView } from \"./checkoutFlexTreeView.js\";\nimport {\n\tHydratedContext,\n\tSimpleContextSlot,\n\tareImplicitFieldSchemaEqual,\n} from \"../simple-tree/index.js\";\n/**\n * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already\n * exists and error if creating a second.\n */\nexport const ViewSlot = anchorSlot<TreeView<ImplicitFieldSchema>>();\n\n/**\n * Implementation of TreeView wrapping a FlexTreeView.\n */\n@breakingClass\nexport class SchematizingSimpleTreeView<\n\tin out TRootSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n> implements TreeBranch, TreeViewAlpha<TRootSchema>, WithBreakable\n{\n\t/**\n\t * The view is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.\n\t *\n\t * The view schema may be incompatible with the stored schema. Use `compatibility` to check.\n\t */\n\tprivate view: CheckoutFlexTreeView | undefined;\n\n\t/**\n\t * Undefined iff uninitialized or disposed.\n\t */\n\tprivate currentCompatibility: SchemaCompatibilityStatus | undefined;\n\tprivate readonly schemaPolicy: SchemaPolicy;\n\tpublic readonly events: Listenable<TreeViewEvents & TreeBranchEvents> &\n\t\tIEmitter<TreeViewEvents & TreeBranchEvents> &\n\t\tHasListeners<TreeViewEvents & TreeBranchEvents> = createEmitter();\n\n\tprivate readonly viewSchema: ViewSchema;\n\n\tprivate readonly unregisterCallbacks = new Set<() => void>();\n\n\tpublic disposed = false;\n\t/**\n\t * This is set to true while an edit impacting the document schema is in progress.\n\t * This allows suppressing extra rootChanged / schemaChanged events until the edit concludes.\n\t * This is useful especially for some initialization edits, since document initialization can involve transient schemas\n\t * which are implementation details and should not be exposed to the user.\n\t */\n\tprivate midUpgrade = false;\n\n\tprivate readonly rootFieldSchema: FieldSchema;\n\n\tpublic constructor(\n\t\tpublic readonly checkout: TreeCheckout,\n\t\tpublic readonly config: TreeViewConfiguration<ReadSchema<TRootSchema>>,\n\t\tpublic readonly nodeKeyManager: NodeKeyManager,\n\t\tpublic readonly breaker: Breakable = new Breakable(\"SchematizingSimpleTreeView\"),\n\t\tprivate readonly onDispose?: () => void,\n\t) {\n\t\tif (checkout.forest.anchors.slots.has(ViewSlot)) {\n\t\t\tthrow new UsageError(\"Cannot create a second tree view from the same checkout\");\n\t\t}\n\t\tcheckout.forest.anchors.slots.set(ViewSlot, this);\n\n\t\tconst policy = {\n\t\t\t...defaultSchemaPolicy,\n\t\t\tvalidateSchema: config.enableSchemaValidation,\n\t\t};\n\t\tthis.rootFieldSchema = normalizeFieldSchema(config.schema);\n\t\tthis.schemaPolicy = defaultSchemaPolicy;\n\n\t\tthis.viewSchema = new ViewSchema(policy, {}, toStoredSchema(this.rootFieldSchema));\n\t\t// This must be initialized before `update` can be called.\n\t\tthis.currentCompatibility = {\n\t\t\tcanView: false,\n\t\t\tcanUpgrade: true,\n\t\t\tisEquivalent: false,\n\t\t\tcanInitialize: true,\n\t\t};\n\t\tthis.update();\n\n\t\tthis.unregisterCallbacks.add(\n\t\t\tthis.checkout.events.on(\"changed\", (data, getRevertible) => {\n\t\t\t\tthis.events.emit(\"changed\", data, getRevertible);\n\t\t\t\tthis.events.emit(\"commitApplied\", data, getRevertible);\n\t\t\t}),\n\t\t);\n\t}\n\n\tpublic hasRootSchema<TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t): this is TreeViewAlpha<TSchema> {\n\t\treturn areImplicitFieldSchemaEqual(this.rootFieldSchema, schema);\n\t}\n\n\tpublic get schema(): ReadSchema<TRootSchema> {\n\t\treturn this.config.schema;\n\t}\n\n\tpublic initialize(content: InsertableField<TRootSchema>): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (!compatibility.canInitialize) {\n\t\t\tthrow new UsageError(\"Tree cannot be initialized more than once.\");\n\t\t}\n\n\t\tthis.runSchemaEdit(() => {\n\t\t\tconst mapTree = mapTreeFromNodeData(\n\t\t\t\tcontent as InsertableContent | undefined,\n\t\t\t\tthis.rootFieldSchema,\n\t\t\t\tthis.nodeKeyManager,\n\t\t\t\t{\n\t\t\t\t\tschema: this.checkout.storedSchema,\n\t\t\t\t\tpolicy: {\n\t\t\t\t\t\t...defaultSchemaPolicy,\n\t\t\t\t\t\tvalidateSchema: this.config.enableSchemaValidation,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tprepareContentForHydration(mapTree, this.checkout.forest);\n\t\t\tinitialize(this.checkout, {\n\t\t\t\tschema: this.viewSchema.schema,\n\t\t\t\tinitialTree: mapTree === undefined ? undefined : cursorForMapTreeNode(mapTree),\n\t\t\t});\n\t\t});\n\t}\n\n\tpublic upgradeSchema(): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (compatibility.isEquivalent) {\n\t\t\t// No-op\n\t\t\treturn;\n\t\t}\n\n\t\tif (!compatibility.canUpgrade) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing stored schema can not be upgraded (see TreeView.compatibility.canUpgrade).\",\n\t\t\t);\n\t\t}\n\n\t\tthis.runSchemaEdit(() => {\n\t\t\tconst result = ensureSchema(\n\t\t\t\tthis.viewSchema,\n\t\t\t\tAllowedUpdateType.SchemaCompatible,\n\t\t\t\tthis.checkout,\n\t\t\t\t{\n\t\t\t\t\tschema: this.viewSchema.schema,\n\t\t\t\t\tinitialTree: undefined,\n\t\t\t\t},\n\t\t\t);\n\t\t\tassert(result, 0x8bf /* Schema upgrade should always work if canUpgrade is set. */);\n\t\t});\n\t}\n\n\t/**\n\t * Gets the view. Throws when disposed.\n\t */\n\tpublic getView(): CheckoutFlexTreeView {\n\t\tthis.ensureUndisposed();\n\t\tassert(this.view !== undefined, 0x8c0 /* unexpected getViewOrError */);\n\t\treturn this.view;\n\t}\n\n\tprivate ensureUndisposed(): void {\n\t\tif (this.disposed) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t}\n\n\tprivate failDisposed(): never {\n\t\tthrow new UsageError(\"Accessed a disposed TreeView.\");\n\t}\n\n\t/**\n\t * Updates `this.view` and the current compatibility status.\n\t * Invoked during initialization and when `this.view` needs to be replaced due to stored schema changes.\n\t * Handles re-registering for events to call update in the future.\n\t * @remarks\n\t * This does not check if the view needs to be replaced, it replaces it unconditionally:\n\t * callers should do any checking to detect if it's really needed before calling `update`.\n\t * @privateRemarks\n\t * This implementation avoids making any edits, which prevents it from being invoked reentrantly.\n\t * If implicit initialization (or some other edit) is desired, it should be done outside of this method.\n\t */\n\tprivate update(): void {\n\t\tthis.disposeView();\n\n\t\tconst compatibility = comparePersistedSchemaInternal(\n\t\t\tthis.checkout.storedSchema,\n\t\t\tthis.viewSchema,\n\t\t\tcanInitialize(this.checkout),\n\t\t);\n\n\t\tlet lastRoot =\n\t\t\tthis.compatibility.canView && this.view !== undefined ? this.root : undefined;\n\t\tthis.currentCompatibility = compatibility;\n\n\t\tif (compatibility.canView) {\n\t\t\t// Trigger \"rootChanged\" if the root changes in the future.\n\t\t\t// Currently there is no good way to do this as FlexTreeField has no events for changes.\n\t\t\t// this.view.flexTree.on(????)\n\t\t\t// As a workaround for the above, trigger \"rootChanged\" in \"afterBatch\"\n\t\t\t// which isn't the correct time since we normally do events during the batch when the forest is modified, but its better than nothing.\n\t\t\t// TODO: provide a better event: this.view.flexTree.on(????)\n\t\t\tconst cleanupCheckOutEvents = this.checkout.events.on(\"afterBatch\", () => {\n\t\t\t\t// In the initialization flow, this event is raised before the correct compatibility w.r.t the new schema is calculated.\n\t\t\t\t// Accessing `this.root` in that case can throw. It's OK to ignore this because:\n\t\t\t\t// - The rootChanged event will already be raised at the end of the current upgrade\n\t\t\t\t// - It doesn't matter that `lastRoot` isn't updated in this case, because `update` will be called again before the upgrade\n\t\t\t\t// completes (at which point this callback and the `lastRoot` captured here will be out of scope anyway)\n\t\t\t\tif (!this.midUpgrade && lastRoot !== this.root) {\n\t\t\t\t\tlastRoot = this.root;\n\t\t\t\t\tthis.events.emit(\"rootChanged\");\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tconst onViewDispose = (): void => {\n\t\t\t\tcleanupCheckOutEvents();\n\t\t\t\tthis.view = undefined;\n\t\t\t\tif (!this.disposed) {\n\t\t\t\t\tthis.update();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst view = requireSchema(\n\t\t\t\tthis.checkout,\n\t\t\t\tthis.viewSchema,\n\t\t\t\tonViewDispose,\n\t\t\t\tthis.nodeKeyManager,\n\t\t\t\tthis.schemaPolicy,\n\t\t\t);\n\t\t\tthis.view = view;\n\t\t\tassert(\n\t\t\t\t!this.checkout.forest.anchors.slots.has(SimpleContextSlot),\n\t\t\t\t0xa47 /* extra simple tree context */,\n\t\t\t);\n\t\t\tthis.checkout.forest.anchors.slots.set(\n\t\t\t\tSimpleContextSlot,\n\t\t\t\tnew HydratedContext(this.rootFieldSchema.allowedTypeSet, view.context),\n\t\t\t);\n\n\t\t\tconst unregister = this.checkout.storedSchema.events.on(\"afterSchemaChange\", () => {\n\t\t\t\tunregister();\n\t\t\t\tthis.unregisterCallbacks.delete(unregister);\n\t\t\t\tview[disposeSymbol]();\n\t\t\t});\n\t\t\tthis.unregisterCallbacks.add(unregister);\n\t\t} else {\n\t\t\tthis.view = undefined;\n\t\t\tthis.checkout.forest.anchors.slots.delete(SimpleContextSlot);\n\n\t\t\tconst unregister = this.checkout.storedSchema.events.on(\"afterSchemaChange\", () => {\n\t\t\t\tunregister();\n\t\t\t\tthis.unregisterCallbacks.delete(unregister);\n\t\t\t\tthis.update();\n\t\t\t});\n\t\t\tthis.unregisterCallbacks.add(unregister);\n\t\t}\n\n\t\tif (!this.midUpgrade) {\n\t\t\tthis.events.emit(\"schemaChanged\");\n\t\t\tthis.events.emit(\"rootChanged\");\n\t\t}\n\t}\n\n\tprivate runSchemaEdit(edit: () => void): void {\n\t\tthis.midUpgrade = true;\n\t\ttry {\n\t\t\tedit();\n\t\t} finally {\n\t\t\tthis.midUpgrade = false;\n\t\t}\n\t\tthis.events.emit(\"schemaChanged\");\n\t\tthis.events.emit(\"rootChanged\");\n\t}\n\n\tprivate disposeView(): void {\n\t\tif (this.view !== undefined) {\n\t\t\tthis.view[disposeSymbol]();\n\t\t\tthis.view = undefined;\n\t\t\tthis.checkout.forest.anchors.slots.delete(SimpleContextSlot);\n\t\t\tthis.unregisterCallbacks.forEach((unregister) => unregister());\n\t\t}\n\t\tthis.checkout.forest.anchors.slots.delete(SimpleContextSlot);\n\t}\n\n\tpublic get compatibility(): SchemaCompatibilityStatus {\n\t\tif (!this.currentCompatibility) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t\treturn this.currentCompatibility;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.disposeView();\n\t\tthis.checkout.forest.anchors.slots.delete(ViewSlot);\n\t\tthis.currentCompatibility = undefined;\n\t\tthis.onDispose?.();\n\t\tif (this.checkout.isBranch && !this.checkout.disposed) {\n\t\t\t// All (non-main) branches are 1:1 with views, so if a user manually disposes a view, we should also dispose the checkout/branch.\n\t\t\tthis.checkout.dispose();\n\t\t}\n\t}\n\n\tpublic get root(): ReadableField<TRootSchema> {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getView();\n\t\treturn getTreeNodeForField(view.flexTree) as ReadableField<TRootSchema>;\n\t}\n\n\tpublic set root(newRoot: InsertableField<TRootSchema>) {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getView();\n\t\tsetField(\n\t\t\tview.context.root,\n\t\t\tthis.rootFieldSchema,\n\t\t\tnewRoot as InsertableContent | undefined,\n\t\t);\n\t}\n\n\t// #region Branching\n\n\tpublic fork(): ReturnType<TreeBranch[\"fork\"]> & TreeViewAlpha<TRootSchema> {\n\t\treturn this.checkout.branch().viewWith(this.config);\n\t}\n\n\tpublic merge(context: TreeBranch, disposeMerged = true): void {\n\t\tthis.checkout.merge(getCheckout(context), disposeMerged);\n\t}\n\n\tpublic rebaseOnto(context: TreeBranch): void {\n\t\tgetCheckout(context).rebase(this.checkout);\n\t}\n\n\t// #endregion Branching\n}\n\n/**\n * Get the {@link TreeCheckout} associated with a given {@link TreeBranch}.\n * @remarks Currently, all contexts are also {@link SchematizingSimpleTreeView}s.\n * Other checkout implementations (e.g. not associated with a view) may be supported in the future.\n */\nfunction getCheckout(context: TreeBranch): TreeCheckout {\n\tif (context instanceof SchematizingSimpleTreeView) {\n\t\treturn context.checkout;\n\t}\n\tthrow new UsageError(\"Unsupported context implementation\");\n}\n\n/**\n * Creates a view that self-disposes whenenever the stored schema changes.\n * This may only be called when the schema is already known to be compatible (typically via ensureSchema).\n */\nexport function requireSchema(\n\tcheckout: ITreeCheckout,\n\tviewSchema: ViewSchema,\n\tonDispose: () => void,\n\tnodeKeyManager: NodeKeyManager,\n\tschemaPolicy: FullSchemaPolicy,\n): CheckoutFlexTreeView {\n\tconst slots = checkout.forest.anchors.slots;\n\tassert(!slots.has(ContextSlot), 0x8c2 /* Cannot create second view from checkout */);\n\n\t{\n\t\tconst compatibility = viewSchema.checkCompatibility(checkout.storedSchema);\n\t\tassert(\n\t\t\tcompatibility.write === Compatibility.Compatible &&\n\t\t\t\tcompatibility.read === Compatibility.Compatible,\n\t\t\t0x8c3 /* requireSchema invoked with incompatible schema */,\n\t\t);\n\t}\n\n\tconst view = new CheckoutFlexTreeView(checkout, schemaPolicy, nodeKeyManager, onDispose);\n\tassert(slots.has(ContextSlot), 0x90d /* Context should be tracked in slot */);\n\n\treturn view;\n}\n"]}
1
+ {"version":3,"file":"schematizingTreeView.js","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOH,+DAA6D;AAC7D,kEAA6D;AAC7D,uEAAsE;AAEtE,+CAK0B;AAC1B,4DAMuC;AACvC,sDAuBiC;AACjC,+CAA+F;AAE/F,2DAA8E;AAE9E,uEAAiE;AACjE,sDAIiC;AACjC;;;GAGG;AACU,QAAA,QAAQ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AAa,CAAC,UAAU;YAC/C,aAAa,CAAC,IAAI,KAAK,wBAAa,CAAC,UAAU,EAChD,KAAK,CAAC,oDAAoD,CAC1D,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,8CAAoB,CAAC,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IACzF,IAAA,iBAAM,EAAC,KAAK,CAAC,GAAG,CAAC,sBAAW,CAAC,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAE9E,OAAO,IAAI,CAAC;AACb,CAAC;AAvBD,sCAuBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tHasListeners,\n\tIEmitter,\n\tListenable,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tAllowedUpdateType,\n\tanchorSlot,\n\tCompatibility,\n\ttype SchemaPolicy,\n} from \"../core/index.js\";\nimport {\n\ttype NodeKeyManager,\n\tdefaultSchemaPolicy,\n\tContextSlot,\n\tcursorForMapTreeNode,\n\ttype FullSchemaPolicy,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype FieldSchema,\n\ttype ImplicitFieldSchema,\n\ttype SchemaCompatibilityStatus,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tgetTreeNodeForField,\n\tsetField,\n\tnormalizeFieldSchema,\n\tViewSchema,\n\ttype InsertableContent,\n\ttype TreeViewConfiguration,\n\tmapTreeFromNodeData,\n\tprepareContentForHydration,\n\tcomparePersistedSchemaInternal,\n\ttoStoredSchema,\n\ttype TreeViewAlpha,\n\ttype InsertableField,\n\ttype ReadableField,\n\ttype ReadSchema,\n\ttype UnsafeUnknownSchema,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n} from \"../simple-tree/index.js\";\nimport { Breakable, breakingClass, disposeSymbol, type WithBreakable } from \"../util/index.js\";\n\nimport { canInitialize, ensureSchema, initialize } from \"./schematizeTree.js\";\nimport type { ITreeCheckout, TreeCheckout } from \"./treeCheckout.js\";\nimport { CheckoutFlexTreeView } from \"./checkoutFlexTreeView.js\";\nimport {\n\tHydratedContext,\n\tSimpleContextSlot,\n\tareImplicitFieldSchemaEqual,\n} from \"../simple-tree/index.js\";\n/**\n * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already\n * exists and error if creating a second.\n */\nexport const ViewSlot = anchorSlot<TreeView<ImplicitFieldSchema>>();\n\n/**\n * Implementation of TreeView wrapping a FlexTreeView.\n */\n@breakingClass\nexport class SchematizingSimpleTreeView<\n\tin out TRootSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n> implements TreeBranch, TreeViewAlpha<TRootSchema>, WithBreakable\n{\n\t/**\n\t * The view is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.\n\t *\n\t * The view schema may be incompatible with the stored schema. Use `compatibility` to check.\n\t */\n\tprivate view: CheckoutFlexTreeView | undefined;\n\n\t/**\n\t * Undefined iff uninitialized or disposed.\n\t */\n\tprivate currentCompatibility: SchemaCompatibilityStatus | undefined;\n\tprivate readonly schemaPolicy: SchemaPolicy;\n\tpublic readonly events: Listenable<TreeViewEvents & TreeBranchEvents> &\n\t\tIEmitter<TreeViewEvents & TreeBranchEvents> &\n\t\tHasListeners<TreeViewEvents & TreeBranchEvents> = createEmitter();\n\n\tprivate readonly viewSchema: ViewSchema;\n\n\tprivate readonly unregisterCallbacks = new Set<() => void>();\n\n\tpublic disposed = false;\n\t/**\n\t * This is set to true while an edit impacting the document schema is in progress.\n\t * This allows suppressing extra rootChanged / schemaChanged events until the edit concludes.\n\t * This is useful especially for some initialization edits, since document initialization can involve transient schemas\n\t * which are implementation details and should not be exposed to the user.\n\t */\n\tprivate midUpgrade = false;\n\n\tprivate readonly rootFieldSchema: FieldSchema;\n\n\tpublic constructor(\n\t\tpublic readonly checkout: TreeCheckout,\n\t\tpublic readonly config: TreeViewConfiguration<ReadSchema<TRootSchema>>,\n\t\tpublic readonly nodeKeyManager: NodeKeyManager,\n\t\tpublic readonly breaker: Breakable = new Breakable(\"SchematizingSimpleTreeView\"),\n\t\tprivate readonly onDispose?: () => void,\n\t) {\n\t\tif (checkout.forest.anchors.slots.has(ViewSlot)) {\n\t\t\tthrow new UsageError(\"Cannot create a second tree view from the same checkout\");\n\t\t}\n\t\tcheckout.forest.anchors.slots.set(ViewSlot, this);\n\n\t\tconst policy = {\n\t\t\t...defaultSchemaPolicy,\n\t\t\tvalidateSchema: config.enableSchemaValidation,\n\t\t};\n\t\tthis.rootFieldSchema = normalizeFieldSchema(config.schema);\n\t\tthis.schemaPolicy = defaultSchemaPolicy;\n\n\t\tthis.viewSchema = new ViewSchema(policy, {}, toStoredSchema(this.rootFieldSchema));\n\t\t// This must be initialized before `update` can be called.\n\t\tthis.currentCompatibility = {\n\t\t\tcanView: false,\n\t\t\tcanUpgrade: true,\n\t\t\tisEquivalent: false,\n\t\t\tcanInitialize: true,\n\t\t};\n\t\tthis.update();\n\n\t\tthis.unregisterCallbacks.add(\n\t\t\tthis.checkout.events.on(\"changed\", (data, getRevertible) => {\n\t\t\t\tthis.events.emit(\"changed\", data, getRevertible);\n\t\t\t\tthis.events.emit(\"commitApplied\", data, getRevertible);\n\t\t\t}),\n\t\t);\n\t}\n\n\tpublic hasRootSchema<TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t): this is TreeViewAlpha<TSchema> {\n\t\treturn areImplicitFieldSchemaEqual(this.rootFieldSchema, schema);\n\t}\n\n\tpublic get schema(): ReadSchema<TRootSchema> {\n\t\treturn this.config.schema;\n\t}\n\n\tpublic initialize(content: InsertableField<TRootSchema>): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (!compatibility.canInitialize) {\n\t\t\tthrow new UsageError(\"Tree cannot be initialized more than once.\");\n\t\t}\n\n\t\tthis.runSchemaEdit(() => {\n\t\t\tconst mapTree = mapTreeFromNodeData(\n\t\t\t\tcontent as InsertableContent | undefined,\n\t\t\t\tthis.rootFieldSchema,\n\t\t\t\tthis.nodeKeyManager,\n\t\t\t\t{\n\t\t\t\t\tschema: this.checkout.storedSchema,\n\t\t\t\t\tpolicy: {\n\t\t\t\t\t\t...defaultSchemaPolicy,\n\t\t\t\t\t\tvalidateSchema: this.config.enableSchemaValidation,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tprepareContentForHydration(mapTree, this.checkout.forest);\n\t\t\tinitialize(this.checkout, {\n\t\t\t\tschema: this.viewSchema.schema,\n\t\t\t\tinitialTree: mapTree === undefined ? undefined : cursorForMapTreeNode(mapTree),\n\t\t\t});\n\t\t});\n\t}\n\n\tpublic upgradeSchema(): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (compatibility.isEquivalent) {\n\t\t\t// No-op\n\t\t\treturn;\n\t\t}\n\n\t\tif (!compatibility.canUpgrade) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing stored schema can not be upgraded (see TreeView.compatibility.canUpgrade).\",\n\t\t\t);\n\t\t}\n\n\t\tthis.runSchemaEdit(() => {\n\t\t\tconst result = ensureSchema(\n\t\t\t\tthis.viewSchema,\n\t\t\t\tAllowedUpdateType.SchemaCompatible,\n\t\t\t\tthis.checkout,\n\t\t\t\t{\n\t\t\t\t\tschema: this.viewSchema.schema,\n\t\t\t\t\tinitialTree: undefined,\n\t\t\t\t},\n\t\t\t);\n\t\t\tassert(result, 0x8bf /* Schema upgrade should always work if canUpgrade is set. */);\n\t\t});\n\t}\n\n\t/**\n\t * Gets the view. Throws when disposed.\n\t */\n\tpublic getView(): CheckoutFlexTreeView {\n\t\tthis.ensureUndisposed();\n\t\tassert(this.view !== undefined, 0x8c0 /* unexpected getViewOrError */);\n\t\treturn this.view;\n\t}\n\n\tprivate ensureUndisposed(): void {\n\t\tif (this.disposed) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t}\n\n\tprivate failDisposed(): never {\n\t\tthrow new UsageError(\"Accessed a disposed TreeView.\");\n\t}\n\n\t/**\n\t * Updates `this.view` and the current compatibility status.\n\t * Invoked during initialization and when `this.view` needs to be replaced due to stored schema changes.\n\t * Handles re-registering for events to call update in the future.\n\t * @remarks\n\t * This does not check if the view needs to be replaced, it replaces it unconditionally:\n\t * callers should do any checking to detect if it's really needed before calling `update`.\n\t * @privateRemarks\n\t * This implementation avoids making any edits, which prevents it from being invoked reentrantly.\n\t * If implicit initialization (or some other edit) is desired, it should be done outside of this method.\n\t */\n\tprivate update(): void {\n\t\tthis.disposeView();\n\n\t\tconst compatibility = comparePersistedSchemaInternal(\n\t\t\tthis.checkout.storedSchema,\n\t\t\tthis.viewSchema,\n\t\t\tcanInitialize(this.checkout),\n\t\t);\n\n\t\tlet lastRoot =\n\t\t\tthis.compatibility.canView && this.view !== undefined ? this.root : undefined;\n\t\tthis.currentCompatibility = compatibility;\n\n\t\tif (compatibility.canView) {\n\t\t\t// Trigger \"rootChanged\" if the root changes in the future.\n\t\t\t// Currently there is no good way to do this as FlexTreeField has no events for changes.\n\t\t\t// this.view.flexTree.on(????)\n\t\t\t// As a workaround for the above, trigger \"rootChanged\" in \"afterBatch\"\n\t\t\t// which isn't the correct time since we normally do events during the batch when the forest is modified, but its better than nothing.\n\t\t\t// TODO: provide a better event: this.view.flexTree.on(????)\n\t\t\tconst cleanupCheckOutEvents = this.checkout.events.on(\"afterBatch\", () => {\n\t\t\t\t// In the initialization flow, this event is raised before the correct compatibility w.r.t the new schema is calculated.\n\t\t\t\t// Accessing `this.root` in that case can throw. It's OK to ignore this because:\n\t\t\t\t// - The rootChanged event will already be raised at the end of the current upgrade\n\t\t\t\t// - It doesn't matter that `lastRoot` isn't updated in this case, because `update` will be called again before the upgrade\n\t\t\t\t// completes (at which point this callback and the `lastRoot` captured here will be out of scope anyway)\n\t\t\t\tif (!this.midUpgrade && lastRoot !== this.root) {\n\t\t\t\t\tlastRoot = this.root;\n\t\t\t\t\tthis.events.emit(\"rootChanged\");\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tconst onViewDispose = (): void => {\n\t\t\t\tcleanupCheckOutEvents();\n\t\t\t\tthis.view = undefined;\n\t\t\t\tif (!this.disposed) {\n\t\t\t\t\tthis.update();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst view = requireSchema(\n\t\t\t\tthis.checkout,\n\t\t\t\tthis.viewSchema,\n\t\t\t\tonViewDispose,\n\t\t\t\tthis.nodeKeyManager,\n\t\t\t\tthis.schemaPolicy,\n\t\t\t);\n\t\t\tthis.view = view;\n\t\t\tassert(\n\t\t\t\t!this.checkout.forest.anchors.slots.has(SimpleContextSlot),\n\t\t\t\t0xa47 /* extra simple tree context */,\n\t\t\t);\n\t\t\tthis.checkout.forest.anchors.slots.set(\n\t\t\t\tSimpleContextSlot,\n\t\t\t\tnew HydratedContext(this.rootFieldSchema.allowedTypeSet, view.context),\n\t\t\t);\n\n\t\t\tconst unregister = this.checkout.storedSchema.events.on(\"afterSchemaChange\", () => {\n\t\t\t\tunregister();\n\t\t\t\tthis.unregisterCallbacks.delete(unregister);\n\t\t\t\tview[disposeSymbol]();\n\t\t\t});\n\t\t\tthis.unregisterCallbacks.add(unregister);\n\t\t} else {\n\t\t\tthis.view = undefined;\n\t\t\tthis.checkout.forest.anchors.slots.delete(SimpleContextSlot);\n\n\t\t\tconst unregister = this.checkout.storedSchema.events.on(\"afterSchemaChange\", () => {\n\t\t\t\tunregister();\n\t\t\t\tthis.unregisterCallbacks.delete(unregister);\n\t\t\t\tthis.update();\n\t\t\t});\n\t\t\tthis.unregisterCallbacks.add(unregister);\n\t\t}\n\n\t\tif (!this.midUpgrade) {\n\t\t\tthis.events.emit(\"schemaChanged\");\n\t\t\tthis.events.emit(\"rootChanged\");\n\t\t}\n\t}\n\n\tprivate runSchemaEdit(edit: () => void): void {\n\t\tthis.midUpgrade = true;\n\t\ttry {\n\t\t\tedit();\n\t\t} finally {\n\t\t\tthis.midUpgrade = false;\n\t\t}\n\t\tthis.events.emit(\"schemaChanged\");\n\t\tthis.events.emit(\"rootChanged\");\n\t}\n\n\tprivate disposeView(): void {\n\t\tif (this.view !== undefined) {\n\t\t\tthis.view[disposeSymbol]();\n\t\t\tthis.view = undefined;\n\t\t\tthis.checkout.forest.anchors.slots.delete(SimpleContextSlot);\n\t\t\tthis.unregisterCallbacks.forEach((unregister) => unregister());\n\t\t}\n\t\tthis.checkout.forest.anchors.slots.delete(SimpleContextSlot);\n\t}\n\n\tpublic get compatibility(): SchemaCompatibilityStatus {\n\t\tif (!this.currentCompatibility) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t\treturn this.currentCompatibility;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.disposeView();\n\t\tthis.checkout.forest.anchors.slots.delete(ViewSlot);\n\t\tthis.currentCompatibility = undefined;\n\t\tthis.onDispose?.();\n\t\tif (this.checkout.isBranch && !this.checkout.disposed) {\n\t\t\t// All (non-main) branches are 1:1 with views, so if a user manually disposes a view, we should also dispose the checkout/branch.\n\t\t\tthis.checkout.dispose();\n\t\t}\n\t}\n\n\tpublic get root(): ReadableField<TRootSchema> {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getView();\n\t\treturn getTreeNodeForField(view.flexTree) as ReadableField<TRootSchema>;\n\t}\n\n\tpublic set root(newRoot: InsertableField<TRootSchema>) {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getView();\n\t\tsetField(\n\t\t\tview.context.root,\n\t\t\tthis.rootFieldSchema,\n\t\t\tnewRoot as InsertableContent | undefined,\n\t\t);\n\t}\n\n\t// #region Branching\n\n\tpublic fork(): ReturnType<TreeBranch[\"fork\"]> & TreeViewAlpha<TRootSchema> {\n\t\treturn this.checkout.branch().viewWith(this.config);\n\t}\n\n\tpublic merge(context: TreeBranch, disposeMerged = true): void {\n\t\tthis.checkout.merge(getCheckout(context), disposeMerged);\n\t}\n\n\tpublic rebaseOnto(context: TreeBranch): void {\n\t\tgetCheckout(context).rebase(this.checkout);\n\t}\n\n\t// #endregion Branching\n}\n\n/**\n * Get the {@link TreeCheckout} associated with a given {@link TreeBranch}.\n * @remarks Currently, all contexts are also {@link SchematizingSimpleTreeView}s.\n * Other checkout implementations (e.g. not associated with a view) may be supported in the future.\n */\nexport function getCheckout(context: TreeBranch): TreeCheckout {\n\tif (context instanceof SchematizingSimpleTreeView) {\n\t\treturn context.checkout;\n\t}\n\tthrow new UsageError(\"Unsupported context implementation\");\n}\n\n/**\n * Creates a view that self-disposes whenenever the stored schema changes.\n * This may only be called when the schema is already known to be compatible (typically via ensureSchema).\n */\nexport function requireSchema(\n\tcheckout: ITreeCheckout,\n\tviewSchema: ViewSchema,\n\tonDispose: () => void,\n\tnodeKeyManager: NodeKeyManager,\n\tschemaPolicy: FullSchemaPolicy,\n): CheckoutFlexTreeView {\n\tconst slots = checkout.forest.anchors.slots;\n\tassert(!slots.has(ContextSlot), 0x8c2 /* Cannot create second view from checkout */);\n\n\t{\n\t\tconst compatibility = viewSchema.checkCompatibility(checkout.storedSchema);\n\t\tassert(\n\t\t\tcompatibility.write === Compatibility.Compatible &&\n\t\t\t\tcompatibility.read === Compatibility.Compatible,\n\t\t\t0x8c3 /* requireSchema invoked with incompatible schema */,\n\t\t);\n\t}\n\n\tconst view = new CheckoutFlexTreeView(checkout, schemaPolicy, nodeKeyManager, onDispose);\n\tassert(slots.has(ContextSlot), 0x90d /* Context should be tracked in slot */);\n\n\treturn view;\n}\n"]}