@fluidframework/tree 2.20.0 → 2.22.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 (357) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +1 -0
  3. package/api-report/tree.alpha.api.md +29 -4
  4. package/api-report/tree.beta.api.md +29 -4
  5. package/api-report/tree.legacy.alpha.api.md +35 -4
  6. package/api-report/tree.legacy.public.api.md +29 -4
  7. package/api-report/tree.public.api.md +29 -4
  8. package/dist/alpha.d.ts +1 -0
  9. package/dist/beta.d.ts +1 -0
  10. package/dist/core/forest/editableForest.js +1 -1
  11. package/dist/core/forest/editableForest.js.map +1 -1
  12. package/dist/core/index.d.ts +1 -1
  13. package/dist/core/index.d.ts.map +1 -1
  14. package/dist/core/index.js.map +1 -1
  15. package/dist/core/tree/anchorSet.d.ts +2 -5
  16. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  17. package/dist/core/tree/anchorSet.js +1 -151
  18. package/dist/core/tree/anchorSet.js.map +1 -1
  19. package/dist/core/tree/index.d.ts +1 -2
  20. package/dist/core/tree/index.d.ts.map +1 -1
  21. package/dist/core/tree/index.js.map +1 -1
  22. package/dist/core/tree/pathTree.d.ts +0 -11
  23. package/dist/core/tree/pathTree.d.ts.map +1 -1
  24. package/dist/core/tree/pathTree.js.map +1 -1
  25. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  26. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  27. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  28. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  29. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
  30. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  31. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
  32. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  33. package/dist/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
  34. package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  35. package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  36. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
  37. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  38. package/dist/feature-libraries/forest-summary/forestSummarizer.js +0 -9
  39. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  40. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
  41. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  42. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  43. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -4
  44. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  45. package/dist/feature-libraries/modular-schema/genericFieldKind.js +4 -19
  46. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  47. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  48. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +11 -12
  49. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  50. package/dist/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  51. package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  52. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  53. package/dist/feature-libraries/optional-field/optionalField.js +7 -3
  54. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  55. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
  56. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  57. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -11
  58. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  59. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
  60. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  61. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
  62. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  63. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  64. package/dist/feature-libraries/treeCursorUtils.js +1 -1
  65. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  66. package/dist/index.d.ts +3 -3
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +4 -2
  69. package/dist/index.js.map +1 -1
  70. package/dist/legacy.d.ts +4 -1
  71. package/dist/packageVersion.d.ts +1 -1
  72. package/dist/packageVersion.js +1 -1
  73. package/dist/packageVersion.js.map +1 -1
  74. package/dist/public.d.ts +1 -0
  75. package/dist/shared-tree/index.d.ts +1 -2
  76. package/dist/shared-tree/index.d.ts.map +1 -1
  77. package/dist/shared-tree/index.js +1 -4
  78. package/dist/shared-tree/index.js.map +1 -1
  79. package/dist/shared-tree/schematizingTreeView.d.ts +4 -5
  80. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  81. package/dist/shared-tree/schematizingTreeView.js +9 -10
  82. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  83. package/dist/shared-tree/sharedTree.d.ts +39 -39
  84. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  85. package/dist/shared-tree/sharedTree.js +81 -55
  86. package/dist/shared-tree/sharedTree.js.map +1 -1
  87. package/dist/shared-tree/treeApi.d.ts +2 -2
  88. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  89. package/dist/shared-tree/treeApi.js +9 -3
  90. package/dist/shared-tree/treeApi.js.map +1 -1
  91. package/dist/shared-tree/treeCheckout.d.ts +3 -3
  92. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  93. package/dist/shared-tree/treeCheckout.js +3 -2
  94. package/dist/shared-tree/treeCheckout.js.map +1 -1
  95. package/dist/shared-tree-core/editManager.js +1 -1
  96. package/dist/shared-tree-core/editManager.js.map +1 -1
  97. package/dist/shared-tree-core/editManagerSummarizer.d.ts +1 -2
  98. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  99. package/dist/shared-tree-core/editManagerSummarizer.js +0 -9
  100. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  101. package/dist/shared-tree-core/sequenceIdUtils.d.ts +12 -1
  102. package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  103. package/dist/shared-tree-core/sequenceIdUtils.js +25 -7
  104. package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
  105. package/dist/shared-tree-core/sharedTreeCore.d.ts +25 -30
  106. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  107. package/dist/shared-tree-core/sharedTreeCore.js +20 -49
  108. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  109. package/dist/simple-tree/api/index.d.ts +3 -2
  110. package/dist/simple-tree/api/index.d.ts.map +1 -1
  111. package/dist/simple-tree/api/index.js +3 -1
  112. package/dist/simple-tree/api/index.js.map +1 -1
  113. package/dist/simple-tree/api/schemaFactory.d.ts +158 -63
  114. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  115. package/dist/simple-tree/api/schemaFactory.js +181 -86
  116. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  117. package/dist/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
  118. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -0
  119. package/dist/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
  120. package/dist/simple-tree/api/tree.d.ts +27 -2
  121. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  122. package/dist/simple-tree/api/tree.js.map +1 -1
  123. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  124. package/dist/simple-tree/core/getOrCreateNode.js +1 -1
  125. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  126. package/dist/simple-tree/core/index.d.ts +1 -1
  127. package/dist/simple-tree/core/index.d.ts.map +1 -1
  128. package/dist/simple-tree/core/index.js +2 -2
  129. package/dist/simple-tree/core/index.js.map +1 -1
  130. package/dist/simple-tree/core/treeNodeKernel.d.ts +2 -6
  131. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  132. package/dist/simple-tree/core/treeNodeKernel.js +10 -13
  133. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  134. package/dist/simple-tree/index.d.ts +1 -1
  135. package/dist/simple-tree/index.d.ts.map +1 -1
  136. package/dist/simple-tree/index.js +3 -2
  137. package/dist/simple-tree/index.js.map +1 -1
  138. package/dist/simple-tree/proxies.js +1 -1
  139. package/dist/simple-tree/proxies.js.map +1 -1
  140. package/dist/simple-tree/schemaTypes.d.ts +2 -2
  141. package/dist/simple-tree/schemaTypes.js +1 -1
  142. package/dist/simple-tree/schemaTypes.js.map +1 -1
  143. package/dist/simple-tree/treeNodeValid.js +1 -2
  144. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  145. package/dist/treeFactory.d.ts +16 -5
  146. package/dist/treeFactory.d.ts.map +1 -1
  147. package/dist/treeFactory.js +21 -12
  148. package/dist/treeFactory.js.map +1 -1
  149. package/dist/util/breakable.d.ts +1 -1
  150. package/dist/util/breakable.d.ts.map +1 -1
  151. package/dist/util/breakable.js.map +1 -1
  152. package/dist/util/rangeMap.d.ts +11 -2
  153. package/dist/util/rangeMap.d.ts.map +1 -1
  154. package/dist/util/rangeMap.js +36 -8
  155. package/dist/util/rangeMap.js.map +1 -1
  156. package/lib/alpha.d.ts +1 -0
  157. package/lib/beta.d.ts +1 -0
  158. package/lib/core/forest/editableForest.js +1 -1
  159. package/lib/core/forest/editableForest.js.map +1 -1
  160. package/lib/core/index.d.ts +1 -1
  161. package/lib/core/index.d.ts.map +1 -1
  162. package/lib/core/index.js.map +1 -1
  163. package/lib/core/tree/anchorSet.d.ts +2 -5
  164. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  165. package/lib/core/tree/anchorSet.js +1 -151
  166. package/lib/core/tree/anchorSet.js.map +1 -1
  167. package/lib/core/tree/index.d.ts +1 -2
  168. package/lib/core/tree/index.d.ts.map +1 -1
  169. package/lib/core/tree/index.js.map +1 -1
  170. package/lib/core/tree/pathTree.d.ts +0 -11
  171. package/lib/core/tree/pathTree.d.ts.map +1 -1
  172. package/lib/core/tree/pathTree.js.map +1 -1
  173. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  174. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  175. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  176. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  177. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
  178. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  179. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
  180. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  181. package/lib/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
  182. package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  183. package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  184. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
  185. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  186. package/lib/feature-libraries/forest-summary/forestSummarizer.js +0 -9
  187. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  188. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
  189. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  190. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  191. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -4
  192. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  193. package/lib/feature-libraries/modular-schema/genericFieldKind.js +4 -19
  194. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  195. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  196. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +11 -12
  197. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  198. package/lib/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  199. package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  200. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  201. package/lib/feature-libraries/optional-field/optionalField.js +7 -3
  202. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  203. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
  204. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  205. package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -11
  206. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  207. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
  208. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  209. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
  210. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  211. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  212. package/lib/feature-libraries/treeCursorUtils.js +2 -2
  213. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  214. package/lib/index.d.ts +3 -3
  215. package/lib/index.d.ts.map +1 -1
  216. package/lib/index.js +3 -3
  217. package/lib/index.js.map +1 -1
  218. package/lib/legacy.d.ts +4 -1
  219. package/lib/packageVersion.d.ts +1 -1
  220. package/lib/packageVersion.js +1 -1
  221. package/lib/packageVersion.js.map +1 -1
  222. package/lib/public.d.ts +1 -0
  223. package/lib/shared-tree/index.d.ts +1 -2
  224. package/lib/shared-tree/index.d.ts.map +1 -1
  225. package/lib/shared-tree/index.js +1 -2
  226. package/lib/shared-tree/index.js.map +1 -1
  227. package/lib/shared-tree/schematizingTreeView.d.ts +4 -5
  228. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  229. package/lib/shared-tree/schematizingTreeView.js +4 -5
  230. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  231. package/lib/shared-tree/sharedTree.d.ts +39 -39
  232. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  233. package/lib/shared-tree/sharedTree.js +79 -53
  234. package/lib/shared-tree/sharedTree.js.map +1 -1
  235. package/lib/shared-tree/treeApi.d.ts +2 -2
  236. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  237. package/lib/shared-tree/treeApi.js +8 -2
  238. package/lib/shared-tree/treeApi.js.map +1 -1
  239. package/lib/shared-tree/treeCheckout.d.ts +3 -3
  240. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  241. package/lib/shared-tree/treeCheckout.js +4 -3
  242. package/lib/shared-tree/treeCheckout.js.map +1 -1
  243. package/lib/shared-tree-core/editManager.js +2 -2
  244. package/lib/shared-tree-core/editManager.js.map +1 -1
  245. package/lib/shared-tree-core/editManagerSummarizer.d.ts +1 -2
  246. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  247. package/lib/shared-tree-core/editManagerSummarizer.js +0 -9
  248. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  249. package/lib/shared-tree-core/sequenceIdUtils.d.ts +12 -1
  250. package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  251. package/lib/shared-tree-core/sequenceIdUtils.js +23 -5
  252. package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
  253. package/lib/shared-tree-core/sharedTreeCore.d.ts +25 -30
  254. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  255. package/lib/shared-tree-core/sharedTreeCore.js +19 -48
  256. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  257. package/lib/simple-tree/api/index.d.ts +3 -2
  258. package/lib/simple-tree/api/index.d.ts.map +1 -1
  259. package/lib/simple-tree/api/index.js +1 -0
  260. package/lib/simple-tree/api/index.js.map +1 -1
  261. package/lib/simple-tree/api/schemaFactory.d.ts +158 -63
  262. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  263. package/lib/simple-tree/api/schemaFactory.js +180 -85
  264. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  265. package/lib/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
  266. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -0
  267. package/lib/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
  268. package/lib/simple-tree/api/tree.d.ts +27 -2
  269. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  270. package/lib/simple-tree/api/tree.js.map +1 -1
  271. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  272. package/lib/simple-tree/core/getOrCreateNode.js +2 -2
  273. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  274. package/lib/simple-tree/core/index.d.ts +1 -1
  275. package/lib/simple-tree/core/index.d.ts.map +1 -1
  276. package/lib/simple-tree/core/index.js +1 -1
  277. package/lib/simple-tree/core/index.js.map +1 -1
  278. package/lib/simple-tree/core/treeNodeKernel.d.ts +2 -6
  279. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  280. package/lib/simple-tree/core/treeNodeKernel.js +9 -11
  281. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  282. package/lib/simple-tree/index.d.ts +1 -1
  283. package/lib/simple-tree/index.d.ts.map +1 -1
  284. package/lib/simple-tree/index.js +1 -1
  285. package/lib/simple-tree/index.js.map +1 -1
  286. package/lib/simple-tree/proxies.js +2 -2
  287. package/lib/simple-tree/proxies.js.map +1 -1
  288. package/lib/simple-tree/schemaTypes.d.ts +2 -2
  289. package/lib/simple-tree/schemaTypes.js +1 -1
  290. package/lib/simple-tree/schemaTypes.js.map +1 -1
  291. package/lib/simple-tree/treeNodeValid.js +1 -2
  292. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  293. package/lib/treeFactory.d.ts +16 -5
  294. package/lib/treeFactory.d.ts.map +1 -1
  295. package/lib/treeFactory.js +20 -11
  296. package/lib/treeFactory.js.map +1 -1
  297. package/lib/util/breakable.d.ts +1 -1
  298. package/lib/util/breakable.d.ts.map +1 -1
  299. package/lib/util/breakable.js.map +1 -1
  300. package/lib/util/rangeMap.d.ts +11 -2
  301. package/lib/util/rangeMap.d.ts.map +1 -1
  302. package/lib/util/rangeMap.js +36 -8
  303. package/lib/util/rangeMap.js.map +1 -1
  304. package/package.json +23 -23
  305. package/src/core/forest/editableForest.ts +1 -1
  306. package/src/core/index.ts +0 -3
  307. package/src/core/tree/anchorSet.ts +4 -197
  308. package/src/core/tree/index.ts +0 -3
  309. package/src/core/tree/pathTree.ts +0 -13
  310. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
  311. package/src/feature-libraries/detachedFieldIndexSummarizer.ts +0 -11
  312. package/src/feature-libraries/flex-tree/treeEvents.ts +2 -4
  313. package/src/feature-libraries/forest-summary/forestSummarizer.ts +0 -11
  314. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +6 -2
  315. package/src/feature-libraries/modular-schema/genericFieldKind.ts +3 -35
  316. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +9 -42
  317. package/src/feature-libraries/optional-field/optionalField.ts +10 -3
  318. package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -16
  319. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +13 -2
  320. package/src/feature-libraries/treeCursorUtils.ts +4 -2
  321. package/src/index.ts +15 -10
  322. package/src/packageVersion.ts +1 -1
  323. package/src/shared-tree/index.ts +3 -14
  324. package/src/shared-tree/schematizingTreeView.ts +18 -16
  325. package/src/shared-tree/sharedTree.ts +203 -103
  326. package/src/shared-tree/treeApi.ts +10 -1
  327. package/src/shared-tree/treeCheckout.ts +11 -8
  328. package/src/shared-tree-core/editManager.ts +2 -2
  329. package/src/shared-tree-core/editManagerSummarizer.ts +0 -11
  330. package/src/shared-tree-core/sequenceIdUtils.ts +26 -5
  331. package/src/shared-tree-core/sharedTreeCore.ts +30 -87
  332. package/src/simple-tree/api/index.ts +15 -0
  333. package/src/simple-tree/api/schemaFactory.ts +205 -89
  334. package/src/{shared-tree → simple-tree/api}/transactionTypes.ts +1 -1
  335. package/src/simple-tree/api/tree.ts +35 -6
  336. package/src/simple-tree/core/getOrCreateNode.ts +6 -2
  337. package/src/simple-tree/core/index.ts +1 -1
  338. package/src/simple-tree/core/treeNodeKernel.ts +16 -14
  339. package/src/simple-tree/index.ts +12 -0
  340. package/src/simple-tree/proxies.ts +2 -2
  341. package/src/simple-tree/schemaTypes.ts +2 -2
  342. package/src/treeFactory.ts +29 -11
  343. package/src/util/breakable.ts +1 -1
  344. package/src/util/rangeMap.ts +36 -7
  345. package/dist/core/tree/visitPath.d.ts +0 -101
  346. package/dist/core/tree/visitPath.d.ts.map +0 -1
  347. package/dist/core/tree/visitPath.js +0 -7
  348. package/dist/core/tree/visitPath.js.map +0 -1
  349. package/dist/shared-tree/transactionTypes.d.ts.map +0 -1
  350. package/lib/core/tree/visitPath.d.ts +0 -101
  351. package/lib/core/tree/visitPath.d.ts.map +0 -1
  352. package/lib/core/tree/visitPath.js +0 -6
  353. package/lib/core/tree/visitPath.js.map +0 -1
  354. package/lib/shared-tree/transactionTypes.d.ts.map +0 -1
  355. package/src/core/tree/visitPath.ts +0 -124
  356. /package/dist/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
  357. /package/lib/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"treeCursorUtils.js","sourceRoot":"","sources":["../../src/feature-libraries/treeCursorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAEN,YAAY,EASZ,kBA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AC,MAAM,CAAC,CAAC;IACnD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tCursorLocationType,\n\tCursorMarker,\n\ttype DetachedField,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype ITreeCursorSynchronous,\n\ttype PathRootPrefix,\n\ttype TreeType,\n\ttype UpPath,\n\ttype Value,\n\tdetachedFieldAsKey,\n\trootField,\n} from \"../core/index.js\";\nimport { fail } from \"../util/index.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * {@link ITreeCursorSynchronous} that can return the underlying node objects.\n */\nexport interface CursorWithNode<TNode> extends ITreeCursorSynchronous {\n\t/**\n\t * Gets the underlying object for the current node.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t */\n\tgetNode(): TNode;\n\n\t/**\n\t * Create a copy of this cursor which navigates independently,\n\t * and is initially located at the same place as this one.\n\t *\n\t * Depending on the cursor implementation this may be significantly faster\n\t * than other ways to copy the cursor\n\t * (such as creating a new one and walking the path from this one).\n\t */\n\tfork(): CursorWithNode<TNode>;\n}\n\n/**\n * Create a cursor, in `nodes` mode at the root of the provided tree.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single root in `nodes` mode.\n */\nexport function stackTreeNodeCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n): CursorWithNode<TNode> {\n\treturn new StackCursor(adapter, [], [], [root], 0);\n}\n\n/**\n * Create a cursor, in `fields` mode at the `detachedField` under the provided `root`.\n *\n * @returns an {@link ITreeCursorSynchronous} for `detachedField` of `root` in `fields` mode.\n */\nexport function stackTreeFieldCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n\tdetachedField: DetachedField = rootField,\n): CursorWithNode<TNode> {\n\tconst cursor = stackTreeNodeCursor(adapter, root);\n\t// Because the root node in `stackTreeNodeCursor` is treated as the above detached fields node,\n\t// using it then just entering the correct field doesn't mess up the paths reported by the cursor.\n\tcursor.enterField(detachedFieldAsKey(detachedField));\n\treturn cursor;\n}\n\n/**\n * Provides functionality to allow a {@link stackTreeNodeCursor} and {@link stackTreeFieldCursor} to implement cursors.\n */\nexport interface CursorAdapter<TNode> {\n\t/**\n\t * @returns the value of the given node.\n\t */\n\tvalue(node: TNode): Value;\n\t/**\n\t * @returns the type of the given node.\n\t */\n\ttype(node: TNode): TreeType;\n\t/**\n\t * @returns the keys for non-empty fields on the given node.\n\t */\n\tkeysFromNode(node: TNode): readonly FieldKey[];\n\t/**\n\t * @returns the child nodes for the given node and key.\n\t */\n\tgetFieldFromNode(node: TNode, key: FieldKey): readonly TNode[];\n}\n\ntype SiblingsOrKey<TNode> = readonly TNode[] | readonly FieldKey[];\n\n/**\n * A class that satisfies part of the ITreeCursorSynchronous implementation.\n */\nexport abstract class SynchronousCursor {\n\tpublic readonly [CursorMarker] = true;\n\tpublic readonly pending = false;\n\n\tpublic skipPendingFields(): boolean {\n\t\treturn true;\n\t}\n}\n\n/**\n * A simple general purpose ITreeCursorSynchronous implementation.\n *\n * As this is a generic implementation, it's ability to optimize is limited.\n *\n * @privateRemarks\n * Note that TNode can be `null` (and we should support `undefined` as well),\n * so be careful using types like `TNode | undefined` and expressions like `TNode ??`.\n *\n * TODO:\n * 1. Unit tests for this.\n * 2. Support for cursors which are field cursors at the root.\n */\nclass StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNode> {\n\tpublic readonly [CursorMarker] = true;\n\t/**\n\t * Might start at special root where fields are detached sequences.\n\t *\n\t * @param adapter - policy logic.\n\t * @param siblingStack - Stack of collections of siblings along the path through the tree:\n\t * does not include current level (which is stored in `siblings`).\n\t * Even levels in the stack (starting from 0) are sequences of nodes and odd levels\n\t * are for fields keys on a node.\n\t * @param indexStack - Stack of indices into the corresponding levels in `siblingStack`.\n\t * @param siblings - Siblings at the current level (not included in `siblingStack`).\n\t * @param index - Index into `siblings`.\n\t */\n\tpublic constructor(\n\t\tprivate readonly adapter: CursorAdapter<TNode>,\n\t\tprivate readonly siblingStack: SiblingsOrKey<TNode>[],\n\t\tprivate readonly indexStack: number[],\n\t\tprivate siblings: SiblingsOrKey<TNode>,\n\t\tprivate index: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic getFieldKey(): FieldKey {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\treturn this.siblings[this.index] as FieldKey;\n\t}\n\n\tprivate getStackedFieldKey(height: number): FieldKey {\n\t\tassert(height % 2 === 1, 0x3b8 /* must field height */);\n\t\tconst siblingStack = this.siblingStack[height] ?? oob();\n\t\tconst indexStack = this.indexStack[height] ?? oob();\n\t\treturn siblingStack[indexStack] as FieldKey;\n\t}\n\n\tprivate getStackedNodeIndex(height: number): number {\n\t\t// assert(height % 2 === 0, \"must be node height\");\n\t\treturn this.indexStack[height] ?? oob();\n\t}\n\n\tprivate getStackedNode(height: number): TNode {\n\t\tconst index = this.getStackedNodeIndex(height);\n\t\t// Test is failing when using `?? oob()` here.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblingStack[height] as readonly TNode[])[index]!;\n\t}\n\n\tpublic getFieldLength(): number {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\treturn this.getField().length;\n\t}\n\n\tpublic enterNode(index: number): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\tconst siblings = this.getField();\n\t\tif (!(index in siblings)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"A child does not exist at the specified index, check the status of a node using `Tree.status()`.\",\n\t\t\t);\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = index;\n\t\tthis.siblings = siblings;\n\t}\n\n\tpublic getPath(prefix?: PathRootPrefix): UpPath | undefined {\n\t\tassert(this.mode === CursorLocationType.Nodes, 0x3b9 /* must be in nodes mode */);\n\t\treturn this.getOffsetPath(0, prefix);\n\t}\n\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\tassert(this.mode === CursorLocationType.Fields, 0x449 /* must be in fields mode */);\n\t\treturn {\n\t\t\tfield:\n\t\t\t\tthis.indexStack.length === 1\n\t\t\t\t\t? (prefix?.rootFieldOverride ?? this.getFieldKey())\n\t\t\t\t\t: this.getFieldKey(),\n\t\t\tparent: this.getOffsetPath(1, prefix),\n\t\t};\n\t}\n\n\tprivate getOffsetPath(\n\t\toffset: number,\n\t\tprefix: PathRootPrefix | undefined,\n\t): UpPath | undefined {\n\t\t// It is more efficient to handle prefix directly in here rather than delegating to PrefixedPath.\n\n\t\tconst length = this.indexStack.length - offset;\n\t\tif (length === 0) {\n\t\t\treturn prefix?.parent; // At root\n\t\t}\n\n\t\tassert(length > 0, 0x44a /* invalid offset to above root */);\n\t\tassert(length % 2 === 0, 0x44b /* offset path must point to node not field */);\n\n\t\tconst getIndex = (height: number): number => {\n\t\t\tlet parentIndex: number =\n\t\t\t\theight === this.indexStack.length ? this.index : this.getStackedNodeIndex(height);\n\t\t\tif (prefix !== undefined && height === 2) {\n\t\t\t\tparentIndex += prefix.indexOffset ?? 0;\n\t\t\t}\n\t\t\treturn parentIndex;\n\t\t};\n\n\t\t// Perf Note:\n\t\t// This is O(depth) in tree.\n\t\t// If many different anchors are created, this could be optimized to amortize the costs.\n\t\t// For example, the cursor could cache UpPaths from the anchorSet when creating an anchor,\n\t\t// then reuse them as a starting point when making another.\n\t\t// Could cache this at one depth, and remember the depth.\n\t\t// When navigating up, adjust cached anchor if present.\n\n\t\tlet path: UpPath | undefined = prefix?.parent;\n\t\t// Skip top level, since root node in path is \"undefined\" and does not have a parent or index.\n\t\tfor (let height = 2; height <= length; height += 2) {\n\t\t\tconst fieldOverride = height === 2 ? prefix?.rootFieldOverride : undefined;\n\t\t\tpath = {\n\t\t\t\tparent: path,\n\t\t\t\tparentIndex: getIndex(height),\n\t\t\t\tparentField: fieldOverride ?? this.getStackedFieldKey(height - 1),\n\t\t\t};\n\t\t}\n\n\t\treturn path;\n\t}\n\n\tpublic fork(): StackCursor<TNode> {\n\t\t// Siblings arrays are not modified during navigation and do not need be be copied.\n\t\t// This allows this copy to be shallow, and `this.siblings` below to not be copied as all.\n\t\treturn new StackCursor<TNode>(\n\t\t\tthis.adapter,\n\t\t\t[...this.siblingStack],\n\t\t\t[...this.indexStack],\n\t\t\tthis.siblings,\n\t\t\tthis.index,\n\t\t);\n\t}\n\n\tpublic enterField(key: FieldKey): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\n\t\t// For fields, siblings are only used for key lookup and\n\t\t// nextField and which has arbitrary iteration order,\n\t\t// so making a array of just key here works.\n\t\t// This adds an allocation, so it's optimizing code simplicity and for the other use case (enumeration)\n\t\t// at the cost of an allocation here.\n\t\tthis.index = 0;\n\t\tthis.siblings = [key];\n\t}\n\n\tpublic get mode(): CursorLocationType {\n\t\treturn this.siblingStack.length % 2 === 0\n\t\t\t? CursorLocationType.Nodes\n\t\t\t: CursorLocationType.Fields;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tthis.index += 1;\n\t\tif (this.index === (this.siblings as []).length) {\n\t\t\tthis.exitField();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic firstField(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tconst fields = this.adapter.keysFromNode(this.getNode());\n\t\tif (fields.length === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = fields;\n\t\treturn true;\n\t}\n\n\tpublic seekNodes(offset: number): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only seekNodes when in Nodes\");\n\t\tthis.index += offset;\n\t\tif (this.index in this.siblings) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic firstNode(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"firstNode only allowed in fields mode\");\n\t\tconst nodes = this.getField();\n\t\tif (nodes.length === 0) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = nodes;\n\t\treturn true;\n\t}\n\n\tpublic nextNode(): boolean {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Nodes,\n\t\t\t0x406 /* can only nextNode when in Nodes */,\n\t\t);\n\t\tthis.index++;\n\t\tif (this.index < (this.siblings as []).length) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic exitField(): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only navigate up from field when in field\");\n\t\tthis.siblings = this.siblingStack.pop() ?? fail(\"Unexpected siblingStack.length\");\n\t\tthis.index = this.indexStack.pop() ?? fail(\"Unexpected indexStack.length\");\n\t}\n\n\tpublic exitNode(): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only navigate up from node when in node\");\n\t\tthis.siblings = this.siblingStack.pop() ?? fail(\"Unexpected siblingStack.length\");\n\t\tthis.index = this.indexStack.pop() ?? fail(\"Unexpected indexStack.length\");\n\t}\n\n\tpublic getNode(): TNode {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only get node when in node\");\n\t\t// Test is failing when using `?? oob()` here.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblings as TNode[])[this.index]!;\n\t}\n\n\tprivate getField(): readonly TNode[] {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only get field when in fields\");\n\t\tconst parent = this.getStackedNode(this.indexStack.length - 1);\n\t\tconst key: FieldKey = this.getFieldKey();\n\t\tconst field = this.adapter.getFieldFromNode(parent, key);\n\t\treturn field;\n\t}\n\n\t/**\n\t * @returns the value of the current node\n\t */\n\tpublic get value(): Value {\n\t\treturn this.adapter.value(this.getNode());\n\t}\n\n\t/**\n\t * @returns the type of the current node\n\t */\n\tpublic get type(): TreeType {\n\t\treturn this.adapter.type(this.getNode());\n\t}\n\n\tpublic get fieldIndex(): number {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only node's index when in node\");\n\t\treturn this.index;\n\t}\n\n\tpublic get chunkStart(): number {\n\t\treturn this.fieldIndex;\n\t}\n\n\tpublic readonly chunkLength = 1;\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: UpPath | undefined,\n): UpPath | undefined {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn applyPrefix(prefix, path);\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixFieldPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: FieldUpPath,\n): FieldUpPath {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn {\n\t\tfield: path.parent === undefined ? (prefix.rootFieldOverride ?? path.field) : path.field,\n\t\tparent: prefixPath(prefix, path.parent),\n\t};\n}\n\n/**\n * Compose two prefixes together.\n * `prefixFieldPath(root, prefixFieldPath(inner, path))` should be the same as `prefixFieldPath(prefixPathPrefix(root, inner), path))`\n *\n * TODO: tests for this.\n */\nexport function prefixPathPrefix(root: PathRootPrefix, inner: PathRootPrefix): PathRootPrefix {\n\tif (inner.parent !== undefined) {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: new PrefixedPath(root, inner.parent),\n\t\t\trootFieldOverride: inner.rootFieldOverride,\n\t\t\tindexOffset: inner.indexOffset,\n\t\t};\n\t\treturn composedPrefix;\n\t} else {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: root.parent,\n\t\t\trootFieldOverride: root.rootFieldOverride ?? inner.rootFieldOverride,\n\t\t\tindexOffset: (inner.indexOffset ?? 0) + (root.indexOffset ?? 0),\n\t\t};\n\t\treturn composedPrefix;\n\t}\n}\n\nfunction applyPrefix(prefix: PathRootPrefix, path: UpPath | undefined): UpPath | undefined {\n\tif (path === undefined) {\n\t\treturn prefix.parent;\n\t} else {\n\t\t// As an optimization, avoid double wrapping paths with multiple prefixes\n\t\tif (path instanceof PrefixedPath) {\n\t\t\tconst composedPrefix: PathRootPrefix = prefixPathPrefix(prefix, path.prefix);\n\t\t\treturn new PrefixedPath(composedPrefix, path.path);\n\t\t} else {\n\t\t\treturn new PrefixedPath(prefix, path);\n\t\t}\n\t}\n}\n\n/**\n * Wrapper around a path that adds a prefix to the root.\n *\n * Exported for testing: use `prefixPath` and `prefixFieldPath` to construct.\n */\nexport class PrefixedPath implements UpPath {\n\tpublic readonly parentField: FieldKey;\n\tpublic readonly parentIndex: number;\n\tpublic constructor(\n\t\tpublic readonly prefix: PathRootPrefix,\n\t\tpublic readonly path: UpPath,\n\t) {\n\t\tif (path.parent === undefined) {\n\t\t\tthis.parentField = prefix.rootFieldOverride ?? path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex + (prefix.indexOffset ?? 0);\n\t\t} else {\n\t\t\tthis.parentField = path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex;\n\t\t}\n\t}\n\tpublic get parent(): UpPath | undefined {\n\t\treturn applyPrefix(this.prefix, this.path.parent);\n\t}\n}\n"]}
