@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
@@ -171,6 +171,141 @@ export type ScopedSchemaName<
171
171
  > = TScope extends undefined ? `${TName}` : `${TScope}.${TName}`;
172
172
  // > = `${TScope extends undefined ? "" : `${TScope}.`}${TName}`;
173
173
 
174
+ /**
175
+ * Stateless APIs exposed via {@link SchemaFactory} as both instance properties and as statics.
176
+ * @privateRemarks
177
+ * We have no way to make linkable members which exist both as statics and instance properties since API-Extractor does not support this.
178
+ * As a workaround, we have this type as a third place which can be linked.
179
+ * @system @sealed @public
180
+ */
181
+ export const schemaStatics = {
182
+ /**
183
+ * {@link TreeNodeSchema} for holding a JavaScript `string`.
184
+ *
185
+ * @remarks
186
+ * Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.
187
+ *
188
+ * These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.
189
+ * JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.
190
+ * @privateRemarks
191
+ * TODO:
192
+ * We should be much more clear about what happens if you use problematic values.
193
+ * We should validate and/or normalize them when inserting content.
194
+ */
195
+ string: stringSchema,
196
+
197
+ /**
198
+ * {@link TreeNodeSchema} for holding a JavaScript `number`.
199
+ *
200
+ * @remarks
201
+ * The number is a {@link https://en.wikipedia.org/wiki/Double-precision_floating-point_format | double-precision 64-bit binary format IEEE 754} value, however there are some exceptions:
202
+ * - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).
203
+ * - `-0` may be converted to `0` in some cases.
204
+ *
205
+ * These limitations match the limitations of JSON.
206
+ * @privateRemarks
207
+ * TODO:
208
+ * We should be much more clear about what happens if you use problematic values.
209
+ * We should validate and/or normalize them when inserting content.
210
+ */
211
+ number: numberSchema,
212
+
213
+ /**
214
+ * {@link TreeNodeSchema} for holding a boolean.
215
+ */
216
+ boolean: booleanSchema,
217
+
218
+ /**
219
+ * {@link TreeNodeSchema} for JavaScript `null`.
220
+ *
221
+ * @remarks
222
+ * There are good {@link https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null | reasons to avoid using null} in JavaScript, however sometimes it is desired.
223
+ * This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.
224
+ * Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.
225
+ */
226
+ null: nullSchema,
227
+
228
+ /**
229
+ * {@link TreeNodeSchema} for holding an {@link @fluidframework/core-interfaces#(IFluidHandle:interface)}.
230
+ */
231
+ handle: handleSchema,
232
+
233
+ /**
234
+ * {@link AllowedTypes} for holding any of the leaf types.
235
+ */
236
+ leaves: [stringSchema, numberSchema, booleanSchema, nullSchema, handleSchema],
237
+
238
+ /**
239
+ * Make a field optional instead of the default, which is required.
240
+ *
241
+ * @param t - The types allowed under the field.
242
+ * @param props - Optional properties to associate with the field.
243
+ *
244
+ * @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
245
+ * See {@link FieldSchemaMetadata.custom}.
246
+ */
247
+ optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
248
+ t: T,
249
+ props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
250
+ ): FieldSchema<FieldKind.Optional, T, TCustomMetadata> => {
251
+ const defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => {
252
+ return undefined;
253
+ });
254
+ return createFieldSchema(FieldKind.Optional, t, {
255
+ defaultProvider: defaultOptionalProvider,
256
+ ...props,
257
+ });
258
+ },
259
+
260
+ /**
261
+ * Make a field explicitly required.
262
+ *
263
+ * @param t - The types allowed under the field.
264
+ * @param props - Optional properties to associate with the field.
265
+ *
266
+ * @remarks
267
+ * Fields are required by default, but this API can be used to make the required nature explicit in the schema,
268
+ * and allows associating custom {@link FieldProps | properties} with the field.
269
+ *
270
+ * @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
271
+ * See {@link FieldSchemaMetadata.custom}.
272
+ */
273
+ required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
274
+ t: T,
275
+ props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
276
+ ): FieldSchema<FieldKind.Required, T, TCustomMetadata> => {
277
+ return createFieldSchema(FieldKind.Required, t, props);
278
+ },
279
+
280
+ /**
281
+ * {@link schemaStatics.optional} except tweaked to work better for recursive types.
282
+ * Use with {@link ValidateRecursiveSchema} for improved type safety.
283
+ * @remarks
284
+ * This version of {@link schemaStatics.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
285
+ * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
286
+ */
287
+ optionalRecursive: <const T extends Unenforced<ImplicitAllowedTypes>>(
288
+ t: T,
289
+ props?: Omit<FieldProps, "defaultProvider">,
290
+ ): FieldSchemaUnsafe<FieldKind.Optional, T> => {
291
+ return createFieldSchemaUnsafe(FieldKind.Optional, t, props);
292
+ },
293
+
294
+ /**
295
+ * {@link schemaStatics.required} except tweaked to work better for recursive types.
296
+ * Use with {@link ValidateRecursiveSchema} for improved type safety.
297
+ * @remarks
298
+ * This version of {@link schemaStatics.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
299
+ * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
300
+ */
301
+ requiredRecursive: <const T extends Unenforced<ImplicitAllowedTypes>>(
302
+ t: T,
303
+ props?: Omit<FieldProps, "defaultProvider">,
304
+ ): FieldSchemaUnsafe<FieldKind.Required, T> => {
305
+ return createFieldSchemaUnsafe(FieldKind.Required, t, props);
306
+ },
307
+ } as const;
308
+
174
309
  // TODO:
175
310
  // SchemaFactory.array references should link to the correct overloads, however the syntax for this does not seems to work currently for methods unless the they are not qualified with the class.
176
311
  // API-Extractor requires such links to be qualified with the class, so it can't work.
@@ -263,6 +398,8 @@ export type ScopedSchemaName<
263
398
  *
264
399
  * Note: the comparison between the customizable and POJO modes is not done in a table because TSDoc does not currently have support for embedded markdown.
265
400
  *
401
+ * @see {@link SchemaFactoryAlpha}
402
+ *
266
403
  * @sealed @public
267
404
  */
268
405
  export class SchemaFactory<
@@ -326,56 +463,65 @@ export class SchemaFactory<
326
463
  }
327
464
 
328
465
  /**
329
- * {@link TreeNodeSchema} for holding a JavaScript `string`.
330
- *
331
- * @remarks
332
- * Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.
333
- *
334
- * These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.
335
- * JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.
336
- * @privateRemarks
337
- * TODO:
338
- * We should be much more clear about what happens if you use problematic values.
339
- * We should validate and/or normalize them when inserting content.
466
+ * {@inheritDoc schemaStatics.string}
340
467
  */
341
468
  public readonly string = stringSchema;
342
469
 
343
470
  /**
344
- * {@link TreeNodeSchema} for holding a JavaScript `number`.
345
- *
346
- * @remarks
347
- * The number is a [double-precision 64-bit binary format IEEE 754](https://en.wikipedia.org/wiki/Double-precision_floating-point_format) value, however there are some exceptions:
348
- * - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).
349
- * - `-0` may be converted to `0` in some cases.
350
- *
351
- * These limitations match the limitations of JSON.
352
- * @privateRemarks
353
- * TODO:
354
- * We should be much more clear about what happens if you use problematic values.
355
- * We should validate and/or normalize them when inserting content.
471
+ * {@inheritDoc schemaStatics.number}
356
472
  */
357
473
  public readonly number = numberSchema;
358
474
 
359
475
  /**
360
- * {@link TreeNodeSchema} for holding a boolean.
476
+ * {@inheritDoc schemaStatics.boolean}
361
477
  */
362
478
  public readonly boolean = booleanSchema;
363
479
 
364
480
  /**
365
- * {@link TreeNodeSchema} for JavaScript `null`.
366
- *
367
- * @remarks
368
- * There are good [reasons to avoid using null](https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null) in JavaScript, however sometimes it is desired.
369
- * This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.
370
- * Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.
481
+ * {@inheritDoc schemaStatics.null}
371
482
  */
372
483
  public readonly null = nullSchema;
373
484
 
374
485
  /**
375
- * {@link TreeNodeSchema} for holding an {@link @fluidframework/core-interfaces#(IFluidHandle:interface)}.
486
+ * {@inheritDoc schemaStatics.handle}
376
487
  */
