@fluidframework/tree 2.116.1 → 2.118.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 (421) hide show
  1. package/CHANGELOG.md +202 -0
  2. package/api-report/tree.alpha.api.md +122 -31
  3. package/api-report/tree.beta.api.md +50 -9
  4. package/api-report/tree.legacy.beta.api.md +50 -9
  5. package/dist/codec/codec.d.ts +18 -0
  6. package/dist/codec/codec.d.ts.map +1 -1
  7. package/dist/codec/codec.js +18 -0
  8. package/dist/codec/codec.js.map +1 -1
  9. package/dist/core/index.d.ts +2 -2
  10. package/dist/core/index.d.ts.map +1 -1
  11. package/dist/core/index.js +3 -2
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/core/rebase/index.d.ts +1 -1
  14. package/dist/core/rebase/index.d.ts.map +1 -1
  15. package/dist/core/rebase/index.js +2 -1
  16. package/dist/core/rebase/index.js.map +1 -1
  17. package/dist/core/rebase/types.d.ts +39 -2
  18. package/dist/core/rebase/types.d.ts.map +1 -1
  19. package/dist/core/rebase/types.js +37 -2
  20. package/dist/core/rebase/types.js.map +1 -1
  21. package/dist/core/rebase/utils.d.ts.map +1 -1
  22. package/dist/core/rebase/utils.js +1 -0
  23. package/dist/core/rebase/utils.js.map +1 -1
  24. package/dist/core/revertible.d.ts +62 -6
  25. package/dist/core/revertible.d.ts.map +1 -1
  26. package/dist/core/revertible.js.map +1 -1
  27. package/dist/entrypoints/alpha.d.ts +1 -1
  28. package/dist/entrypoints/alpha.d.ts.map +1 -1
  29. package/dist/entrypoints/alpha.js.map +1 -1
  30. package/dist/entrypoints/beta.d.ts +1 -1
  31. package/dist/entrypoints/beta.d.ts.map +1 -1
  32. package/dist/entrypoints/beta.js.map +1 -1
  33. package/dist/entrypoints/legacy.d.ts +1 -1
  34. package/dist/entrypoints/legacy.d.ts.map +1 -1
  35. package/dist/entrypoints/legacy.js.map +1 -1
  36. package/dist/feature-libraries/index.d.ts +1 -1
  37. package/dist/feature-libraries/index.js.map +1 -1
  38. package/dist/feature-libraries/indexing/types.d.ts +1 -1
  39. package/dist/feature-libraries/indexing/types.js.map +1 -1
  40. package/dist/feature-libraries/schemaChecker.d.ts +9 -19
  41. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
  42. package/dist/feature-libraries/schemaChecker.js +130 -46
  43. package/dist/feature-libraries/schemaChecker.js.map +1 -1
  44. package/dist/index.d.ts +2 -2
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js.map +1 -1
  47. package/dist/packageVersion.d.ts +1 -1
  48. package/dist/packageVersion.js +1 -1
  49. package/dist/packageVersion.js.map +1 -1
  50. package/dist/shared-tree/history.d.ts +22 -0
  51. package/dist/shared-tree/history.d.ts.map +1 -0
  52. package/dist/shared-tree/history.js +66 -0
  53. package/dist/shared-tree/history.js.map +1 -0
  54. package/dist/shared-tree/schematizingTreeView.d.ts +24 -9
  55. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  56. package/dist/shared-tree/schematizingTreeView.js +61 -11
  57. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  58. package/dist/shared-tree/sharedTree.d.ts +3 -2
  59. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  60. package/dist/shared-tree/sharedTree.js +2 -0
  61. package/dist/shared-tree/sharedTree.js.map +1 -1
  62. package/dist/shared-tree/tree.js +1 -1
  63. package/dist/shared-tree/tree.js.map +1 -1
  64. package/dist/shared-tree/treeAlpha.d.ts +8 -20
  65. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  66. package/dist/shared-tree/treeAlpha.js +9 -12
  67. package/dist/shared-tree/treeAlpha.js.map +1 -1
  68. package/dist/shared-tree/treeCheckout.d.ts +16 -9
  69. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  70. package/dist/shared-tree/treeCheckout.js +122 -25
  71. package/dist/shared-tree/treeCheckout.js.map +1 -1
  72. package/dist/shared-tree/unhydratedTreeContext.d.ts +3 -2
  73. package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  74. package/dist/shared-tree/unhydratedTreeContext.js +3 -0
  75. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
  76. package/dist/shared-tree-core/branch.d.ts +16 -2
  77. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  78. package/dist/shared-tree-core/branch.js +20 -2
  79. package/dist/shared-tree-core/branch.js.map +1 -1
  80. package/dist/shared-tree-core/branchCommitCounter.d.ts +31 -0
  81. package/dist/shared-tree-core/branchCommitCounter.d.ts.map +1 -0
  82. package/dist/shared-tree-core/branchCommitCounter.js +79 -0
  83. package/dist/shared-tree-core/branchCommitCounter.js.map +1 -0
  84. package/dist/shared-tree-core/customMetadataCodec.d.ts +9 -0
  85. package/dist/shared-tree-core/customMetadataCodec.d.ts.map +1 -0
  86. package/dist/shared-tree-core/customMetadataCodec.js +37 -0
  87. package/dist/shared-tree-core/customMetadataCodec.js.map +1 -0
  88. package/dist/shared-tree-core/customMetadataFormat.d.ts +18 -0
  89. package/dist/shared-tree-core/customMetadataFormat.d.ts.map +1 -0
  90. package/dist/shared-tree-core/customMetadataFormat.js +15 -0
  91. package/dist/shared-tree-core/customMetadataFormat.js.map +1 -0
  92. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  93. package/dist/shared-tree-core/editManager.js +15 -3
  94. package/dist/shared-tree-core/editManager.js.map +1 -1
  95. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  96. package/dist/shared-tree-core/editManagerCodecs.js +5 -0
  97. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  98. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
  99. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  100. package/dist/shared-tree-core/editManagerCodecsCommons.js +17 -5
  101. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  102. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  103. package/dist/shared-tree-core/editManagerCodecsV1toV4.js +4 -2
  104. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  105. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  106. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +2 -2
  107. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  108. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +17 -6
  109. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  110. package/dist/shared-tree-core/editManagerFormatCommons.js +18 -8
  111. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  112. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +7 -5
  113. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  114. package/dist/shared-tree-core/editManagerFormatV1toV4.js +4 -3
  115. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  116. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +4 -0
  117. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  118. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +2 -2
  119. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
  120. package/dist/shared-tree-core/index.d.ts +2 -1
  121. package/dist/shared-tree-core/index.d.ts.map +1 -1
  122. package/dist/shared-tree-core/index.js +3 -1
  123. package/dist/shared-tree-core/index.js.map +1 -1
  124. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
  125. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  126. package/dist/shared-tree-core/messageCodecV1ToV4.js +12 -3
  127. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  128. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  129. package/dist/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  130. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  131. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  132. package/dist/shared-tree-core/messageCodecs.js +5 -0
  133. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  134. package/dist/shared-tree-core/messageFormat.d.ts +1 -0
  135. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  136. package/dist/shared-tree-core/messageFormat.js +6 -0
  137. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  138. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +10 -3
  139. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  140. package/dist/shared-tree-core/messageFormatV1ToV4.js +10 -2
  141. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  142. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -0
  143. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  144. package/dist/shared-tree-core/messageFormatVSharedBranches.js +2 -0
  145. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  146. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  147. package/dist/shared-tree-core/sharedTreeCore.js +4 -2
  148. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  149. package/dist/shared-tree-core/transaction.d.ts +9 -0
  150. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  151. package/dist/shared-tree-core/transaction.js +26 -4
  152. package/dist/shared-tree-core/transaction.js.map +1 -1
  153. package/dist/simple-tree/api/configuration.d.ts +4 -4
  154. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  155. package/dist/simple-tree/api/configuration.js.map +1 -1
  156. package/dist/simple-tree/api/discrepancies.d.ts +36 -3
  157. package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
  158. package/dist/simple-tree/api/discrepancies.js +40 -14
  159. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  160. package/dist/simple-tree/api/index.d.ts +3 -2
  161. package/dist/simple-tree/api/index.d.ts.map +1 -1
  162. package/dist/simple-tree/api/index.js +3 -2
  163. package/dist/simple-tree/api/index.js.map +1 -1
  164. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +22 -3
  165. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  166. package/dist/simple-tree/api/schemaCompatibilityTester.js +140 -10
  167. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  168. package/dist/simple-tree/api/transactionTypes.d.ts +28 -2
  169. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  170. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  171. package/dist/simple-tree/api/tree.d.ts +353 -68
  172. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  173. package/dist/simple-tree/api/tree.js.map +1 -1
  174. package/dist/simple-tree/core/toStored.d.ts +7 -0
  175. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  176. package/dist/simple-tree/core/toStored.js.map +1 -1
  177. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  178. package/dist/simple-tree/core/treeNodeValid.js +2 -2
  179. package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
  180. package/dist/simple-tree/index.d.ts +1 -1
  181. package/dist/simple-tree/index.d.ts.map +1 -1
  182. package/dist/simple-tree/index.js +4 -3
  183. package/dist/simple-tree/index.js.map +1 -1
  184. package/dist/tableSchema.js +10 -10
  185. package/dist/tableSchema.js.map +1 -1
  186. package/docs/main/glossary.md +163 -0
  187. package/lib/codec/codec.d.ts +18 -0
  188. package/lib/codec/codec.d.ts.map +1 -1
  189. package/lib/codec/codec.js +18 -0
  190. package/lib/codec/codec.js.map +1 -1
  191. package/lib/core/index.d.ts +2 -2
  192. package/lib/core/index.d.ts.map +1 -1
  193. package/lib/core/index.js +1 -1
  194. package/lib/core/index.js.map +1 -1
  195. package/lib/core/rebase/index.d.ts +1 -1
  196. package/lib/core/rebase/index.d.ts.map +1 -1
  197. package/lib/core/rebase/index.js +1 -1
  198. package/lib/core/rebase/index.js.map +1 -1
  199. package/lib/core/rebase/types.d.ts +39 -2
  200. package/lib/core/rebase/types.d.ts.map +1 -1
  201. package/lib/core/rebase/types.js +35 -1
  202. package/lib/core/rebase/types.js.map +1 -1
  203. package/lib/core/rebase/utils.d.ts.map +1 -1
  204. package/lib/core/rebase/utils.js +1 -0
  205. package/lib/core/rebase/utils.js.map +1 -1
  206. package/lib/core/revertible.d.ts +62 -6
  207. package/lib/core/revertible.d.ts.map +1 -1
  208. package/lib/core/revertible.js.map +1 -1
  209. package/lib/entrypoints/alpha.d.ts +1 -1
  210. package/lib/entrypoints/alpha.d.ts.map +1 -1
  211. package/lib/entrypoints/alpha.js.map +1 -1
  212. package/lib/entrypoints/beta.d.ts +1 -1
  213. package/lib/entrypoints/beta.d.ts.map +1 -1
  214. package/lib/entrypoints/beta.js.map +1 -1
  215. package/lib/entrypoints/legacy.d.ts +1 -1
  216. package/lib/entrypoints/legacy.d.ts.map +1 -1
  217. package/lib/entrypoints/legacy.js.map +1 -1
  218. package/lib/feature-libraries/index.d.ts +1 -1
  219. package/lib/feature-libraries/index.js.map +1 -1
  220. package/lib/feature-libraries/indexing/types.d.ts +1 -1
  221. package/lib/feature-libraries/indexing/types.js.map +1 -1
  222. package/lib/feature-libraries/schemaChecker.d.ts +9 -19
  223. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
  224. package/lib/feature-libraries/schemaChecker.js +133 -49
  225. package/lib/feature-libraries/schemaChecker.js.map +1 -1
  226. package/lib/index.d.ts +2 -2
  227. package/lib/index.d.ts.map +1 -1
  228. package/lib/index.js.map +1 -1
  229. package/lib/packageVersion.d.ts +1 -1
  230. package/lib/packageVersion.js +1 -1
  231. package/lib/packageVersion.js.map +1 -1
  232. package/lib/shared-tree/history.d.ts +22 -0
  233. package/lib/shared-tree/history.d.ts.map +1 -0
  234. package/lib/shared-tree/history.js +62 -0
  235. package/lib/shared-tree/history.js.map +1 -0
  236. package/lib/shared-tree/schematizingTreeView.d.ts +24 -9
  237. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  238. package/lib/shared-tree/schematizingTreeView.js +62 -12
  239. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  240. package/lib/shared-tree/sharedTree.d.ts +3 -2
  241. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  242. package/lib/shared-tree/sharedTree.js +2 -0
  243. package/lib/shared-tree/sharedTree.js.map +1 -1
  244. package/lib/shared-tree/tree.js +1 -1
  245. package/lib/shared-tree/tree.js.map +1 -1
  246. package/lib/shared-tree/treeAlpha.d.ts +8 -20
  247. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  248. package/lib/shared-tree/treeAlpha.js +9 -12
  249. package/lib/shared-tree/treeAlpha.js.map +1 -1
  250. package/lib/shared-tree/treeCheckout.d.ts +16 -9
  251. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  252. package/lib/shared-tree/treeCheckout.js +123 -26
  253. package/lib/shared-tree/treeCheckout.js.map +1 -1
  254. package/lib/shared-tree/unhydratedTreeContext.d.ts +3 -2
  255. package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  256. package/lib/shared-tree/unhydratedTreeContext.js +3 -0
  257. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
  258. package/lib/shared-tree-core/branch.d.ts +16 -2
  259. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  260. package/lib/shared-tree-core/branch.js +20 -2
  261. package/lib/shared-tree-core/branch.js.map +1 -1
  262. package/lib/shared-tree-core/branchCommitCounter.d.ts +31 -0
  263. package/lib/shared-tree-core/branchCommitCounter.d.ts.map +1 -0
  264. package/lib/shared-tree-core/branchCommitCounter.js +75 -0
  265. package/lib/shared-tree-core/branchCommitCounter.js.map +1 -0
  266. package/lib/shared-tree-core/customMetadataCodec.d.ts +9 -0
  267. package/lib/shared-tree-core/customMetadataCodec.d.ts.map +1 -0
  268. package/lib/shared-tree-core/customMetadataCodec.js +32 -0
  269. package/lib/shared-tree-core/customMetadataCodec.js.map +1 -0
  270. package/lib/shared-tree-core/customMetadataFormat.d.ts +18 -0
  271. package/lib/shared-tree-core/customMetadataFormat.d.ts.map +1 -0
  272. package/lib/shared-tree-core/customMetadataFormat.js +11 -0
  273. package/lib/shared-tree-core/customMetadataFormat.js.map +1 -0
  274. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  275. package/lib/shared-tree-core/editManager.js +16 -4
  276. package/lib/shared-tree-core/editManager.js.map +1 -1
  277. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  278. package/lib/shared-tree-core/editManagerCodecs.js +5 -0
  279. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  280. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
  281. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  282. package/lib/shared-tree-core/editManagerCodecsCommons.js +17 -5
  283. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  284. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  285. package/lib/shared-tree-core/editManagerCodecsV1toV4.js +4 -2
  286. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  287. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  288. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +2 -2
  289. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  290. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +17 -6
  291. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  292. package/lib/shared-tree-core/editManagerFormatCommons.js +18 -8
  293. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  294. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +7 -5
  295. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  296. package/lib/shared-tree-core/editManagerFormatV1toV4.js +4 -3
  297. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  298. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +4 -0
  299. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  300. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js +2 -2
  301. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
  302. package/lib/shared-tree-core/index.d.ts +2 -1
  303. package/lib/shared-tree-core/index.d.ts.map +1 -1
  304. package/lib/shared-tree-core/index.js +1 -0
  305. package/lib/shared-tree-core/index.js.map +1 -1
  306. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
  307. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  308. package/lib/shared-tree-core/messageCodecV1ToV4.js +12 -3
  309. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  310. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  311. package/lib/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  312. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  313. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  314. package/lib/shared-tree-core/messageCodecs.js +5 -0
  315. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  316. package/lib/shared-tree-core/messageFormat.d.ts +1 -0
  317. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  318. package/lib/shared-tree-core/messageFormat.js +6 -0
  319. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  320. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +10 -3
  321. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  322. package/lib/shared-tree-core/messageFormatV1ToV4.js +10 -2
  323. package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  324. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -0
  325. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  326. package/lib/shared-tree-core/messageFormatVSharedBranches.js +2 -0
  327. package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  328. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  329. package/lib/shared-tree-core/sharedTreeCore.js +5 -3
  330. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  331. package/lib/shared-tree-core/transaction.d.ts +9 -0
  332. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  333. package/lib/shared-tree-core/transaction.js +27 -5
  334. package/lib/shared-tree-core/transaction.js.map +1 -1
  335. package/lib/simple-tree/api/configuration.d.ts +4 -4
  336. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  337. package/lib/simple-tree/api/configuration.js.map +1 -1
  338. package/lib/simple-tree/api/discrepancies.d.ts +36 -3
  339. package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
  340. package/lib/simple-tree/api/discrepancies.js +40 -14
  341. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  342. package/lib/simple-tree/api/index.d.ts +3 -2
  343. package/lib/simple-tree/api/index.d.ts.map +1 -1
  344. package/lib/simple-tree/api/index.js +1 -1
  345. package/lib/simple-tree/api/index.js.map +1 -1
  346. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +22 -3
  347. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  348. package/lib/simple-tree/api/schemaCompatibilityTester.js +136 -7
  349. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  350. package/lib/simple-tree/api/transactionTypes.d.ts +28 -2
  351. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  352. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  353. package/lib/simple-tree/api/tree.d.ts +353 -68
  354. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  355. package/lib/simple-tree/api/tree.js.map +1 -1
  356. package/lib/simple-tree/core/toStored.d.ts +7 -0
  357. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  358. package/lib/simple-tree/core/toStored.js.map +1 -1
  359. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  360. package/lib/simple-tree/core/treeNodeValid.js +3 -3
  361. package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
  362. package/lib/simple-tree/index.d.ts +1 -1
  363. package/lib/simple-tree/index.d.ts.map +1 -1
  364. package/lib/simple-tree/index.js +1 -1
  365. package/lib/simple-tree/index.js.map +1 -1
  366. package/lib/tableSchema.js +10 -10
  367. package/lib/tableSchema.js.map +1 -1
  368. package/package.json +22 -22
  369. package/src/codec/codec.ts +19 -0
  370. package/src/core/index.ts +4 -0
  371. package/src/core/rebase/index.ts +2 -0
  372. package/src/core/rebase/types.ts +72 -2
  373. package/src/core/rebase/utils.ts +1 -0
  374. package/src/core/revertible.ts +67 -6
  375. package/src/entrypoints/alpha.ts +11 -0
  376. package/src/entrypoints/beta.ts +3 -0
  377. package/src/entrypoints/legacy.ts +3 -0
  378. package/src/feature-libraries/index.ts +1 -1
  379. package/src/feature-libraries/indexing/types.ts +1 -1
  380. package/src/feature-libraries/schemaChecker.ts +198 -82
  381. package/src/index.ts +11 -0
  382. package/src/packageVersion.ts +1 -1
  383. package/src/shared-tree/history.ts +99 -0
  384. package/src/shared-tree/schematizingTreeView.ts +100 -29
  385. package/src/shared-tree/sharedTree.ts +5 -2
  386. package/src/shared-tree/tree.ts +1 -1
  387. package/src/shared-tree/treeAlpha.ts +17 -35
  388. package/src/shared-tree/treeCheckout.ts +170 -31
  389. package/src/shared-tree/unhydratedTreeContext.ts +6 -2
  390. package/src/shared-tree-core/branch.ts +34 -2
  391. package/src/shared-tree-core/branchCommitCounter.ts +103 -0
  392. package/src/shared-tree-core/customMetadataCodec.ts +42 -0
  393. package/src/shared-tree-core/customMetadataFormat.ts +39 -0
  394. package/src/shared-tree-core/editManager.ts +22 -3
  395. package/src/shared-tree-core/editManagerCodecs.ts +12 -0
  396. package/src/shared-tree-core/editManagerCodecsCommons.ts +41 -15
  397. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +7 -1
  398. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +2 -0
  399. package/src/shared-tree-core/editManagerFormatCommons.ts +46 -12
  400. package/src/shared-tree-core/editManagerFormatV1toV4.ts +13 -5
  401. package/src/shared-tree-core/editManagerFormatVSharedBranches.ts +2 -2
  402. package/src/shared-tree-core/index.ts +3 -0
  403. package/src/shared-tree-core/messageCodecV1ToV4.ts +18 -5
  404. package/src/shared-tree-core/messageCodecVSharedBranches.ts +9 -2
  405. package/src/shared-tree-core/messageCodecs.ts +12 -0
  406. package/src/shared-tree-core/messageFormat.ts +6 -0
  407. package/src/shared-tree-core/messageFormatV1ToV4.ts +21 -3
  408. package/src/shared-tree-core/messageFormatVSharedBranches.ts +8 -0
  409. package/src/shared-tree-core/sharedTreeCore.ts +5 -2
  410. package/src/shared-tree-core/transaction.ts +56 -4
  411. package/src/simple-tree/api/configuration.ts +4 -4
  412. package/src/simple-tree/api/discrepancies.ts +100 -5
  413. package/src/simple-tree/api/index.ts +12 -1
  414. package/src/simple-tree/api/schemaCompatibilityTester.ts +185 -11
  415. package/src/simple-tree/api/transactionTypes.ts +29 -2
  416. package/src/simple-tree/api/tree.ts +384 -68
  417. package/src/simple-tree/core/toStored.ts +8 -0
  418. package/src/simple-tree/core/treeNodeValid.ts +3 -1
  419. package/src/simple-tree/index.ts +9 -0
  420. package/src/tableSchema.ts +9 -9
  421. package/docs/main/runtime-schema-upgrade.md +0 -208