1
+ {"version":3,"file":"treeCursorUtils.js","sourceRoot":"","sources":["../../src/feature-libraries/treeCursorUtils.ts"],"names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AC;QACjE,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;YACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,CAAC;IACF,CAAC;IACD,IAAW,MAAM;QAChB,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob, debugAssert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tCursorLocationType,\n\tCursorMarker,\n\ttype DetachedField,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype ITreeCursorSynchronous,\n\ttype PathRootPrefix,\n\ttype TreeType,\n\ttype UpPath,\n\ttype Value,\n\tdetachedFieldAsKey,\n\trootField,\n} from \"../core/index.js\";\nimport { fail } from \"../util/index.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * {@link ITreeCursorSynchronous} that can return the underlying node objects.\n */\nexport interface CursorWithNode<TNode> extends ITreeCursorSynchronous {\n\t/**\n\t * Gets the underlying object for the current node.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t */\n\tgetNode(): TNode;\n\n\t/**\n\t * Create a copy of this cursor which navigates independently,\n\t * and is initially located at the same place as this one.\n\t *\n\t * Depending on the cursor implementation this may be significantly faster\n\t * than other ways to copy the cursor\n\t * (such as creating a new one and walking the path from this one).\n\t */\n\tfork(): CursorWithNode<TNode>;\n}\n\n/**\n * Create a cursor, in `nodes` mode at the root of the provided tree.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single root in `nodes` mode.\n */\nexport function stackTreeNodeCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n): CursorWithNode<TNode> {\n\treturn new StackCursor(adapter, [], [], [root], 0);\n}\n\n/**\n * Create a cursor, in `fields` mode at the `detachedField` under the provided `root`.\n *\n * @returns an {@link ITreeCursorSynchronous} for `detachedField` of `root` in `fields` mode.\n */\nexport function stackTreeFieldCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n\tdetachedField: DetachedField = rootField,\n): CursorWithNode<TNode> {\n\tconst cursor = stackTreeNodeCursor(adapter, root);\n\t// Because the root node in `stackTreeNodeCursor` is treated as the above detached fields node,\n\t// using it then just entering the correct field doesn't mess up the paths reported by the cursor.\n\tcursor.enterField(detachedFieldAsKey(detachedField));\n\treturn cursor;\n}\n\n/**\n * Provides functionality to allow a {@link stackTreeNodeCursor} and {@link stackTreeFieldCursor} to implement cursors.\n */\nexport interface CursorAdapter<TNode> {\n\t/**\n\t * @returns the value of the given node.\n\t */\n\tvalue(node: TNode): Value;\n\t/**\n\t * @returns the type of the given node.\n\t */\n\ttype(node: TNode): TreeType;\n\t/**\n\t * @returns the keys for non-empty fields on the given node.\n\t */\n\tkeysFromNode(node: TNode): readonly FieldKey[];\n\t/**\n\t * @returns the child nodes for the given node and key.\n\t */\n\tgetFieldFromNode(node: TNode, key: FieldKey): readonly TNode[];\n}\n\ntype SiblingsOrKey<TNode> = readonly TNode[] | readonly FieldKey[];\n\n/**\n * A class that satisfies part of the ITreeCursorSynchronous implementation.\n */\nexport abstract class SynchronousCursor {\n\tpublic readonly [CursorMarker] = true;\n\tpublic readonly pending = false;\n\n\tpublic skipPendingFields(): boolean {\n\t\treturn true;\n\t}\n}\n\n/**\n * A simple general purpose ITreeCursorSynchronous implementation.\n *\n * As this is a generic implementation, it's ability to optimize is limited.\n *\n * @privateRemarks\n * Note that TNode can be `null` (and we should support `undefined` as well),\n * so be careful using types like `TNode | undefined` and expressions like `TNode ??`.\n *\n * TODO:\n * 1. Unit tests for this.\n * 2. Support for cursors which are field cursors at the root.\n */\nclass StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNode> {\n\tpublic readonly [CursorMarker] = true;\n\t/**\n\t * Might start at special root where fields are detached sequences.\n\t *\n\t * @param adapter - policy logic.\n\t * @param siblingStack - Stack of collections of siblings along the path through the tree:\n\t * does not include current level (which is stored in `siblings`).\n\t * Even levels in the stack (starting from 0) are sequences of nodes and odd levels\n\t * are for fields keys on a node.\n\t * @param indexStack - Stack of indices into the corresponding levels in `siblingStack`.\n\t * @param siblings - Siblings at the current level (not included in `siblingStack`).\n\t * @param index - Index into `siblings`.\n\t */\n\tpublic constructor(\n\t\tprivate readonly adapter: CursorAdapter<TNode>,\n\t\tprivate readonly siblingStack: SiblingsOrKey<TNode>[],\n\t\tprivate readonly indexStack: number[],\n\t\tprivate siblings: SiblingsOrKey<TNode>,\n\t\tprivate index: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic getFieldKey(): FieldKey {\n\t\tdebugAssert(() =>\n\t\t\tthis.mode === CursorLocationType.Fields ? true : \"must be in fields mode\",\n\t\t);\n\t\treturn this.siblings[this.index] as FieldKey;\n\t}\n\n\tprivate getStackedFieldKey(height: number): FieldKey {\n\t\tassert(height % 2 === 1, 0x3b8 /* must field height */);\n\t\tconst siblingStack = this.siblingStack[height] ?? oob();\n\t\tconst indexStack = this.indexStack[height] ?? oob();\n\t\treturn siblingStack[indexStack] as FieldKey;\n\t}\n\n\tprivate getStackedNodeIndex(height: number): number {\n\t\t// assert(height % 2 === 0, \"must be node height\");\n\t\treturn this.indexStack[height] ?? oob();\n\t}\n\n\tprivate getStackedNode(height: number): TNode {\n\t\tconst index = this.getStackedNodeIndex(height);\n\t\t// Test is failing when using `?? oob()` here.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblingStack[height] as readonly TNode[])[index]!;\n\t}\n\n\tpublic getFieldLength(): number {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\treturn this.getField().length;\n\t}\n\n\tpublic enterNode(index: number): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\tconst siblings = this.getField();\n\t\tif (!(index in siblings)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"A child does not exist at the specified index, check the status of a node using `Tree.status()`.\",\n\t\t\t);\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = index;\n\t\tthis.siblings = siblings;\n\t}\n\n\tpublic getPath(prefix?: PathRootPrefix): UpPath | undefined {\n\t\tassert(this.mode === CursorLocationType.Nodes, 0x3b9 /* must be in nodes mode */);\n\t\treturn this.getOffsetPath(0, prefix);\n\t}\n\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\tassert(this.mode === CursorLocationType.Fields, 0x449 /* must be in fields mode */);\n\t\treturn {\n\t\t\tfield:\n\t\t\t\tthis.indexStack.length === 1\n\t\t\t\t\t? (prefix?.rootFieldOverride ?? this.getFieldKey())\n\t\t\t\t\t: this.getFieldKey(),\n\t\t\tparent: this.getOffsetPath(1, prefix),\n\t\t};\n\t}\n\n\tprivate getOffsetPath(\n\t\toffset: number,\n\t\tprefix: PathRootPrefix | undefined,\n\t): UpPath | undefined {\n\t\t// It is more efficient to handle prefix directly in here rather than delegating to PrefixedPath.\n\n\t\tconst length = this.indexStack.length - offset;\n\t\tif (length === 0) {\n\t\t\treturn prefix?.parent; // At root\n\t\t}\n\n\t\tassert(length > 0, 0x44a /* invalid offset to above root */);\n\t\tassert(length % 2 === 0, 0x44b /* offset path must point to node not field */);\n\n\t\tconst getIndex = (height: number): number => {\n\t\t\tlet parentIndex: number =\n\t\t\t\theight === this.indexStack.length ? this.index : this.getStackedNodeIndex(height);\n\t\t\tif (prefix !== undefined && height === 2) {\n\t\t\t\tparentIndex += prefix.indexOffset ?? 0;\n\t\t\t}\n\t\t\treturn parentIndex;\n\t\t};\n\n\t\t// Perf Note:\n\t\t// This is O(depth) in tree.\n\t\t// If many different anchors are created, this could be optimized to amortize the costs.\n\t\t// For example, the cursor could cache UpPaths from the anchorSet when creating an anchor,\n\t\t// then reuse them as a starting point when making another.\n\t\t// Could cache this at one depth, and remember the depth.\n\t\t// When navigating up, adjust cached anchor if present.\n\n\t\tlet path: UpPath | undefined = prefix?.parent;\n\t\t// Skip top level, since root node in path is \"undefined\" and does not have a parent or index.\n\t\tfor (let height = 2; height <= length; height += 2) {\n\t\t\tconst fieldOverride = height === 2 ? prefix?.rootFieldOverride : undefined;\n\t\t\tpath = {\n\t\t\t\tparent: path,\n\t\t\t\tparentIndex: getIndex(height),\n\t\t\t\tparentField: fieldOverride ?? this.getStackedFieldKey(height - 1),\n\t\t\t};\n\t\t}\n\n\t\treturn path;\n\t}\n\n\tpublic fork(): StackCursor<TNode> {\n\t\t// Siblings arrays are not modified during navigation and do not need be be copied.\n\t\t// This allows this copy to be shallow, and `this.siblings` below to not be copied as all.\n\t\treturn new StackCursor<TNode>(\n\t\t\tthis.adapter,\n\t\t\t[...this.siblingStack],\n\t\t\t[...this.indexStack],\n\t\t\tthis.siblings,\n\t\t\tthis.index,\n\t\t);\n\t}\n\n\tpublic enterField(key: FieldKey): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\n\t\t// For fields, siblings are only used for key lookup and\n\t\t// nextField and which has arbitrary iteration order,\n\t\t// so making a array of just key here works.\n\t\t// This adds an allocation, so it's optimizing code simplicity and for the other use case (enumeration)\n\t\t// at the cost of an allocation here.\n\t\tthis.index = 0;\n\t\tthis.siblings = [key];\n\t}\n\n\tpublic get mode(): CursorLocationType {\n\t\treturn this.siblingStack.length % 2 === 0\n\t\t\t? CursorLocationType.Nodes\n\t\t\t: CursorLocationType.Fields;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tthis.index += 1;\n\t\tif (this.index === (this.siblings as []).length) {\n\t\t\tthis.exitField();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic firstField(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tconst fields = this.adapter.keysFromNode(this.getNode());\n\t\tif (fields.length === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = fields;\n\t\treturn true;\n\t}\n\n\tpublic seekNodes(offset: number): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only seekNodes when in Nodes\");\n\t\tthis.index += offset;\n\t\tif (this.index in this.siblings) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic firstNode(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"firstNode only allowed in fields mode\");\n\t\tconst nodes = this.getField();\n\t\tif (nodes.length === 0) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = nodes;\n\t\treturn true;\n\t}\n\n\tpublic nextNode(): boolean {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Nodes,\n\t\t\t0x406 /* can only nextNode when in Nodes */,\n\t\t);\n\t\tthis.index++;\n\t\tif (this.index < (this.siblings as []).length) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic exitField(): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only navigate up from field when in field\");\n\t\tthis.siblings = this.siblingStack.pop() ?? fail(\"Unexpected siblingStack.length\");\n\t\tthis.index = this.indexStack.pop() ?? fail(\"Unexpected indexStack.length\");\n\t}\n\n\tpublic exitNode(): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only navigate up from node when in node\");\n\t\tthis.siblings = this.siblingStack.pop() ?? fail(\"Unexpected siblingStack.length\");\n\t\tthis.index = this.indexStack.pop() ?? fail(\"Unexpected indexStack.length\");\n\t}\n\n\tpublic getNode(): TNode {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only get node when in node\");\n\t\t// Test is failing when using `?? oob()` here.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblings as TNode[])[this.index]!;\n\t}\n\n\tprivate getField(): readonly TNode[] {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only get field when in fields\");\n\t\tconst parent = this.getStackedNode(this.indexStack.length - 1);\n\t\tconst key: FieldKey = this.getFieldKey();\n\t\tconst field = this.adapter.getFieldFromNode(parent, key);\n\t\treturn field;\n\t}\n\n\t/**\n\t * @returns the value of the current node\n\t */\n\tpublic get value(): Value {\n\t\treturn this.adapter.value(this.getNode());\n\t}\n\n\t/**\n\t * @returns the type of the current node\n\t */\n\tpublic get type(): TreeType {\n\t\treturn this.adapter.type(this.getNode());\n\t}\n\n\tpublic get fieldIndex(): number {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only node's index when in node\");\n\t\treturn this.index;\n\t}\n\n\tpublic get chunkStart(): number {\n\t\treturn this.fieldIndex;\n\t}\n\n\tpublic readonly chunkLength = 1;\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: UpPath | undefined,\n): UpPath | undefined {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn applyPrefix(prefix, path);\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixFieldPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: FieldUpPath,\n): FieldUpPath {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn {\n\t\tfield: path.parent === undefined ? (prefix.rootFieldOverride ?? path.field) : path.field,\n\t\tparent: prefixPath(prefix, path.parent),\n\t};\n}\n\n/**\n * Compose two prefixes together.\n * `prefixFieldPath(root, prefixFieldPath(inner, path))` should be the same as `prefixFieldPath(prefixPathPrefix(root, inner), path))`\n *\n * TODO: tests for this.\n */\nexport function prefixPathPrefix(root: PathRootPrefix, inner: PathRootPrefix): PathRootPrefix {\n\tif (inner.parent !== undefined) {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: new PrefixedPath(root, inner.parent),\n\t\t\trootFieldOverride: inner.rootFieldOverride,\n\t\t\tindexOffset: inner.indexOffset,\n\t\t};\n\t\treturn composedPrefix;\n\t} else {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: root.parent,\n\t\t\trootFieldOverride: root.rootFieldOverride ?? inner.rootFieldOverride,\n\t\t\tindexOffset: (inner.indexOffset ?? 0) + (root.indexOffset ?? 0),\n\t\t};\n\t\treturn composedPrefix;\n\t}\n}\n\nfunction applyPrefix(prefix: PathRootPrefix, path: UpPath | undefined): UpPath | undefined {\n\tif (path === undefined) {\n\t\treturn prefix.parent;\n\t} else {\n\t\t// As an optimization, avoid double wrapping paths with multiple prefixes\n\t\tif (path instanceof PrefixedPath) {\n\t\t\tconst composedPrefix: PathRootPrefix = prefixPathPrefix(prefix, path.prefix);\n\t\t\treturn new PrefixedPath(composedPrefix, path.path);\n\t\t} else {\n\t\t\treturn new PrefixedPath(prefix, path);\n\t\t}\n\t}\n}\n\n/**\n * Wrapper around a path that adds a prefix to the root.\n *\n * Exported for testing: use `prefixPath` and `prefixFieldPath` to construct.\n */\nexport class PrefixedPath implements UpPath {\n\tpublic readonly parentField: FieldKey;\n\tpublic readonly parentIndex: number;\n\tpublic constructor(\n\t\tpublic readonly prefix: PathRootPrefix,\n\t\tpublic readonly path: UpPath,\n\t) {\n\t\tif (path.parent === undefined) {\n\t\t\tthis.parentField = prefix.rootFieldOverride ?? path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex + (prefix.indexOffset ?? 0);\n\t\t} else {\n\t\t\tthis.parentField = path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex;\n\t\t}\n\t}\n\tpublic get parent(): UpPath | undefined {\n\t\treturn applyPrefix(this.prefix, this.path.parent);\n\t}\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -29,9 +29,9 @@ export type Listenable<T extends object> = EventListenable<T>;
29
29
  */
30
30
  export type Off = EventOff;
31
31
  export { TreeStatus, TreeCompressionStrategy, type TreeIndex, type TreeIndexKey, type TreeIndexNodes, } from "./feature-libraries/index.js";
32
- export { type ITreeInternal, type SharedTreeOptions, type ForestType, type SharedTreeFormatOptions, SharedTreeFormatVersion, Tree, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransaction, rollback, type ForestOptions, getBranch, type BranchableTree, type TreeBranchFork, independentInitializedView, type ViewContent, TreeAlpha, independentView, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./shared-tree/index.js";
33
- export { TreeArrayNode, type Unhydrated, IterableTreeArrayContent, TreeNode, type ViewableTree, type ITree, type TreeNodeSchema, TreeViewConfiguration, type ITreeViewConfiguration, type ITreeConfigurationOptions, type TreeView, type TreeViewEvents, SchemaFactory, SchemaFactoryAlpha, type SchemaFactoryObjectOptions, 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, type ReadonlyArrayNode, type InsertableTreeNodeFromAllowedTypes, type Input, type TreeBranch, type TreeBranchEvents, asTreeViewAlpha, type NodeSchemaOptions, type NodeSchemaMetadata, } from "./simple-tree/index.js";
34
- export { SharedTree, configuredSharedTree, } from "./treeFactory.js";
32
+ export { type ITreeInternal, type SharedTreeOptions, type ForestType, type SharedTreeFormatOptions, SharedTreeFormatVersion, Tree, type RunTransaction, type ForestOptions, getBranch, type BranchableTree, type TreeBranchFork, independentInitializedView, type ViewContent, TreeAlpha, independentView, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, type IChannelView, } from "./shared-tree/index.js";
33
+ export { TreeArrayNode, type Unhydrated, IterableTreeArrayContent, TreeNode, type ViewableTree, type ITree, type TreeNodeSchema, TreeViewConfiguration, type ITreeViewConfiguration, type ITreeConfigurationOptions, type TreeView, type TreeViewEvents, SchemaFactory, SchemaFactoryAlpha, type SchemaFactoryObjectOptions, 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, type ReadonlyArrayNode, type InsertableTreeNodeFromAllowedTypes, type Input, type TreeBranch, type TreeBranchEvents, asTreeViewAlpha, type NodeSchemaOptions, type NodeSchemaMetadata, type schemaStatics, type ITreeAlpha, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, rollback, } from "./simple-tree/index.js";
34
+ export { SharedTree, configuredSharedTree, SharedTreeAttributes, SharedTreeFactoryType, } from "./treeFactory.js";
35
35
  export { type ICodecOptions, type JsonValidator, type SchemaValidationFunction, FluidClientVersion, } from "./codec/index.js";
36
36
  export { noopValidator } from "./codec/index.js";
37
37
  export { typeboxValidator } from "./external-utilities/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EACX,KAAK,UAAU,EACf,UAAU,EACV,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK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,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,QAAQ,GACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,UAAU,EACV,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GACrB,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,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/lib/index.js CHANGED
@@ -4,15 +4,15 @@
4
4
  */
5
5
  export { ValueSchema, CommitKind, RevertibleStatus, } from "./core/index.js";
6
6
  export { TreeStatus, TreeCompressionStrategy, } from "./feature-libraries/index.js";
7
- export { SharedTreeFormatVersion, Tree, rollback, getBranch, independentInitializedView, TreeAlpha, independentView, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./shared-tree/index.js";
7
+ export { SharedTreeFormatVersion, Tree, getBranch, independentInitializedView, TreeAlpha, independentView, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./shared-tree/index.js";
8
8
  export { TreeArrayNode, IterableTreeArrayContent, TreeViewConfiguration, SchemaFactory, SchemaFactoryAlpha, FieldKind, FieldSchema, NodeKind, createSimpleTreeIndex, createIdentifierIndex,
9
9
  // experimental @alpha APIs:
10
10
  adaptEnum, enumFromStrings, singletonSchema,
11
11
  // test recursive schema for checking that d.ts files handles schema correctly
12
12
  test_RecursiveObject, test_RecursiveObject_base, test_RecursiveObjectPojoMode,
13
13
  // Beta APIs
14
- TreeBeta, extractPersistedSchema, comparePersistedSchema, getJsonSchema, normalizeAllowedTypes, getSimpleSchema, asTreeViewAlpha, } from "./simple-tree/index.js";
15
- export { SharedTree, configuredSharedTree, } from "./treeFactory.js";
14
+ TreeBeta, extractPersistedSchema, comparePersistedSchema, getJsonSchema, normalizeAllowedTypes, getSimpleSchema, asTreeViewAlpha, rollback, } from "./simple-tree/index.js";
15
+ export { SharedTree, configuredSharedTree, SharedTreeAttributes, SharedTreeFactoryType, } from "./treeFactory.js";
16
16
  export { FluidClientVersion, } from "./codec/index.js";
17
17
  export { noopValidator } from "./codec/index.js";
18
18
  export { typeboxValidator } from "./external-utilities/index.js";
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EAEX,UAAU,EACV,gBAAgB,GAKhB,MAAM,iBAAiB,CAAC;AAkCzB,OAAO,EACN,UAAU,EACV,uBAAuB,GAIvB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAKN,uBAAuB,EACvB,IAAI,EAIJ,QAAQ,EAER,SAAS,EAGT,0BAA0B,EAE1B,SAAS,EACT,eAAe,EAQf,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,aAAa,EAEb,wBAAwB,EAKxB,qBAAqB,EAKrB,aAAa,EACb,kBAAkB,EASlB,SAAS,EACT,WAAW,EAKX,QAAQ,EAoCR,qBAAqB,EACrB,qBAAqB;AACrB,4BAA4B;AAC5B,SAAS,EACT,eAAe,EACf,eAAe;AAUf,8EAA8E;AAC9E,oBAAoB,EACpB,yBAAyB,EACzB,4BAA4B;AAC5B,YAAY;AACZ,QAAQ,EAMR,sBAAsB,EACtB,sBAAsB,EAgBtB,aAAa,EAWb,qBAAqB,EACrB,eAAe,EAMf,eAAe,GAGf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,UAAU,EACV,oBAAoB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAIN,kBAAkB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAYjE,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO;AACN;;;GAGG;AACH,aAAa,GACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tValueSchema,\n\ttype Revertible,\n\tCommitKind,\n\tRevertibleStatus,\n\ttype CommitMetadata,\n\ttype RevertibleFactory,\n\ttype RevertibleAlphaFactory,\n\ttype RevertibleAlpha,\n} from \"./core/index.js\";\n\nimport type {\n\tListeners as EventListeners,\n\tIsListener as EventIsListener,\n\tListenable as EventListenable,\n\tOff as EventOff,\n} from \"@fluidframework/core-interfaces\";\n\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listeners}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listeners<T extends object> = EventListeners<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#IsListener}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type IsListener<T> = EventIsListener<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listenable}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listenable<T extends object> = EventListenable<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Off}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Off = EventOff;\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 ITreeInternal,\n\ttype SharedTreeOptions,\n\ttype ForestType,\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\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\tForestTypeOptimized,\n\tForestTypeExpensiveDebug,\n\tForestTypeReference,\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\tSchemaFactoryAlpha,\n\ttype SchemaFactoryObjectOptions,\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\ttype ReadonlyArrayNode,\n\ttype InsertableTreeNodeFromAllowedTypes,\n\ttype Input,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tasTreeViewAlpha,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaMetadata,\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 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,OAAO,EACN,WAAW,EAEX,UAAU,EACV,gBAAgB,GAKhB,MAAM,iBAAiB,CAAC;AAkCzB,OAAO,EACN,UAAU,EACV,uBAAuB,GAIvB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAKN,uBAAuB,EACvB,IAAI,EAGJ,SAAS,EAGT,0BAA0B,EAE1B,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,GAEnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,aAAa,EAEb,wBAAwB,EAKxB,qBAAqB,EAKrB,aAAa,EACb,kBAAkB,EASlB,SAAS,EACT,WAAW,EAKX,QAAQ,EAoCR,qBAAqB,EACrB,qBAAqB;AACrB,4BAA4B;AAC5B,SAAS,EACT,eAAe,EACf,eAAe;AAUf,8EAA8E;AAC9E,oBAAoB,EACpB,yBAAyB,EACzB,4BAA4B;AAC5B,YAAY;AACZ,QAAQ,EAMR,sBAAsB,EACtB,sBAAsB,EAgBtB,aAAa,EAWb,qBAAqB,EACrB,eAAe,EAMf,eAAe,EAcf,QAAQ,GACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,UAAU,EACV,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAIN,kBAAkB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAYjE,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO;AACN;;;GAGG;AACH,aAAa,GACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tValueSchema,\n\ttype Revertible,\n\tCommitKind,\n\tRevertibleStatus,\n\ttype CommitMetadata,\n\ttype RevertibleFactory,\n\ttype RevertibleAlphaFactory,\n\ttype RevertibleAlpha,\n} from \"./core/index.js\";\n\nimport type {\n\tListeners as EventListeners,\n\tIsListener as EventIsListener,\n\tListenable as EventListenable,\n\tOff as EventOff,\n} from \"@fluidframework/core-interfaces\";\n\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listeners}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listeners<T extends object> = EventListeners<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#IsListener}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type IsListener<T> = EventIsListener<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listenable}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listenable<T extends object> = EventListenable<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Off}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Off = EventOff;\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 ITreeInternal,\n\ttype SharedTreeOptions,\n\ttype ForestType,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tTree,\n\ttype RunTransaction,\n\ttype ForestOptions,\n\tgetBranch,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n\tindependentInitializedView,\n\ttype ViewContent,\n\tTreeAlpha,\n\tindependentView,\n\tForestTypeOptimized,\n\tForestTypeExpensiveDebug,\n\tForestTypeReference,\n\ttype IChannelView,\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\tSchemaFactoryAlpha,\n\ttype SchemaFactoryObjectOptions,\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\ttype ReadonlyArrayNode,\n\ttype InsertableTreeNodeFromAllowedTypes,\n\ttype Input,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tasTreeViewAlpha,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaMetadata,\n\ttype schemaStatics,\n\ttype ITreeAlpha,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\trollback,\n} from \"./simple-tree/index.js\";\nexport {\n\tSharedTree,\n\tconfiguredSharedTree,\n\tSharedTreeAttributes,\n\tSharedTreeFactoryType,\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 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"]}
package/lib/legacy.d.ts CHANGED
@@ -88,8 +88,11 @@ export {
88
88
  ViewableTree,
89
89
  WithType,
90
90
  rollback,
91
+ schemaStatics,
91
92
  typeSchemaSymbol,
92
93
 
93
94
  // @legacy APIs
94
- SharedTree
95
+ SharedTree,
96
+ SharedTreeAttributes,
97
+ SharedTreeFactoryType
95
98
  } from "./index.js";