377
488
  public readonly handle = handleSchema;
378
489
 
490
+ /**
491
+ * {@inheritDoc schemaStatics.leaves}
492
+ */
493
+ public readonly leaves = schemaStatics.leaves;
494
+
495
+ /**
496
+ * {@inheritDoc schemaStatics.string}
497
+ */
498
+ public static readonly string = stringSchema;
499
+
500
+ /**
501
+ * {@inheritDoc schemaStatics.number}
502
+ */
503
+ public static readonly number = numberSchema;
504
+
505
+ /**
506
+ * {@inheritDoc schemaStatics.boolean}
507
+ */
508
+ public static readonly boolean = booleanSchema;
509
+
510
+ /**
511
+ * {@inheritDoc schemaStatics.null}
512
+ */
513
+ public static readonly null = nullSchema;
514
+
515
+ /**
516
+ * {@inheritDoc schemaStatics.handle}
517
+ */
518
+ public static readonly handle = handleSchema;
519
+
520
+ /**
521
+ * {@inheritDoc schemaStatics.leaves}
522
+ */
523
+ public static readonly leaves = schemaStatics.leaves;
524
+
379
525
  /**
380
526
  * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.
381
527
  *
@@ -694,74 +840,44 @@ export class SchemaFactory<
694
840
  }
695
841
 
696
842
  /**
697
- * Make a field optional instead of the default, which is required.
698
- *
699
- * @param t - The types allowed under the field.
700
- * @param props - Optional properties to associate with the field.
701
- *
702
- * @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
703
- * See {@link FieldSchemaMetadata.custom}.
843
+ * {@inheritDoc schemaStatics.optional}
704
844
  */
705
- public optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
706
- t: T,
707
- props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
708
- ): FieldSchema<FieldKind.Optional, T, TCustomMetadata> {
709
- const defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => {
710
- return undefined;
711
- });
712
- return createFieldSchema(FieldKind.Optional, t, {
713
- defaultProvider: defaultOptionalProvider,
714
- ...props,
715
- });
716
- }
845
+ public readonly optional = schemaStatics.optional;
717
846
 
718
847
  /**
719
- * Make a field explicitly required.
720
- *
721
- * @param t - The types allowed under the field.
722
- * @param props - Optional properties to associate with the field.
723
- *
724
- * @remarks
725
- * Fields are required by default, but this API can be used to make the required nature explicit in the schema,
726
- * and allows associating custom {@link FieldProps | properties} with the field.
727
- *
728
- * @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
729
- * See {@link FieldSchemaMetadata.custom}.
848
+ * {@inheritDoc schemaStatics.required}
730
849
  */
731
- public required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
732
- t: T,
733
- props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
734
- ): FieldSchema<FieldKind.Required, T, TCustomMetadata> {
735
- return createFieldSchema(FieldKind.Required, t, props);
736
- }
850
+ public readonly required = schemaStatics.required;
737
851
 
738
852
  /**
739
- * {@link SchemaFactory.optional} except tweaked to work better for recursive types.
740
- * Use with {@link ValidateRecursiveSchema} for improved type safety.
741
- * @remarks
742
- * This version of {@link SchemaFactory.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
743
- * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
853
+ * {@inheritDoc schemaStatics.optionalRecursive}
744
854
  */
745
- public optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(
746
- t: T,
747
- props?: Omit<FieldProps, "defaultProvider">,
748
- ): FieldSchemaUnsafe<FieldKind.Optional, T> {
749
- return createFieldSchemaUnsafe(FieldKind.Optional, t, props);
750
- }
855
+ public readonly optionalRecursive = schemaStatics.optionalRecursive;
751
856
 
752
857
  /**
753
- * {@link SchemaFactory.required} except tweaked to work better for recursive types.
754
- * Use with {@link ValidateRecursiveSchema} for improved type safety.
755
- * @remarks
756
- * This version of {@link SchemaFactory.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
757
- * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
858
+ * {@inheritDoc schemaStatics.requiredRecursive}
758
859
  */