@@ -1 +1 @@
1
- {"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/tree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoyBH;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC9B,IAAuB;IAEvB,OAAO,IAA8B,CAAC;AACvC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidLoadable, IDisposable, Listenable } from \"@fluidframework/core-interfaces\";\n\nimport type {\n\tChangeMetadata,\n\tCommitMetadata,\n\tRevertibleAlphaFactory,\n\tRevertibleFactory,\n} from \"../../core/index.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- This is referenced by doc comments.\nimport type { TreeStatus } from \"../../feature-libraries/index.js\";\nimport type {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports -- This is referenced by doc comments.\n\tTreeAlpha,\n} from \"../../shared-tree/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../../util/index.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- This is referenced by doc comments.\nimport type { Unhydrated } from \"../core/index.js\";\nimport type {\n\tImplicitFieldSchema,\n\tInsertableField,\n\tInsertableTreeFieldFromImplicitField,\n\tReadableField,\n\tReadSchema,\n\tTreeFieldFromImplicitField,\n} from \"../fieldSchema.js\";\nimport type { SimpleTreeSchema } from \"../simpleSchema.js\";\nimport type { UnsafeUnknownSchema } from \"../unsafeUnknownSchema.js\";\n\nimport type { TreeViewConfiguration } from \"./configuration.js\";\nimport type {\n\tRunTransactionParamsAlpha,\n\tRunTransactionParamsBeta,\n\tTransactionCallbackStatusAlpha,\n\tTransactionCallbackStatusBeta,\n\tTransactionVoidResult,\n\tTransactionValueResult,\n\tVoidTransactionCallbackStatusAlpha,\n\tVoidTransactionCallbackStatusBeta,\n\tWithValue,\n} from \"./transactionTypes.js\";\nimport type { VerboseTree } from \"./verboseTree.js\";\n\n/**\n * A tree from which a {@link TreeView} can be created.\n *\n * @privateRemarks\n * TODO:\n * Add stored key versions of {@link (TreeAlpha:interface).(exportVerbose:2)}, {@link (TreeAlpha:interface).(exportConcise:2)} and {@link (TreeAlpha:interface).exportCompressed} here so tree content can be accessed without a view schema.\n * Add exportSimpleSchema and exportJsonSchema methods (which should exactly match the concise format, and match the free functions for exporting view schema).\n * Maybe rename \"exportJsonSchema\" to align on \"concise\" terminology.\n * 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).\n * Make sure users of independentView can use these export APIs (maybe provide a reference back to the ViewableTree from the TreeView to accomplish that).\n * @system @sealed @public\n */\nexport interface ViewableTree {\n\t/**\n\t * Returns a {@link TreeView} using the provided schema.\n\t * If the stored schema is compatible with the view schema specified by `config`,\n\t * the returned {@link TreeView} will expose the root with a schema-aware API based on the provided view schema.\n\t * If the provided schema is incompatible with the stored schema, the view will instead expose a status indicating the incompatibility.\n\t *\n\t * @remarks\n\t * If the tree is uninitialized (has no schema and no content), use {@link TreeView.initialize} on the returned view to set the schema and content together.\n\t * Using `viewWith` followed by {@link TreeView.upgradeSchema} to initialize only the schema for a document is technically valid when the schema\n\t * permits trees with no content.\n\t *\n\t * Note that other clients can modify the document at any time, causing the view to change its compatibility status: see {@link TreeView.events} for how to handle invalidation in these cases.\n\t *\n\t * Only one schematized view may exist for a given ITree at a time.\n\t * If creating a second, the first must be disposed before calling `viewWith` again.\n\t *\n\t * @privateRemarks\n\t * TODO: Support adapters for handling out-of-schema data.\n\t */\n\tviewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n}\n\n/**\n * Channel for a Fluid Tree DDS.\n * @remarks\n * Allows storing and collaboratively editing schema-aware hierarchial data.\n * @sealed @public\n */\nexport interface ITree extends ViewableTree, IFluidLoadable {}\n\n/**\n * {@link ITree} extended with some alpha APIs.\n * @sealed @alpha\n */\nexport interface ITreeAlpha extends ITree {\n\t/**\n\t * Exports root in the same format as {@link (TreeAlpha:interface).(exportVerbose:1)} using stored keys.\n\t * @remarks\n\t * This is `undefined` if and only if the root field is empty (this can only happen if the root field is optional).\n\t */\n\texportVerbose(): VerboseTree | undefined;\n\n\t/**\n\t * Exports the SimpleTreeSchema that is stored in the tree, using stored keys for object fields.\n\t * @remarks\n\t * To get the schema using property keys, use {@link getSimpleSchema} on the view schema.\n\t */\n\texportSimpleSchema(): SimpleTreeSchema;\n\n\t/**\n\t * Creates a fork of the current state of the main branch.\n\t * This new branch will be shared with and editable by all clients.\n\t * @param name - Optional name for the new branch.\n\t * This name is not guaranteed to be unique.\n\t * (Maximum {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length | length}: 1024)\n\t * @returns The ID of the new branch, which can be used to {@link ITreeAlpha.viewSharedBranchWith | view} the branch.\n\t */\n\tcreateSharedBranch(name?: string): string;\n\n\t/**\n\t * Retrieves the name, if any, of the shared branch with the given ID.\n\t * @param branchId - The ID of the shared branch to retrieve the name of.\n\t * @returns The name of the shared branch, or `undefined` if the branch has no assigned name.\n\t * @throws if the branch with the given ID does not exist.\n\t */\n\tgetSharedBranchName(branchId: string): string | undefined;\n\n\t/**\n\t * Returns a list of all shared branches that currently exist on this tree.\n\t * Any one of them can be checked out using {@link ITreeAlpha.viewSharedBranchWith}.\n\t */\n\tgetSharedBranchIds(): string[];\n\n\t/**\n\t * Returns a view of the tree on the specified shared branch, using the provided schema.\n\t * See {@link ViewableTree.viewWith}.\n\t */\n\tviewSharedBranchWith<TRoot extends ImplicitFieldSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n}\n\n/**\n * A collection of functionality associated with a (version-control-style) branch of a SharedTree.\n * @remarks A `TreeBranch` allows for the {@link TreeBranch.fork | creation of branches} and for those branches to later be {@link TreeBranch.merge | merged}.\n *\n * The branch associated directly with the {@link ITree | SharedTree} is the \"main\" branch, and all other branches fork (directly or transitively) from that main branch.\n *\n * See {@link TreeBranchAlpha} for additional APIs that are in an earlier stage of development.\n * @sealed @beta\n */\nexport interface TreeBranch extends IDisposable {\n\t/**\n\t * Fork a new branch off of this branch which is based off of this branch's current state.\n\t * @remarks Any changes to the tree on the new branch will not apply to this branch until the new branch is e.g. {@link TreeBranch.merge | merged} back into this branch.\n\t * The branch should be disposed when no longer needed, either {@link TreeBranch.dispose | explicitly} or {@link TreeBranch.merge | implicitly when merging} into another branch.\n\t */\n\tfork(): TreeBranch;\n\n\t/**\n\t * Apply all the new changes on the given branch to this branch.\n\t * @param branch - a branch which was created by a call to `branch()`.\n\t * @param disposeMerged - whether or not to dispose `branch` after the merge completes.\n\t * Defaults to true.\n\t * The {@link TreeBranch | main branch} cannot be disposed - attempting to do so will have no effect.\n\t * @remarks All ongoing transactions (if any) in `branch` will be committed before the merge.\n\t */\n\tmerge(branch: TreeBranch, disposeMerged?: boolean): void;\n\n\t/**\n\t * Advance this branch forward such that all new changes on the target branch become part of this branch.\n\t * @param branch - The branch to rebase onto.\n\t * @remarks After rebasing, this branch will be \"ahead\" of the target branch, that is, its unique changes will have been recreated as if they happened after all changes on the target branch.\n\t * This method may only be called on branches produced via {@link TreeBranch.fork | branch} - attempting to rebase the main branch will throw.\n\t *\n\t * Rebasing long-lived branches is important to avoid consuming memory unnecessarily.\n\t * In particular, the SharedTree retains all sequenced changes made to the tree since the \"most-behind\" branch was created or last rebased.\n\t *\n\t * The {@link TreeBranch | main branch} cannot be rebased onto another branch - attempting to do so will throw an error.\n\t */\n\trebaseOnto(branch: TreeBranch): void;\n\n\t/**\n\t * Dispose of this branch, cleaning up any resources associated with it.\n\t * @param error - Optional error indicating the reason for the disposal, if the object was disposed as the result of an error.\n\t * @remarks Branches can also be automatically disposed when {@link TreeBranch.merge | they are merged} into another branch.\n\t *\n\t * Disposing branches is important to avoid consuming memory unnecessarily.\n\t * In particular, the SharedTree retains all sequenced changes made to the tree since the \"most-behind\" branch was created or last {@link TreeBranch.rebaseOnto | rebased}.\n\t *\n\t * The {@link TreeBranch | main branch} cannot be disposed - attempting to do so will have no effect.\n\t */\n\tdispose(error?: Error): void;\n}\n\n/**\n * Provides additional APIs that may be used to interact with a tree node or a tree node's SharedTree.\n * @alpha\n */\nexport interface TreeContextAlpha {\n\t/**\n\t * Run a synchronous transaction which groups sequential edits to the tree into a single atomic edit if possible.\n\t * @param transaction - A callback run during the transaction to perform user-supplied operations.\n\t * It may optionally return a {@link WithValue | value }, which will be returned by the `runTransaction` call.\n\t * @param params - Optional {@link RunTransactionParamsAlpha | parameters} for the transaction.\n\t * @returns A {@link TransactionValueResult | value } indicating whether or not the transaction succeeded, and containing the value returned by `transaction`.\n\t * @remarks\n\t * All of the changes in the transaction are applied synchronously and therefore no other changes from a remote client can be interleaved with those changes.\n\t * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.\n\t *\n\t * {@link (TreeBeta:interface).on | Change events } will be emitted for changed nodes on this client _as each edit happens_, just as they would be if the changes were made outside of a transaction.\n\t * Any other/future clients or contexts will process the transaction \"squashed\", i.e. they will apply its changes all at once, emitting only a single event per node (even if that node was edited multiple times in the transaction).\n\t * Edits to the tree are not permitted within these event callbacks, therefore no other local changes from this client will be interleaved with the changes in this transaction.\n\t *\n\t * Using a transaction has the following additional consequences:\n\t *\n\t * - If {@link Revertible | reverted } (e.g. via an \"undo\" operation), all the changes in the transaction are reverted together.\n\t * Only the \"outermost\" transaction commits a change to the synchronized tree state and therefore only the outermost transaction can be reverted.\n\t * If a transaction is started and completed while another transaction is already in progress, then the inner transaction will be reverted together with the outer transaction.\n\t * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.\n\t *\n\t * `runTransaction` may be invoked on the context of a {@link TreeStatus.InDocument | hydrated } or {@link Unhydrated | unhydrated } node.\n\t * Use {@link TreeContextAlpha.isBranch | isBranch() } to check whether this context is associated with a branch and gain {@link TreeBranchAlpha.(runTransaction:1) | access to more transaction capabilities} if so.\n\t */\n\trunTransaction<TValue>(\n\t\ttransaction: () => WithValue<TValue>,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): TransactionValueResult<TValue, TValue>;\n\n\t/**\n\t * An overload of {@link TreeContextAlpha.(runTransaction:1) | runTransaction } which does not return a value.\n\t *\n\t * @privateRemarks\n\t * TODO: Consider updating these methods to avoid the need for overloads.\n\t * See {@link TreeViewBeta.runTransaction} for an example of how to do this.\n\t */\n\trunTransaction(\n\t\ttransaction: () => void,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): TransactionVoidResult;\n\n\t/**\n\t * An asynchronous version of {@link TreeContextAlpha.(runTransaction:1) | runTransaction}.\n\t * @remarks\n\t * As with synchronous transactions, all of the changes in an asynchronous transaction are treated as a unit.\n\t * Therefore, no other changes (either from this client or from a remote client) can be interleaved with the transaction changes.\n\t *\n\t * Unlike with synchronous transactions, it is possible that other changes (e.g. from a remote client) may be applied to the branch while this transaction is in progress.\n\t * Those other changes will be not be reflected on the branch until after this transaction completes, at which point the transaction changes will be applied after those other changes.\n\t *\n\t * An asynchronous transaction may not be started while any other transaction is in progress in this context.\n\t */\n\trunTransactionAsync<TValue>(\n\t\ttransaction: () => Promise<WithValue<TValue>>,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): Promise<TransactionValueResult<TValue, TValue>>;\n\n\t/**\n\t * An overload of {@link TreeContextAlpha.(runTransactionAsync:1) | runTransactionAsync } which does not return a value.\n\t *\n\t * @privateRemarks\n\t * TODO: Consider updating these methods to avoid the need for overloads.\n\t * See {@link TreeViewBeta.runTransactionAsync} for an example of how to do this.\n\t */\n\trunTransactionAsync(\n\t\ttransaction: () => Promise<void>,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): Promise<TransactionVoidResult>;\n\n\t/**\n\t * True if this context is associated with a {@link TreeBranchAlpha | branch} and false if it is associated with an {@link Unhydrated | unhydrated } node.\n\t * @remarks If this returns true, the context can be safely inferred or cast to {@link TreeBranchAlpha} to access additional branch-specific APIs.\n\t * @example\n\t * ```typescript\n\t * const context = tree.context(someNode);\n\t * if (context.isBranch()) {\n\t * assert(context.hasRootSchema(MySchema)) // `hasRootSchema` is a method on TreeBranchAlpha, so this is only accessible if `context` is a branch context.\n\t * context.root.foo = \"bar\"; // Edit the root of the SharedTree that `someNode` belongs to.\n\t * }\n\t * ```\n\t */\n\tisBranch(): this is TreeBranchAlpha;\n}\n\n/**\n * {@link TreeBranch} with alpha-level APIs.\n * @remarks\n * The `TreeBranch` for a specific {@link TreeNode} may be acquired by calling `TreeAlpha.branch`.\n *\n * A branch does not necessarily know the schema of its SharedTree - to convert a branch to a {@link TreeViewAlpha | view with a schema}, use {@link TreeBranchAlpha.hasRootSchema | hasRootSchema()}.\n * @sealed @alpha\n */\nexport interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {\n\t/**\n\t * Events for the branch\n\t */\n\treadonly events: Listenable<TreeBranchEvents>;\n\n\t/**\n\t * Returns true if this branch has the given schema as its root schema.\n\t * @remarks This is a type guard which allows this branch to become strongly typed as a {@link TreeViewAlpha | view} of the given schema.\n\t *\n\t * To succeed, the given schema must be invariant to the schema of the view - it must include exactly the same allowed types.\n\t * For example, a schema of `Foo | Bar` will not match a view schema of `Foo`, and likewise a schema of `Foo` will not match a view schema of `Foo | Bar`.\n\t * @example\n\t * ```typescript\n\t * if (branch.hasRootSchema(MySchema)) {\n\t * const { root } = branch; // `branch` is now a TreeViewAlpha<MySchema>\n\t * // ...\n\t * }\n\t * ```\n\t */\n\thasRootSchema<TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t): this is TreeViewAlpha<TSchema>;\n\n\t// Override the base fork method to return the alpha variant.\n\tfork(): TreeBranchAlpha;\n\n\t/**\n\t * {@link TreeContextAlpha.(runTransaction:1) | Run a transaction} on a branch of the SharedTree.\n\t * @param transaction - The function to run as the body of the transaction, which may optionally return a {@link TransactionCallbackStatusAlpha | value or rollback signal}.\n\t * @remarks\n\t * If the transaction is rolled back, a corresponding {@link TreeBranchEvents.changed | `changed`} event will also be emitted for the rollback.\n\t */\n\trunTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () => TransactionCallbackStatusAlpha<TSuccessValue, TFailureValue>,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): TransactionValueResult<TSuccessValue, TFailureValue>;\n\n\t/**\n\t * An overload of {@link TreeBranchAlpha.(runTransaction:1) | runTransaction } which does not return a value.\n\t *\n\t * @privateRemarks\n\t * TODO: Consider updating these methods to avoid the need for overloads.\n\t * See {@link TreeViewBeta.runTransaction} for an example of how to do this.\n\t */\n\trunTransaction(\n\t\ttransaction: () => VoidTransactionCallbackStatusAlpha | void,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): TransactionVoidResult;\n\n\t/**\n\t * An asynchronous version of {@link TreeBranchAlpha.(runTransaction:1) | runTransaction}.\n\t * @remarks See {@link TreeContextAlpha.(runTransactionAsync:1) | runTransactionAsync} for additional information about asynchronous transactions.\n\t */\n\n\trunTransactionAsync<TSuccessValue, TFailureValue>(\n\t\ttransaction: () => Promise<TransactionCallbackStatusAlpha<TSuccessValue, TFailureValue>>,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): Promise<TransactionValueResult<TSuccessValue, TFailureValue>>;\n\n\t/**\n\t * An overload of {@link TreeBranchAlpha.(runTransactionAsync:1) | runTransactionAsync } which does not return a value.\n\t *\n\t * @privateRemarks\n\t * TODO: Consider updating these methods to avoid the need for overloads.\n\t * See {@link TreeViewBeta.runTransactionAsync} for an example of how to do this.\n\t */\n\trunTransactionAsync(\n\t\ttransaction: () => Promise<VoidTransactionCallbackStatusAlpha | void>,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): Promise<TransactionVoidResult>;\n\n\t/**\n\t * Apply a serialized change to this branch.\n\t * @param change - the change to apply.\n\t * Changes are acquired via `getChange` in a branch's {@link TreeBranchEvents.changed | \"changed\"} event.\n\t * @remarks Changes may only be applied to a SharedTree with the same IdCompressor instance and branch state from which they were generated.\n\t * They may be created by one branch and applied to another, but only if both branches share the same history at the time of creation and application.\n\t *\n\t * @privateRemarks\n\t * TODO: This method will support applying changes from different IdCompressor instances as long as they have the same local session ID.\n\t * Update the tests and docs to match when that is done.\n\t */\n\tapplyChange(change: JsonCompatibleReadOnly): void;\n\n\t/**\n\t * Determines if there are changes on the given branch that are not present on this branch.\n\t * @param branch - The branch to compare to.\n\t *\n\t * The new edits, if any, can be applied to this branch by {@link TreeBranch.rebaseOnto | rebasing this branch onto the given branch}\n\t * or by {@link TreeBranch.merge | merging the given branch into this branch}.\n\t *\n\t * @throws UsageError if the branches are unrelated.\n\t */\n\tisMissingEditsFrom(branch: TreeBranch): boolean;\n\n\t/**\n\t * Computes the net change that would result if this branch were {@link TreeBranch.rebaseOnto | rebased onto} the given branch.\n\t * Note that this method does not actually perform the rebase and therefore has no effect on this branch.\n\t *\n\t * @param branch - The branch that would be rebased onto.\n\t * @returns The net change that would result if this branch were rebased onto the given branch,\n\t * or `undefined` if rebasing would have no impact.\n\t */\n\tcomputeNetChangeIfRebasedOnto(branch: TreeBranch): JsonCompatibleReadOnly | undefined;\n}\n\n/**\n * An editable view of a (version control style) branch of a shared tree based on some schema.\n *\n * @remarks\n * This schema (known as the view schema) may or may not align with the stored schema of the document.\n * Information about discrepancies between the two schemas is available via {@link TreeView.compatibility | compatibility}.\n *\n * Application authors are encouraged to read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/docs/user-facing/schema-evolution.md | schema-evolution.md}\n * and choose a schema compatibility policy that aligns with their application's needs.\n *\n * See also {@link TreeViewAlpha}, {@link TreeViewBeta} and {@link TreeBranch} for additional APIs that are in earlier stages of development.\n *\n * @privateRemarks\n * From an API design perspective, `upgradeSchema` could be merged into `viewWith` and/or `viewWith` could return errors explicitly on incompatible documents.\n * Such approaches would make it discoverable that out of schema handling may need to be done.\n * Doing that would however complicate trivial \"hello world\" style example slightly, as well as be a breaking API change.\n * It also seems more complex to handle invalidation with that pattern.\n * Thus this design was chosen at the risk of apps blindly accessing `root` then breaking unexpectedly when the document is incompatible.\n *\n * @see {@link TreeViewAlpha}\n * @see {@link asTreeViewAlpha}\n *\n * @sealed @public\n */\nexport interface TreeView<in out TSchema extends ImplicitFieldSchema> extends IDisposable {\n\t/**\n\t * The current root of the tree.\n\t *\n\t * If the view schema not sufficiently compatible with the stored schema, accessing this will throw.\n\t * To handle this case, check {@link TreeView.compatibility | compatibility}'s {@link SchemaCompatibilityStatus.canView | canView} before using.\n\t *\n\t * To get notified about changes to this field,\n\t * use {@link TreeViewEvents.rootChanged} via `view.events.on(\"rootChanged\", callback)`.\n\t *\n\t * To get notified about changes to stored schema (which may affect compatibility between this view's schema and\n\t * the stored schema), use {@link TreeViewEvents.schemaChanged} via `view.events.on(\"schemaChanged\", callback)`.\n\t */\n\tget root(): TreeFieldFromImplicitField<TSchema>;\n\n\tset root(newRoot: InsertableTreeFieldFromImplicitField<TSchema>);\n\n\t/**\n\t * Description of the current compatibility status between the view schema and stored schema.\n\t * @remarks\n\t * {@link TreeViewEvents.schemaChanged} is fired when the compatibility status of the document's stored schema changes.\n\t * See {@link https://fluidframework.com/docs/data-structures/tree/schema-evolution/ | schema-evolution} for more guidance on how to change schema while maintaining compatibility.\n\t * Use {@link snapshotSchemaCompatibility} to write tests to validate that this compatibility behaves as desired across schema changes.\n\t */\n\treadonly compatibility: SchemaCompatibilityStatus;\n\n\t/**\n\t * When {@link SchemaCompatibilityStatus.canUpgrade} is true,\n\t * this can be used to modify the stored schema to make it match the view schema.\n\t * @remarks\n\t * This will update the {@link TreeView.compatibility}, allowing access to `root`.\n\t * Beware that this may impact other clients' ability to view the document: see {@link SchemaCompatibilityStatus.canView} for more information.\n\t *\n\t * It is an error to call this when {@link SchemaCompatibilityStatus.canUpgrade} is false.\n\t * {@link SchemaCompatibilityStatus.canUpgrade} being true does not mean that an upgrade is required, nor that an upgrade will have any effect.\n\t *\n\t * When using {@link TreeViewConfigurationAlpha} with a {@link ITreeViewConfigurationAlpha.stagedUpgradePolicy},\n\t * staged schema upgrades matching the configured policy are included in the target stored schema.\n\t * Once a staged schema upgrade has been enabled in a document's stored schema, loading that document\n\t * with a view that does not include equivalent staged members in its construction-time policy will cause\n\t * `upgradeSchema` to throw a `UsageError` because the requested target would narrow the stored schema.\n\t *\n\t * @example Enabling a staged allowed type for documents, selected by a feature flag\n\t *\n\t * ```typescript\n\t * const sf = new SchemaFactoryBeta(\"my-app\");\n\t *\n\t * class TaskItem extends sf.object(\"TaskItem\", { title: sf.string }) {}\n\t * class ChecklistItem extends sf.object(\"ChecklistItem\", { text: sf.string }) {}\n\t *\n\t * // `staged` wraps ChecklistItem so it can be enabled at runtime.\n\t * const stagedChecklist = SchemaFactoryBeta.staged(ChecklistItem);\n\t * const checklistUpgrade = stagedChecklist.metadata.stagedSchemaUpgrade;\n\t *\n\t * class AppSchema extends sf.object(\"AppSchema\", {\n\t * items: sf.array([TaskItem, stagedChecklist]),\n\t * }) {}\n\t *\n\t * // Feature flag controls whether the upgrade is enabled for this session.\n\t * const policy = featureFlags.enableChecklist\n\t * ? StagedSchemaUpgradePolicy.enabledStagedUpgrades(checklistUpgrade)\n\t * : undefined;\n\t *\n\t * const view = tree.viewWith(\n\t * new TreeViewConfigurationAlpha({ schema: AppSchema, stagedUpgradePolicy: policy }),\n\t * );\n\t *\n\t * if (view.compatibility.canUpgrade) {\n\t * // Writes the staged type into the document's stored schema.\n\t * view.upgradeSchema();\n\t * }\n\t * ```\n\t *\n\t * @privateRemarks\n\t * In the future, more upgrade options could be provided here.\n\t * Some options that could be added:\n\t * - check the actual document contents (not just the schema) and attempt an atomic document update if the data is compatible.\n\t * - apply converters and upgrade the document.\n\t * - apply converters to lazily to adapt the document to the requested view schema (with optional lazy schema updates or transparent conversions on write).\n\t * - update only a specific change (add an optional field, or apply a staged upgrade)\n\t * - update persistedMetadata or not\n\t *\n\t * As persisted metadata becomes more supported, how it interacts with isEquivalent and upgradeSchema should be clarified:\n\t * for now the docs are being left somewhat vague to allow flexibility in this area.\n\t */\n\tupgradeSchema(): void;\n\n\t/**\n\t * Initialize the tree, setting the stored schema to match this view's schema and setting the tree content.\n\t *\n\t * @remarks\n\t * Only valid to call when this view's {@link SchemaCompatibilityStatus.canInitialize} is true.\n\t *\n\t * When using {@link TreeViewConfigurationAlpha} with a {@link ITreeViewConfigurationAlpha.stagedUpgradePolicy},\n\t * staged schema upgrades matching the configured policy are included in the initial stored schema.\n\t *\n\t * Applications should typically call this function before attaching a `SharedTree`.\n\t * @param content - The content to initialize the tree with.\n\t */\n\tinitialize(content: InsertableTreeFieldFromImplicitField<TSchema>): void;\n\n\t/**\n\t * Events for the tree.\n\t */\n\treadonly events: Listenable<TreeViewEvents>;\n\n\t/**\n\t * The view schema used by this TreeView.\n\t */\n\treadonly schema: TSchema;\n}\n\n/**\n * {@link TreeView} with additional beta APIs.\n * @sealed @beta\n */\nexport interface TreeViewBeta<in out TSchema extends ImplicitFieldSchema>\n\textends TreeView<TSchema>,\n\t\tTreeBranch {\n\t// Override the base branch method to return a typed view rather than merely a branch.\n\tfork(): ReturnType<TreeBranch[\"fork\"]> & TreeViewBeta<TSchema>;\n\n\t/**\n\t * Run a synchronous transaction which groups sequential edits to the tree into a single atomic edit if possible.\n\t *\n\t * @param transaction - The function to run as the body of the transaction, which may optionally return a {@link TransactionCallbackStatusBeta | value or rollback signal}.\n\t * It may optionally return a {@link WithValue | value }, which will be returned by the `runTransaction` call.\n\t *\n\t * @param params - Optional {@link RunTransactionParamsBeta | parameters} for the transaction.\n\t *\n\t * @returns A {@link TransactionValueResult | value } indicating whether or not the transaction succeeded, and containing the value returned by `transaction`.\n\t *\n\t * @remarks\n\t * All of the changes in the transaction are applied synchronously and therefore no other changes from a remote client can be interleaved with those changes.\n\t * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.\n\t *\n\t * {@link (TreeBeta:interface).on | Change events } will be emitted for changed nodes on this client _as each edit happens_, just as they would be if the changes were made outside of a transaction.\n\t * Any other/future clients or contexts will process the transaction \"squashed\", i.e. they will apply its changes all at once, emitting only a single event per node (even if that node was edited multiple times in the transaction).\n\t * Edits to the tree are not permitted within these event callbacks, therefore no other local changes from this client will be interleaved with the changes in this transaction.\n\t *\n\t * Using a transaction has the following additional consequences:\n\t *\n\t * - If {@link Revertible | reverted } (e.g. via an \"undo\" operation), all the changes in the transaction are reverted together.\n\t * Only the \"outermost\" transaction commits a change to the synchronized tree state and therefore only the outermost transaction can be reverted.\n\t * If a transaction is started and completed while another transaction is already in progress, then the inner transaction will be reverted together with the outer transaction.\n\t * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.\n\t *\n\t * If the transaction is rolled back, a corresponding {@link TreeBranchEvents.changed | `changed`} event will also be emitted for the rollback.\n\t */\n\trunTransaction<\n\t\tTOut extends\n\t\t\t| TransactionCallbackStatusBeta<unknown, unknown>\n\t\t\t| VoidTransactionCallbackStatusBeta\n\t\t\t| void,\n\t>(\n\t\ttransaction: () => TOut,\n\t\tparams?: RunTransactionParamsBeta,\n\t): TOut extends TransactionCallbackStatusBeta<infer TSuccessValue, infer TFailureValue>\n\t\t? TransactionValueResult<TSuccessValue, TFailureValue>\n\t\t: TransactionVoidResult;\n\n\t/**\n\t * An asynchronous version of {@link TreeViewBeta.runTransaction | runTransaction}.\n\t *\n\t * @remarks\n\t * As with synchronous transactions, all of the changes in an asynchronous transaction are treated as a unit.\n\t * Therefore, no other changes (either from this client or from a remote client) can be interleaved with the transaction changes.\n\t *\n\t * Unlike with synchronous transactions, it is possible that other changes (e.g. from a remote client) may be applied to the branch while this transaction is in progress.\n\t * Those other changes will be not be reflected on the branch until after this transaction completes, at which point the transaction changes will be applied after those other changes.\n\t *\n\t * An asynchronous transaction may not be started while any other transaction is in progress in this view.\n\t */\n\trunTransactionAsync<\n\t\tTOut extends\n\t\t\t| TransactionCallbackStatusBeta<unknown, unknown>\n\t\t\t| VoidTransactionCallbackStatusBeta\n\t\t\t| void,\n\t>(\n\t\ttransaction: () => Promise<TOut>,\n\t\tparams?: RunTransactionParamsBeta,\n\t): Promise<\n\t\tTOut extends TransactionCallbackStatusBeta<infer TSuccessValue, infer TFailureValue>\n\t\t\t? TransactionValueResult<TSuccessValue, TFailureValue>\n\t\t\t: TransactionVoidResult\n\t>;\n}\n\n/**\n * {@link TreeView} with proposed changes to the schema aware typing to allow use with `UnsafeUnknownSchema`.\n * @sealed @alpha\n */\nexport interface TreeViewAlpha<\n\tin out TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n> extends Omit<\n\t\t\tTreeViewBeta<ReadSchema<TSchema>>,\n\t\t\t\"root\" | \"initialize\" | \"fork\" | \"runTransaction\" | \"runTransactionAsync\"\n\t\t>,\n\t\tTreeBranchAlpha {\n\tget root(): ReadableField<TSchema>;\n\n\tset root(newRoot: InsertableField<TSchema>);\n\n\t/**\n\t * Initialize the tree, setting the stored schema to match this view's schema and setting the tree content.\n\t *\n\t * @remarks\n\t * Only valid to call when this view's {@link SchemaCompatibilityStatus.canInitialize} is true.\n\t *\n\t * Enables staged schema upgrades declared by {@link ITreeViewConfigurationAlpha.stagedUpgradePolicy} when generating the initial stored schema.\n\t * Once a staged schema upgrade has been enabled in a document's stored schema, loading that document\n\t * with a view that does not include equivalent staged members in its construction-time policy will cause\n\t * a subsequent `upgradeSchema` call to throw a `UsageError` because the stored schema already contains\n\t * the upgraded members and the new target would narrow it.\n\t *\n\t * Applications should typically call this function before attaching a `SharedTree`.\n\t * @param content - The content to initialize the tree with.\n\t */\n\tinitialize(content: InsertableField<TSchema>): void;\n\n\treadonly events: Listenable<TreeViewEvents & TreeBranchEvents>;\n\n\t// Override the base fork method to return a TreeViewAlpha.\n\tfork(): ReturnType<TreeBranch[\"fork\"]> & TreeViewAlpha<TSchema>;\n}\n\n/**\n * Information about a view schema's compatibility with the document's stored schema.\n *\n * @see\n * See SharedTree's README for more information about choosing a compatibility policy.\n *\n * @privateRemarks\n * See {@link checkSchemaCompatibility} for the implementation of this compatibility checking.\n *\n * @sealed @public\n */\nexport interface SchemaCompatibilityStatus {\n\t/**\n\t * Whether the view schema allows exactly the same set of documents as the stored schema.\n\t *\n\t * @remarks\n\t * Equivalence here is defined in terms of allowed documents because there are some degenerate cases where schemas are not\n\t * exact matches in a strict (schema-based) sense but still allow the same documents, and the document notion is more useful to applications.\n\t *\n\t * Examples which are expressible where this may occur include:\n\t *\n\t * - schema repository `A` has extra schema which schema `B` doesn't have, but they are unused (i.e. not reachable from the root schema)\n\t *\n\t * - field in schema `A` has allowed field members which the corresponding field in schema `B` does not have, but those types are not constructible (for example: an object node type containing a required field with no allowed types)\n\t *\n\t * These cases are typically not interesting to applications.\n\t *\n\t * Note that other content in the stored schema that does not impact document compatibility, like {@link NodeSchemaOptionsAlpha.persistedMetadata}, does not affect this field.\n\t *\n\t * For the computation of this equivalence, {@link SchemaStaticsBeta.staged | staged} schemas are not included.\n\t * If there are any unknown optional fields, even if allowed by {@link ObjectSchemaOptions.allowUnknownOptionalFields}, `isEquivalent` will be false.\n\t */\n\treadonly isEquivalent: boolean;\n\n\t/**\n\t * Whether the current view schema is sufficiently compatible with the stored schema to allow viewing tree data.\n\t * If false, {@link TreeView.root} will throw upon access.\n\t * @remarks\n\t * If the view schema does not opt into supporting any additional cases, then `canView` is only true when `isEquivalent` is also true.\n\t * The view schema can however opt into supporting additional cases, and thus can also view documents with stored schema which would be equivalent, except for the following discrepancies:\n\t *\n\t * - An object node with {@link ObjectSchemaOptions.allowUnknownOptionalFields} to set to true that has additional optional fields in the stored schema beyond those mentioned in its view schema.\n\t *\n\t * - An additional type allowed at a location in the stored schema where it is {@link SchemaStaticsBeta.staged | staged} in the view schema.\n\t *\n\t * In these cases `canUpgrade` and `isEquivalent` will be false.\n\t *\n\t * When the set of documents allowed by the view schema is a strict superset of those allowed by the stored schema,\n\t * `canView` is false because writes to the document using the view schema could make the document violate its stored schema.\n\t * In this case, the stored schema could be updated to match the provided view schema, allowing read-write access to the tree.\n\t * See {@link SchemaCompatibilityStatus.canUpgrade}.\n\t *\n\t * Future versions of SharedTree may provide readonly access to the document in this case because that would be safe,\n\t * but this is not currently supported.\n\t *\n\t * @privateRemarks\n\t * A necessary condition for this to be true is that the documents allowed by the view schema are a subset of those allowed by the stored schema.\n\t * This is not sufficient: the simple-tree layer's read APIs only tolerate very specific cases beyond their schema (unknown optional fields).\n\t * For example, if the view schema for a node has a required `Point` field but the stored schema has an optional `Point` field,\n\t * read APIs on the view schema do not work correctly when the document has a node with a missing `Point` field.\n\t * Similar issues happen when the view schema has a field with less allowed types than the stored schema and the document actually leverages those types.\n\t */\n\treadonly canView: boolean;\n\n\t/**\n\t * True when {@link TreeView.upgradeSchema} can add support for all content required to be supported by the view schema.\n\t * @remarks\n\t * When true, it is valid to call {@link TreeView.upgradeSchema} (though if the stored schema is already an exact match, this is a no-op).\n\t *\n\t * When adding optional fields to schema which previously were marked with {@link ObjectSchemaOptions.allowUnknownOptionalFields}\n\t * the schema upgrade (assuming no other changes are included) will allow the previous version to view.\n\t * Even this case must still must be done with caution however as only clients with the newly added field will be able to do future upgrades.\n\t * Thus if a version of an application is shipped that adds an unknown optional field, all future versions should include it, even if its no longer used,\n\t * to ensure that documents containing it can still be upgraded.\n\t */\n\treadonly canUpgrade: boolean;\n\n\t/**\n\t * True iff the document is uninitialized (i.e. it has no schema and no content).\n\t *\n\t * To initialize the document, call {@link TreeView.initialize}.\n\t *\n\t * @remarks\n\t * It's not necessary to check this field before calling {@link TreeView.initialize} in most scenarios; application authors typically know from\n\t * branch that they're in a flow which creates a new `SharedTree` and would like to initialize it.\n\t */\n\treadonly canInitialize: boolean;\n\n\t// TODO: Consider extending this status to include:\n\t// - application-defined metadata about the stored schema\n\t// - details about the differences between the stored and view schema sufficient for implementing \"safe mismatch\" policies\n}\n\n/**\n * Events for {@link TreeBranch}.\n * @sealed @alpha\n */\nexport interface TreeBranchEvents {\n\t/**\n\t * Fired when a change is made to the branch. Includes data about the change that is made which listeners\n\t * can use to filter on changes they care about (e.g. local vs. remote changes).\n\t *\n\t * @param data - information about the change\n\t * @param getRevertible - a function that allows users to get a revertible for the change. If not provided,\n\t * this change is not revertible.\n\t */\n\tchanged(data: ChangeMetadata, getRevertible?: RevertibleAlphaFactory): void;\n}\n\n/**\n * Events for {@link TreeView}.\n * @remarks\n * See {@link TreeBranchEvents} for more events related to the underlying branch of the SharedTree.\n * @sealed @public\n */\nexport interface TreeViewEvents {\n\t/**\n\t * Raised whenever {@link TreeView.root} is invalidated.\n\t *\n\t * This includes changes to the document schema.\n\t * It also includes changes to the field containing the root such as setting or clearing an optional root or changing which node is the root.\n\t * This does NOT include changes to the content (fields/children) of the root node: for that case subscribe to events on the root node.\n\t */\n\trootChanged(): void;\n\n\t/**\n\t * The stored schema for the document has changed.\n\t * This may affect the compatibility between the view schema and the stored schema, and thus the ability to use the view.\n\t *\n\t * @remarks\n\t * This event implies that the old {@link TreeView.root} is no longer valid, but applications need not handle that separately:\n\t * {@link TreeViewEvents.rootChanged} will be fired after this event.\n\t */\n\tschemaChanged(): void;\n\n\t/**\n\t * Fired when:\n\t *\n\t * - a local commit is applied outside of a transaction\n\t *\n\t * - a local transaction is committed\n\t *\n\t * The event is not fired when:\n\t *\n\t * - a local commit is applied within a transaction\n\t *\n\t * - a remote commit is applied\n\t *\n\t * @param data - information about the commit that was applied\n\t * @param getRevertible - a function provided that allows users to get a revertible for the commit that was applied. If not provided,\n\t * this commit is not revertible.\n\t */\n\tcommitApplied(data: CommitMetadata, getRevertible?: RevertibleFactory): void;\n}\n\n/**\n * Retrieve the {@link TreeViewAlpha | alpha API} for a {@link TreeView}.\n * @alpha\n * @deprecated Use {@link (asAlpha:1)} instead.\n * @privateRemarks Despite being deprecated, this function should be used within the tree package (outside of tests) rather than `asAlpha` in order to avoid circular import dependencies.\n */\nexport function asTreeViewAlpha<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): TreeViewAlpha<TSchema> {\n\treturn view as TreeViewAlpha<TSchema>;\n}\n"]}
1
+ {"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/tree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgmCH;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC9B,IAAuB;IAEvB,OAAO,IAA8B,CAAC;AACvC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidLoadable, IDisposable, Listenable } from \"@fluidframework/core-interfaces\";\n\nimport type {\n\tChangeMetadata,\n\tCommitMetadata,\n\tCustomMetadataTree,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars -- This is referenced by doc comments.\n\tRevertible,\n\tRevertibleAlphaFactory,\n\tRevertibleFactory,\n\tRevertToOptionsAlpha,\n} from \"../../core/index.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- This is referenced by doc comments.\nimport type { TreeStatus } from \"../../feature-libraries/index.js\";\nimport type {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports -- This is referenced by doc comments.\n\tTreeAlpha,\n} from \"../../shared-tree/index.js\";\nimport type {\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnlyObject,\n} from \"../../util/index.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- This is referenced by doc comments.\nimport type { SchemaUpgrade, Unhydrated } from \"../core/index.js\";\nimport type {\n\tImplicitFieldSchema,\n\tInsertableField,\n\tInsertableTreeFieldFromImplicitField,\n\tReadableField,\n\tReadSchema,\n\tTreeFieldFromImplicitField,\n} from \"../fieldSchema.js\";\nimport type { SimpleTreeSchema } from \"../simpleSchema.js\";\nimport type { UnsafeUnknownSchema } from \"../unsafeUnknownSchema.js\";\n\nimport type { TreeViewConfiguration } from \"./configuration.js\";\nimport type { StagedUpgradeStatus } from \"./schemaCompatibilityTester.js\";\nimport type {\n\tRunTransactionParamsAlpha,\n\tRunTransactionParamsBeta,\n\tTransactionCallbackStatusAlpha,\n\tTransactionCallbackStatusBeta,\n\tTransactionVoidResult,\n\tTransactionValueResult,\n\tVoidTransactionCallbackStatusAlpha,\n\tVoidTransactionCallbackStatusBeta,\n\tWithValue,\n} from \"./transactionTypes.js\";\nimport type { VerboseTree } from \"./verboseTree.js\";\n\n/**\n * A tree from which a {@link TreeView} can be created.\n *\n * @privateRemarks\n * TODO:\n * Add stored key versions of {@link (TreeAlpha:interface).(exportVerbose:2)}, {@link (TreeAlpha:interface).(exportConcise:2)} and {@link (TreeAlpha:interface).exportCompressed} here so tree content can be accessed without a view schema.\n * Add exportSimpleSchema and exportJsonSchema methods (which should exactly match the concise format, and match the free functions for exporting view schema).\n * Maybe rename \"exportJsonSchema\" to align on \"concise\" terminology.\n * 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).\n * Make sure users of independentView can use these export APIs (maybe provide a reference back to the ViewableTree from the TreeView to accomplish that).\n * @system @sealed @public\n */\nexport interface ViewableTree {\n\t/**\n\t * Returns a {@link TreeView} using the provided schema.\n\t * If the stored schema is compatible with the view schema specified by `config`,\n\t * the returned {@link TreeView} will expose the root with a schema-aware API based on the provided view schema.\n\t * If the provided schema is incompatible with the stored schema, the view will instead expose a status indicating the incompatibility.\n\t *\n\t * @remarks\n\t * If the tree is uninitialized (has no schema and no content), use {@link TreeView.initialize} on the returned view to set the schema and content together.\n\t * Using `viewWith` followed by {@link TreeView.upgradeSchema} to initialize only the schema for a document is technically valid when the schema\n\t * permits trees with no content.\n\t *\n\t * Note that other clients can modify the document at any time, causing the view to change its compatibility status: see {@link TreeView.events} for how to handle invalidation in these cases.\n\t *\n\t * Only one schematized view may exist for a given ITree at a time.\n\t * If creating a second, the first must be disposed before calling `viewWith` again.\n\t *\n\t * @privateRemarks\n\t * TODO: Support adapters for handling out-of-schema data.\n\t */\n\tviewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n}\n\n/**\n * Channel for a Fluid Tree DDS.\n * @remarks\n * Allows storing and collaboratively editing schema-aware hierarchial data.\n * @sealed @public\n */\nexport interface ITree extends ViewableTree, IFluidLoadable {}\n\n/**\n * {@link ITree} extended with some alpha APIs.\n * @sealed @alpha\n */\nexport interface ITreeAlpha extends ITree {\n\t/**\n\t * Exports root in the same format as {@link (TreeAlpha:interface).(exportVerbose:1)} using stored keys.\n\t * @remarks\n\t * This is `undefined` if and only if the root field is empty (this can only happen if the root field is optional).\n\t */\n\texportVerbose(): VerboseTree | undefined;\n\n\t/**\n\t * Exports the SimpleTreeSchema that is stored in the tree, using stored keys for object fields.\n\t * @remarks\n\t * To get the schema using property keys, use {@link getSimpleSchema} on the view schema.\n\t */\n\texportSimpleSchema(): SimpleTreeSchema;\n\n\t/**\n\t * Creates a fork of the current state of the main branch.\n\t * This new branch will be shared with and editable by all clients.\n\t * @param name - Optional name for the new branch.\n\t * This name is not guaranteed to be unique.\n\t * (Maximum {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length | length}: 1024)\n\t * @returns The ID of the new branch, which can be used to {@link ITreeAlpha.viewSharedBranchWith | view} the branch.\n\t */\n\tcreateSharedBranch(name?: string): string;\n\n\t/**\n\t * Retrieves the name, if any, of the shared branch with the given ID.\n\t * @param branchId - The ID of the shared branch to retrieve the name of.\n\t * @returns The name of the shared branch, or `undefined` if the branch has no assigned name.\n\t * @throws if the branch with the given ID does not exist.\n\t */\n\tgetSharedBranchName(branchId: string): string | undefined;\n\n\t/**\n\t * Returns a list of all shared branches that currently exist on this tree.\n\t * Any one of them can be checked out using {@link ITreeAlpha.viewSharedBranchWith}.\n\t */\n\tgetSharedBranchIds(): string[];\n\n\t/**\n\t * Returns a view of the tree on the specified shared branch, using the provided schema.\n\t * See {@link ViewableTree.viewWith}.\n\t */\n\tviewSharedBranchWith<TRoot extends ImplicitFieldSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n}\n\n/**\n * An untyped view of a (version-control-style) branch of a SharedTree.\n * @remarks An `UntypedTreeView` allows for the {@link UntypedTreeView.fork | creation of branches} and for those branches to later be {@link UntypedTreeView.merge | merged}.\n *\n * The branch associated directly with the {@link ITree | SharedTree} is the \"main\" branch, and all other branches fork (directly or transitively) from that main branch.\n *\n * See {@link UntypedTreeViewAlpha} for additional APIs that are in an earlier stage of development.\n * @sealed @beta\n */\nexport interface UntypedTreeView extends IDisposable {\n\t/**\n\t * Fork a new branch off of this branch which is based off of this branch's current state.\n\t * @remarks Any changes to the tree on the new view will not apply to this view until the new view is e.g. {@link UntypedTreeView.merge | merged} back into this view.\n\t * The view should be disposed when no longer needed, either {@link UntypedTreeView.dispose | explicitly} or {@link UntypedTreeView.merge | implicitly when merging} into another view.\n\t */\n\tfork(): UntypedTreeView;\n\n\t/**\n\t * Apply all the new changes on the given view to this view.\n\t * @param view - A view created by {@link UntypedTreeView.fork}.\n\t * @param disposeMerged - Whether or not to dispose `view` after the merge completes.\n\t * Defaults to true.\n\t * The {@link UntypedTreeView | main view} cannot be disposed - attempting to do so will have no effect.\n\t * @remarks All ongoing transactions (if any) in `view` will be committed before the merge.\n\t */\n\tmerge(view: UntypedTreeView, disposeMerged?: boolean): void;\n\n\t/**\n\t * Advance this view forward such that all new changes on the target view become part of this view.\n\t * @param view - The view to rebase onto.\n\t * @remarks After rebasing, this view will be \"ahead\" of the target view, that is, its unique changes will have been recreated as if they happened after all changes on the target view.\n\t * This method may only be called on views produced via {@link UntypedTreeView.fork | fork} - attempting to rebase the main view will throw.\n\t *\n\t * Rebasing long-lived branches is important to avoid consuming memory unnecessarily.\n\t * In particular, the SharedTree retains all sequenced changes made to the tree since the \"most-behind\" branch was created or last rebased.\n\t *\n\t * The {@link UntypedTreeView | main view} cannot be rebased onto another view - attempting to do so will throw an error.\n\t */\n\trebaseOnto(view: UntypedTreeView): void;\n\n\t/**\n\t * Dispose of this view, cleaning up any resources associated with it.\n\t * @param error - Optional error indicating the reason for the disposal, if the object was disposed as the result of an error.\n\t * @remarks Views can also be automatically disposed when {@link UntypedTreeView.merge | they are merged} into another view.\n\t *\n\t * Disposing branches is important to avoid consuming memory unnecessarily.\n\t * In particular, the SharedTree retains all sequenced changes made to the tree since the \"most-behind\" view was created or last {@link UntypedTreeView.rebaseOnto | rebased}.\n\t *\n\t * The {@link UntypedTreeView | main view} cannot be disposed - attempting to do so will have no effect.\n\t */\n\tdispose(error?: Error): void;\n}\n\n/**\n * Compatibility alias for {@link UntypedTreeView}.\n *\n * @deprecated Use {@link UntypedTreeView} instead.\n * @beta\n */\nexport type TreeBranch = UntypedTreeView;\n\n/**\n * Provides additional APIs that may be used to interact with a tree node or a tree node's SharedTree.\n * @alpha\n */\nexport interface TreeContextAlpha {\n\t/**\n\t * Run a synchronous transaction which groups sequential edits to the tree into a single atomic edit if possible.\n\t * @param transaction - A callback run during the transaction to perform user-supplied operations.\n\t * It may optionally return a {@link WithValue | value }, which will be returned by the `runTransaction` call.\n\t * @param params - Optional {@link RunTransactionParamsAlpha | parameters} for the transaction.\n\t * @returns A {@link TransactionValueResult | value } indicating whether or not the transaction succeeded, and containing the value returned by `transaction`.\n\t * @remarks\n\t * All of the changes in the transaction are applied synchronously and therefore no other changes from a remote client can be interleaved with those changes.\n\t * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.\n\t *\n\t * {@link (TreeBeta:interface).on | Change events } will be emitted for changed nodes on this client _as each edit happens_, just as they would be if the changes were made outside of a transaction.\n\t * Any other/future clients or contexts will process the transaction \"squashed\", i.e. they will apply its changes all at once, emitting only a single event per node (even if that node was edited multiple times in the transaction).\n\t * Edits to the tree are not permitted within these event callbacks, therefore no other local changes from this client will be interleaved with the changes in this transaction.\n\t *\n\t * Using a transaction has the following additional consequences:\n\t *\n\t * - If {@link Revertible | reverted } (e.g. via an \"undo\" operation), all the changes in the transaction are reverted together.\n\t * Only the \"outermost\" transaction commits a change to the synchronized tree state and therefore only the outermost transaction can be reverted.\n\t * If a transaction is started and completed while another transaction is already in progress, then the inner transaction will be reverted together with the outer transaction.\n\t * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.\n\t *\n\t * `runTransaction` may be invoked on the context of a {@link TreeStatus.InDocument | hydrated } or {@link Unhydrated | unhydrated } node.\n\t * Use {@link TreeContextAlpha.isView | isView() } to check whether this context is associated with a view and gain {@link UntypedTreeViewAlpha.(runTransaction:1) | access to more transaction capabilities} if so.\n\t */\n\trunTransaction<TValue>(\n\t\ttransaction: () => WithValue<TValue>,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): TransactionValueResult<TValue, TValue>;\n\n\t/**\n\t * An overload of {@link TreeContextAlpha.(runTransaction:1) | runTransaction } which does not return a value.\n\t *\n\t * @privateRemarks\n\t * TODO: Consider updating these methods to avoid the need for overloads.\n\t * See {@link TreeViewBeta.runTransaction} for an example of how to do this.\n\t */\n\trunTransaction(\n\t\ttransaction: () => void,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): TransactionVoidResult;\n\n\t/**\n\t * An asynchronous version of {@link TreeContextAlpha.(runTransaction:1) | runTransaction}.\n\t * @remarks\n\t * As with synchronous transactions, all of the changes in an asynchronous transaction are treated as a unit.\n\t * Therefore, no other changes (either from this client or from a remote client) can be interleaved with the transaction changes.\n\t *\n\t * Unlike with synchronous transactions, it is possible that other changes (e.g. from a remote client) may be applied to the branch while this transaction is in progress.\n\t * Those other changes will be not be reflected on the branch until after this transaction completes, at which point the transaction changes will be applied after those other changes.\n\t *\n\t * An asynchronous transaction may not be started while any other transaction is in progress in this context.\n\t */\n\trunTransactionAsync<TValue>(\n\t\ttransaction: () => Promise<WithValue<TValue>>,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): Promise<TransactionValueResult<TValue, TValue>>;\n\n\t/**\n\t * An overload of {@link TreeContextAlpha.(runTransactionAsync:1) | runTransactionAsync } which does not return a value.\n\t *\n\t * @privateRemarks\n\t * TODO: Consider updating these methods to avoid the need for overloads.\n\t * See {@link TreeViewBeta.runTransactionAsync} for an example of how to do this.\n\t */\n\trunTransactionAsync(\n\t\ttransaction: () => Promise<void>,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): Promise<TransactionVoidResult>;\n\n\t/**\n\t * True if this context is associated with an {@link UntypedTreeViewAlpha | untyped view} and false if it is associated with an {@link Unhydrated | unhydrated } node.\n\t * @remarks If this returns true, the context can be safely inferred or cast to {@link UntypedTreeViewAlpha} to access additional view-specific APIs.\n\t * @example\n\t * ```typescript\n\t * const context = tree.context(someNode);\n\t * if (context.isView()) {\n\t * assert(context.hasRootSchema(MySchema)) // `hasRootSchema` is a method on UntypedTreeViewAlpha, so this is only accessible if `context` is a view context.\n\t * context.root.foo = \"bar\"; // Edit the root of the SharedTree that `someNode` belongs to.\n\t * }\n\t * ```\n\t * @returns Whether this context is associated with an untyped view.\n\t */\n\tisView(): this is UntypedTreeViewAlpha;\n\n\t/**\n\t * {@inheritDoc TreeContextAlpha.isView}\n\t * @deprecated Use {@link TreeContextAlpha.isView | isView()} instead.\n\t */\n\tisBranch(): this is UntypedTreeViewAlpha;\n}\n\n/**\n * An identifier for a commit in a {@link UntypedTreeViewAlpha}'s {@link UntypedTreeViewAlpha.branchHistory | history}.\n * @alpha\n */\nexport type CommitRevision = string;\n\n/**\n * Metadata describing a single commit in a {@link UntypedTreeViewAlpha}'s history.\n * @sealed @alpha\n */\nexport interface TreeBranchCommitMetadata {\n\t/**\n\t * The revision UUID that uniquely identifies this commit within the branch's history.\n\t */\n\treadonly revision: CommitRevision;\n\n\t/**\n\t * Arbitrary, application-defined metadata that was {@link RunTransactionParamsAlpha.customMetadata | attached}\n\t * to this commit when it was created, flattened into a single object.\n\t *\n\t * @remarks\n\t * This is `undefined` for commits that were not annotated.\n\t *\n\t * A commit may be produced by nested transactions, each of which may supply metadata. This property combines\n\t * them: where two of them used the same property, the outermost transaction wins, and between siblings the\n\t * later one wins. Use {@link TreeBranchCommitMetadata.customTree} to recover which transaction supplied what.\n\t */\n\treadonly custom: JsonCompatibleReadOnlyObject | undefined;\n\n\t/**\n\t * The {@link CustomMetadataTree | tree} of metadata attached to this commit, reflecting the nesting of\n\t * the transactions that produced it.\n\t *\n\t * @remarks\n\t * The structural counterpart to {@link TreeBranchCommitMetadata.custom}, and `undefined` whenever it is.\n\t * Prefer `custom` unless you need to know which transaction supplied a particular property.\n\t */\n\treadonly customTree: CustomMetadataTree | undefined;\n\n\t/**\n\t * The metadata for the commit that this commit was based on, or `undefined` if this commit has no parent\n\t * (i.e. it is the oldest commit in the branch's history).\n\t *\n\t * @remarks\n\t * This method may return a different value over time if the parent commit is trimmed from the branch's history.\n\t */\n\tgetParent(): TreeBranchCommitMetadata | undefined;\n}\n\n/**\n * Provides APIs for querying information about the history of a {@link UntypedTreeViewAlpha}.\n * @remarks\n * The history of a branch is the sequence of commits leading up to its current state.\n * @sealed @alpha\n */\nexport interface TreeBranchHistory {\n\t/**\n\t * The number of commits in this branch's history.\n\t * @remarks\n\t * This number grows when any of the following occurs:\n\t * - A new edit is made on this branch (either through editing or by reverting an existing commit on this branch).\n\t * - A branch that contains commits not already on this branch is merged into this branch.\n\t * - The branch is rebased onto another branch that contains commits not already on this branch.\n\t * This number shrinks when past commits are trimmed from the history.\n\t */\n\treadonly length: number;\n\n\t/**\n\t * Returns metadata for the current head commit of this branch.\n\t * @returns The metadata for the head commit, or `undefined` if the branch has no commits.\n\t */\n\tgetHead(): TreeBranchCommitMetadata | undefined;\n}\n\n/**\n * An untyped view of a {@link UntypedTreeView} with alpha-level APIs.\n * @remarks\n * The untyped view for a specific {@link TreeNode} may be acquired by calling `TreeAlpha.context` and checking {@link TreeContextAlpha.isView | isView()}.\n *\n * An untyped view does not necessarily know the schema of its SharedTree. To convert it to a {@link TreeViewAlpha | view with a schema}, use {@link UntypedTreeViewAlpha.hasRootSchema | hasRootSchema()}.\n * @sealed @alpha\n */\nexport interface UntypedTreeViewAlpha extends UntypedTreeView, TreeContextAlpha {\n\t/**\n\t * Events for the view's underlying branch.\n\t */\n\treadonly events: Listenable<TreeBranchEvents>;\n\n\t/**\n\t * APIs for querying the history of the branch being viewed.\n\t */\n\treadonly branchHistory: TreeBranchHistory;\n\n\t/**\n\t * Returns true if this view has the given schema as its root schema.\n\t * @remarks This is a type guard which allows this view to become strongly typed as a {@link TreeViewAlpha | view} of the given schema.\n\t *\n\t * To succeed, the given schema must be invariant to the schema of the view - it must include exactly the same allowed types.\n\t * For example, a schema of `Foo | Bar` will not match a view schema of `Foo`, and likewise a schema of `Foo` will not match a view schema of `Foo | Bar`.\n\t * @example\n\t * ```typescript\n\t * if (view.hasRootSchema(MySchema)) {\n\t * const { root } = view; // `view` is now a TreeViewAlpha<MySchema>\n\t * // ...\n\t * }\n\t * ```\n\t */\n\thasRootSchema<TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t): this is TreeViewAlpha<TSchema>;\n\n\t// Override the base fork method to return the alpha variant.\n\tfork(): UntypedTreeViewAlpha;\n\n\t/**\n\t * Switches this view to a new underlying branch with the given commit as the head, updating the view state accordingly.\n\t *\n\t * @param revision - The {@link TreeBranchCommitMetadata.revision | revision} to rewind to.\n\t * Can be obtained by navigating the commits on the {@link UntypedTreeViewAlpha.branchHistory | branch history}.\n\t *\n\t * @remarks\n\t * Unlike {@link UntypedTreeViewAlpha.revertTo | revertTo}, this does not apply a change to the underlying branch.\n\t * The original underlying branch will be disposed.\n\t * Consider {@link UntypedTreeViewAlpha.fork | forking} before rewinding.\n\t * Not valid to invoke on the main branch or a {@link (ITreeAlpha:interface).createSharedBranch | shared branch}.\n\t */\n\trewindTo(revision: CommitRevision): void;\n\n\t/**\n\t * Applies a new change which reverts all changes made since the given `revision`.\n\t * This is a no-op if the given revision is the head commit of the underlying branch being viewed.\n\t *\n\t * @param revision - The {@link TreeBranchCommitMetadata.revision | revision} to restore the state of.\n\t * Can be obtained by navigating the commits on the {@link UntypedTreeViewAlpha.branchHistory | branch history}.\n\t * @param options - Optional {@link RevertToOptionsAlpha | options} for the revert.\n\t *\n\t * @remarks\n\t * The generated change is subject to the same merge semantics as the {@link Revertible.(revert:1) | reverts of individual commits}:\n\t * Concurrent changes that are sequenced before the revert will not be overwritten by the revert if they affect different parts of the document.\n\t *\n\t * Unlike {@link UntypedTreeViewAlpha.rewindTo | rewindTo}, this does not switch to a new branch.\n\t */\n\trevertTo(revision: CommitRevision, options?: RevertToOptionsAlpha): void;\n\n\t/**\n\t * {@link TreeContextAlpha.(runTransaction:1) | Run a transaction} on this view of the SharedTree.\n\t * @param transaction - The function to run as the body of the transaction, which may optionally return a {@link TransactionCallbackStatusAlpha | value or rollback signal}.\n\t * @remarks\n\t * If the transaction is rolled back, a corresponding {@link TreeBranchEvents.changed | `changed`} event will also be emitted for the rollback.\n\t */\n\trunTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () => TransactionCallbackStatusAlpha<TSuccessValue, TFailureValue>,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): TransactionValueResult<TSuccessValue, TFailureValue>;\n\n\t/**\n\t * An overload of {@link UntypedTreeViewAlpha.(runTransaction:1) | runTransaction } which does not return a value.\n\t *\n\t * @privateRemarks\n\t * TODO: Consider updating these methods to avoid the need for overloads.\n\t * See {@link TreeViewBeta.runTransaction} for an example of how to do this.\n\t */\n\trunTransaction(\n\t\ttransaction: () => VoidTransactionCallbackStatusAlpha | void,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): TransactionVoidResult;\n\n\t/**\n\t * An asynchronous version of {@link UntypedTreeViewAlpha.(runTransaction:1) | runTransaction}.\n\t * @remarks See {@link TreeContextAlpha.(runTransactionAsync:1) | runTransactionAsync} for additional information about asynchronous transactions.\n\t */\n\n\trunTransactionAsync<TSuccessValue, TFailureValue>(\n\t\ttransaction: () => Promise<TransactionCallbackStatusAlpha<TSuccessValue, TFailureValue>>,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): Promise<TransactionValueResult<TSuccessValue, TFailureValue>>;\n\n\t/**\n\t * An overload of {@link UntypedTreeViewAlpha.(runTransactionAsync:1) | runTransactionAsync } which does not return a value.\n\t *\n\t * @privateRemarks\n\t * TODO: Consider updating these methods to avoid the need for overloads.\n\t * See {@link TreeViewBeta.runTransactionAsync} for an example of how to do this.\n\t */\n\trunTransactionAsync(\n\t\ttransaction: () => Promise<VoidTransactionCallbackStatusAlpha | void>,\n\t\tparams?: RunTransactionParamsAlpha,\n\t): Promise<TransactionVoidResult>;\n\n\t/**\n\t * Apply a serialized change to this branch.\n\t * @param change - the change to apply.\n\t * Changes are acquired via `getChange` in a branch's {@link TreeBranchEvents.changed | \"changed\"} event.\n\t * @remarks Changes may only be applied to a SharedTree with the same IdCompressor instance and branch state from which they were generated.\n\t * They may be created by one branch and applied to another, but only if both branches share the same history at the time of creation and application.\n\t *\n\t * @privateRemarks\n\t * TODO: This method will support applying changes from different IdCompressor instances as long as they have the same local session ID.\n\t * Update the tests and docs to match when that is done.\n\t */\n\tapplyChange(change: JsonCompatibleReadOnly): void;\n\n\t/**\n\t * Determines if there are changes on the given view that are not present on this view.\n\t * @param view - The view to compare to.\n\t *\n\t * The new edits, if any, can be applied to this view by {@link UntypedTreeView.rebaseOnto | rebasing this view onto the given view}\n\t * or by {@link UntypedTreeView.merge | merging the given view into this view}.\n\t *\n\t * @throws UsageError if the branches are unrelated.\n\t */\n\tisMissingEditsFrom(view: UntypedTreeView): boolean;\n\n\t/**\n\t * Computes the net change that would result if this view were {@link UntypedTreeView.rebaseOnto | rebased onto} the given view.\n\t * Note that this method does not actually perform the rebase and therefore has no effect on this view.\n\t *\n\t * @param view - The view that would be rebased onto.\n\t * @returns The net change that would result if this view were rebased onto the given view,\n\t * or `undefined` if rebasing would have no impact.\n\t */\n\tcomputeNetChangeIfRebasedOnto(view: UntypedTreeView): JsonCompatibleReadOnly | undefined;\n}\n\n/**\n * Compatibility alias for {@link UntypedTreeViewAlpha}.\n *\n * @deprecated Use {@link UntypedTreeViewAlpha} instead.\n * @alpha\n */\nexport type TreeBranchAlpha = UntypedTreeViewAlpha;\n\n/**\n * An editable view of a (version control style) branch of a shared tree based on some schema.\n *\n * @remarks\n * This schema (known as the view schema) may or may not align with the stored schema of the document.\n * Information about discrepancies between the two schemas is available via {@link TreeView.compatibility | compatibility}.\n *\n * Application authors are encouraged to read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/docs/user-facing/schema-evolution.md | schema-evolution.md}\n * and choose a schema compatibility policy that aligns with their application's needs.\n *\n * See also {@link TreeViewAlpha}, {@link TreeViewBeta} and {@link UntypedTreeView} for additional APIs that are in earlier stages of development.\n *\n * @privateRemarks\n * From an API design perspective, `upgradeSchema` could be merged into `viewWith` and/or `viewWith` could return errors explicitly on incompatible documents.\n * Such approaches would make it discoverable that out of schema handling may need to be done.\n * Doing that would however complicate trivial \"hello world\" style example slightly, as well as be a breaking API change.\n * It also seems more complex to handle invalidation with that pattern.\n * Thus this design was chosen at the risk of apps blindly accessing `root` then breaking unexpectedly when the document is incompatible.\n *\n * @see {@link TreeViewAlpha}\n * @see {@link asTreeViewAlpha}\n *\n * @sealed @public\n */\nexport interface TreeView<in out TSchema extends ImplicitFieldSchema> extends IDisposable {\n\t/**\n\t * The current root of the tree.\n\t *\n\t * If the view schema not sufficiently compatible with the stored schema, accessing this will throw.\n\t * To handle this case, check {@link TreeView.compatibility | compatibility}'s {@link SchemaCompatibilityStatus.canView | canView} before using.\n\t *\n\t * To get notified about changes to this field,\n\t * use {@link TreeViewEvents.rootChanged} via `view.events.on(\"rootChanged\", callback)`.\n\t *\n\t * To get notified about changes to stored schema (which may affect compatibility between this view's schema and\n\t * the stored schema), use {@link TreeViewEvents.schemaChanged} via `view.events.on(\"schemaChanged\", callback)`.\n\t */\n\tget root(): TreeFieldFromImplicitField<TSchema>;\n\n\tset root(newRoot: InsertableTreeFieldFromImplicitField<TSchema>);\n\n\t/**\n\t * Description of the current compatibility status between the view schema and stored schema.\n\t * @remarks\n\t * {@link TreeViewEvents.schemaChanged} is fired when the compatibility status of the document's stored schema changes.\n\t * See {@link https://fluidframework.com/docs/data-structures/tree/schema-evolution/ | schema-evolution} for more guidance on how to change schema while maintaining compatibility.\n\t * Use {@link snapshotSchemaCompatibility} to write tests to validate that this compatibility behaves as desired across schema changes.\n\t */\n\treadonly compatibility: SchemaCompatibilityStatus;\n\n\t/**\n\t * When {@link SchemaCompatibilityStatus.canUpgrade} is true,\n\t * this can be used to modify the stored schema to make it match the view schema.\n\t * @remarks\n\t * This will update the {@link TreeView.compatibility}, allowing access to `root`.\n\t * Beware that this may impact other clients' ability to view the document: see {@link SchemaCompatibilityStatus.canView} for more information.\n\t *\n\t * It is an error to call this when {@link SchemaCompatibilityStatus.canUpgrade} is false.\n\t * {@link SchemaCompatibilityStatus.canUpgrade} being true does not mean that an upgrade is required, nor that an upgrade will have any effect.\n\t *\n\t * When using {@link TreeViewConfigurationAlpha} with a {@link ITreeViewConfigurationAlpha.stagedUpgradePolicy},\n\t * staged schema upgrades matching the configured policy are included in the target stored schema.\n\t * Staged upgrades that are already enabled in the document are also included by default. Set\n\t * {@link (StagedSchemaUpgradePolicy:interface).includeAlreadyEnabledUpgrades} to `false` when\n\t * creating the policy to only include staged upgrades selected explicitly by the policy.\n\t *\n\t * @example Enabling a staged allowed type for documents, selected by a feature flag\n\t *\n\t * ```typescript\n\t * const sf = new SchemaFactoryBeta(\"my-app\");\n\t *\n\t * class TaskItem extends sf.object(\"TaskItem\", { title: sf.string }) {}\n\t * class ChecklistItem extends sf.object(\"ChecklistItem\", { text: sf.string }) {}\n\t *\n\t * // `staged` wraps ChecklistItem so it can be enabled at runtime.\n\t * const stagedChecklist = SchemaFactoryBeta.staged(ChecklistItem);\n\t * const checklistUpgrade = stagedChecklist.metadata.stagedSchemaUpgrade;\n\t *\n\t * class AppSchema extends sf.object(\"AppSchema\", {\n\t * items: sf.array([TaskItem, stagedChecklist]),\n\t * }) {}\n\t *\n\t * // Feature flag controls whether the upgrade is enabled for this session.\n\t * const policy = featureFlags.enableChecklist\n\t * ? StagedSchemaUpgradePolicy.enabledStagedUpgrades(checklistUpgrade)\n\t * : undefined;\n\t *\n\t * const view = tree.viewWith(\n\t * new TreeViewConfigurationAlpha({ schema: AppSchema, stagedUpgradePolicy: policy }),\n\t * );\n\t *\n\t * if (view.compatibility.canUpgrade) {\n\t * // Writes the staged type into the document's stored schema.\n\t * view.upgradeSchema();\n\t * }\n\t * ```\n\t *\n\t * @privateRemarks\n\t * In the future, more upgrade options could be provided here.\n\t * Some options that could be added:\n\t * - check the actual document contents (not just the schema) and attempt an atomic document update if the data is compatible.\n\t * - apply converters and upgrade the document.\n\t * - apply converters to lazily to adapt the document to the requested view schema (with optional lazy schema updates or transparent conversions on write).\n\t * - update only a specific change (add an optional field, or apply a staged upgrade)\n\t * - update persistedMetadata or not\n\t *\n\t * As persisted metadata becomes more supported, how it interacts with isEquivalent and upgradeSchema should be clarified:\n\t * for now the docs are being left somewhat vague to allow flexibility in this area.\n\t */\n\tupgradeSchema(): void;\n\n\t/**\n\t * Initialize the tree, setting the stored schema to match this view's schema and setting the tree content.\n\t *\n\t * @remarks\n\t * Only valid to call when this view's {@link SchemaCompatibilityStatus.canInitialize} is true.\n\t *\n\t * When using {@link TreeViewConfigurationAlpha} with a {@link ITreeViewConfigurationAlpha.stagedUpgradePolicy},\n\t * staged schema upgrades matching the configured policy are included in the initial stored schema.\n\t *\n\t * Applications should typically call this function before attaching a `SharedTree`.\n\t * @param content - The content to initialize the tree with.\n\t */\n\tinitialize(content: InsertableTreeFieldFromImplicitField<TSchema>): void;\n\n\t/**\n\t * Events for the tree.\n\t */\n\treadonly events: Listenable<TreeViewEvents>;\n\n\t/**\n\t * The view schema used by this TreeView.\n\t */\n\treadonly schema: TSchema;\n}\n\n/**\n * A discrepancy between a view schema and a document's stored schema.\n *\n * @remarks\n * The `mismatch` property discriminates the different discrepancy shapes.\n *\n * @sealed @beta\n */\nexport type SchemaDiscrepancy =\n\t| {\n\t\t\t/**\n\t\t\t * Indicates that a field allows different node types in the view and stored schemas.\n\t\t\t */\n\t\t\treadonly mismatch: \"allowedTypes\";\n\t\t\t/**\n\t\t\t * The field with the discrepancy.\n\t\t\t *\n\t\t\t * `\"root\"` identifies the root field. Otherwise, `nodeType` identifies the containing\n\t\t\t * node schema and `fieldKey` identifies its field. `fieldKey` is undefined for a map\n\t\t\t * node's implicit field.\n\t\t\t */\n\t\t\treadonly location:\n\t\t\t\t| \"root\"\n\t\t\t\t| {\n\t\t\t\t\t\treadonly nodeType: string;\n\t\t\t\t\t\treadonly fieldKey: string | undefined;\n\t\t\t\t };\n\t\t\t/**\n\t\t\t * Non-staged node type identifiers allowed by the view schema but not the stored schema.\n\t\t\t */\n\t\t\treadonly view: readonly string[];\n\t\t\t/**\n\t\t\t * Staged node type identifiers allowed by the view schema but not the stored schema.\n\t\t\t *\n\t\t\t * @remarks These types provide rollout context but do not cause the discrepancy.\n\t\t\t */\n\t\t\treadonly stagedView?: readonly string[];\n\t\t\t/**\n\t\t\t * Node type identifiers allowed by the stored schema but not the view schema.\n\t\t\t */\n\t\t\treadonly stored: readonly string[];\n\t\t\t/**\n\t\t\t * Whether the view field is a staged optional field.\n\t\t\t *\n\t\t\t * @remarks Omitted when false.\n\t\t\t */\n\t\t\treadonly viewIsStagedOptional?: true;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * Indicates that a field has different field kinds in the view and stored schemas.\n\t\t\t */\n\t\t\treadonly mismatch: \"fieldKind\";\n\t\t\t/**\n\t\t\t * The field with the discrepancy.\n\t\t\t *\n\t\t\t * `\"root\"` identifies the root field. Otherwise, `nodeType` identifies the containing\n\t\t\t * node schema and `fieldKey` identifies its field. `fieldKey` is undefined for a map\n\t\t\t * node's implicit field.\n\t\t\t */\n\t\t\treadonly location:\n\t\t\t\t| \"root\"\n\t\t\t\t| {\n\t\t\t\t\t\treadonly nodeType: string;\n\t\t\t\t\t\treadonly fieldKey: string | undefined;\n\t\t\t\t };\n\t\t\t/**\n\t\t\t * The field kind required by the view schema.\n\t\t\t */\n\t\t\treadonly view: string;\n\t\t\t/**\n\t\t\t * The field kind recorded in the stored schema.\n\t\t\t */\n\t\t\treadonly stored: string;\n\t\t\t/**\n\t\t\t * Whether the view field is a staged optional field.\n\t\t\t *\n\t\t\t * @remarks Omitted when false.\n\t\t\t */\n\t\t\treadonly viewIsStagedOptional?: true;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * Indicates that a leaf node accepts different value types in the view and stored schemas.\n\t\t\t */\n\t\t\treadonly mismatch: \"valueSchema\";\n\t\t\t/**\n\t\t\t * The identifier of the leaf node schema with the discrepancy.\n\t\t\t */\n\t\t\treadonly nodeType: string;\n\t\t\t/**\n\t\t\t * The value schema required by the view, or undefined when it does not constrain values.\n\t\t\t */\n\t\t\treadonly view: string | undefined;\n\t\t\t/**\n\t\t\t * The value schema recorded in the stored schema, or undefined when it does not constrain values.\n\t\t\t */\n\t\t\treadonly stored: string | undefined;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * Indicates that a node is represented by different node kinds in the view and stored schemas.\n\t\t\t */\n\t\t\treadonly mismatch: \"nodeKind\";\n\t\t\t/**\n\t\t\t * The identifier of the node schema with the discrepancy.\n\t\t\t */\n\t\t\treadonly nodeType: string;\n\t\t\t/**\n\t\t\t * The node kind required by the view schema.\n\t\t\t */\n\t\t\treadonly view: string;\n\t\t\t/**\n\t\t\t * The node kind recorded in the stored schema.\n\t\t\t */\n\t\t\treadonly stored: string;\n\t };\n\n/**\n * {@link SchemaCompatibilityStatus} with additional beta APIs.\n *\n * @sealed @beta\n */\nexport interface SchemaCompatibilityStatusBeta extends SchemaCompatibilityStatus {\n\t/**\n\t * Details about the schema discrepancies that prevent this view from accessing the tree.\n\t *\n\t * @remarks\n\t * This property is undefined when {@link SchemaCompatibilityStatus.canView} is true and present\n\t * when `canView` is false.\n\t * It can include application-defined schema identifiers and field keys.\n\t *\n\t * @example Interpreting an allowed-types discrepancy\n\t *\n\t * If a document's stored schema allows `string` for `Todo.title`, but the view schema expects\n\t * `number`, the discrepancy identifies the field and the type permitted by each schema:\n\t *\n\t * ```typescript\n\t * const sf = new SchemaFactory(\"com.example\");\n\t * class Todo extends sf.object(\"Todo\", {\n\t * \ttitle: sf.number,\n\t * }) {}\n\t *\n\t * const view = asBeta(tree.viewWith(new TreeViewConfiguration({ schema: Todo })));\n\t * if (!view.compatibility.canView) {\n\t * \t// [{\n\t * \t// mismatch: \"allowedTypes\",\n\t * \t// location: { nodeType: \"com.example.Todo\", fieldKey: \"title\" },\n\t * \t// view: [\"com.fluidframework.leaf.number\"],\n\t * \t// stored: [\"com.fluidframework.leaf.string\"],\n\t * \t// }]\n\t * \tconsole.error(view.compatibility.discrepancies);\n\t * }\n\t * ```\n\t */\n\treadonly discrepancies: readonly SchemaDiscrepancy[] | undefined;\n}\n\n/**\n * {@link TreeView} with additional beta APIs.\n * @sealed @beta\n */\nexport interface TreeViewBeta<in out TSchema extends ImplicitFieldSchema>\n\textends TreeView<TSchema>,\n\t\tUntypedTreeView {\n\t/**\n\t * {@inheritDoc TreeView.compatibility}\n\t */\n\treadonly compatibility: SchemaCompatibilityStatusBeta;\n\n\t// Override the base branch method to return a typed view rather than merely a branch.\n\tfork(): ReturnType<UntypedTreeView[\"fork\"]> & TreeViewBeta<TSchema>;\n\n\t/**\n\t * Run a synchronous transaction which groups sequential edits to the tree into a single atomic edit if possible.\n\t *\n\t * @param transaction - The function to run as the body of the transaction, which may optionally return a {@link TransactionCallbackStatusBeta | value or rollback signal}.\n\t * It may optionally return a {@link WithValue | value }, which will be returned by the `runTransaction` call.\n\t *\n\t * @param params - Optional {@link RunTransactionParamsBeta | parameters} for the transaction.\n\t *\n\t * @returns A {@link TransactionValueResult | value } indicating whether or not the transaction succeeded, and containing the value returned by `transaction`.\n\t *\n\t * @remarks\n\t * All of the changes in the transaction are applied synchronously and therefore no other changes from a remote client can be interleaved with those changes.\n\t * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.\n\t *\n\t * {@link (TreeBeta:interface).on | Change events } will be emitted for changed nodes on this client _as each edit happens_, just as they would be if the changes were made outside of a transaction.\n\t * Any other/future clients or contexts will process the transaction \"squashed\", i.e. they will apply its changes all at once, emitting only a single event per node (even if that node was edited multiple times in the transaction).\n\t * Edits to the tree are not permitted within these event callbacks, therefore no other local changes from this client will be interleaved with the changes in this transaction.\n\t *\n\t * Using a transaction has the following additional consequences:\n\t *\n\t * - If {@link Revertible | reverted } (e.g. via an \"undo\" operation), all the changes in the transaction are reverted together.\n\t * Only the \"outermost\" transaction commits a change to the synchronized tree state and therefore only the outermost transaction can be reverted.\n\t * If a transaction is started and completed while another transaction is already in progress, then the inner transaction will be reverted together with the outer transaction.\n\t * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.\n\t *\n\t * If the transaction is rolled back, a corresponding {@link TreeBranchEvents.changed | `changed`} event will also be emitted for the rollback.\n\t */\n\trunTransaction<\n\t\tTOut extends\n\t\t\t| TransactionCallbackStatusBeta<unknown, unknown>\n\t\t\t| VoidTransactionCallbackStatusBeta\n\t\t\t| void,\n\t>(\n\t\ttransaction: () => TOut,\n\t\tparams?: RunTransactionParamsBeta,\n\t): TOut extends TransactionCallbackStatusBeta<infer TSuccessValue, infer TFailureValue>\n\t\t? TransactionValueResult<TSuccessValue, TFailureValue>\n\t\t: TransactionVoidResult;\n\n\t/**\n\t * An asynchronous version of {@link TreeViewBeta.runTransaction | runTransaction}.\n\t *\n\t * @remarks\n\t * As with synchronous transactions, all of the changes in an asynchronous transaction are treated as a unit.\n\t * Therefore, no other changes (either from this client or from a remote client) can be interleaved with the transaction changes.\n\t *\n\t * Unlike with synchronous transactions, it is possible that other changes (e.g. from a remote client) may be applied to the branch while this transaction is in progress.\n\t * Those other changes will be not be reflected on the branch until after this transaction completes, at which point the transaction changes will be applied after those other changes.\n\t *\n\t * An asynchronous transaction may not be started while any other transaction is in progress in this view.\n\t */\n\trunTransactionAsync<\n\t\tTOut extends\n\t\t\t| TransactionCallbackStatusBeta<unknown, unknown>\n\t\t\t| VoidTransactionCallbackStatusBeta\n\t\t\t| void,\n\t>(\n\t\ttransaction: () => Promise<TOut>,\n\t\tparams?: RunTransactionParamsBeta,\n\t): Promise<\n\t\tTOut extends TransactionCallbackStatusBeta<infer TSuccessValue, infer TFailureValue>\n\t\t\t? TransactionValueResult<TSuccessValue, TFailureValue>\n\t\t\t: TransactionVoidResult\n\t>;\n}\n\n/**\n * {@link TreeView} with proposed changes to the schema aware typing to allow use with `UnsafeUnknownSchema`.\n * @sealed @alpha\n */\nexport interface TreeViewAlpha<\n\tin out TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n> extends Omit<\n\t\t\tTreeViewBeta<ReadSchema<TSchema>>,\n\t\t\t\"root\" | \"initialize\" | \"fork\" | \"runTransaction\" | \"runTransactionAsync\"\n\t\t>,\n\t\tUntypedTreeViewAlpha {\n\tget root(): ReadableField<TSchema>;\n\n\tset root(newRoot: InsertableField<TSchema>);\n\n\t/**\n\t * Initialize the tree, setting the stored schema to match this view's schema and setting the tree content.\n\t *\n\t * @remarks\n\t * Only valid to call when this view's {@link SchemaCompatibilityStatus.canInitialize} is true.\n\t *\n\t * Enables staged schema upgrades declared by {@link ITreeViewConfigurationAlpha.stagedUpgradePolicy} when generating the initial stored schema.\n\t *\n\t * Applications should typically call this function before attaching a `SharedTree`.\n\t * @param content - The content to initialize the tree with.\n\t */\n\tinitialize(content: InsertableField<TSchema>): void;\n\n\t/**\n\t * Checks whether a staged schema upgrade has been applied to the document's stored schema.\n\t *\n\t * @param upgrade - The upgrade token to check.\n\t *\n\t * @returns The {@link StagedUpgradeStatus} of the upgrade.\n\t *\n\t * @remarks\n\t * Use this to determine whether a document has already been upgraded, for example when deciding\n\t * whether to include an upgrade token in the view configuration after a feature flag rollback.\n\t *\n\t * Results are derived from this view's schema and the current stored schema.\n\t * The full schema is checked even when the view is incompatible with the stored schema, so the\n\t * result includes all locations declared by the view schema.\n\t */\n\tisStagedUpgradeEnabled(upgrade: SchemaUpgrade): StagedUpgradeStatus;\n\n\treadonly events: Listenable<TreeViewEvents & TreeBranchEvents>;\n\n\t// Override the base fork method to return a TreeViewAlpha.\n\tfork(): ReturnType<UntypedTreeView[\"fork\"]> & TreeViewAlpha<TSchema>;\n}\n\n/**\n * Information about a view schema's compatibility with the document's stored schema.\n *\n * @see\n * See SharedTree's README for more information about choosing a compatibility policy.\n *\n * @privateRemarks\n * See {@link checkSchemaCompatibility} for the implementation of this compatibility checking.\n *\n * @sealed @public\n */\nexport interface SchemaCompatibilityStatus {\n\t/**\n\t * Whether the view schema allows exactly the same set of documents as the stored schema.\n\t *\n\t * @remarks\n\t * Equivalence here is defined in terms of allowed documents because there are some degenerate cases where schemas are not\n\t * exact matches in a strict (schema-based) sense but still allow the same documents, and the document notion is more useful to applications.\n\t *\n\t * Examples which are expressible where this may occur include:\n\t *\n\t * - schema repository `A` has extra schema which schema `B` doesn't have, but they are unused (i.e. not reachable from the root schema)\n\t *\n\t * - field in schema `A` has allowed field members which the corresponding field in schema `B` does not have, but those types are not constructible (for example: an object node type containing a required field with no allowed types)\n\t *\n\t * These cases are typically not interesting to applications.\n\t *\n\t * Note that other content in the stored schema that does not impact document compatibility, like {@link NodeSchemaOptionsAlpha.persistedMetadata}, does not affect this field.\n\t *\n\t * For the computation of this equivalence, {@link SchemaStaticsBeta.staged | staged} schemas are not included.\n\t * If there are any unknown optional fields, even if allowed by {@link ObjectSchemaOptions.allowUnknownOptionalFields}, `isEquivalent` will be false.\n\t */\n\treadonly isEquivalent: boolean;\n\n\t/**\n\t * Whether the current view schema is sufficiently compatible with the stored schema to allow viewing tree data.\n\t * If false, {@link TreeView.root} will throw upon access.\n\t * @remarks\n\t * If the view schema does not opt into supporting any additional cases, then `canView` is only true when `isEquivalent` is also true.\n\t * The view schema can however opt into supporting additional cases, and thus can also view documents with stored schema which would be equivalent, except for the following discrepancies:\n\t *\n\t * - An object node with {@link ObjectSchemaOptions.allowUnknownOptionalFields} to set to true that has additional optional fields in the stored schema beyond those mentioned in its view schema.\n\t *\n\t * - An additional type allowed at a location in the stored schema where it is {@link SchemaStaticsBeta.staged | staged} in the view schema.\n\t *\n\t * In these cases `canUpgrade` and `isEquivalent` will be false.\n\t *\n\t * When the set of documents allowed by the view schema is a strict superset of those allowed by the stored schema,\n\t * `canView` is false because writes to the document using the view schema could make the document violate its stored schema.\n\t * In this case, the stored schema could be updated to match the provided view schema, allowing read-write access to the tree.\n\t * See {@link SchemaCompatibilityStatus.canUpgrade}.\n\t *\n\t * Future versions of SharedTree may provide readonly access to the document in this case because that would be safe,\n\t * but this is not currently supported.\n\t *\n\t * @privateRemarks\n\t * A necessary condition for this to be true is that the documents allowed by the view schema are a subset of those allowed by the stored schema.\n\t * This is not sufficient: the simple-tree layer's read APIs only tolerate very specific cases beyond their schema (unknown optional fields).\n\t * For example, if the view schema for a node has a required `Point` field but the stored schema has an optional `Point` field,\n\t * read APIs on the view schema do not work correctly when the document has a node with a missing `Point` field.\n\t * Similar issues happen when the view schema has a field with less allowed types than the stored schema and the document actually leverages those types.\n\t */\n\treadonly canView: boolean;\n\n\t/**\n\t * True when {@link TreeView.upgradeSchema} can add support for all content required to be supported by the view schema.\n\t * @remarks\n\t * When true, it is valid to call {@link TreeView.upgradeSchema} (though if the stored schema is already an exact match, this is a no-op).\n\t *\n\t * When adding optional fields to schema which previously were marked with {@link ObjectSchemaOptions.allowUnknownOptionalFields}\n\t * the schema upgrade (assuming no other changes are included) will allow the previous version to view.\n\t * Even this case must still must be done with caution however as only clients with the newly added field will be able to do future upgrades.\n\t * Thus if a version of an application is shipped that adds an unknown optional field, all future versions should include it, even if its no longer used,\n\t * to ensure that documents containing it can still be upgraded.\n\t */\n\treadonly canUpgrade: boolean;\n\n\t/**\n\t * True iff the document is uninitialized (i.e. it has no schema and no content).\n\t *\n\t * To initialize the document, call {@link TreeView.initialize}.\n\t *\n\t * @remarks\n\t * It's not necessary to check this field before calling {@link TreeView.initialize} in most scenarios; application authors typically know from\n\t * branch that they're in a flow which creates a new `SharedTree` and would like to initialize it.\n\t */\n\treadonly canInitialize: boolean;\n\n\t// TODO: Consider extending this status to include:\n\t// - application-defined metadata about the stored schema\n\t// - details about the differences between the stored and view schema sufficient for implementing \"safe mismatch\" policies\n}\n\n/**\n * Events for {@link UntypedTreeView}.\n * @sealed @alpha\n */\nexport interface TreeBranchEvents {\n\t/**\n\t * Fired when a change is made to the branch. Includes data about the change that is made which listeners\n\t * can use to filter on changes they care about (e.g. local vs. remote changes).\n\t *\n\t * @param data - information about the change\n\t * @param getRevertible - a function that allows users to get a revertible for the change. If not provided,\n\t * this change is not revertible.\n\t */\n\tchanged(data: ChangeMetadata, getRevertible?: RevertibleAlphaFactory): void;\n}\n\n/**\n * Events for {@link TreeView}.\n * @remarks\n * See {@link TreeBranchEvents} for more events related to the underlying branch of the SharedTree.\n * @sealed @public\n */\nexport interface TreeViewEvents {\n\t/**\n\t * Raised whenever {@link TreeView.root} is invalidated.\n\t *\n\t * This includes changes to the document schema.\n\t * It also includes changes to the field containing the root such as setting or clearing an optional root or changing which node is the root.\n\t * This does NOT include changes to the content (fields/children) of the root node: for that case subscribe to events on the root node.\n\t */\n\trootChanged(): void;\n\n\t/**\n\t * The stored schema for the document has changed.\n\t * This may affect the compatibility between the view schema and the stored schema, and thus the ability to use the view.\n\t *\n\t * @remarks\n\t * This event implies that the old {@link TreeView.root} is no longer valid, but applications need not handle that separately:\n\t * {@link TreeViewEvents.rootChanged} will be fired after this event.\n\t */\n\tschemaChanged(): void;\n\n\t/**\n\t * Fired when:\n\t *\n\t * - a local commit is applied outside of a transaction\n\t *\n\t * - a local transaction is committed\n\t *\n\t * The event is not fired when:\n\t *\n\t * - a local commit is applied within a transaction\n\t *\n\t * - a remote commit is applied\n\t *\n\t * @param data - information about the commit that was applied\n\t * @param getRevertible - a function provided that allows users to get a revertible for the commit that was applied. If not provided,\n\t * this commit is not revertible.\n\t */\n\tcommitApplied(data: CommitMetadata, getRevertible?: RevertibleFactory): void;\n}\n\n/**\n * Retrieve the {@link TreeViewAlpha | alpha API} for a {@link TreeView}.\n * @alpha\n * @deprecated Use {@link (asAlpha:1)} instead.\n * @privateRemarks Despite being deprecated, this function should be used within the tree package (outside of tests) rather than `asAlpha` in order to avoid circular import dependencies.\n */\nexport function asTreeViewAlpha<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): TreeViewAlpha<TSchema> {\n\treturn view as TreeViewAlpha<TSchema>;\n}\n"]}
@@ -9,6 +9,13 @@ import type { SchemaUpgrade } from "./allowedTypes.js";
9
9
  * @alpha