@@ -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.20.0";
8
+ export declare const pkgVersion = "2.22.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/tree";
8
- export const pkgVersion = "2.20.0";
8
+ export const pkgVersion = "2.22.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC;AAC9C,MAAM,CAAC,MAAM,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.20.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC;AAC9C,MAAM,CAAC,MAAM,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.22.0\";\n"]}
package/lib/public.d.ts CHANGED
@@ -88,5 +88,6 @@ export {
88
88
  ViewableTree,
89
89
  WithType,
90
90
  rollback,
91
+ schemaStatics,
91
92
  typeSchemaSymbol
92
93
  } from "./index.js";
@@ -2,14 +2,13 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { type ISharedTree, SharedTreeFactory, type SharedTreeOptions, SharedTree, getBranch, type ForestType, type SharedTreeContentSnapshot, type SharedTreeFormatOptions, SharedTreeFormatVersion, buildConfiguredForest, defaultSharedTreeOptions, type ForestOptions, type ITreeInternal, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./sharedTree.js";
5
+ export { type ISharedTree, type ITreePrivate, type SharedTreeOptionsInternal, type SharedTreeOptions, SharedTree, getBranch, type ForestType, type SharedTreeContentSnapshot, type SharedTreeFormatOptions, SharedTreeFormatVersion, buildConfiguredForest, defaultSharedTreeOptions, type ForestOptions, type ITreeInternal, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, type IChannelView, } from "./sharedTree.js";
6
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";
10
10
  export type { ISharedTreeEditor, ISchemaEditor } from "./sharedTreeEditBuilder.js";
11
11
  export { treeApi as Tree, type TreeApi, type RunTransaction, } from "./treeApi.js";
12
- export { type TransactionConstraint, type NodeInDocumentConstraint, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, rollback, } from "./transactionTypes.js";
13
12
  export { TreeAlpha } from "./treeApiAlpha.js";
14
13
  export { independentInitializedView, type ViewContent, independentView, } from "./independentView.js";
15
14
  //# sourceMappingURL=index.d.ts.map
@@ -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,UA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K,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,UAAU,EACV,SAAS,EACT,KAAK,UAAU,EACf,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,KAAK,YAAY,GACjB,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,cAAc,GACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EACN,0BAA0B,EAC1B,KAAK,WAAW,EAChB,eAAe,GACf,MAAM,sBAAsB,CAAC"}
@@ -2,12 +2,11 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { SharedTreeFactory, SharedTree, getBranch, SharedTreeFormatVersion, buildConfiguredForest, defaultSharedTreeOptions, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./sharedTree.js";
5
+ export { SharedTree, getBranch, SharedTreeFormatVersion, buildConfiguredForest, defaultSharedTreeOptions, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./sharedTree.js";
6
6
  export { createTreeCheckout, TreeCheckout, } from "./treeCheckout.js";
7
7
  export { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
8
8
  export { CheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
9
9
  export { treeApi as Tree, } from "./treeApi.js";
10
- export { rollback, } from "./transactionTypes.js";
11
10
  export { TreeAlpha } from "./treeApiAlpha.js";
12
11
  export { independentInitializedView, independentView, } from "./independentView.js";
13
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,iBAAiB,EAEjB,UAAU,EACV,SAAS,EAIT,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EAGxB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,kBAAkB,EAClB,YAAY,GAMZ,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,EACN,OAAO,IAAI,IAAI,GAGf,MAAM,cAAc,CAAC;AAEtB,OAAO,EAUN,QAAQ,GACR,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EACN,0BAA0B,EAE1B,eAAe,GACf,MAAM,sBAAsB,CAAC","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\ttype ForestType,\n\ttype SharedTreeContentSnapshot,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tbuildConfiguredForest,\n\tdefaultSharedTreeOptions,\n\ttype ForestOptions,\n\ttype ITreeInternal,\n\tForestTypeOptimized,\n\tForestTypeExpensiveDebug,\n\tForestTypeReference,\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 RunTransaction,\n} from \"./treeApi.js\";\n\nexport {\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\trollback,\n} from \"./transactionTypes.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,OAAO,EAKN,UAAU,EACV,SAAS,EAIT,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EAGxB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,GAEnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,kBAAkB,EAClB,YAAY,GAMZ,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,EACN,OAAO,IAAI,IAAI,GAGf,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EACN,0BAA0B,EAE1B,eAAe,GACf,MAAM,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ISharedTree,\n\ttype ITreePrivate,\n\ttype SharedTreeOptionsInternal,\n\ttype SharedTreeOptions,\n\tSharedTree,\n\tgetBranch,\n\ttype ForestType,\n\ttype SharedTreeContentSnapshot,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tbuildConfiguredForest,\n\tdefaultSharedTreeOptions,\n\ttype ForestOptions,\n\ttype ITreeInternal,\n\tForestTypeOptimized,\n\tForestTypeExpensiveDebug,\n\tForestTypeReference,\n\ttype IChannelView,\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 RunTransaction,\n} from \"./treeApi.js\";\n\nexport { TreeAlpha } from \"./treeApiAlpha.js\";\n\nexport {\n\tindependentInitializedView,\n\ttype ViewContent,\n\tindependentView,\n} from \"./independentView.js\";\n"]}
@@ -4,11 +4,10 @@
4
4
  */
5
5
  import type { HasListeners, IEmitter, Listenable } from "@fluidframework/core-interfaces/internal";
6
6
  import { type NodeKeyManager, type FullSchemaPolicy } from "../feature-libraries/index.js";
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
- import { Breakable, type WithBreakable } from "../util/index.js";
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, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type RunTransactionParams } from "../simple-tree/index.js";
8
+ import { type Breakable, type WithBreakable } from "../util/index.js";
9
9
  import type { ITreeCheckout, TreeCheckout } from "./treeCheckout.js";
10
10
  import { CheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
11
- import type { VoidTransactionCallbackStatus, TransactionCallbackStatus, TransactionResult, TransactionResultExt, RunTransactionParams } from "./transactionTypes.js";
12
11
  /**
13
12
  * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already
14
13
  * exists and error if creating a second.
@@ -21,7 +20,6 @@ export declare class SchematizingSimpleTreeView<in out TRootSchema extends Impli
21
20
  readonly checkout: TreeCheckout;
22
21
  readonly config: TreeViewConfiguration<ReadSchema<TRootSchema>>;
23
22
  readonly nodeKeyManager: NodeKeyManager;
24
- readonly breaker: Breakable;
25
23
  private readonly onDispose?;
26
24
  /**
27
25
  * The view is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.
@@ -46,7 +44,8 @@ export declare class SchematizingSimpleTreeView<in out TRootSchema extends Impli
46
44
  */
47
45
  private midUpgrade;
48
46
  private readonly rootFieldSchema;
49
- constructor(checkout: TreeCheckout, config: TreeViewConfiguration<ReadSchema<TRootSchema>>, nodeKeyManager: NodeKeyManager, breaker?: Breakable, onDispose?: (() => void) | undefined);
47
+ readonly breaker: Breakable;
48
+ constructor(checkout: TreeCheckout, config: TreeViewConfiguration<ReadSchema<TRootSchema>>, nodeKeyManager: NodeKeyManager, onDispose?: (() => void) | undefined);
50
49
  hasRootSchema<TSchema extends ImplicitFieldSchema>(schema: TSchema): this is TreeViewAlpha<TSchema>;
51
50
  get schema(): ReadSchema<TRootSchema>;
52
51
  initialize(content: InsertableField<TRootSchema>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"schematizingTreeView.d.ts","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,MAAM,0CAA0C,CAAC;AAMlD,OAAO,EACN,KAAK,cAAc,EAInB,KAAK,gBAAgB,EAErB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEN,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,QAAQ,EACb,KAAK,cAAc,EAInB,UAAU,EAEV,KAAK,qBAAqB,EAK1B,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,gBAAgB,EAGrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAgC,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAG/F,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAOjE,OAAO,KAAK,EACX,6BAA6B,EAC7B,yBAAyB,EACzB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EAEpB,MAAM,uBAAuB,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,QAAQ,sEAA8C,CA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,EAAE,oBAAoB,GAC3B,iBAAiB;IAiEpB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,YAAY;IAIpB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM;IAiFd,OAAO,CAAC,aAAa;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,0BAA0B,CAAC,WAAW,CAAC;IAIhF,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,CAatB"}
@@ -45,11 +45,10 @@ import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
45
45
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
46
46
  import { AllowedUpdateType, anchorSlot } from "../core/index.js";
47
47
  import { defaultSchemaPolicy, ContextSlot, cursorForMapTreeNode, TreeStatus, } from "../feature-libraries/index.js";
48
- import { getTreeNodeForField, setField, normalizeFieldSchema, ViewSchema, mapTreeFromNodeData, prepareContentForHydration, comparePersistedSchemaInternal, toStoredSchema, getOrCreateInnerNode, getKernel, } from "../simple-tree/index.js";
49
- import { Breakable, breakingClass, disposeSymbol } from "../util/index.js";
48
+ import { getTreeNodeForField, setField, normalizeFieldSchema, ViewSchema, mapTreeFromNodeData, prepareContentForHydration, comparePersistedSchemaInternal, toStoredSchema, getOrCreateInnerNode, getKernel, HydratedContext, SimpleContextSlot, areImplicitFieldSchemaEqual, createUnknownOptionalFieldPolicy, } from "../simple-tree/index.js";
49
+ import { breakingClass, disposeSymbol, } from "../util/index.js";
50
50
  import { canInitialize, ensureSchema, initialize } from "./schematizeTree.js";
51
51
  import { CheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
52
- import { HydratedContext, SimpleContextSlot, areImplicitFieldSchemaEqual, createUnknownOptionalFieldPolicy, } from "../simple-tree/index.js";
53
52
  /**
54
53
  * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already
55
54
  * exists and error if creating a second.
@@ -64,11 +63,10 @@ let SchematizingSimpleTreeView = (() => {
64
63
  let _classExtraInitializers = [];
65
64
  let _classThis;
66
65
  var SchematizingSimpleTreeView = _classThis = class {
67
- constructor(checkout, config, nodeKeyManager, breaker = new Breakable("SchematizingSimpleTreeView"), onDispose) {
66
+ constructor(checkout, config, nodeKeyManager, onDispose) {
68
67
  this.checkout = checkout;
69
68
  this.config = config;
70
69
  this.nodeKeyManager = nodeKeyManager;
71
- this.breaker = breaker;
72
70
  this.onDispose = onDispose;
73
71
  this.events = createEmitter();
74
72
  this.unregisterCallbacks = new Set();
@@ -80,6 +78,7 @@ let SchematizingSimpleTreeView = (() => {
80
78
  * which are implementation details and should not be exposed to the user.
81
79
  */
82
80
  this.midUpgrade = false;
81
+ this.breaker = checkout.breaker;
83
82
  if (checkout.forest.anchors.slots.has(ViewSlot)) {
84
83
  throw new UsageError("Cannot create a second tree view from the same checkout");
85
84
  }
@@ -1 +1 @@
1
- {"version":3,"file":"schematizingTreeView.js","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOH,OAAO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aAAa,GAAG,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC3E,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAC3F,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,oBAAoB,CAAC,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IACzF,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAE9E,OAAO,IAAI,CAAC;AACb,CAAC","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, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { AllowedUpdateType, anchorSlot, type SchemaPolicy } from \"../core/index.js\";\nimport {\n\ttype NodeKeyManager,\n\tdefaultSchemaPolicy,\n\tContextSlot,\n\tcursorForMapTreeNode,\n\ttype FullSchemaPolicy,\n\tTreeStatus,\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\tgetOrCreateInnerNode,\n\tgetKernel,\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\tcreateUnknownOptionalFieldPolicy,\n} from \"../simple-tree/index.js\";\nimport type {\n\tVoidTransactionCallbackStatus,\n\tTransactionCallbackStatus,\n\tTransactionResult,\n\tTransactionResultExt,\n\tRunTransactionParams,\n\tTransactionConstraint,\n} from \"./transactionTypes.js\";\n\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\tthis.rootFieldSchema = normalizeFieldSchema(config.schema);\n\t\tthis.schemaPolicy = {\n\t\t\t...defaultSchemaPolicy,\n\t\t\tvalidateSchema: config.enableSchemaValidation,\n\t\t\tallowUnknownOptionalFields: createUnknownOptionalFieldPolicy(this.rootFieldSchema),\n\t\t};\n\n\t\tthis.viewSchema = new ViewSchema(this.schemaPolicy, {}, 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: this.schemaPolicy,\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: toStoredSchema(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: toStoredSchema(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\t/**\n\t * {@inheritDoc @fluidframework/shared-tree#TreeViewAlpha.runTransaction}\n\t */\n\tpublic runTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResultExt<TSuccessValue, TFailureValue>;\n\t/**\n\t * {@inheritDoc @fluidframework/shared-tree#TreeViewAlpha.runTransaction}\n\t */\n\tpublic runTransaction(\n\t\ttransaction: () => VoidTransactionCallbackStatus | void,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResult;\n\tpublic runTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () =>\n\t\t\t| TransactionCallbackStatus<TSuccessValue, TFailureValue>\n\t\t\t| VoidTransactionCallbackStatus\n\t\t\t| void,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResultExt<TSuccessValue, TFailureValue> | TransactionResult {\n\t\tconst addConstraints = (\n\t\t\tconstraintsOnRevert: boolean,\n\t\t\tconstraints: readonly TransactionConstraint[] = [],\n\t\t): void => {\n\t\t\tfor (const constraint of constraints) {\n\t\t\t\tswitch (constraint.type) {\n\t\t\t\t\tcase \"nodeInDocument\": {\n\t\t\t\t\t\tconst node = getOrCreateInnerNode(constraint.node);\n\t\t\t\t\t\tconst nodeStatus = getKernel(constraint.node).getStatus();\n\t\t\t\t\t\tif (nodeStatus !== TreeStatus.InDocument) {\n\t\t\t\t\t\t\tconst revertText = constraintsOnRevert ? \" on revert\" : \"\";\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Attempted to add a \"nodeInDocument\" constraint${revertText}, but the node is not currently in the document. Node status: ${nodeStatus}`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (constraintsOnRevert) {\n\t\t\t\t\t\t\tthis.checkout.editor.addNodeExistsConstraintOnRevert(node.anchorNode);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.checkout.editor.addNodeExistsConstraint(node.anchorNode);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunreachableCase(constraint.type);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis.checkout.transaction.start();\n\n\t\t// Validate preconditions before running the transaction callback.\n\t\taddConstraints(false /* constraintsOnRevert */, params?.preconditions);\n\t\tconst transactionCallbackStatus = transaction();\n\t\tconst rollback = transactionCallbackStatus?.rollback;\n\t\tconst value = (\n\t\t\ttransactionCallbackStatus as TransactionCallbackStatus<TSuccessValue, TFailureValue>\n\t\t)?.value;\n\n\t\tif (rollback === true) {\n\t\t\tthis.checkout.transaction.abort();\n\t\t\treturn value !== undefined\n\t\t\t\t? { success: false, value: value as TFailureValue }\n\t\t\t\t: { success: false };\n\t\t}\n\n\t\t// Validate preconditions on revert after running the transaction callback and was successful.\n\t\taddConstraints(\n\t\t\ttrue /* constraintsOnRevert */,\n\t\t\ttransactionCallbackStatus?.preconditionsOnRevert,\n\t\t);\n\n\t\tthis.checkout.transaction.commit();\n\t\treturn value !== undefined\n\t\t\t? { success: true, value: value as TSuccessValue }\n\t\t\t: { success: true };\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\"]> & SchematizingSimpleTreeView<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(compatibility.canView, 0x8c3 /* requireSchema invoked with incompatible schema */);\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,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAqB,MAAM,kBAAkB,CAAC;AACpF,OA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,CAAC,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAE9E,OAAO,IAAI,CAAC;AACb,CAAC","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, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { AllowedUpdateType, anchorSlot, type SchemaPolicy } from \"../core/index.js\";\nimport {\n\ttype NodeKeyManager,\n\tdefaultSchemaPolicy,\n\tContextSlot,\n\tcursorForMapTreeNode,\n\ttype FullSchemaPolicy,\n\tTreeStatus,\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\tgetOrCreateInnerNode,\n\tgetKernel,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype RunTransactionParams,\n\ttype TransactionConstraint,\n\tHydratedContext,\n\tSimpleContextSlot,\n\tareImplicitFieldSchemaEqual,\n\tcreateUnknownOptionalFieldPolicy,\n} from \"../simple-tree/index.js\";\nimport {\n\ttype Breakable,\n\tbreakingClass,\n\tdisposeSymbol,\n\ttype WithBreakable,\n} from \"../util/index.js\";\n\nimport { canInitialize, ensureSchema, initialize } from \"./schematizeTree.js\";\nimport type { ITreeCheckout, TreeCheckout } from \"./treeCheckout.js\";\nimport { CheckoutFlexTreeView } from \"./checkoutFlexTreeView.js\";\n\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\tpublic readonly breaker: Breakable;\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\tprivate readonly onDispose?: () => void,\n\t) {\n\t\tthis.breaker = checkout.breaker;\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\tthis.rootFieldSchema = normalizeFieldSchema(config.schema);\n\t\tthis.schemaPolicy = {\n\t\t\t...defaultSchemaPolicy,\n\t\t\tvalidateSchema: config.enableSchemaValidation,\n\t\t\tallowUnknownOptionalFields: createUnknownOptionalFieldPolicy(this.rootFieldSchema),\n\t\t};\n\n\t\tthis.viewSchema = new ViewSchema(this.schemaPolicy, {}, 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: this.schemaPolicy,\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: toStoredSchema(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: toStoredSchema(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\t/**\n\t * {@inheritDoc @fluidframework/shared-tree#TreeViewAlpha.runTransaction}\n\t */\n\tpublic runTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResultExt<TSuccessValue, TFailureValue>;\n\t/**\n\t * {@inheritDoc @fluidframework/shared-tree#TreeViewAlpha.runTransaction}\n\t */\n\tpublic runTransaction(\n\t\ttransaction: () => VoidTransactionCallbackStatus | void,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResult;\n\tpublic runTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () =>\n\t\t\t| TransactionCallbackStatus<TSuccessValue, TFailureValue>\n\t\t\t| VoidTransactionCallbackStatus\n\t\t\t| void,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResultExt<TSuccessValue, TFailureValue> | TransactionResult {\n\t\tconst addConstraints = (\n\t\t\tconstraintsOnRevert: boolean,\n\t\t\tconstraints: readonly TransactionConstraint[] = [],\n\t\t): void => {\n\t\t\tfor (const constraint of constraints) {\n\t\t\t\tswitch (constraint.type) {\n\t\t\t\t\tcase \"nodeInDocument\": {\n\t\t\t\t\t\tconst node = getOrCreateInnerNode(constraint.node);\n\t\t\t\t\t\tconst nodeStatus = getKernel(constraint.node).getStatus();\n\t\t\t\t\t\tif (nodeStatus !== TreeStatus.InDocument) {\n\t\t\t\t\t\t\tconst revertText = constraintsOnRevert ? \" on revert\" : \"\";\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Attempted to add a \"nodeInDocument\" constraint${revertText}, but the node is not currently in the document. Node status: ${nodeStatus}`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (constraintsOnRevert) {\n\t\t\t\t\t\t\tthis.checkout.editor.addNodeExistsConstraintOnRevert(node.anchorNode);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.checkout.editor.addNodeExistsConstraint(node.anchorNode);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunreachableCase(constraint.type);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis.checkout.transaction.start();\n\n\t\t// Validate preconditions before running the transaction callback.\n\t\taddConstraints(false /* constraintsOnRevert */, params?.preconditions);\n\t\tconst transactionCallbackStatus = transaction();\n\t\tconst rollback = transactionCallbackStatus?.rollback;\n\t\tconst value = (\n\t\t\ttransactionCallbackStatus as TransactionCallbackStatus<TSuccessValue, TFailureValue>\n\t\t)?.value;\n\n\t\tif (rollback === true) {\n\t\t\tthis.checkout.transaction.abort();\n\t\t\treturn value !== undefined\n\t\t\t\t? { success: false, value: value as TFailureValue }\n\t\t\t\t: { success: false };\n\t\t}\n\n\t\t// Validate preconditions on revert after running the transaction callback and was successful.\n\t\taddConstraints(\n\t\t\ttrue /* constraintsOnRevert */,\n\t\t\ttransactionCallbackStatus?.preconditionsOnRevert,\n\t\t);\n\n\t\tthis.checkout.transaction.commit();\n\t\treturn value !== undefined\n\t\t\t? { success: true, value: value as TSuccessValue }\n\t\t\t: { success: true };\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\"]> & SchematizingSimpleTreeView<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(compatibility.canView, 0x8c3 /* requireSchema invoked with incompatible schema */);\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"]}