759
- public requiredRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(
760
- t: T,
761
- props?: Omit<FieldProps, "defaultProvider">,
762
- ): FieldSchemaUnsafe<FieldKind.Required, T> {
763
- return createFieldSchemaUnsafe(FieldKind.Required, t, props);
764
- }
860
+ public readonly requiredRecursive = schemaStatics.requiredRecursive;
861
+
862
+ /**
863
+ * {@inheritDoc schemaStatics.optional}
864
+ */
865
+ public static readonly optional = schemaStatics.optional;
866
+
867
+ /**
868
+ * {@inheritDoc schemaStatics.required}
869
+ */
870
+ public static readonly required = schemaStatics.required;
871
+
872
+ /**
873
+ * {@inheritDoc schemaStatics.optionalRecursive}
874
+ */
875
+ public static readonly optionalRecursive = schemaStatics.optionalRecursive;
876
+
877
+ /**
878
+ * {@inheritDoc schemaStatics.requiredRecursive}
879
+ */
880
+ public static readonly requiredRecursive = schemaStatics.requiredRecursive;
765
881
 
766
882
  /**
767
883
  * A special field which holds a unique identifier for an object node.
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import type { TreeNode } from "../simple-tree/index.js";
6
+ import type { TreeNode } from "../core/index.js";
7
7
 
8
8
  /**
9
9
  * A special object that signifies when a SharedTree {@link RunTransaction | transaction} should "roll back".
@@ -13,11 +13,6 @@ import type {
13
13
  } from "../../core/index.js";
14
14
 
15
15
  import type {
16
- RunTransactionParams,
17
- VoidTransactionCallbackStatus,
18
- TransactionCallbackStatus,
19
- TransactionResult,
20
- TransactionResultExt,
21
16
  // This is referenced by doc comments.
22
17
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports
23
18
  TreeAlpha,
@@ -42,6 +37,15 @@ import { markSchemaMostDerived } from "./schemaFactory.js";
42
37
  import { fail, getOrCreate } from "../../util/index.js";
43
38
  import type { MakeNominal } from "../../util/index.js";
44
39
  import { walkFieldSchema } from "../walkFieldSchema.js";
40
+ import type { VerboseTree } from "./verboseTree.js";
41
+ import type { SimpleTreeSchema } from "./simpleSchema.js";
42
+ import type {
43
+ RunTransactionParams,
44
+ TransactionCallbackStatus,
45
+ TransactionResult,
46
+ TransactionResultExt,
47
+ VoidTransactionCallbackStatus,
48
+ } from "./transactionTypes.js";
45
49
  /**
46
50
  * A tree from which a {@link TreeView} can be created.
47
51
  *
@@ -52,7 +56,6 @@ import { walkFieldSchema } from "../walkFieldSchema.js";
52
56
  * Maybe rename "exportJsonSchema" to align on "concise" terminology.
53
57
  * Ensure schema exporting APIs here align and reference APIs for exporting view schema to the same formats (which should include stored vs property key choice).
54
58
  * Make sure users of independentView can use these export APIs (maybe provide a reference back to the ViewableTree from the TreeView to accomplish that).
55
- * Some of these APIs are on ISharedTree and can get moved here.
56
59
  * @system @sealed @public
57
60
  */