10
10
  */
11
11
  export interface StagedSchemaUpgradePolicy {
12
+ /**
13
+ * Whether schema upgrades should include staged upgrades that are already enabled in the
14
+ * document's stored schema.
15
+ *
16
+ * @defaultValue `true`
17
+ */
18
+ readonly includeAlreadyEnabledUpgrades?: boolean;
12
19
  /**
13
20
  * Determines whether to include staged allowed types in the resulting stored schema.
14
21
  * @remarks
@@ -1 +1 @@
1
- {"version":3,"file":"toStored.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/toStored.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACzC;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;IAE/C;;;;;OAKG;IACH,qBAAqB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;CACvD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,WAAW,gCAAgC;IAChD;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,EAAE,yBAAyB,CAAC;IAChD;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,yBAAyB,CAAC;IAC/C;;;;;;;;;OASG;IACH,qBAAqB,CAAC,GAAG,QAAQ,EAAE,aAAa,EAAE,GAAG,yBAAyB,CAAC;CAC/E;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,gCAqBvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,eAAyB,CAAC;AACnD,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,SAAS,eAAsB,CAAC;AAC7C,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,GAAG,YAAY,CAAC;AAErF;;;;;;GAMG;AACH,MAAM,MAAM,iCAAiC,GAC1C,yBAAyB,GACzB,YAAY,GACZ,SAAS,CAAC"}
1
+ {"version":3,"file":"toStored.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/toStored.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACzC;;;;;OAKG;IACH,QAAQ,CAAC,6BAA6B,CAAC,EAAE,OAAO,CAAC;IAEjD;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;IAE/C;;;;;OAKG;IACH,qBAAqB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;CACvD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,WAAW,gCAAgC;IAChD;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,EAAE,yBAAyB,CAAC;IAChD;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,yBAAyB,CAAC;IAC/C;;;;;;;;;OASG;IACH,qBAAqB,CAAC,GAAG,QAAQ,EAAE,aAAa,EAAE,GAAG,yBAAyB,CAAC;CAC/E;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,gCAqBvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,eAAyB,CAAC;AACnD,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,SAAS,eAAsB,CAAC;AAC7C,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,GAAG,YAAY,CAAC;AAErF;;;;;;GAMG;AACH,MAAM,MAAM,iCAAiC,GAC1C,yBAAyB,GACzB,YAAY,GACZ,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"toStored.js","sourceRoot":"","sources":["../../../src/simple-tree/core/toStored.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsFH;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAqC;IAC1E,WAAW,EAAE;QACZ,aAAa,EAAE,GAAG,EAAE,CAAC,KAAK;QAC1B,qBAAqB,EAAE,GAAG,EAAE,CAAC,KAAK;KAClC;IAED,UAAU,EAAE;QACX,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI;QACzB,qBAAqB,EAAE,GAAG,EAAE,CAAC,IAAI;KACjC;IAED,qBAAqB,CAAC,GAAG,QAAyB;QACjD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO,yBAAyB,CAAC,WAAW,CAAC;QAC9C,CAAC;QACD,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC5C,OAAO;YACN,aAAa,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC;YAC1D,qBAAqB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC;SAClE,CAAC;IACH,CAAC;CACD,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAGnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SchemaUpgrade } from \"./allowedTypes.js\";\n\n/**\n * Policy controlling which staged schema upgrades are included when generating stored schema from a view schema.\n * @input\n * @alpha\n */\nexport interface StagedSchemaUpgradePolicy {\n\t/**\n\t * Determines whether to include staged allowed types in the resulting stored schema.\n\t * @remarks\n\t * Due to caching, the behavior of this function must be pure.\n\t */\n\tincludeStaged(upgrade: SchemaUpgrade): boolean;\n\n\t/**\n\t * Determines whether to treat a staged optional field as optional\n\t * (rather than required) in the resulting stored schema.\n\t * @remarks\n\t * Due to caching, the behavior of this function must be pure.\n\t */\n\tincludeStagedOptional(upgrade: SchemaUpgrade): boolean;\n}\n\n/**\n * Provides factory methods for creating {@link (StagedSchemaUpgradePolicy:interface)} instances.\n *\n * @remarks\n * Use the properties and methods on this object to obtain staged-schema generation options\n * for different scenarios:\n *\n * - {@link StagedSchemaUpgradePolicyFactory.restrictive} — no staged upgrades (default)\n *\n * - {@link StagedSchemaUpgradePolicyFactory.permissive} — all staged upgrades enabled\n *\n * - {@link StagedSchemaUpgradePolicyFactory.enabledStagedUpgrades} — only specific upgrades enabled\n *\n * @example\n * ```typescript\n * // Enable specific upgrades:\n * const options = StagedSchemaUpgradePolicy.enabledStagedUpgrades(myUpgrade);\n *\n * // Use restrictive (default, no staged upgrades):\n * const options = StagedSchemaUpgradePolicy.restrictive;\n *\n * // Use permissive (all staged upgrades, useful for testing):\n * const options = StagedSchemaUpgradePolicy.permissive;\n * ```\n *\n * @sealed\n * @alpha\n */\nexport interface StagedSchemaUpgradePolicyFactory {\n\t/**\n\t * Restrictive policy — excludes all staged schema members.\n\t *\n\t * @remarks\n\t * Use this when you want the most conservative stored schema for compatibility-sensitive\n\t * scenarios, or when staged schema upgrades should remain disabled.\n\t *\n\t * This is the default behavior when no staged upgrades are enabled.\n\t */\n\treadonly restrictive: StagedSchemaUpgradePolicy;\n\t/**\n\t * Permissive policy — includes all staged schema upgrades.\n\t *\n\t * @remarks\n\t * Use this for testing, validation, and rollout rehearsal scenarios where you want to exercise\n\t * future document shapes before enabling staged upgrades broadly.\n\t */\n\treadonly permissive: StagedSchemaUpgradePolicy;\n\t/**\n\t * Creates options that include only the specified staged schema upgrades.\n\t *\n\t * @param upgrades - The staged schema upgrades to enable.\n\t * @returns Options that include only the specified upgrades.\n\t *\n\t * @remarks\n\t * If an empty set of upgrades is passed, the result is equivalent to\n\t * `StagedSchemaUpgradePolicy.restrictive`.\n\t */\n\tenabledStagedUpgrades(...upgrades: SchemaUpgrade[]): StagedSchemaUpgradePolicy;\n}\n\n/**\n * {@inheritDoc (StagedSchemaUpgradePolicyFactory:interface)}\n * @alpha\n */\nexport const StagedSchemaUpgradePolicy: StagedSchemaUpgradePolicyFactory = {\n\trestrictive: {\n\t\tincludeStaged: () => false,\n\t\tincludeStagedOptional: () => false,\n\t},\n\n\tpermissive: {\n\t\tincludeStaged: () => true,\n\t\tincludeStagedOptional: () => true,\n\t},\n\n\tenabledStagedUpgrades(...upgrades: SchemaUpgrade[]): StagedSchemaUpgradePolicy {\n\t\tif (upgrades.length === 0) {\n\t\t\treturn StagedSchemaUpgradePolicy.restrictive;\n\t\t}\n\t\tconst enabledUpgradeSet = new Set(upgrades);\n\t\treturn {\n\t\t\tincludeStaged: (upgrade) => enabledUpgradeSet.has(upgrade),\n\t\t\tincludeStagedOptional: (upgrade) => enabledUpgradeSet.has(upgrade),\n\t\t};\n\t},\n};\n\n/**\n * Marker type indicating that the input schema is already a stored schema.\n */\nexport const ExpectStored = Symbol(\"ExpectStored\");\nexport type ExpectStored = typeof ExpectStored;\n\n/**\n * Marker type indicating that the input schema should not be transformed: data accessible from the simple schema API surface should be copied as is.\n * @remarks\n * The only real use-cases for this are deep-copying simple schema, and copying objects that implement more than just simple schema (such as {@link TreeSchema}) into simple object without extra prototypes and properties.\n */\nexport const Unchanged = Symbol(\"Unchanged\");\nexport type Unchanged = typeof Unchanged;\n\n/**\n * Subset of {@link SimpleSchemaTransformationOptions} for when the output is a known to be a stored schema.\n */\nexport type StoredSchemaGenerationOptions = StagedSchemaUpgradePolicy | ExpectStored;\n\n/**\n * Options for transforming a schema.\n * @remarks\n * See also {@link generateSchemaFromSimpleSchema} for a different schema transformation.\n * Note that if we want to make `generateSchemaFromSimpleSchema` consume view simple-schema, and use these transformation APIs to generate that view simple-schema from a stored simple-schema,\n * we will need to add a \"ToView\" option here.\n */\nexport type SimpleSchemaTransformationOptions =\n\t| StagedSchemaUpgradePolicy\n\t| ExpectStored\n\t| Unchanged;\n"]}
1
+ {"version":3,"file":"toStored.js","sourceRoot":"","sources":["../../../src/simple-tree/core/toStored.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8FH;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAqC;IAC1E,WAAW,EAAE;QACZ,aAAa,EAAE,GAAG,EAAE,CAAC,KAAK;QAC1B,qBAAqB,EAAE,GAAG,EAAE,CAAC,KAAK;KAClC;IAED,UAAU,EAAE;QACX,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI;QACzB,qBAAqB,EAAE,GAAG,EAAE,CAAC,IAAI;KACjC;IAED,qBAAqB,CAAC,GAAG,QAAyB;QACjD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO,yBAAyB,CAAC,WAAW,CAAC;QAC9C,CAAC;QACD,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC5C,OAAO;YACN,aAAa,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC;YAC1D,qBAAqB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC;SAClE,CAAC;IACH,CAAC;CACD,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAGnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SchemaUpgrade } from \"./allowedTypes.js\";\n\n/**\n * Policy controlling which staged schema upgrades are included when generating stored schema from a view schema.\n * @input\n * @alpha\n */\nexport interface StagedSchemaUpgradePolicy {\n\t/**\n\t * Whether schema upgrades should include staged upgrades that are already enabled in the\n\t * document's stored schema.\n\t *\n\t * @defaultValue `true`\n\t */\n\treadonly includeAlreadyEnabledUpgrades?: boolean;\n\n\t/**\n\t * Determines whether to include staged allowed types in the resulting stored schema.\n\t * @remarks\n\t * Due to caching, the behavior of this function must be pure.\n\t */\n\tincludeStaged(upgrade: SchemaUpgrade): boolean;\n\n\t/**\n\t * Determines whether to treat a staged optional field as optional\n\t * (rather than required) in the resulting stored schema.\n\t * @remarks\n\t * Due to caching, the behavior of this function must be pure.\n\t */\n\tincludeStagedOptional(upgrade: SchemaUpgrade): boolean;\n}\n\n/**\n * Provides factory methods for creating {@link (StagedSchemaUpgradePolicy:interface)} instances.\n *\n * @remarks\n * Use the properties and methods on this object to obtain staged-schema generation options\n * for different scenarios:\n *\n * - {@link StagedSchemaUpgradePolicyFactory.restrictive} — no staged upgrades (default)\n *\n * - {@link StagedSchemaUpgradePolicyFactory.permissive} — all staged upgrades enabled\n *\n * - {@link StagedSchemaUpgradePolicyFactory.enabledStagedUpgrades} — only specific upgrades enabled\n *\n * @example\n * ```typescript\n * // Enable specific upgrades:\n * const options = StagedSchemaUpgradePolicy.enabledStagedUpgrades(myUpgrade);\n *\n * // Use restrictive (default, no staged upgrades):\n * const options = StagedSchemaUpgradePolicy.restrictive;\n *\n * // Use permissive (all staged upgrades, useful for testing):\n * const options = StagedSchemaUpgradePolicy.permissive;\n * ```\n *\n * @sealed\n * @alpha\n */\nexport interface StagedSchemaUpgradePolicyFactory {\n\t/**\n\t * Restrictive policy — excludes all staged schema members.\n\t *\n\t * @remarks\n\t * Use this when you want the most conservative stored schema for compatibility-sensitive\n\t * scenarios, or when staged schema upgrades should remain disabled.\n\t *\n\t * This is the default behavior when no staged upgrades are enabled.\n\t */\n\treadonly restrictive: StagedSchemaUpgradePolicy;\n\t/**\n\t * Permissive policy — includes all staged schema upgrades.\n\t *\n\t * @remarks\n\t * Use this for testing, validation, and rollout rehearsal scenarios where you want to exercise\n\t * future document shapes before enabling staged upgrades broadly.\n\t */\n\treadonly permissive: StagedSchemaUpgradePolicy;\n\t/**\n\t * Creates options that include only the specified staged schema upgrades.\n\t *\n\t * @param upgrades - The staged schema upgrades to enable.\n\t * @returns Options that include only the specified upgrades.\n\t *\n\t * @remarks\n\t * If an empty set of upgrades is passed, the result is equivalent to\n\t * `StagedSchemaUpgradePolicy.restrictive`.\n\t */\n\tenabledStagedUpgrades(...upgrades: SchemaUpgrade[]): StagedSchemaUpgradePolicy;\n}\n\n/**\n * {@inheritDoc (StagedSchemaUpgradePolicyFactory:interface)}\n * @alpha\n */\nexport const StagedSchemaUpgradePolicy: StagedSchemaUpgradePolicyFactory = {\n\trestrictive: {\n\t\tincludeStaged: () => false,\n\t\tincludeStagedOptional: () => false,\n\t},\n\n\tpermissive: {\n\t\tincludeStaged: () => true,\n\t\tincludeStagedOptional: () => true,\n\t},\n\n\tenabledStagedUpgrades(...upgrades: SchemaUpgrade[]): StagedSchemaUpgradePolicy {\n\t\tif (upgrades.length === 0) {\n\t\t\treturn StagedSchemaUpgradePolicy.restrictive;\n\t\t}\n\t\tconst enabledUpgradeSet = new Set(upgrades);\n\t\treturn {\n\t\t\tincludeStaged: (upgrade) => enabledUpgradeSet.has(upgrade),\n\t\t\tincludeStagedOptional: (upgrade) => enabledUpgradeSet.has(upgrade),\n\t\t};\n\t},\n};\n\n/**\n * Marker type indicating that the input schema is already a stored schema.\n */\nexport const ExpectStored = Symbol(\"ExpectStored\");\nexport type ExpectStored = typeof ExpectStored;\n\n/**\n * Marker type indicating that the input schema should not be transformed: data accessible from the simple schema API surface should be copied as is.\n * @remarks\n * The only real use-cases for this are deep-copying simple schema, and copying objects that implement more than just simple schema (such as {@link TreeSchema}) into simple object without extra prototypes and properties.\n */\nexport const Unchanged = Symbol(\"Unchanged\");\nexport type Unchanged = typeof Unchanged;\n\n/**\n * Subset of {@link SimpleSchemaTransformationOptions} for when the output is a known to be a stored schema.\n */\nexport type StoredSchemaGenerationOptions = StagedSchemaUpgradePolicy | ExpectStored;\n\n/**\n * Options for transforming a schema.\n * @remarks\n * See also {@link generateSchemaFromSimpleSchema} for a different schema transformation.\n * Note that if we want to make `generateSchemaFromSimpleSchema` consume view simple-schema, and use these transformation APIs to generate that view simple-schema from a stored simple-schema,\n * we will need to add a \"ToView\" option here.\n */\nexport type SimpleSchemaTransformationOptions =\n\t| StagedSchemaUpgradePolicy\n\t| ExpectStored\n\t| Unchanged;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"treeNodeValid.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeValid.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,kCAAkC,CAAC;AAErF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAkC,QAAQ,EAAE,MAAM,eAAe,CAAC;AAOzE,OAAO,EACN,QAAQ,EACR,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAGjE;;;;;;;GAOG;AACH,8BAAsB,aAAa,CAAC,MAAM,CAAE,SAAQ,QAAQ;IAC3D;;;;;;;OAOG;IACH,SAAS,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EACjC,IAAI,EAAE,OAAO,aAAa,CAAC,CAAC,CAAC,EAC7B,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,KAAK,EAAE,YAAY,GACjB,aAAa,CAAC,CAAC,CAAC;IAInB;;OAEG;IACH,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAC9B,IAAI,EAAE,OAAO,aAA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AAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GACpC,MAAM,IAAI,OAAO,aAAa,GAAG,cAAc,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC9C,MAAM,EAAE,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,EACrD,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,GAC5C,yBAAyB,CAU3B"}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { assert, fail } from "@fluidframework/core-utils/internal";
6
- import { UsageError } from "@fluidframework/telemetry-utils/internal";
6
+ import { tagSchemaArtifacts, UsageError } from "@fluidframework/telemetry-utils/internal";
7
7
  import { isFlexTreeNode } from "../../feature-libraries/index.js";
8
8
  import { inPrototypeChain, privateToken, TreeNode } from "./treeNode.js";
9
9
  import { getSimpleNodeSchemaFromInnerNode, isTreeNode, TreeNodeKernel, } from "./treeNodeKernel.js";
@@ -73,7 +73,7 @@ export class TreeNodeValid extends TreeNode {
73
73
  // If users trying to diagnose the cause of this error becomes a common issue, more information could be captured.
74
74
  // The call stack to when a schema is first marked most derived could be captured in debug builds and stored in the `MostDerivedData` object:
75
75
  // This could then be included in the error to aid in debugging this error.
76
- throw new UsageError(`Two schema classes were used (${this.name} and ${this.constructorCached.constructor.name}) which derived from the same SchemaFactory generated class (${JSON.stringify(this.identifier)}). This is invalid.`);
76
+ throw new UsageError(`Two schema classes were used (${this.name} and ${this.constructorCached.constructor.name}) which derived from the same SchemaFactory generated class (${JSON.stringify(this.identifier)}). This is invalid.`, tagSchemaArtifacts({ schemaIdentifier: this.identifier }));
77
77
  }
78
78
  /**
79
79
  * Node creation function for implementing the TreeNodeSchemaNonClass half of TreeNodeSchemaBoth.
@@ -149,7 +149,7 @@ TreeNodeValid.constructorCached = "default";
149
149
  export function schemaAsTreeNodeValid(schema) {
150
150
  if (!isClassBasedSchema(schema)) {
151
151
  // Use JSON.stringify to quote and escape identifier string.
152
- throw new UsageError(`Schema for ${JSON.stringify(schema.identifier)} does not extend a SchemaFactory generated class. This is invalid.`);
152
+ throw new UsageError(`Schema for ${JSON.stringify(schema.identifier)} does not extend a SchemaFactory generated class. This is invalid.`, tagSchemaArtifacts({ schemaIdentifier: schema.identifier }));
153
153
  }
154
154
  return schema;
155
155
  }
@@ -1 +1 @@
1
- {"version":3,"file":"treeNodeValid.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeValid.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAqB,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAIrF,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACN,gCAAgC,EAChC,UAAU,EACV,cAAc,GAEd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,QAAQ,GAKR,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,OAAgB,aAAsB,SAAQ,QAAQ;IAC3D;;;;;;;OAOG;IACO,MAAM,CAAC,eAAe,CAE/B,QAA0B,EAC1B,KAAmB;QAEnB,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED;;OAEG;IACO,MAAM,CAAC,YAAY,CAE5B,QAA0B,EAC1B,KAAQ;QAER,OAAO,IAAI,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;OAKG;IACO,MAAM,CAAC,YAAY;QAG5B,IAAI,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACxC,CAAC;IAsBD;;OAEG;IACI,MAAM,CAAC,eAAe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I,CAAC;IACb,CAAC;IACD,IAAI,CAAC,MAAM,EAAE,MAAM;QAClB,MAAM,QAAQ,GAA6B,EAAE,CAAC;QAC9C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAkB,CAAC,EAAE,CAAC;YAC/D,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,QAAQ;QACR,+HAA+H;QAC/H,qDAAqD;QACrD,qCAAqC;QACrC,2DAA2D;QAE3D,OAAO,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,CAAC,MAAM,EAAE,MAAM;QACrB,OAAO,YAAY,CAAC,MAAkC,CAAC,KAAK,SAAS,CAAC;IACvE,CAAC;CACD,CAAC;AAEF,SAAS,kBAAkB,CAC1B,MAAe,EACf,MAAuC;IAEvC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC9B,CAAC;SAAM,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type FlexTreeNode, isFlexTreeNode } from \"../../feature-libraries/index.js\";\n\nimport type { AllowedTypesFull } from \"./allowedTypes.js\";\nimport type { SimpleNodeSchemaBase } from \"./simpleNodeSchemaBase.js\";\nimport { inPrototypeChain, privateToken, TreeNode } from \"./treeNode.js\";\nimport {\n\tgetSimpleNodeSchemaFromInnerNode,\n\tisTreeNode,\n\tTreeNodeKernel,\n\ttype InnerNode,\n} from \"./treeNodeKernel.js\";\nimport {\n\tNodeKind,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaCore,\n\ttype TreeNodeSchemaInitializedData,\n\ttype TreeNodeSchemaPrivateData,\n} from \"./treeNodeSchema.js\";\nimport type { InternalTreeNode } from \"./types.js\";\nimport { UnhydratedFlexTreeNode } from \"./unhydratedFlexTree.js\";\nimport { typeSchemaSymbol } from \"./withType.js\";\n\n/**\n * Class which all {@link TreeNode}s must extend.\n * Since this is not exported, it allows robust detection of attempts to create TreeNodes which do not go through SchemaFactory which is the only place which exposes classes that extend this.\n *\n * This has static members which schema classes can override to provide schema specific functionality.\n * These static members are only intended to be used / overridden by code within this package, and are used by the various node kinds.\n * Access to these static members has to be done via `this.constructor.staticMember` to support the overrides, and thus can only be used in the constructor, after the base constructor has been invoked.\n */\nexport abstract class TreeNodeValid<TInput> extends TreeNode {\n\t/**\n\t * Schema classes can override this to control what happens at the end of the constructor.\n\t * The return value from this is returned from the constructor, allowing substituting a proxy if desired.\n\t *\n\t * This is not simply done in the derived constructor to enable:\n\t * - this class to access the value which is being returned before it's returned from the constructor.\n\t * - the derived class to be provided the input `FlexTreeNode` without relying on a field on the node to hold it.\n\t */\n\tprotected static prepareInstance<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: FlexTreeNode,\n\t): TreeNodeValid<T> {\n\t\treturn instance;\n\t}\n\n\t/**\n\t * Schema classes must override to provide an implementation of RawTreeNode construction.\n\t */\n\tprotected static buildRawNode<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: T,\n\t): UnhydratedFlexTreeNode {\n\t\treturn fail(0xae4 /* Schema must override buildRawNode */);\n\t}\n\n\t/**\n\t * Schema classes can override to provide a callback that is called once when the first node is constructed.\n\t * This is a good place to perform extra validation and cache schema derived data needed for the implementation of the node.\n\t * @remarks\n\t * It is valid to dereference LazyItem schema references in this function (or anything that runs after it).\n\t */\n\tprotected static oneTimeSetup<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t): TreeNodeSchemaInitializedData {\n\t\tfail(0xae5 /* Missing oneTimeSetup */);\n\t}\n\n\t/**\n\t * The most derived constructor (the one invoked with the `new` operator, not a parent class constructor invoked with as `super`) used to construct an instance of this type.\n\t * @remarks\n\t * Captured when an instance is constructed.\n\t *\n\t * Used to ensure that some derived class (which must override this member, defaulting it to `undefined`) is only instantiated with a single \"most derived\" class (the constructor actually invoked the the user with `new`).\n\t *\n\t * Typically this is override in the class that statically implements {@link TreeNodeSchema} to enforce that all nodes using that schema use the same class and not different subclasses of it.\n\t *\n\t * Also used to detect if oneTimeSetup has run.\n\t *\n\t * @privateRemarks\n\t * This defaults to \"default\", which is used to trigger an error if not overridden in the derived class.\n\t *\n\t * The value of this on TreeNodeValid must only be overridden by base classes and never modified.\n\t * Ways to enforce this immutability prevent it from being overridden,\n\t * so code modifying constructorCached should be extra careful to avoid accidentally modifying the base/inherited value.\n\t */\n\tprotected static constructorCached: MostDerivedData | \"default\" | undefined = \"default\";\n\n\t/**\n\t * Indicate that `this` is the most derived version of a schema, and thus the only one allowed to be used (other than by being subclassed a single time).\n\t */\n\tpublic static markMostDerived(this: typeof TreeNodeValid & TreeNodeSchema): MostDerivedData {\n\t\tassert(this.constructorCached !== \"default\", 0x95f /* invalid schema class */);\n\n\t\tif (this.constructorCached === undefined) {\n\t\t\t// Set the constructorCached on the layer of the prototype chain that declared it.\n\t\t\t// This is necessary to ensure there is only one subclass of that type used:\n\t\t\t// if constructorCached was simply set on `schema`,\n\t\t\t// then a base classes between `schema` (exclusive) and where `constructorCached` is set (inclusive) and other subclasses of them\n\t\t\t// would not see the stored `constructorCached`, and the validation above against multiple derived classes would not work.\n\n\t\t\t// This is not just an alias of `this`, but a reference to the item in the prototype chain being walked, which happens to start at `this`.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias, unicorn/no-this-assignment\n\t\t\tlet schemaBase: typeof TreeNodeValid = this;\n\t\t\twhile (!Object.prototype.hasOwnProperty.call(schemaBase, \"constructorCached\")) {\n\t\t\t\tschemaBase = Reflect.getPrototypeOf(schemaBase) as typeof TreeNodeValid;\n\t\t\t}\n\t\t\tassert(schemaBase.constructorCached === undefined, 0x962 /* overwriting wrong cache */);\n\t\t\tschemaBase.constructorCached = { constructor: this, oneTimeInitialized: undefined };\n\t\t\tassert(\n\t\t\t\tthis.constructorCached === schemaBase.constructorCached,\n\t\t\t\t0x9b5 /* Inheritance should work */,\n\t\t\t);\n\t\t\treturn this.constructorCached;\n\t\t} else if (this.constructorCached.constructor === this) {\n\t\t\treturn this.constructorCached;\n\t\t}\n\n\t\t// If users trying to diagnose the cause of this error becomes a common issue, more information could be captured.\n\t\t// The call stack to when a schema is first marked most derived could be captured in debug builds and stored in the `MostDerivedData` object:\n\t\t// This could then be included in the error to aid in debugging this error.\n\t\tthrow new UsageError(\n\t\t\t`Two schema classes were used (${this.name} and ${\n\t\t\t\tthis.constructorCached.constructor.name\n\t\t\t}) which derived from the same SchemaFactory generated class (${JSON.stringify(\n\t\t\t\tthis.identifier,\n\t\t\t)}). This is invalid.`,\n\t\t);\n\t}\n\n\t/**\n\t * Node creation function for implementing the TreeNodeSchemaNonClass half of TreeNodeSchemaBoth.\n\t * @remarks\n\t * When used as TreeNodeSchemaNonClass and subclassed,\n\t * does not actually have the correct compile time type for the return value due to TypeScript limitations.\n\t * This is why this is not exposed as part of TreeNodeSchemaClass where subclassing is allowed.\n\t */\n\tpublic static create<TInput, TOut, TThis extends new (args: TInput) => TOut>(\n\t\tthis: TThis,\n\t\tinput: TInput,\n\t): TOut {\n\t\treturn new this(input);\n\t}\n\n\t/**\n\t * See {@link TreeNodeSchemaCore.createFromInsertable}.\n\t */\n\tpublic static createFromInsertable<TInput, TOut, TThis extends new (args: TInput) => TOut>(\n\t\tthis: TThis,\n\t\tinput: TInput,\n\t): TOut {\n\t\treturn new this(input);\n\t}\n\n\t/**\n\t * Idempotent initialization function that pre-caches data and can dereference lazy schema references.\n\t */\n\tpublic static oneTimeInitialize(\n\t\tthis: typeof TreeNodeValid & TreeNodeSchema,\n\t): Required<MostDerivedData> {\n\t\tconst cache = this.markMostDerived();\n\t\tcache.oneTimeInitialized ??= this.oneTimeSetup();\n\t\t// TypeScript fails to narrow the type of `oneTimeInitialized` to `Context` here, so use a cast:\n\t\treturn cache as MostDerivedData & { oneTimeInitialized: TreeNodeSchemaInitializedData };\n\t}\n\n\tpublic constructor(input: TInput | InternalTreeNode) {\n\t\tsuper(privateToken);\n\t\tconst schema = this.constructor as typeof TreeNodeValid & TreeNodeSchema;\n\t\tconst cache = schema.oneTimeInitialize();\n\n\t\tif (isTreeNode(input)) {\n\t\t\t// TODO: update this once TreeBeta.clone is stable.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing nodes may not be used as the constructor parameter for a new node. The existing node may be used directly instead of creating a new one, used as a child of the new node (if it has not yet been inserted into the tree). If the desired result is copying the provided node, it must be deep copied (since any child node would be parented under both the new and old nodes). `TreeBeta.clone` can be used to do this.\",\n\t\t\t);\n\t\t}\n\n\t\tconst node: InnerNode = isFlexTreeNode(input) ? input : schema.buildRawNode(this, input);\n\t\tassert(\n\t\t\tgetSimpleNodeSchemaFromInnerNode(node) === schema,\n\t\t\t0x83b /* building node with wrong schema */,\n\t\t);\n\n\t\tconst result = schema.prepareInstance(this, node);\n\t\t// For unhydrated nodes, grab the context from the `simpleContext` (which likely is from cache.oneTimeInitialized.context,\n\t\t// but might be customized for better schema evolution support like unknown optional fields like in clone)\n\t\t// For hydrated nodes, this context is unused, so using the default from cache.oneTimeInitialized.context is always fine.\n\t\tconst context =\n\t\t\tnode instanceof UnhydratedFlexTreeNode\n\t\t\t\t? node.simpleContext\n\t\t\t\t: cache.oneTimeInitialized.context;\n\t\t// The TreeNodeKernel associates itself the TreeNode (result here, not node) so it can be looked up later via getKernel.\n\t\t// If desired this could be put in a non-enumerable symbol property for lookup instead, but that gets messy going through proxies,\n\t\t// so just relying on the WeakMap seems like the cleanest approach.\n\t\tnew TreeNodeKernel(result, schema, node, context);\n\n\t\treturn result;\n\t}\n}\n\n/**\n * Data cached about the most derived type in a schema's class hierarchy.\n * @remarks\n * The most derived type is the only one allowed to be referenced by other schema or constructed as a node.\n * It has to be discovered lazily (when a node is constructed or when a {@link TreeViewConfiguration} is made),\n * since JavaScript provides no way to find derived classes, or inject static class initialization time logic into base classes.\n * Additionally since schema can reference other schema through lazy references which might be forward or recursive references,\n * this can not be evaluated for one schema when referenced by another schema.\n *\n * See {@link TreeNodeValid.constructorCached} and {@link TreeNodeValid.markMostDerived}.\n */\nexport interface MostDerivedData {\n\treadonly constructor: typeof TreeNodeValid & TreeNodeSchema;\n\toneTimeInitialized?: TreeNodeSchemaInitializedData;\n}\n\n/**\n * Cast `schema` to a {@link TreeNodeValid}, asserting it actually extends it.\n */\nexport function schemaAsTreeNodeValid(\n\tschema: TreeNodeSchemaCore<string, NodeKind, boolean>,\n): typeof TreeNodeValid & TreeNodeSchema {\n\tif (!isClassBasedSchema(schema)) {\n\t\t// Use JSON.stringify to quote and escape identifier string.\n\t\tthrow new UsageError(\n\t\t\t`Schema for ${JSON.stringify(\n\t\t\t\tschema.identifier,\n\t\t\t)} does not extend a SchemaFactory generated class. This is invalid.`,\n\t\t);\n\t}\n\n\treturn schema;\n}\n\n/**\n * Check if a schema is a {@link TreeNodeValid}.\n */\nexport function isClassBasedSchema(\n\tschema: SimpleNodeSchemaBase<NodeKind>,\n): schema is typeof TreeNodeValid & TreeNodeSchema {\n\treturn inPrototypeChain(schema, TreeNodeValid);\n}\n\n/**\n * Provides the {@link TreeNodeSchemaPrivateData} for class based implementations of {@link asTreeNodeSchemaCorePrivate}.\n * @remarks\n * Such schema must extends {@link TreeNodeValid}.\n */\nexport function createTreeNodeSchemaPrivateData(\n\tschema: TreeNodeSchemaCore<string, NodeKind, boolean>,\n\tchildAllowedTypes: readonly AllowedTypesFull[],\n): TreeNodeSchemaPrivateData {\n\tconst schemaValid = schemaAsTreeNodeValid(schema);\n\t// Since this closes over the schema, ensure this schema is marked as most derived\n\t// so if some other subclass is used later, it will error instead of giving inconsistent results.\n\tschemaValid.markMostDerived();\n\n\treturn {\n\t\tidempotentInitialize: () => schemaValid.oneTimeInitialize().oneTimeInitialized,\n\t\tchildAllowedTypes,\n\t};\n}\n\n// #region NodeJS custom inspect for TreeNodes.\n\n/**\n * Used to customize \"inspect\" behavior in NodeJS.\n * See https://nodejs.org/api/util.html#utilinspectcustom for details.\n *\n * VS-Code's debugger also uses this to inspect objects,\n * see https://github.com/microsoft/vscode-js-debug/blob/64df2686c92bac402909dee5c3c389bbb7a81f6d/src/adapter/templates/getStringyProps.ts#L11 for details.\n */\nconst customInspectSymbol = Symbol.for(\"nodejs.util.inspect.custom\");\n\n/**\n * Node inspecting function for use with {@link customInspectSymbol}.\n */\nfunction inspectNodeFunction(\n\tthis: TreeNodeValid<unknown>,\n\tdepth: number,\n\toptions?: unknown,\n\tinspect?: unknown,\n): unknown {\n\tconst schema = this[typeSchemaSymbol];\n\tconst title = `${schema.name}: ${NodeKind[schema.kind]} Node (${schema.identifier})`;\n\n\tif (depth < 2) {\n\t\tconst short = shortContent(this);\n\t\tif (short !== undefined) {\n\t\t\treturn `${title} ${short}`;\n\t\t}\n\t\treturn title;\n\t}\n\tconst content = `${title} ${JSON.stringify(this)}`;\n\treturn content;\n}\n\n/**\n * If the node has no items, a short JSON string for it.\n */\nfunction shortContent(node: TreeNodeValid<unknown>): string | undefined {\n\tif (Object.values(node).length === 0) {\n\t\treturn JSON.stringify(node);\n\t}\n\treturn undefined;\n}\n\n/**\n * Add inherited non-enumerable symbol for NodeJS inspection to all nodes.\n *\n * See {@link customInspectSymbol}.\n */\nObject.defineProperty(TreeNodeValid.prototype, customInspectSymbol, {\n\tvalue: inspectNodeFunction,\n\tenumerable: false,\n});\n\n// #endregion\n\n// #region Browser custom debug format for TreeNodes\n\n// This section has side-effects, so including it in this file ensures its loaded whenever TreeNodes could exist.\n// Supported in at least Chrome and FireFox, more details at https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n// For this to work the browser's dev tools generally have to \"Enable custom formatters\".\n\n// This formatter is inspired by https://github.com/andrewdavey/immutable-devtools/blob/master/src/createFormatters.js which provides a similar formatter for the immutable.js library.\n\nconst globals = typeof window === \"undefined\" ? globalThis : window;\nconst formatters = ((\n\tglobals as { devtoolsFormatters?: DevtoolsFormatter.DevtoolsFormatter[] }\n).devtoolsFormatters ??= []);\n\nconst nodeFormatter: DevtoolsFormatter.DevtoolsFormatter = {\n\theader(object, config) {\n\t\tif (isTreeNode(object)) {\n\t\t\treturn [\"span\", `${inspectNodeFunction.call(object, 1)}`];\n\t\t}\n\t\treturn null;\n\t},\n\tbody(object, config): DevtoolsFormatter.Item {\n\t\tconst children: DevtoolsFormatter.Item[] = [];\n\t\tfor (const [key, value] of Object.entries(object as TreeNode)) {\n\t\t\tchildren.push([\"li\", [\"span\", `${key}: `], formattedReference(value)]);\n\t\t}\n\n\t\t// TODO:\n\t\t// for array nodes, this isn't great since (at least in FireFox) the list items show up with a prefixed number starting from 1.\n\t\t// This looks messy when followed by the array index.\n\t\t// Find a way to hide the list index.\n\t\t// { style: 'list-style-type: none` } did not seem to work.\n\n\t\treturn [\"ol\", ...children];\n\t},\n\thasBody(object, config) {\n\t\treturn shortContent(object as TreeNodeValid<undefined>) === undefined;\n\t},\n};\n\nfunction formattedReference(\n\tobject: unknown,\n\tconfig?: DevtoolsFormatter.ObjectConfig,\n): DevtoolsFormatter.Item {\n\tif (object === undefined) {\n\t\treturn [\"span\", \"undefined\"];\n\t} else if (object === \"null\") {\n\t\treturn [\"span\", \"null\"];\n\t}\n\n\treturn [\"object\", { object, config }];\n}\n\nformatters.push(nodeFormatter);\n\n// #endregion\n\n// These types are based on https://github.com/BenjaminAster/Better-TypeScript/blob/main/types/devtools-formatters.d.ts\n// however the original package causes multiple compile errors due to some of its other types it used, so the relevant part has been extracted and adjusted to better match our conventions.\ndeclare namespace DevtoolsFormatter {\n\ttype ObjectConfig = Record<string | symbol, unknown>;\n\n\ttype ElementTagName = \"div\" | \"span\" | \"ol\" | \"li\" | \"table\" | \"tr\" | \"td\";\n\n\ttype ElementTemplate = StyledElementTemplate | UnstyledElementTemplate;\n\n\ttype StyledElementTemplate = readonly [\n\t\tElementTagName,\n\t\t{\n\t\t\tstyle?: string;\n\t\t},\n\t\t...Item[],\n\t];\n\n\ttype UnstyledElementTemplate = readonly [ElementTagName, ...Item[]];\n\n\ttype ObjectReference = readonly [\n\t\t\"object\",\n\t\t{\n\t\t\tobject: unknown;\n\t\t\tconfig?: ObjectConfig;\n\t\t},\n\t];\n\n\ttype Item = string | ElementTemplate | ObjectReference;\n\n\tinterface DevtoolsFormatter {\n\t\theader(\n\t\t\tobject?: unknown,\n\t\t\tconfig?: ObjectConfig,\n\t\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\t): Item | null;\n\t\thasBody(object?: unknown, config?: ObjectConfig): boolean;\n\t\tbody(object?: unknown, config?: ObjectConfig): Item;\n\t}\n}\n"]}
1
+ {"version":3,"file":"treeNodeValid.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeValid.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE1F,OAAO,EAAqB,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAIrF,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACN,gCAAgC,EA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AI,EAAE,GAAG,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,CAAC,MAAM,EAAE,MAAM;QACrB,OAAO,YAAY,CAAC,MAAkC,CAAC,KAAK,SAAS,CAAC;IACvE,CAAC;CACD,CAAC;AAEF,SAAS,kBAAkB,CAC1B,MAAe,EACf,MAAuC;IAEvC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC9B,CAAC;SAAM,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { tagSchemaArtifacts, UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type FlexTreeNode, isFlexTreeNode } from \"../../feature-libraries/index.js\";\n\nimport type { AllowedTypesFull } from \"./allowedTypes.js\";\nimport type { SimpleNodeSchemaBase } from \"./simpleNodeSchemaBase.js\";\nimport { inPrototypeChain, privateToken, TreeNode } from \"./treeNode.js\";\nimport {\n\tgetSimpleNodeSchemaFromInnerNode,\n\tisTreeNode,\n\tTreeNodeKernel,\n\ttype InnerNode,\n} from \"./treeNodeKernel.js\";\nimport {\n\tNodeKind,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaCore,\n\ttype TreeNodeSchemaInitializedData,\n\ttype TreeNodeSchemaPrivateData,\n} from \"./treeNodeSchema.js\";\nimport type { InternalTreeNode } from \"./types.js\";\nimport { UnhydratedFlexTreeNode } from \"./unhydratedFlexTree.js\";\nimport { typeSchemaSymbol } from \"./withType.js\";\n\n/**\n * Class which all {@link TreeNode}s must extend.\n * Since this is not exported, it allows robust detection of attempts to create TreeNodes which do not go through SchemaFactory which is the only place which exposes classes that extend this.\n *\n * This has static members which schema classes can override to provide schema specific functionality.\n * These static members are only intended to be used / overridden by code within this package, and are used by the various node kinds.\n * Access to these static members has to be done via `this.constructor.staticMember` to support the overrides, and thus can only be used in the constructor, after the base constructor has been invoked.\n */\nexport abstract class TreeNodeValid<TInput> extends TreeNode {\n\t/**\n\t * Schema classes can override this to control what happens at the end of the constructor.\n\t * The return value from this is returned from the constructor, allowing substituting a proxy if desired.\n\t *\n\t * This is not simply done in the derived constructor to enable:\n\t * - this class to access the value which is being returned before it's returned from the constructor.\n\t * - the derived class to be provided the input `FlexTreeNode` without relying on a field on the node to hold it.\n\t */\n\tprotected static prepareInstance<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: FlexTreeNode,\n\t): TreeNodeValid<T> {\n\t\treturn instance;\n\t}\n\n\t/**\n\t * Schema classes must override to provide an implementation of RawTreeNode construction.\n\t */\n\tprotected static buildRawNode<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: T,\n\t): UnhydratedFlexTreeNode {\n\t\treturn fail(0xae4 /* Schema must override buildRawNode */);\n\t}\n\n\t/**\n\t * Schema classes can override to provide a callback that is called once when the first node is constructed.\n\t * This is a good place to perform extra validation and cache schema derived data needed for the implementation of the node.\n\t * @remarks\n\t * It is valid to dereference LazyItem schema references in this function (or anything that runs after it).\n\t */\n\tprotected static oneTimeSetup<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t): TreeNodeSchemaInitializedData {\n\t\tfail(0xae5 /* Missing oneTimeSetup */);\n\t}\n\n\t/**\n\t * The most derived constructor (the one invoked with the `new` operator, not a parent class constructor invoked with as `super`) used to construct an instance of this type.\n\t * @remarks\n\t * Captured when an instance is constructed.\n\t *\n\t * Used to ensure that some derived class (which must override this member, defaulting it to `undefined`) is only instantiated with a single \"most derived\" class (the constructor actually invoked the the user with `new`).\n\t *\n\t * Typically this is override in the class that statically implements {@link TreeNodeSchema} to enforce that all nodes using that schema use the same class and not different subclasses of it.\n\t *\n\t * Also used to detect if oneTimeSetup has run.\n\t *\n\t * @privateRemarks\n\t * This defaults to \"default\", which is used to trigger an error if not overridden in the derived class.\n\t *\n\t * The value of this on TreeNodeValid must only be overridden by base classes and never modified.\n\t * Ways to enforce this immutability prevent it from being overridden,\n\t * so code modifying constructorCached should be extra careful to avoid accidentally modifying the base/inherited value.\n\t */\n\tprotected static constructorCached: MostDerivedData | \"default\" | undefined = \"default\";\n\n\t/**\n\t * Indicate that `this` is the most derived version of a schema, and thus the only one allowed to be used (other than by being subclassed a single time).\n\t */\n\tpublic static markMostDerived(this: typeof TreeNodeValid & TreeNodeSchema): MostDerivedData {\n\t\tassert(this.constructorCached !== \"default\", 0x95f /* invalid schema class */);\n\n\t\tif (this.constructorCached === undefined) {\n\t\t\t// Set the constructorCached on the layer of the prototype chain that declared it.\n\t\t\t// This is necessary to ensure there is only one subclass of that type used:\n\t\t\t// if constructorCached was simply set on `schema`,\n\t\t\t// then a base classes between `schema` (exclusive) and where `constructorCached` is set (inclusive) and other subclasses of them\n\t\t\t// would not see the stored `constructorCached`, and the validation above against multiple derived classes would not work.\n\n\t\t\t// This is not just an alias of `this`, but a reference to the item in the prototype chain being walked, which happens to start at `this`.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias, unicorn/no-this-assignment\n\t\t\tlet schemaBase: typeof TreeNodeValid = this;\n\t\t\twhile (!Object.prototype.hasOwnProperty.call(schemaBase, \"constructorCached\")) {\n\t\t\t\tschemaBase = Reflect.getPrototypeOf(schemaBase) as typeof TreeNodeValid;\n\t\t\t}\n\t\t\tassert(schemaBase.constructorCached === undefined, 0x962 /* overwriting wrong cache */);\n\t\t\tschemaBase.constructorCached = { constructor: this, oneTimeInitialized: undefined };\n\t\t\tassert(\n\t\t\t\tthis.constructorCached === schemaBase.constructorCached,\n\t\t\t\t0x9b5 /* Inheritance should work */,\n\t\t\t);\n\t\t\treturn this.constructorCached;\n\t\t} else if (this.constructorCached.constructor === this) {\n\t\t\treturn this.constructorCached;\n\t\t}\n\n\t\t// If users trying to diagnose the cause of this error becomes a common issue, more information could be captured.\n\t\t// The call stack to when a schema is first marked most derived could be captured in debug builds and stored in the `MostDerivedData` object:\n\t\t// This could then be included in the error to aid in debugging this error.\n\t\tthrow new UsageError(\n\t\t\t`Two schema classes were used (${this.name} and ${\n\t\t\t\tthis.constructorCached.constructor.name\n\t\t\t}) which derived from the same SchemaFactory generated class (${JSON.stringify(\n\t\t\t\tthis.identifier,\n\t\t\t)}). This is invalid.`,\n\t\t\ttagSchemaArtifacts({ schemaIdentifier: this.identifier }),\n\t\t);\n\t}\n\n\t/**\n\t * Node creation function for implementing the TreeNodeSchemaNonClass half of TreeNodeSchemaBoth.\n\t * @remarks\n\t * When used as TreeNodeSchemaNonClass and subclassed,\n\t * does not actually have the correct compile time type for the return value due to TypeScript limitations.\n\t * This is why this is not exposed as part of TreeNodeSchemaClass where subclassing is allowed.\n\t */\n\tpublic static create<TInput, TOut, TThis extends new (args: TInput) => TOut>(\n\t\tthis: TThis,\n\t\tinput: TInput,\n\t): TOut {\n\t\treturn new this(input);\n\t}\n\n\t/**\n\t * See {@link TreeNodeSchemaCore.createFromInsertable}.\n\t */\n\tpublic static createFromInsertable<TInput, TOut, TThis extends new (args: TInput) => TOut>(\n\t\tthis: TThis,\n\t\tinput: TInput,\n\t): TOut {\n\t\treturn new this(input);\n\t}\n\n\t/**\n\t * Idempotent initialization function that pre-caches data and can dereference lazy schema references.\n\t */\n\tpublic static oneTimeInitialize(\n\t\tthis: typeof TreeNodeValid & TreeNodeSchema,\n\t): Required<MostDerivedData> {\n\t\tconst cache = this.markMostDerived();\n\t\tcache.oneTimeInitialized ??= this.oneTimeSetup();\n\t\t// TypeScript fails to narrow the type of `oneTimeInitialized` to `Context` here, so use a cast:\n\t\treturn cache as MostDerivedData & { oneTimeInitialized: TreeNodeSchemaInitializedData };\n\t}\n\n\tpublic constructor(input: TInput | InternalTreeNode) {\n\t\tsuper(privateToken);\n\t\tconst schema = this.constructor as typeof TreeNodeValid & TreeNodeSchema;\n\t\tconst cache = schema.oneTimeInitialize();\n\n\t\tif (isTreeNode(input)) {\n\t\t\t// TODO: update this once TreeBeta.clone is stable.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing nodes may not be used as the constructor parameter for a new node. The existing node may be used directly instead of creating a new one, used as a child of the new node (if it has not yet been inserted into the tree). If the desired result is copying the provided node, it must be deep copied (since any child node would be parented under both the new and old nodes). `TreeBeta.clone` can be used to do this.\",\n\t\t\t);\n\t\t}\n\n\t\tconst node: InnerNode = isFlexTreeNode(input) ? input : schema.buildRawNode(this, input);\n\t\tassert(\n\t\t\tgetSimpleNodeSchemaFromInnerNode(node) === schema,\n\t\t\t0x83b /* building node with wrong schema */,\n\t\t);\n\n\t\tconst result = schema.prepareInstance(this, node);\n\t\t// For unhydrated nodes, grab the context from the `simpleContext` (which likely is from cache.oneTimeInitialized.context,\n\t\t// but might be customized for better schema evolution support like unknown optional fields like in clone)\n\t\t// For hydrated nodes, this context is unused, so using the default from cache.oneTimeInitialized.context is always fine.\n\t\tconst context =\n\t\t\tnode instanceof UnhydratedFlexTreeNode\n\t\t\t\t? node.simpleContext\n\t\t\t\t: cache.oneTimeInitialized.context;\n\t\t// The TreeNodeKernel associates itself the TreeNode (result here, not node) so it can be looked up later via getKernel.\n\t\t// If desired this could be put in a non-enumerable symbol property for lookup instead, but that gets messy going through proxies,\n\t\t// so just relying on the WeakMap seems like the cleanest approach.\n\t\tnew TreeNodeKernel(result, schema, node, context);\n\n\t\treturn result;\n\t}\n}\n\n/**\n * Data cached about the most derived type in a schema's class hierarchy.\n * @remarks\n * The most derived type is the only one allowed to be referenced by other schema or constructed as a node.\n * It has to be discovered lazily (when a node is constructed or when a {@link TreeViewConfiguration} is made),\n * since JavaScript provides no way to find derived classes, or inject static class initialization time logic into base classes.\n * Additionally since schema can reference other schema through lazy references which might be forward or recursive references,\n * this can not be evaluated for one schema when referenced by another schema.\n *\n * See {@link TreeNodeValid.constructorCached} and {@link TreeNodeValid.markMostDerived}.\n */\nexport interface MostDerivedData {\n\treadonly constructor: typeof TreeNodeValid & TreeNodeSchema;\n\toneTimeInitialized?: TreeNodeSchemaInitializedData;\n}\n\n/**\n * Cast `schema` to a {@link TreeNodeValid}, asserting it actually extends it.\n */\nexport function schemaAsTreeNodeValid(\n\tschema: TreeNodeSchemaCore<string, NodeKind, boolean>,\n): typeof TreeNodeValid & TreeNodeSchema {\n\tif (!isClassBasedSchema(schema)) {\n\t\t// Use JSON.stringify to quote and escape identifier string.\n\t\tthrow new UsageError(\n\t\t\t`Schema for ${JSON.stringify(\n\t\t\t\tschema.identifier,\n\t\t\t)} does not extend a SchemaFactory generated class. This is invalid.`,\n\t\t\ttagSchemaArtifacts({ schemaIdentifier: schema.identifier }),\n\t\t);\n\t}\n\n\treturn schema;\n}\n\n/**\n * Check if a schema is a {@link TreeNodeValid}.\n */\nexport function isClassBasedSchema(\n\tschema: SimpleNodeSchemaBase<NodeKind>,\n): schema is typeof TreeNodeValid & TreeNodeSchema {\n\treturn inPrototypeChain(schema, TreeNodeValid);\n}\n\n/**\n * Provides the {@link TreeNodeSchemaPrivateData} for class based implementations of {@link asTreeNodeSchemaCorePrivate}.\n * @remarks\n * Such schema must extends {@link TreeNodeValid}.\n */\nexport function createTreeNodeSchemaPrivateData(\n\tschema: TreeNodeSchemaCore<string, NodeKind, boolean>,\n\tchildAllowedTypes: readonly AllowedTypesFull[],\n): TreeNodeSchemaPrivateData {\n\tconst schemaValid = schemaAsTreeNodeValid(schema);\n\t// Since this closes over the schema, ensure this schema is marked as most derived\n\t// so if some other subclass is used later, it will error instead of giving inconsistent results.\n\tschemaValid.markMostDerived();\n\n\treturn {\n\t\tidempotentInitialize: () => schemaValid.oneTimeInitialize().oneTimeInitialized,\n\t\tchildAllowedTypes,\n\t};\n}\n\n// #region NodeJS custom inspect for TreeNodes.\n\n/**\n * Used to customize \"inspect\" behavior in NodeJS.\n * See https://nodejs.org/api/util.html#utilinspectcustom for details.\n *\n * VS-Code's debugger also uses this to inspect objects,\n * see https://github.com/microsoft/vscode-js-debug/blob/64df2686c92bac402909dee5c3c389bbb7a81f6d/src/adapter/templates/getStringyProps.ts#L11 for details.\n */\nconst customInspectSymbol = Symbol.for(\"nodejs.util.inspect.custom\");\n\n/**\n * Node inspecting function for use with {@link customInspectSymbol}.\n */\nfunction inspectNodeFunction(\n\tthis: TreeNodeValid<unknown>,\n\tdepth: number,\n\toptions?: unknown,\n\tinspect?: unknown,\n): unknown {\n\tconst schema = this[typeSchemaSymbol];\n\tconst title = `${schema.name}: ${NodeKind[schema.kind]} Node (${schema.identifier})`;\n\n\tif (depth < 2) {\n\t\tconst short = shortContent(this);\n\t\tif (short !== undefined) {\n\t\t\treturn `${title} ${short}`;\n\t\t}\n\t\treturn title;\n\t}\n\tconst content = `${title} ${JSON.stringify(this)}`;\n\treturn content;\n}\n\n/**\n * If the node has no items, a short JSON string for it.\n */\nfunction shortContent(node: TreeNodeValid<unknown>): string | undefined {\n\tif (Object.values(node).length === 0) {\n\t\treturn JSON.stringify(node);\n\t}\n\treturn undefined;\n}\n\n/**\n * Add inherited non-enumerable symbol for NodeJS inspection to all nodes.\n *\n * See {@link customInspectSymbol}.\n */\nObject.defineProperty(TreeNodeValid.prototype, customInspectSymbol, {\n\tvalue: inspectNodeFunction,\n\tenumerable: false,\n});\n\n// #endregion\n\n// #region Browser custom debug format for TreeNodes\n\n// This section has side-effects, so including it in this file ensures its loaded whenever TreeNodes could exist.\n// Supported in at least Chrome and FireFox, more details at https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n// For this to work the browser's dev tools generally have to \"Enable custom formatters\".\n\n// This formatter is inspired by https://github.com/andrewdavey/immutable-devtools/blob/master/src/createFormatters.js which provides a similar formatter for the immutable.js library.\n\nconst globals = typeof window === \"undefined\" ? globalThis : window;\nconst formatters = ((\n\tglobals as { devtoolsFormatters?: DevtoolsFormatter.DevtoolsFormatter[] }\n).devtoolsFormatters ??= []);\n\nconst nodeFormatter: DevtoolsFormatter.DevtoolsFormatter = {\n\theader(object, config) {\n\t\tif (isTreeNode(object)) {\n\t\t\treturn [\"span\", `${inspectNodeFunction.call(object, 1)}`];\n\t\t}\n\t\treturn null;\n\t},\n\tbody(object, config): DevtoolsFormatter.Item {\n\t\tconst children: DevtoolsFormatter.Item[] = [];\n\t\tfor (const [key, value] of Object.entries(object as TreeNode)) {\n\t\t\tchildren.push([\"li\", [\"span\", `${key}: `], formattedReference(value)]);\n\t\t}\n\n\t\t// TODO:\n\t\t// for array nodes, this isn't great since (at least in FireFox) the list items show up with a prefixed number starting from 1.\n\t\t// This looks messy when followed by the array index.\n\t\t// Find a way to hide the list index.\n\t\t// { style: 'list-style-type: none` } did not seem to work.\n\n\t\treturn [\"ol\", ...children];\n\t},\n\thasBody(object, config) {\n\t\treturn shortContent(object as TreeNodeValid<undefined>) === undefined;\n\t},\n};\n\nfunction formattedReference(\n\tobject: unknown,\n\tconfig?: DevtoolsFormatter.ObjectConfig,\n): DevtoolsFormatter.Item {\n\tif (object === undefined) {\n\t\treturn [\"span\", \"undefined\"];\n\t} else if (object === \"null\") {\n\t\treturn [\"span\", \"null\"];\n\t}\n\n\treturn [\"object\", { object, config }];\n}\n\nformatters.push(nodeFormatter);\n\n// #endregion\n\n// These types are based on https://github.com/BenjaminAster/Better-TypeScript/blob/main/types/devtools-formatters.d.ts\n// however the original package causes multiple compile errors due to some of its other types it used, so the relevant part has been extracted and adjusted to better match our conventions.\ndeclare namespace DevtoolsFormatter {\n\ttype ObjectConfig = Record<string | symbol, unknown>;\n\n\ttype ElementTagName = \"div\" | \"span\" | \"ol\" | \"li\" | \"table\" | \"tr\" | \"td\";\n\n\ttype ElementTemplate = StyledElementTemplate | UnstyledElementTemplate;\n\n\ttype StyledElementTemplate = readonly [\n\t\tElementTagName,\n\t\t{\n\t\t\tstyle?: string;\n\t\t},\n\t\t...Item[],\n\t];\n\n\ttype UnstyledElementTemplate = readonly [ElementTagName, ...Item[]];\n\n\ttype ObjectReference = readonly [\n\t\t\"object\",\n\t\t{\n\t\t\tobject: unknown;\n\t\t\tconfig?: ObjectConfig;\n\t\t},\n\t];\n\n\ttype Item = string | ElementTemplate | ObjectReference;\n\n\tinterface DevtoolsFormatter {\n\t\theader(\n\t\t\tobject?: unknown,\n\t\t\tconfig?: ObjectConfig,\n\t\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\t): Item | null;\n\t\thasBody(object?: unknown, config?: ObjectConfig): boolean;\n\t\tbody(object?: unknown, config?: ObjectConfig): Item;\n\t}\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  export { typeNameSymbol, typeSchemaSymbol, contentSchemaSymbol, type WithType, type TreeNodeSchema, type AnnotatedAllowedType, type AllowedTypesFullEvaluated, NodeKind, type TreeNodeSchemaClass, type TreeNodeSchemaNonClass, type TreeNodeSchemaCore, TreeNode, type Unhydrated, type InternalTreeNode, isTreeNode, tryDisposeTreeNode, HydratedContext, SimpleContextSlot, getInnerNode, getOrCreateNodeFromInnerNode, getOrCreateNodeFromInnerUnboxedNode, getKernel, type NodeFromSchema, isTreeNodeSchemaClass, type TreeNodeFromImplicitAllowedTypes, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, type AllowedTypes, type InsertableTreeNodeFromAllowedTypes, type InsertableTypedNode, type NodeBuilderData, type Input, normalizeAllowedTypes, type NodeSchemaMetadata, type ImplicitAllowedTypes, type AllowedTypesMetadata, evaluateLazySchema, type UnannotateAllowedTypesList, type AllowedTypeMetadata, type AnnotatedAllowedTypes, SchemaUpgrade, type LazyItem, type FlexList, type FlexListToUnion, type ExtractItemType, walkNodeSchema, walkAllowedTypes, type SchemaVisitor, type SimpleNodeSchemaBase, withBufferedTreeEvents, type AnnotateAllowedTypesList, type AllowedTypesFull, type AllowedTypesFullFromMixed, AnnotatedAllowedTypesInternal, type NumberKeys, StagedSchemaUpgradePolicy, type StagedSchemaUpgradePolicyFactory, ExpectStored, createSchemaUpgrade, } from "./core/index.js";
6
6
  export { walkFieldSchema } from "./walkFieldSchema.js";
7
7
  export type { UnsafeUnknownSchema, Insertable } from "./unsafeUnknownSchema.js";
8
- export { type ITree, type TreeView, type ViewableTree, type TreeViewEvents, TreeViewConfiguration, TreeViewConfigurationAlpha, type ITreeViewConfiguration, type ITreeViewConfigurationAlpha, type SchemaCompatibilityStatus, type ITreeConfigurationOptions, SchemaFactory, scoped, SchemaFactoryBeta, type SchemaStaticsBeta, SchemaFactoryAlpha, type SchemaStaticsAlpha, type NodeProvider, type ObjectSchemaOptionsAlpha, type ObjectSchemaOptions, type ScopedSchemaName, type ValidateRecursiveSchema, type FixRecursiveArraySchema, adaptEnum, enumFromStrings, singletonSchema, treeNodeApi, type TreeNodeApi, type ArrayNodeDeltaOp, type ArrayNodeInsertOp, type ArrayNodeRemoveOp, type ArrayNodeRetainOp, type ArrayNodeTreeChangedDeltaOp, type ArrayNodeTreeChangedRetainOp, type NodeChangedData, type NodeChangedDataAlpha, type NodeChangedDataDelta, type NodeChangedDataProperties, type NodeChangedDataTreeDelta, borrowCursorFromTreeNodeOrValue, exportConcise, importConcise, TreeBeta, type TreeChangeEventsBeta, type TreeChangeEventsAlpha, type IdentifierIndex, createTreeIndex, createIdentifierIndex, type TreeIndexKey, type DirtyTreeStatus, trackDirtyNodes, type DirtyTreeMap, type JsonSchemaId, type JsonSchemaType, type JsonObjectNodeSchema, type JsonArrayNodeSchema, type JsonMapNodeSchema, type JsonLeafNodeSchema, type JsonSchemaRef, type JsonRefPath, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonTreeSchema, type JsonFieldSchema, type JsonLeafSchemaType, type JsonRecordNodeSchema, type JsonStringKeyPatternProperties, type TreeSchemaEncodingOptions, getJsonSchema, getSimpleSchema, type VerboseTreeNode, type TreeEncodingOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, checkSchemaCompatibility, type Unenforced, type System_Unsafe, type ArrayNodeCustomizableSchemaUnsafe, type MapNodeCustomizableSchemaUnsafe, type TreeRecordNodeUnsafe, type UnannotateAllowedTypeUnsafe, type AnnotatedAllowedTypeUnsafe, type AnnotatedAllowedTypesUnsafe, type AllowedTypesFullUnsafe, type AllowedTypesFullFromMixedUnsafe, type UnannotateAllowedTypesListUnsafe, type AnnotateAllowedTypesListUnsafe, type FieldHasDefaultAlphaUnsafe, type InsertableObjectFromSchemaRecordAlphaUnsafe, type TreeViewAlpha, type TreeViewBeta, type TreeBranch, type TreeBranchAlpha, type TreeBranchEvents, getPropertyKeyFromStoredKey, getStoredKey, tryGetSchema, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, conciseFromCursor, createFromCursor, asTreeViewAlpha, customFromCursorStored, type CustomTreeNode, type CustomTreeValue, tryStoredSchemaAsArray, type SchemaStatics, type ITreeAlpha, type NoChangeConstraint, type NodeInDocumentConstraint, type RunTransactionParamsAlpha, type RunTransactionParamsBeta, type TransactionCallbackStatusAlpha, type TransactionCallbackStatusBeta, type TransactionConstraint, type TransactionConstraintAlpha, type TransactionPostProcessor, type TransactionResultFailed, type TransactionResultSuccess, type TransactionValueResult, type TransactionVoidResult, type VoidTransactionCallbackStatusAlpha, type VoidTransactionCallbackStatusBeta, rollback, generateSchemaFromSimpleSchema, replaceConciseTreeHandles, replaceHandles, replaceVerboseTreeHandles, type HandleConverter, allowUnused, type FieldSchemaAlphaUnsafe, getIdentifierFromNode, type ValidateRecursiveSchemaTemplate, type FixRecursiveRecursionLimit, schemaStatics, type TreeChangeEvents, type NodeSchemaOptions, type NodeSchemaOptionsAlpha, KeyEncodingOptions, type TreeParsingOptions, incrementalSummaryHint, incrementalEncodingPolicyForAllowedTypes, type SchemaFactory_base, encodeSchemaCompatibilitySnapshot, decodeSchemaCompatibilitySnapshot, exportCompatibilitySchemaSnapshot, importCompatibilitySchemaSnapshot, checkCompatibility, eraseSchemaDetails, eraseSchemaDetailsSubclassable, type ErasedSchema, type ErasedNode, type ErasedSchemaSubclassable, snapshotSchemaCompatibility, type SnapshotFileSystem, type SnapshotSchemaCompatibilityOptions, createCustomizedFluidFrameworkScopedFactory, type TreeContextAlpha, type WithValue, } from "./api/index.js";
8
+ export { type CommitRevision, type ITree, type TreeView, type ViewableTree, type TreeViewEvents, TreeViewConfiguration, TreeViewConfigurationAlpha, type ITreeViewConfiguration, type ITreeViewConfigurationAlpha, type SchemaCompatibilityStatus, type SchemaCompatibilityStatusBeta, type SchemaDiscrepancy, type ITreeConfigurationOptions, SchemaFactory, scoped, SchemaFactoryBeta, type SchemaStaticsBeta, SchemaFactoryAlpha, type SchemaStaticsAlpha, type NodeProvider, type ObjectSchemaOptionsAlpha, type ObjectSchemaOptions, type ScopedSchemaName, type ValidateRecursiveSchema, type FixRecursiveArraySchema, adaptEnum, enumFromStrings, singletonSchema, treeNodeApi, type TreeNodeApi, type ArrayNodeDeltaOp, type ArrayNodeInsertOp, type ArrayNodeRemoveOp, type ArrayNodeRetainOp, type ArrayNodeTreeChangedDeltaOp, type ArrayNodeTreeChangedRetainOp, type NodeChangedData, type NodeChangedDataAlpha, type NodeChangedDataDelta, type NodeChangedDataProperties, type NodeChangedDataTreeDelta, borrowCursorFromTreeNodeOrValue, exportConcise, importConcise, TreeBeta, type TreeChangeEventsBeta, type TreeChangeEventsAlpha, type IdentifierIndex, createTreeIndex, createIdentifierIndex, type TreeIndexKey, type DirtyTreeStatus, trackDirtyNodes, type DirtyTreeMap, type JsonSchemaId, type JsonSchemaType, type JsonObjectNodeSchema, type JsonArrayNodeSchema, type JsonMapNodeSchema, type JsonLeafNodeSchema, type JsonSchemaRef, type JsonRefPath, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonTreeSchema, type JsonFieldSchema, type JsonLeafSchemaType, type JsonRecordNodeSchema, type JsonStringKeyPatternProperties, type TreeSchemaEncodingOptions, getJsonSchema, getSimpleSchema, type StagedUpgradeStatus, type VerboseTreeNode, type TreeEncodingOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, checkSchemaCompatibility, getSchemaIncompatibilityDetails, type Unenforced, type System_Unsafe, type ArrayNodeCustomizableSchemaUnsafe, type MapNodeCustomizableSchemaUnsafe, type TreeRecordNodeUnsafe, type UnannotateAllowedTypeUnsafe, type AnnotatedAllowedTypeUnsafe, type AnnotatedAllowedTypesUnsafe, type AllowedTypesFullUnsafe, type AllowedTypesFullFromMixedUnsafe, type UnannotateAllowedTypesListUnsafe, type AnnotateAllowedTypesListUnsafe, type FieldHasDefaultAlphaUnsafe, type InsertableObjectFromSchemaRecordAlphaUnsafe, type TreeViewAlpha, type TreeViewBeta, type UntypedTreeView, type TreeBranch, type TreeBranchAlpha, type UntypedTreeViewAlpha, type TreeBranchEvents, type TreeBranchCommitMetadata, type TreeBranchHistory, getPropertyKeyFromStoredKey, getStoredKey, tryGetSchema, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, conciseFromCursor, createFromCursor, asTreeViewAlpha, customFromCursorStored, type CustomTreeNode, type CustomTreeValue, tryStoredSchemaAsArray, type SchemaStatics, type ITreeAlpha, type NoChangeConstraint, type NodeInDocumentConstraint, type RunTransactionParamsAlpha, type RunTransactionParamsBeta, type TransactionCallbackStatusAlpha, type TransactionCallbackStatusBeta, type TransactionConstraint, type TransactionConstraintAlpha, type TransactionPostProcessor, type TransactionResultFailed, type TransactionResultSuccess, type TransactionValueResult, type TransactionVoidResult, type VoidTransactionCallbackStatusAlpha, type VoidTransactionCallbackStatusBeta, rollback, generateSchemaFromSimpleSchema, replaceConciseTreeHandles, replaceHandles, replaceVerboseTreeHandles, type HandleConverter, allowUnused, type FieldSchemaAlphaUnsafe, getIdentifierFromNode, type ValidateRecursiveSchemaTemplate, type FixRecursiveRecursionLimit, schemaStatics, type TreeChangeEvents, type NodeSchemaOptions, type NodeSchemaOptionsAlpha, KeyEncodingOptions, type TreeParsingOptions, incrementalSummaryHint, incrementalEncodingPolicyForAllowedTypes, type SchemaFactory_base, encodeSchemaCompatibilitySnapshot, decodeSchemaCompatibilitySnapshot, exportCompatibilitySchemaSnapshot, importCompatibilitySchemaSnapshot, checkCompatibility, eraseSchemaDetails, eraseSchemaDetailsSubclassable, type ErasedSchema, type ErasedNode, type ErasedSchemaSubclassable, snapshotSchemaCompatibility, type SnapshotFileSystem, type SnapshotSchemaCompatibilityOptions, createCustomizedFluidFrameworkScopedFactory, type TreeContextAlpha, type WithValue, } from "./api/index.js";
9
9
  export type { SimpleTreeSchema, SimpleNodeSchema, SimpleFieldSchema, SimpleLeafNodeSchema, SimpleMapNodeSchema, SimpleArrayNodeSchema, SimpleObjectNodeSchema, SimpleNodeSchemaBaseAlpha, SimpleObjectFieldSchema, SimpleRecordNodeSchema, SimpleAllowedTypeAttributes, SchemaType, } from "./simpleSchema.js";
10
10
  export { type ImplicitFieldSchema, type TreeFieldFromImplicitField, FieldKind, FieldSchema, FieldSchemaAlpha, type InsertableTreeFieldFromImplicitField, type DefaultProvider, type FieldProps, type FieldPropsAlpha, normalizeFieldSchema, areFieldSchemaEqual, areImplicitFieldSchemaEqual, type ApplyKind, type FieldSchemaMetadata, type InsertableField, type ApplyKindInput, type ReadableField, type ReadSchema, } from "./fieldSchema.js";
11
11
  export { tryGetTreeNodeForField } from "./getTreeNodeForField.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,gBAAgB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kBAAkB,EAClB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,0BAA0B,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,gCAAgC,EAChC,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,oBAAoB,GACzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,mBAAmB,EACnB,8BAA8B,GAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,GACV,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,KAAK,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,4BAA4B,EAC5B,mCAAmC,EACnC,SAAS,EACT,KAAK,cAAc,EACnB,qBAAqB,EACrB,KAAK,gCAAgC,EAC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nB,QAAQ,EACR,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,0BAA0B,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,gCAAgC,EAChC,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,oBAAoB,GACzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,mBAAmB,EACnB,8BAA8B,GAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,GACV,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,KAAK,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -4,7 +4,7 @@
4
4
  */
5
5
  export { typeNameSymbol, typeSchemaSymbol, contentSchemaSymbol, NodeKind, TreeNode, isTreeNode, tryDisposeTreeNode, HydratedContext, SimpleContextSlot, getInnerNode, getOrCreateNodeFromInnerNode, getOrCreateNodeFromInnerUnboxedNode, getKernel, isTreeNodeSchemaClass, normalizeAllowedTypes, evaluateLazySchema, SchemaUpgrade, walkNodeSchema, walkAllowedTypes, withBufferedTreeEvents, AnnotatedAllowedTypesInternal, StagedSchemaUpgradePolicy, ExpectStored, createSchemaUpgrade, } from "./core/index.js";
6
6
  export { walkFieldSchema } from "./walkFieldSchema.js";
7
- export { TreeViewConfiguration, TreeViewConfigurationAlpha, SchemaFactory, scoped, SchemaFactoryBeta, SchemaFactoryAlpha, adaptEnum, enumFromStrings, singletonSchema, treeNodeApi, borrowCursorFromTreeNodeOrValue, exportConcise, importConcise, TreeBeta, createTreeIndex, createIdentifierIndex, trackDirtyNodes, getJsonSchema, getSimpleSchema, extractPersistedSchema, comparePersistedSchema, checkSchemaCompatibility, getPropertyKeyFromStoredKey, getStoredKey, tryGetSchema, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, conciseFromCursor, createFromCursor, asTreeViewAlpha, customFromCursorStored, tryStoredSchemaAsArray, rollback, generateSchemaFromSimpleSchema, replaceConciseTreeHandles, replaceHandles, replaceVerboseTreeHandles, allowUnused, getIdentifierFromNode, schemaStatics, KeyEncodingOptions, incrementalSummaryHint, incrementalEncodingPolicyForAllowedTypes, encodeSchemaCompatibilitySnapshot, decodeSchemaCompatibilitySnapshot, exportCompatibilitySchemaSnapshot, importCompatibilitySchemaSnapshot, checkCompatibility, eraseSchemaDetails, eraseSchemaDetailsSubclassable, snapshotSchemaCompatibility, createCustomizedFluidFrameworkScopedFactory, } from "./api/index.js";
7
+ export { TreeViewConfiguration, TreeViewConfigurationAlpha, SchemaFactory, scoped, SchemaFactoryBeta, SchemaFactoryAlpha, adaptEnum, enumFromStrings, singletonSchema, treeNodeApi, borrowCursorFromTreeNodeOrValue, exportConcise, importConcise, TreeBeta, createTreeIndex, createIdentifierIndex, trackDirtyNodes, getJsonSchema, getSimpleSchema, extractPersistedSchema, comparePersistedSchema, checkSchemaCompatibility, getSchemaIncompatibilityDetails, getPropertyKeyFromStoredKey, getStoredKey, tryGetSchema, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, conciseFromCursor, createFromCursor, asTreeViewAlpha, customFromCursorStored, tryStoredSchemaAsArray, rollback, generateSchemaFromSimpleSchema, replaceConciseTreeHandles, replaceHandles, replaceVerboseTreeHandles, allowUnused, getIdentifierFromNode, schemaStatics, KeyEncodingOptions, incrementalSummaryHint, incrementalEncodingPolicyForAllowedTypes, encodeSchemaCompatibilitySnapshot, decodeSchemaCompatibilitySnapshot, exportCompatibilitySchemaSnapshot, importCompatibilitySchemaSnapshot, checkCompatibility, eraseSchemaDetails, eraseSchemaDetailsSubclassable, snapshotSchemaCompatibility, createCustomizedFluidFrameworkScopedFactory, } from "./api/index.js";
8
8
  export { FieldKind, FieldSchema, FieldSchemaAlpha, normalizeFieldSchema, areFieldSchemaEqual, areImplicitFieldSchemaEqual, } from "./fieldSchema.js";
9
9
  export { tryGetTreeNodeForField } from "./getTreeNodeForField.js";
10
10
  export { ArrayNodeSchema, asIndex, isArrayNodeSchema, IterableTreeArrayContent, TreeArrayNode, MapNodeSchema, isMapNodeSchema, ObjectNodeSchema, objectSchema, isObjectNodeSchema, setField, isRecordNodeSchema, RecordNodeSchema, createArrayInsertionAnchor, } from "./node-kinds/index.js";