58
61
  export interface ViewableTree {
@@ -101,6 +104,28 @@ export interface ViewableTree {
101
104
  */
102
105
  export interface ITree extends ViewableTree, IFluidLoadable {}
103
106
 
107
+ /**
108
+ * {@link ITree} extended with some alpha APIs.
109
+ * @privateRemarks
110
+ * TODO: Promote this to alpha.
111
+ * @internal
112
+ */
113
+ export interface ITreeAlpha extends ITree {
114
+ /**
115
+ * Exports root in the same format as {@link TreeAlpha.(exportVerbose:1)} using stored keys.
116
+ * @remarks
117
+ * This is `undefined` if and only if the root field is empty (this can only happen if the root field is optional).
118
+ */
119
+ exportVerbose(): VerboseTree | undefined;
120
+
121
+ /**
122
+ * Exports the SimpleTreeSchema that is stored in the tree, using stored keys for object fields.
123
+ * @remarks
124
+ * To get the schema using property keys, use {@link getSimpleSchema} on the view schema.
125
+ */
126
+ exportSimpleSchema(): SimpleTreeSchema;
127
+ }
128
+
104
129
  /**
105
130
  * Options when constructing a tree view.
106
131
  * @public
@@ -467,6 +492,10 @@ export interface TreeBranch extends IDisposable {
467
492
  * Doing that would however complicate trivial "hello world" style example slightly, as well as be a breaking API change.
468
493
  * It also seems more complex to handle invalidation with that pattern.
469
494
  * Thus this design was chosen at the risk of apps blindly accessing `root` then breaking unexpectedly when the document is incompatible.
495
+ *
496
+ * @see {@link TreeViewAlpha}
497
+ * @see {@link asTreeViewAlpha}
498
+ *
470
499
  * @sealed @public
471
500
  */
472
501
  export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends IDisposable {
@@ -6,7 +6,11 @@
6
6
  import type { TreeValue } from "../../core/index.js";
7
7
  import type { FlexTreeNode } from "../../feature-libraries/index.js";
8
8
  import { fail } from "../../util/index.js";
9
- import { type InnerNode, mapTreeNodeToProxy, proxySlot } from "./treeNodeKernel.js";
9
+ import {
10
+ type InnerNode,
11
+ unhydratedFlexTreeNodeToTreeNode,
12
+ proxySlot,
13
+ } from "./treeNodeKernel.js";
10
14
  import { getSimpleNodeSchemaFromInnerNode } from "./schemaCaching.js";
11
15
  import type { TreeNode, InternalTreeNode } from "./types.js";
12
16
  import { UnhydratedFlexTreeNode } from "./unhydratedFlexTree.js";
@@ -20,7 +24,7 @@ import { UnhydratedFlexTreeNode } from "./unhydratedFlexTree.js";
20
24
  export function getOrCreateNodeFromInnerNode(flexNode: InnerNode): TreeNode | TreeValue {
21
25
  const cached =
22
26
  flexNode instanceof UnhydratedFlexTreeNode
23
- ? mapTreeNodeToProxy.get(flexNode)
27
+ ? unhydratedFlexTreeNodeToTreeNode.get(flexNode)
24
28
  : flexNode.anchorNode.slots.get(proxySlot);
25
29
 
26
30
  if (cached !== undefined) {
@@ -10,7 +10,7 @@ export {
10
10
  tryGetTreeNodeSchema,
11
11
  type InnerNode,
12
12
  tryDisposeTreeNode,
13
- tryGetTreeNodeFromMapNode,
13
+ unhydratedFlexTreeNodeToTreeNode,
14
14
  getOrCreateInnerNode,
15
15
  treeNodeFromAnchor,
16
16
  } from "./treeNodeKernel.js";
@@ -146,7 +146,7 @@ export class TreeNodeKernel {
146
146
 
147
147
  if (innerNode instanceof UnhydratedFlexTreeNode) {
148
148
  // Unhydrated case
149
- mapTreeNodeToProxy.set(innerNode, node);
149
+ unhydratedFlexTreeNodeToTreeNodeInternal.set(innerNode, node);
150
150
  // Register for change events from the unhydrated flex node.
151
151
  // These will be fired if the unhydrated node is edited, and will also be forwarded later to the hydrated node.
152
152
  this.#hydrationState = {
@@ -158,7 +158,7 @@ export class TreeNodeKernel {
158
158
 
159
159
  let n: UnhydratedFlexTreeNode | undefined = innerNode;
160
160
  while (n !== undefined) {
161
- const treeNode = mapTreeNodeToProxy.get(n);
161
+ const treeNode = unhydratedFlexTreeNodeToTreeNodeInternal.get(n);
162
162
  if (treeNode !== undefined) {
163
163
  const kernel = getKernel(treeNode);
164
164
  kernel.#unhydratedEvents.value.emit("subtreeChangedAfterBatch");
@@ -200,7 +200,7 @@ export class TreeNodeKernel {
200
200
  private hydrate(anchorNode: AnchorNode): void {
201
201
  assert(!this.disposed, 0xa2a /* cannot hydrate a disposed node */);
202
202
  assert(!isHydrated(this.#hydrationState), 0xa2b /* hydration should only happen once */);
203
- mapTreeNodeToProxy.delete(this.#hydrationState.innerNode);
203
+ unhydratedFlexTreeNodeToTreeNodeInternal.delete(this.#hydrationState.innerNode);
204
204
  this.#hydrationState = this.createHydratedState(anchorNode);
205
205
 
206
206
  // If needed, register forwarding emitters for events from before hydration
@@ -389,9 +389,20 @@ type KernelEvents = Pick<AnchorEvents, (typeof kernelEvents)[number]>;
389
389
  export type InnerNode = FlexTreeNode | UnhydratedFlexTreeNode;
390
390
 
391
391
  /**
392
- * {@inheritdoc proxyToMapTreeNode}
392
+ * Associates a given {@link UnhydratedFlexTreeNode} with a {@link TreeNode}.
393
393
  */
394
- export const mapTreeNodeToProxy = new WeakMap<UnhydratedFlexTreeNode, TreeNode>();
394
+ const unhydratedFlexTreeNodeToTreeNodeInternal = new WeakMap<
395
+ UnhydratedFlexTreeNode,
396
+ TreeNode
397
+ >();
398
+ /**
399
+ * Retrieves the {@link TreeNode} associated with the given {@link UnhydratedFlexTreeNode} if any.
400
+ */
401
+ export const unhydratedFlexTreeNodeToTreeNode =
402
+ unhydratedFlexTreeNodeToTreeNodeInternal as Pick<
403
+ WeakMap<UnhydratedFlexTreeNode, TreeNode>,
404
+ "get"
405
+ >;
395
406
 
396
407
  /**
397
408
  * An anchor slot which associates an anchor with its corresponding TreeNode, if there is one.
@@ -401,15 +412,6 @@ export const mapTreeNodeToProxy = new WeakMap<UnhydratedFlexTreeNode, TreeNode>(
401
412
  */
402
413
  export const proxySlot = anchorSlot<TreeNode>();
403
414
 
404
- /**
405
- * Retrieves the node associated with the given MapTreeNode node if any.
406
- */
407
- export function tryGetTreeNodeFromMapNode(
408
- flexNode: UnhydratedFlexTreeNode,
409
- ): TreeNode | undefined {
410
- return mapTreeNodeToProxy.get(flexNode);
411
- }
412
-
413
415
  export function tryDisposeTreeNode(anchorNode: AnchorNode): void {
414
416
  const treeNode = anchorNode.slots.get(proxySlot);
415
417
  if (treeNode !== undefined) {
@@ -124,6 +124,18 @@ export {
124
124
  type CustomTreeNode,
125
125
  type CustomTreeValue,
126
126
  tryStoredSchemaAsArray,
127
+ type schemaStatics,
128
+ type ITreeAlpha,
129
+ type TransactionConstraint,
130
+ type NodeInDocumentConstraint,
131
+ type RunTransactionParams,
132
+ type VoidTransactionCallbackStatus,
133
+ type TransactionCallbackStatus,
134
+ type TransactionResult,
135
+ type TransactionResultExt,
136
+ type TransactionResultSuccess,
137
+ type TransactionResultFailed,
138
+ rollback,
127
139
  } from "./api/index.js";
128
140
  export {
129
141
  type NodeFromSchema,
@@ -24,9 +24,9 @@ import { type Mutable, fail, isReadonlyArray } from "../util/index.js";
24
24
  import {
25
25
  getKernel,
26
26
  type TreeNode,
27
- tryGetTreeNodeFromMapNode,
28
27
  getOrCreateNodeFromInnerNode,
29
28
  tryUnhydratedFlexTreeNode,
29
+ unhydratedFlexTreeNodeToTreeNode,
30
30
  } from "./core/index.js";
31
31
 
32
32
  /**
@@ -146,7 +146,7 @@ function walkMapTree(
146
146
  const [p, m] = next;
147
147
  const mapTreeNode = tryUnhydratedFlexTreeNode(m);
148
148
  if (mapTreeNode !== undefined) {
149
- const treeNode = tryGetTreeNodeFromMapNode(mapTreeNode);
149
+ const treeNode = unhydratedFlexTreeNodeToTreeNode.get(mapTreeNode);
150
150
  if (treeNode !== undefined) {
151
151
  onVisitTreeNode(p, treeNode);
152
152
  }
@@ -281,7 +281,7 @@ export let createFieldSchema: <
281
281
  * including functionality that does not have to be kept consistent across versions or deterministic.
282
282
  *
283
283
  * This can include policy for how to use this schema for "view" purposes, and well as how to expose editing APIs.
284
- * Use {@link SchemaFactory} to create the FieldSchema instances, for example {@link SchemaFactory.optional}.
284
+ * Use {@link SchemaFactory} to create the FieldSchema instances, for example {@link schemaStatics.optional}.
285
285
  * @privateRemarks
286
286
  * Public access to the constructor is removed to prevent creating expressible but unsupported (or not stable) configurations.
287
287
  * {@link createFieldSchema} can be used internally to create instances.
@@ -822,7 +822,7 @@ export type NodeBuilderData<T extends TreeNodeSchemaCore<string, NodeKind, boole
822
822
  /**
823
823
  * Value that may be stored as a leaf node.
824
824
  * @remarks
825
- * Some limitations apply, see the documentation for {@link SchemaFactory.number} and {@link SchemaFactory.string} for those restrictions.
825
+ * Some limitations apply, see the documentation for {@link schemaStatics.number} and {@link schemaStatics.string} for those restrictions.
826
826
  * @public
827
827
  */
828
828
  // eslint-disable-next-line @rushstack/no-new-null
@@ -15,25 +15,43 @@ import {
15
15
  createSharedObjectKind,
16
16
  } from "@fluidframework/shared-object-base/internal";
17
17
 
18
- import { pkgVersion } from "./packageVersion.js";
19
- import { SharedTree as SharedTreeImpl, type SharedTreeOptions } from "./shared-tree/index.js";
18
+ import {
19
+ SharedTree as SharedTreeImpl,
20
+ type SharedTreeOptions,
21
+ type SharedTreeOptionsInternal,
22
+ } from "./shared-tree/index.js";
20
23
  import type { ITree } from "./simple-tree/index.js";
21
24
 
25
+ import { pkgVersion } from "./packageVersion.js";
26
+
27
+ /**
28
+ * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
29
+ * @alpha
30
+ * @legacy
31
+ */
32
+ export const SharedTreeFactoryType = "https://graph.microsoft.com/types/tree";
33
+
34
+ /**
35
+ * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}
36
+ * @alpha
37
+ * @legacy
38
+ */
39
+ export const SharedTreeAttributes: IChannelAttributes = {
40
+ type: SharedTreeFactoryType,
41
+ snapshotFormatVersion: "0.0.0",
42
+ packageVersion: pkgVersion,
43
+ };
44
+
22
45
  /**
23
46
  * A channel factory that creates an {@link ITree}.
24
47
  */
25
48
  export class TreeFactory implements IChannelFactory<ITree> {
26
- public static readonly Type = "https://graph.microsoft.com/types/tree";
27
- public static readonly attributes: IChannelAttributes = {
28
- type: this.Type,
29
- snapshotFormatVersion: "0.0.0",
30
- packageVersion: pkgVersion,
31
- };
49
+ public static Type: string = SharedTreeFactoryType;
50
+ public readonly type: string = SharedTreeFactoryType;
32
51
 
33
- public readonly type = TreeFactory.Type;
34
- public readonly attributes: IChannelAttributes = TreeFactory.attributes;
52
+ public readonly attributes: IChannelAttributes = SharedTreeAttributes;
35
53
 
36
- public constructor(private readonly options: SharedTreeOptions) {}
54
+ public constructor(private readonly options: SharedTreeOptionsInternal) {}
37
55
 
38
56
  public async load(
39
57
  runtime: IFluidDataStoreRuntime,
@@ -47,7 +47,7 @@ export class Breakable {
47
47
  * @privateRemarks
48
48
  * If there is a use-case, this should be made public.
49
49
  */
50
- private rethrowCaught(brokenBy: unknown): never {
50
+ public rethrowCaught(brokenBy: unknown): never {
51
51
  if (brokenBy instanceof Error) {
52
52
  this.break(brokenBy);
53
53
  }