@fluidframework/tree 2.50.0 → 2.51.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 (636) hide show
  1. package/.eslintrc.cjs +3 -2
  2. package/.vscode/Tree.code-workspace +14 -1
  3. package/.vscode/settings.json +16 -0
  4. package/CHANGELOG.md +51 -2
  5. package/api-report/tree.alpha.api.md +7 -7
  6. package/dist/core/schema-stored/schema.d.ts +14 -1
  7. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  8. package/dist/core/schema-stored/schema.js.map +1 -1
  9. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  10. package/dist/feature-libraries/default-schema/schemaChecker.js +3 -0
  11. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  12. package/dist/feature-libraries/flex-tree/context.d.ts +7 -2
  13. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  14. package/dist/feature-libraries/flex-tree/context.js +4 -4
  15. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  16. package/dist/feature-libraries/flex-tree/index.d.ts +1 -0
  17. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  18. package/dist/feature-libraries/flex-tree/index.js +3 -1
  19. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  20. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  21. package/dist/feature-libraries/flex-tree/lazyField.js +5 -5
  22. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  23. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +3 -1
  24. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  25. package/dist/feature-libraries/flex-tree/lazyNode.js +5 -3
  26. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  27. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  28. package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -4
  29. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  30. package/dist/feature-libraries/index.d.ts +2 -2
  31. package/dist/feature-libraries/index.d.ts.map +1 -1
  32. package/dist/feature-libraries/index.js +3 -8
  33. package/dist/feature-libraries/index.js.map +1 -1
  34. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  35. package/dist/feature-libraries/modular-schema/comparison.js +0 -3
  36. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  37. package/dist/feature-libraries/modular-schema/index.d.ts +0 -1
  38. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  39. package/dist/feature-libraries/modular-schema/index.js +1 -8
  40. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  41. package/dist/packageVersion.d.ts +1 -1
  42. package/dist/packageVersion.js +1 -1
  43. package/dist/packageVersion.js.map +1 -1
  44. package/dist/shared-tree/index.d.ts +0 -1
  45. package/dist/shared-tree/index.d.ts.map +1 -1
  46. package/dist/shared-tree/index.js +1 -3
  47. package/dist/shared-tree/index.js.map +1 -1
  48. package/dist/shared-tree/schematizeTree.d.ts +1 -1
  49. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  50. package/dist/shared-tree/schematizeTree.js +7 -10
  51. package/dist/shared-tree/schematizeTree.js.map +1 -1
  52. package/dist/shared-tree/schematizingTreeView.d.ts +11 -13
  53. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  54. package/dist/shared-tree/schematizingTreeView.js +60 -83
  55. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  56. package/dist/shared-tree/sharedTreeChangeTypes.d.ts +1 -1
  57. package/dist/shared-tree/sharedTreeChangeTypes.js.map +1 -1
  58. package/dist/shared-tree/tree.d.ts.map +1 -1
  59. package/dist/shared-tree/tree.js +4 -3
  60. package/dist/shared-tree/tree.js.map +1 -1
  61. package/dist/shared-tree/treeAlpha.d.ts +7 -1
  62. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  63. package/dist/shared-tree/treeAlpha.js.map +1 -1
  64. package/dist/shared-tree/treeCheckout.d.ts +7 -2
  65. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  66. package/dist/shared-tree/treeCheckout.js +4 -1
  67. package/dist/shared-tree/treeCheckout.js.map +1 -1
  68. package/dist/simple-tree/api/conciseTree.d.ts +1 -1
  69. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  70. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  71. package/dist/simple-tree/api/configuration.d.ts +1 -1
  72. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  73. package/dist/simple-tree/api/configuration.js +5 -5
  74. package/dist/simple-tree/api/configuration.js.map +1 -1
  75. package/dist/simple-tree/api/create.d.ts +3 -1
  76. package/dist/simple-tree/api/create.d.ts.map +1 -1
  77. package/dist/simple-tree/api/create.js +2 -0
  78. package/dist/simple-tree/api/create.js.map +1 -1
  79. package/dist/simple-tree/api/customTree.d.ts +1 -2
  80. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  81. package/dist/simple-tree/api/customTree.js.map +1 -1
  82. package/dist/simple-tree/api/getJsonSchema.d.ts +1 -1
  83. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  84. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  85. package/dist/simple-tree/api/getSimpleSchema.d.ts +1 -1
  86. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  87. package/dist/simple-tree/api/identifierIndex.d.ts +1 -1
  88. package/dist/simple-tree/api/identifierIndex.js +2 -2
  89. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  90. package/dist/simple-tree/api/index.d.ts +1 -1
  91. package/dist/simple-tree/api/index.d.ts.map +1 -1
  92. package/dist/simple-tree/api/index.js.map +1 -1
  93. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +4 -19
  94. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  95. package/dist/simple-tree/api/schemaCompatibilityTester.js +31 -82
  96. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  97. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +14 -2
  98. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  99. package/dist/simple-tree/api/schemaCreationUtilities.js +41 -4
  100. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  101. package/dist/simple-tree/api/schemaFactory.d.ts +36 -3
  102. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  103. package/dist/simple-tree/api/schemaFactory.js +18 -18
  104. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  105. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +16 -16
  106. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  107. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  108. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  109. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  110. package/dist/simple-tree/api/schemaFactoryRecursive.js +2 -2
  111. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  112. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  113. package/dist/simple-tree/api/schemaFromSimple.js +4 -4
  114. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  115. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +2 -2
  116. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  117. package/dist/simple-tree/api/simpleTreeIndex.d.ts +2 -2
  118. package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  119. package/dist/simple-tree/api/simpleTreeIndex.js +1 -1
  120. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  121. package/dist/simple-tree/api/storedSchema.d.ts +1 -1
  122. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  123. package/dist/simple-tree/api/storedSchema.js +2 -2
  124. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  125. package/dist/simple-tree/api/tree.d.ts +2 -1
  126. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  127. package/dist/simple-tree/api/tree.js.map +1 -1
  128. package/dist/simple-tree/api/treeBeta.d.ts +4 -1
  129. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  130. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  131. package/dist/simple-tree/api/treeNodeApi.d.ts +1 -2
  132. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  133. package/dist/simple-tree/api/treeNodeApi.js +3 -3
  134. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  135. package/dist/simple-tree/api/typesUnsafe.d.ts +2 -3
  136. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  137. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  138. package/dist/simple-tree/api/verboseTree.d.ts +2 -1
  139. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  140. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  141. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +1 -1
  142. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +2 -2
  143. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  144. package/dist/simple-tree/core/allowedTypes.d.ts +316 -0
  145. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -0
  146. package/dist/simple-tree/core/allowedTypes.js +173 -0
  147. package/dist/simple-tree/core/allowedTypes.js.map +1 -0
  148. package/dist/simple-tree/core/context.d.ts +3 -9
  149. package/dist/simple-tree/core/context.d.ts.map +1 -1
  150. package/dist/simple-tree/core/context.js +3 -11
  151. package/dist/simple-tree/core/context.js.map +1 -1
  152. package/dist/simple-tree/core/flexList.d.ts.map +1 -0
  153. package/dist/simple-tree/core/flexList.js.map +1 -0
  154. package/dist/simple-tree/core/getOrCreateNode.d.ts +1 -1
  155. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  156. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  157. package/dist/simple-tree/core/index.d.ts +9 -3
  158. package/dist/simple-tree/core/index.d.ts.map +1 -1
  159. package/dist/simple-tree/core/index.js +19 -3
  160. package/dist/simple-tree/core/index.js.map +1 -1
  161. package/dist/simple-tree/core/treeNodeKernel.d.ts +8 -1
  162. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  163. package/dist/simple-tree/core/treeNodeKernel.js +24 -20
  164. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  165. package/dist/simple-tree/core/treeNodeSchema.d.ts +182 -39
  166. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  167. package/dist/simple-tree/core/treeNodeSchema.js +47 -17
  168. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  169. package/{lib/simple-tree → dist/simple-tree/core}/treeNodeValid.d.ts +18 -4
  170. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -0
  171. package/dist/simple-tree/{treeNodeValid.js → core/treeNodeValid.js} +41 -11
  172. package/dist/simple-tree/core/treeNodeValid.js.map +1 -0
  173. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  174. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  175. package/dist/simple-tree/core/walkSchema.d.ts +2 -1
  176. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
  177. package/dist/simple-tree/core/walkSchema.js +6 -2
  178. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  179. package/dist/simple-tree/createContext.d.ts +6 -2
  180. package/dist/simple-tree/createContext.d.ts.map +1 -1
  181. package/dist/simple-tree/createContext.js +15 -3
  182. package/dist/simple-tree/createContext.js.map +1 -1
  183. package/dist/{feature-libraries/modular-schema → simple-tree}/discrepancies.d.ts +22 -29
  184. package/dist/simple-tree/discrepancies.d.ts.map +1 -0
  185. package/dist/simple-tree/discrepancies.js +382 -0
  186. package/dist/simple-tree/discrepancies.js.map +1 -0
  187. package/dist/simple-tree/fieldSchema.d.ts +423 -0
  188. package/dist/simple-tree/fieldSchema.d.ts.map +1 -0
  189. package/dist/simple-tree/{schemaTypes.js → fieldSchema.js} +5 -195
  190. package/dist/simple-tree/fieldSchema.js.map +1 -0
  191. package/dist/simple-tree/index.d.ts +7 -6
  192. package/dist/simple-tree/index.d.ts.map +1 -1
  193. package/dist/simple-tree/index.js +17 -11
  194. package/dist/simple-tree/index.js.map +1 -1
  195. package/dist/simple-tree/leafNodeSchema.d.ts +14 -5
  196. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  197. package/dist/simple-tree/leafNodeSchema.js +117 -2
  198. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  199. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -4
  200. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  201. package/dist/simple-tree/node-kinds/array/arrayNode.js +97 -26
  202. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  203. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +2 -2
  204. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  205. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  206. package/dist/simple-tree/node-kinds/common.d.ts +16 -0
  207. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -0
  208. package/dist/simple-tree/node-kinds/common.js +42 -0
  209. package/dist/simple-tree/node-kinds/common.js.map +1 -0
  210. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  211. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  212. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  213. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +2 -3
  214. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  215. package/dist/simple-tree/node-kinds/map/mapNode.js +64 -26
  216. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  217. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +2 -2
  218. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  219. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  220. package/dist/simple-tree/node-kinds/object/index.d.ts +2 -2
  221. package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  222. package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
  223. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +19 -5
  224. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  225. package/dist/simple-tree/node-kinds/object/objectNode.js +131 -27
  226. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  227. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +11 -4
  228. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  229. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  230. package/dist/simple-tree/node-kinds/record/recordNode.d.ts +2 -2
  231. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  232. package/dist/simple-tree/node-kinds/record/recordNode.js +41 -13
  233. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  234. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  235. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  236. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  237. package/dist/simple-tree/prepareForInsertion.d.ts +2 -2
  238. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  239. package/dist/simple-tree/prepareForInsertion.js +3 -3
  240. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  241. package/dist/simple-tree/simpleSchema.d.ts +2 -2
  242. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  243. package/dist/simple-tree/simpleSchema.js.map +1 -1
  244. package/dist/simple-tree/toStoredSchema.d.ts +1 -1
  245. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  246. package/dist/simple-tree/toStoredSchema.js +6 -7
  247. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  248. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +5 -11
  249. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  250. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +25 -395
  251. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  252. package/dist/simple-tree/unsafeUnknownSchema.d.ts +52 -0
  253. package/dist/simple-tree/unsafeUnknownSchema.d.ts.map +1 -0
  254. package/dist/simple-tree/unsafeUnknownSchema.js +13 -0
  255. package/dist/simple-tree/unsafeUnknownSchema.js.map +1 -0
  256. package/dist/simple-tree/walkFieldSchema.d.ts +1 -1
  257. package/dist/simple-tree/walkFieldSchema.js +2 -2
  258. package/dist/simple-tree/walkFieldSchema.js.map +1 -1
  259. package/dist/tableSchema.d.ts +12 -12
  260. package/dist/treeFactory.d.ts +0 -1
  261. package/dist/treeFactory.d.ts.map +1 -1
  262. package/dist/treeFactory.js +0 -1
  263. package/dist/treeFactory.js.map +1 -1
  264. package/lib/core/schema-stored/schema.d.ts +14 -1
  265. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  266. package/lib/core/schema-stored/schema.js.map +1 -1
  267. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  268. package/lib/feature-libraries/default-schema/schemaChecker.js +3 -0
  269. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  270. package/lib/feature-libraries/flex-tree/context.d.ts +7 -2
  271. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  272. package/lib/feature-libraries/flex-tree/context.js +4 -4
  273. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  274. package/lib/feature-libraries/flex-tree/index.d.ts +1 -0
  275. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  276. package/lib/feature-libraries/flex-tree/index.js +1 -0
  277. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  278. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  279. package/lib/feature-libraries/flex-tree/lazyField.js +6 -6
  280. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  281. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +3 -1
  282. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  283. package/lib/feature-libraries/flex-tree/lazyNode.js +3 -1
  284. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  285. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  286. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -2
  287. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  288. package/lib/feature-libraries/index.d.ts +2 -2
  289. package/lib/feature-libraries/index.d.ts.map +1 -1
  290. package/lib/feature-libraries/index.js +2 -2
  291. package/lib/feature-libraries/index.js.map +1 -1
  292. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  293. package/lib/feature-libraries/modular-schema/comparison.js +0 -3
  294. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  295. package/lib/feature-libraries/modular-schema/index.d.ts +0 -1
  296. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  297. package/lib/feature-libraries/modular-schema/index.js +0 -1
  298. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  299. package/lib/packageVersion.d.ts +1 -1
  300. package/lib/packageVersion.js +1 -1
  301. package/lib/packageVersion.js.map +1 -1
  302. package/lib/shared-tree/index.d.ts +0 -1
  303. package/lib/shared-tree/index.d.ts.map +1 -1
  304. package/lib/shared-tree/index.js +0 -1
  305. package/lib/shared-tree/index.js.map +1 -1
  306. package/lib/shared-tree/schematizeTree.d.ts +1 -1
  307. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  308. package/lib/shared-tree/schematizeTree.js +5 -8
  309. package/lib/shared-tree/schematizeTree.js.map +1 -1
  310. package/lib/shared-tree/schematizingTreeView.d.ts +11 -13
  311. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  312. package/lib/shared-tree/schematizingTreeView.js +61 -83
  313. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  314. package/lib/shared-tree/sharedTreeChangeTypes.d.ts +1 -1
  315. package/lib/shared-tree/sharedTreeChangeTypes.js.map +1 -1
  316. package/lib/shared-tree/tree.d.ts.map +1 -1
  317. package/lib/shared-tree/tree.js +4 -3
  318. package/lib/shared-tree/tree.js.map +1 -1
  319. package/lib/shared-tree/treeAlpha.d.ts +7 -1
  320. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  321. package/lib/shared-tree/treeAlpha.js.map +1 -1
  322. package/lib/shared-tree/treeCheckout.d.ts +7 -2
  323. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  324. package/lib/shared-tree/treeCheckout.js +5 -2
  325. package/lib/shared-tree/treeCheckout.js.map +1 -1
  326. package/lib/simple-tree/api/conciseTree.d.ts +1 -1
  327. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  328. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  329. package/lib/simple-tree/api/configuration.d.ts +1 -1
  330. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  331. package/lib/simple-tree/api/configuration.js +2 -2
  332. package/lib/simple-tree/api/configuration.js.map +1 -1
  333. package/lib/simple-tree/api/create.d.ts +3 -1
  334. package/lib/simple-tree/api/create.d.ts.map +1 -1
  335. package/lib/simple-tree/api/create.js +2 -0
  336. package/lib/simple-tree/api/create.js.map +1 -1
  337. package/lib/simple-tree/api/customTree.d.ts +1 -2
  338. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  339. package/lib/simple-tree/api/customTree.js.map +1 -1
  340. package/lib/simple-tree/api/getJsonSchema.d.ts +1 -1
  341. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  342. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  343. package/lib/simple-tree/api/getSimpleSchema.d.ts +1 -1
  344. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  345. package/lib/simple-tree/api/identifierIndex.d.ts +1 -1
  346. package/lib/simple-tree/api/identifierIndex.js +1 -1
  347. package/lib/simple-tree/api/identifierIndex.js.map +1 -1
  348. package/lib/simple-tree/api/index.d.ts +1 -1
  349. package/lib/simple-tree/api/index.d.ts.map +1 -1
  350. package/lib/simple-tree/api/index.js.map +1 -1
  351. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +4 -19
  352. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  353. package/lib/simple-tree/api/schemaCompatibilityTester.js +25 -76
  354. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  355. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +14 -2
  356. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  357. package/lib/simple-tree/api/schemaCreationUtilities.js +40 -4
  358. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  359. package/lib/simple-tree/api/schemaFactory.d.ts +36 -3
  360. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  361. package/lib/simple-tree/api/schemaFactory.js +2 -2
  362. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  363. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +16 -16
  364. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  365. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  366. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  367. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  368. package/lib/simple-tree/api/schemaFactoryRecursive.js +1 -1
  369. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  370. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  371. package/lib/simple-tree/api/schemaFromSimple.js +1 -1
  372. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  373. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +1 -1
  374. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  375. package/lib/simple-tree/api/simpleTreeIndex.d.ts +2 -2
  376. package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  377. package/lib/simple-tree/api/simpleTreeIndex.js +2 -2
  378. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  379. package/lib/simple-tree/api/storedSchema.d.ts +1 -1
  380. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  381. package/lib/simple-tree/api/storedSchema.js +2 -2
  382. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  383. package/lib/simple-tree/api/tree.d.ts +2 -1
  384. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  385. package/lib/simple-tree/api/tree.js.map +1 -1
  386. package/lib/simple-tree/api/treeBeta.d.ts +4 -1
  387. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  388. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  389. package/lib/simple-tree/api/treeNodeApi.d.ts +1 -2
  390. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  391. package/lib/simple-tree/api/treeNodeApi.js +2 -2
  392. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  393. package/lib/simple-tree/api/typesUnsafe.d.ts +2 -3
  394. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  395. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  396. package/lib/simple-tree/api/verboseTree.d.ts +2 -1
  397. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  398. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  399. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +1 -1
  400. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +1 -1
  401. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  402. package/lib/simple-tree/core/allowedTypes.d.ts +316 -0
  403. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -0
  404. package/lib/simple-tree/core/allowedTypes.js +162 -0
  405. package/lib/simple-tree/core/allowedTypes.js.map +1 -0
  406. package/lib/simple-tree/core/context.d.ts +3 -9
  407. package/lib/simple-tree/core/context.d.ts.map +1 -1
  408. package/lib/simple-tree/core/context.js +0 -8
  409. package/lib/simple-tree/core/context.js.map +1 -1
  410. package/lib/simple-tree/core/flexList.d.ts.map +1 -0
  411. package/lib/simple-tree/core/flexList.js.map +1 -0
  412. package/lib/simple-tree/core/getOrCreateNode.d.ts +1 -1
  413. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  414. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  415. package/lib/simple-tree/core/index.d.ts +9 -3
  416. package/lib/simple-tree/core/index.d.ts.map +1 -1
  417. package/lib/simple-tree/core/index.js +6 -3
  418. package/lib/simple-tree/core/index.js.map +1 -1
  419. package/lib/simple-tree/core/treeNodeKernel.d.ts +8 -1
  420. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  421. package/lib/simple-tree/core/treeNodeKernel.js +10 -6
  422. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  423. package/lib/simple-tree/core/treeNodeSchema.d.ts +182 -39
  424. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  425. package/lib/simple-tree/core/treeNodeSchema.js +44 -14
  426. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  427. package/{dist/simple-tree → lib/simple-tree/core}/treeNodeValid.d.ts +18 -4
  428. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -0
  429. package/lib/simple-tree/{treeNodeValid.js → core/treeNodeValid.js} +31 -3
  430. package/lib/simple-tree/core/treeNodeValid.js.map +1 -0
  431. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  432. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  433. package/lib/simple-tree/core/walkSchema.d.ts +2 -1
  434. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
  435. package/lib/simple-tree/core/walkSchema.js +7 -3
  436. package/lib/simple-tree/core/walkSchema.js.map +1 -1
  437. package/lib/simple-tree/createContext.d.ts +6 -2
  438. package/lib/simple-tree/createContext.d.ts.map +1 -1
  439. package/lib/simple-tree/createContext.js +13 -2
  440. package/lib/simple-tree/createContext.js.map +1 -1
  441. package/lib/{feature-libraries/modular-schema → simple-tree}/discrepancies.d.ts +22 -29
  442. package/lib/simple-tree/discrepancies.d.ts.map +1 -0
  443. package/lib/simple-tree/discrepancies.js +376 -0
  444. package/lib/simple-tree/discrepancies.js.map +1 -0
  445. package/lib/simple-tree/fieldSchema.d.ts +423 -0
  446. package/lib/simple-tree/fieldSchema.d.ts.map +1 -0
  447. package/lib/simple-tree/{schemaTypes.js → fieldSchema.js} +3 -183
  448. package/lib/simple-tree/fieldSchema.js.map +1 -0
  449. package/lib/simple-tree/index.d.ts +7 -6
  450. package/lib/simple-tree/index.d.ts.map +1 -1
  451. package/lib/simple-tree/index.js +4 -3
  452. package/lib/simple-tree/index.js.map +1 -1
  453. package/lib/simple-tree/leafNodeSchema.d.ts +14 -5
  454. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  455. package/lib/simple-tree/leafNodeSchema.js +117 -3
  456. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  457. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -4
  458. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  459. package/lib/simple-tree/node-kinds/array/arrayNode.js +86 -15
  460. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  461. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +2 -2
  462. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  463. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js +1 -1
  464. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  465. package/lib/simple-tree/node-kinds/common.d.ts +16 -0
  466. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -0
  467. package/lib/simple-tree/node-kinds/common.js +38 -0
  468. package/lib/simple-tree/node-kinds/common.js.map +1 -0
  469. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  470. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  471. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  472. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +2 -3
  473. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  474. package/lib/simple-tree/node-kinds/map/mapNode.js +51 -13
  475. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  476. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +2 -2
  477. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  478. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js +1 -1
  479. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  480. package/lib/simple-tree/node-kinds/object/index.d.ts +2 -2
  481. package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  482. package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
  483. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +19 -5
  484. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  485. package/lib/simple-tree/node-kinds/object/objectNode.js +116 -14
  486. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  487. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +11 -4
  488. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  489. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js +1 -1
  490. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  491. package/lib/simple-tree/node-kinds/record/recordNode.d.ts +2 -2
  492. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  493. package/lib/simple-tree/node-kinds/record/recordNode.js +40 -12
  494. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  495. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  496. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  497. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js +1 -1
  498. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  499. package/lib/simple-tree/prepareForInsertion.d.ts +2 -2
  500. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  501. package/lib/simple-tree/prepareForInsertion.js +2 -2
  502. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  503. package/lib/simple-tree/simpleSchema.d.ts +2 -2
  504. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  505. package/lib/simple-tree/simpleSchema.js.map +1 -1
  506. package/lib/simple-tree/toStoredSchema.d.ts +1 -1
  507. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  508. package/lib/simple-tree/toStoredSchema.js +2 -3
  509. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  510. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +5 -11
  511. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  512. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +10 -381
  513. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  514. package/lib/simple-tree/unsafeUnknownSchema.d.ts +52 -0
  515. package/lib/simple-tree/unsafeUnknownSchema.d.ts.map +1 -0
  516. package/lib/simple-tree/unsafeUnknownSchema.js +10 -0
  517. package/lib/simple-tree/unsafeUnknownSchema.js.map +1 -0
  518. package/lib/simple-tree/walkFieldSchema.d.ts +1 -1
  519. package/lib/simple-tree/walkFieldSchema.js +1 -1
  520. package/lib/simple-tree/walkFieldSchema.js.map +1 -1
  521. package/lib/tableSchema.d.ts +12 -12
  522. package/lib/treeFactory.d.ts +0 -1
  523. package/lib/treeFactory.d.ts.map +1 -1
  524. package/lib/treeFactory.js +0 -1
  525. package/lib/treeFactory.js.map +1 -1
  526. package/package.json +22 -23
  527. package/src/core/schema-stored/schema.ts +14 -1
  528. package/src/feature-libraries/default-schema/schemaChecker.ts +3 -0
  529. package/src/feature-libraries/flex-tree/context.ts +10 -5
  530. package/src/feature-libraries/flex-tree/index.ts +2 -0
  531. package/src/feature-libraries/flex-tree/lazyField.ts +10 -6
  532. package/src/feature-libraries/flex-tree/lazyNode.ts +6 -1
  533. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -2
  534. package/src/feature-libraries/index.ts +1 -15
  535. package/src/feature-libraries/modular-schema/comparison.ts +0 -4
  536. package/src/feature-libraries/modular-schema/index.ts +0 -17
  537. package/src/packageVersion.ts +1 -1
  538. package/src/shared-tree/index.ts +0 -2
  539. package/src/shared-tree/schematizeTree.ts +5 -9
  540. package/src/shared-tree/schematizingTreeView.ts +75 -113
  541. package/src/shared-tree/sharedTreeChangeTypes.ts +1 -1
  542. package/src/shared-tree/tree.ts +4 -3
  543. package/src/shared-tree/treeAlpha.ts +7 -1
  544. package/src/shared-tree/treeCheckout.ts +15 -2
  545. package/src/simple-tree/api/conciseTree.ts +1 -2
  546. package/src/simple-tree/api/configuration.ts +7 -4
  547. package/src/simple-tree/api/create.ts +3 -1
  548. package/src/simple-tree/api/customTree.ts +1 -2
  549. package/src/simple-tree/api/getJsonSchema.ts +1 -1
  550. package/src/simple-tree/api/getSimpleSchema.ts +1 -1
  551. package/src/simple-tree/api/identifierIndex.ts +1 -1
  552. package/src/simple-tree/api/index.ts +2 -0
  553. package/src/simple-tree/api/schemaCompatibilityTester.ts +38 -128
  554. package/src/simple-tree/api/schemaCreationUtilities.ts +50 -5
  555. package/src/simple-tree/api/schemaFactory.ts +45 -10
  556. package/src/simple-tree/api/schemaFactoryAlpha.ts +4 -7
  557. package/src/simple-tree/api/schemaFactoryRecursive.ts +9 -4
  558. package/src/simple-tree/api/schemaFromSimple.ts +2 -3
  559. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -1
  560. package/src/simple-tree/api/simpleTreeIndex.ts +8 -3
  561. package/src/simple-tree/api/storedSchema.ts +1 -2
  562. package/src/simple-tree/api/tree.ts +2 -2
  563. package/src/simple-tree/api/treeBeta.ts +4 -1
  564. package/src/simple-tree/api/treeNodeApi.ts +5 -8
  565. package/src/simple-tree/api/typesUnsafe.ts +5 -4
  566. package/src/simple-tree/api/verboseTree.ts +3 -6
  567. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +1 -1
  568. package/src/simple-tree/core/README.md +1 -1
  569. package/src/simple-tree/core/allowedTypes.ts +496 -0
  570. package/src/simple-tree/core/context.ts +3 -10
  571. package/src/simple-tree/core/getOrCreateNode.ts +1 -1
  572. package/src/simple-tree/core/index.ts +62 -9
  573. package/src/simple-tree/core/treeNodeKernel.ts +12 -6
  574. package/src/simple-tree/core/treeNodeSchema.ts +247 -63
  575. package/src/simple-tree/{treeNodeValid.ts → core/treeNodeValid.ts} +59 -15
  576. package/src/simple-tree/core/unhydratedFlexTree.ts +1 -1
  577. package/src/simple-tree/core/walkSchema.ts +9 -5
  578. package/src/simple-tree/createContext.ts +26 -2
  579. package/src/simple-tree/discrepancies.ts +648 -0
  580. package/src/simple-tree/fieldSchema.ts +734 -0
  581. package/src/simple-tree/index.ts +41 -31
  582. package/src/simple-tree/leafNodeSchema.ts +137 -5
  583. package/src/simple-tree/node-kinds/array/arrayNode.ts +141 -30
  584. package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +5 -7
  585. package/src/simple-tree/node-kinds/common.ts +60 -0
  586. package/src/simple-tree/node-kinds/index.ts +2 -0
  587. package/src/simple-tree/node-kinds/map/mapNode.ts +91 -33
  588. package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +5 -7
  589. package/src/simple-tree/node-kinds/object/index.ts +2 -0
  590. package/src/simple-tree/node-kinds/object/objectNode.ts +205 -25
  591. package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +22 -5
  592. package/src/simple-tree/node-kinds/record/recordNode.ts +68 -26
  593. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +6 -8
  594. package/src/simple-tree/prepareForInsertion.ts +7 -6
  595. package/src/simple-tree/simpleSchema.ts +2 -2
  596. package/src/simple-tree/toStoredSchema.ts +2 -3
  597. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +12 -494
  598. package/src/simple-tree/unsafeUnknownSchema.ts +70 -0
  599. package/src/simple-tree/walkFieldSchema.ts +1 -1
  600. package/src/treeFactory.ts +0 -1
  601. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +0 -1
  602. package/dist/feature-libraries/modular-schema/discrepancies.js +0 -361
  603. package/dist/feature-libraries/modular-schema/discrepancies.js.map +0 -1
  604. package/dist/shared-tree/checkoutFlexTreeView.d.ts +0 -58
  605. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +0 -1
  606. package/dist/shared-tree/checkoutFlexTreeView.js +0 -77
  607. package/dist/shared-tree/checkoutFlexTreeView.js.map +0 -1
  608. package/dist/simple-tree/flexList.d.ts.map +0 -1
  609. package/dist/simple-tree/flexList.js.map +0 -1
  610. package/dist/simple-tree/schemaTypes.d.ts +0 -856
  611. package/dist/simple-tree/schemaTypes.d.ts.map +0 -1
  612. package/dist/simple-tree/schemaTypes.js.map +0 -1
  613. package/dist/simple-tree/treeNodeValid.d.ts.map +0 -1
  614. package/dist/simple-tree/treeNodeValid.js.map +0 -1
  615. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +0 -1
  616. package/lib/feature-libraries/modular-schema/discrepancies.js +0 -354
  617. package/lib/feature-libraries/modular-schema/discrepancies.js.map +0 -1
  618. package/lib/shared-tree/checkoutFlexTreeView.d.ts +0 -58
  619. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +0 -1
  620. package/lib/shared-tree/checkoutFlexTreeView.js +0 -72
  621. package/lib/shared-tree/checkoutFlexTreeView.js.map +0 -1
  622. package/lib/simple-tree/flexList.d.ts.map +0 -1
  623. package/lib/simple-tree/flexList.js.map +0 -1
  624. package/lib/simple-tree/schemaTypes.d.ts +0 -856
  625. package/lib/simple-tree/schemaTypes.d.ts.map +0 -1
  626. package/lib/simple-tree/schemaTypes.js.map +0 -1
  627. package/lib/simple-tree/treeNodeValid.d.ts.map +0 -1
  628. package/lib/simple-tree/treeNodeValid.js.map +0 -1
  629. package/src/feature-libraries/modular-schema/discrepancies.ts +0 -567
  630. package/src/shared-tree/checkoutFlexTreeView.ts +0 -100
  631. package/src/simple-tree/schemaTypes.ts +0 -1420
  632. /package/dist/simple-tree/{flexList.d.ts → core/flexList.d.ts} +0 -0
  633. /package/dist/simple-tree/{flexList.js → core/flexList.js} +0 -0
  634. /package/lib/simple-tree/{flexList.d.ts → core/flexList.d.ts} +0 -0
  635. /package/lib/simple-tree/{flexList.js → core/flexList.js} +0 -0
  636. /package/src/simple-tree/{flexList.ts → core/flexList.ts} +0 -0
@@ -64,7 +64,7 @@ export interface FlexTreeHydratedContext extends FlexTreeContext, FlexTreeHydrat
64
64
  */
65
65
  export declare const ContextSlot: import("../../core/index.js").AnchorSlot<Context>;
66
66
  /**
67
- * Implementation of `FlexTreeContext`.
67
+ * Implementation of `FlexTreeHydratedContext`.
68
68
  *
69
69
  * @remarks An editor is required to edit the FlexTree.
70
70
  *
@@ -82,7 +82,12 @@ export declare class Context implements FlexTreeHydratedContext, IDisposable {
82
82
  readonly nodeKeyManager: NodeIdentifierManager;
83
83
  readonly withCursors: Set<LazyEntity>;
84
84
  readonly withAnchors: Set<LazyEntity>;
85
- private readonly eventUnregister;
85
+ /**
86
+ * Callbacks to run when disposing.
87
+ *
88
+ * Mainly event un-registration.
89
+ */
90
+ private readonly onDispose;
86
91
  private disposed;
87
92
  /**
88
93
  * Stores the last accessed version of the root.
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAA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AGhC,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,aAAa;IACvC;;OAEG;IACa,cAAc,EAAE,qBAAqB;IAe/C,UAAU,IAAI,IAAI,IAAI,uBAAuB;IAK7C,UAAU,IAAI,OAAO;IAI5B,IAAW,MAAM,IAAI,gBAAgB,CAEpC;IAED;;;OAGG;IACH,OAAO,CAAC,cAAc;IAQf,CAAC,aAAa,CAAC,IAAI,IAAI;IAa9B;;;;;;OAMG;IACI,KAAK,IAAI,IAAI;IASpB;;;;;OAKG;IACH,IAAW,IAAI,IAAI,aAAa,CAK/B;IAED;;;;;OAKG;IACI,aAAa,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,GAAG,aAAa;IAUpF,IAAW,MAAM,IAAI,UAAU,CAAC,YAAY,CAAC,CAE5C;CACD"}
@@ -12,7 +12,7 @@ import { makeField } from "./lazyField.js";
12
12
  */
13
13
  export const ContextSlot = anchorSlot();
14
14
  /**
15
- * Implementation of `FlexTreeContext`.
15
+ * Implementation of `FlexTreeHydratedContext`.
16
16
  *
17
17
  * @remarks An editor is required to edit the FlexTree.
18
18
  *
@@ -33,7 +33,7 @@ export class Context {
33
33
  this.withCursors = new Set();
34
34
  this.withAnchors = new Set();
35
35
  this.disposed = false;
36
- this.eventUnregister = [
36
+ this.onDispose = [
37
37
  this.checkout.forest.events.on("beforeChange", () => {
38
38
  this.prepareForEdit();
39
39
  }),
@@ -66,10 +66,10 @@ export class Context {
66
66
  assert(this.disposed === false, 0x803 /* double dispose */);
67
67
  this.disposed = true;
68
68
  this.clear();
69
- for (const unregister of this.eventUnregister) {
69
+ for (const unregister of this.onDispose) {
70
70
  unregister();
71
71
  }
72
- this.eventUnregister.length = 0;
72
+ this.onDispose.length = 0;
73
73
  const deleted = this.checkout.forest.anchors.slots.delete(ContextSlot);
74
74
  assert(deleted, 0x8c4 /* unexpected dispose */);
75
75
  }
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../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AAC;QAC/B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAChF,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACjF,CAAC;IAED;;;;;OAKG;IACH,IAAW,IAAI;QACd,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAE/D,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACvF,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACI,aAAa,CAAC,GAAkB,EAAE,MAA2B;QACnE,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAE/D,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC3D,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QACvD,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport { assert, debugAssert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype DetachedField,\n\ttype FieldKindIdentifier,\n\ttype ForestEvents,\n\ttype SchemaPolicy,\n\ttype TreeStoredSchema,\n\tanchorSlot,\n\tmoveToDetachedField,\n\trootField,\n} from \"../../core/index.js\";\nimport type { ITreeCheckout } from \"../../shared-tree/index.js\";\nimport { type IDisposable, disposeSymbol } from \"../../util/index.js\";\nimport type { NodeIdentifierManager } from \"../node-identifier/index.js\";\n\nimport type { FlexTreeField } from \"./flexTreeTypes.js\";\nimport type { LazyEntity } from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\n\n/**\n * Context for FlexTrees.\n */\nexport interface FlexTreeContext {\n\t/**\n\t * Schema used within this context.\n\t * All data must conform to these schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\n\t/**\n\t * SchemaPolicy used within this context.\n\t */\n\treadonly schemaPolicy: SchemaPolicy;\n\n\t/**\n\t * If true, this context is the canonical context instance for a given view,\n\t * and its schema include all schema from the document.\n\t *\n\t * If false, this context was created for use in a unhydrated tree, and the full document schema is unknown.\n\t */\n\tisHydrated(): this is FlexTreeHydratedContext;\n\n\t/**\n\t * If true, none of the nodes in this context can be used.\n\t */\n\tisDisposed(): boolean;\n}\n\n/**\n * Subset of a hydrated context which can be used in more cases (like before the root and events are set up).\n */\nexport interface FlexTreeHydratedContextMinimal {\n\t/**\n\t * The {@link NodeIdentifierManager} responsible for allocating and compressing identifiers for nodes in this context.\n\t */\n\treadonly nodeKeyManager: NodeIdentifierManager;\n\n\t/**\n\t * The checkout object associated with this context.\n\t */\n\treadonly checkout: ITreeCheckout;\n}\n\n/**\n * A common context of a \"forest\" of FlexTrees.\n * It handles group operations like transforming cursors into anchors for edits.\n */\nexport interface FlexTreeHydratedContext\n\textends FlexTreeContext,\n\t\tFlexTreeHydratedContextMinimal {\n\treadonly events: Listenable<ForestEvents>;\n\t/**\n\t * Gets the root field of the tree.\n\t */\n\tget root(): FlexTreeField;\n}\n\n/**\n * Creating multiple flex tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.\n * This slot is used to detect if one already exists and error if creating a second.\n */\nexport const ContextSlot = anchorSlot<Context>();\n\n/**\n * Implementation of `FlexTreeContext`.\n *\n * @remarks An editor is required to edit the FlexTree.\n *\n * A {@link FlexTreeContext} which is used to manage the cursors and anchors within the FlexTrees:\n * This is necessary for supporting using this tree across edits to the forest, and not leaking memory.\n *\n * This context and the trees it produces observe the kinds of fields from the schema\n */\nexport class Context implements FlexTreeHydratedContext, IDisposable {\n\tpublic readonly withCursors: Set<LazyEntity> = new Set();\n\tpublic readonly withAnchors: Set<LazyEntity> = new Set();\n\n\tprivate readonly eventUnregister: (() => void)[];\n\tprivate disposed = false;\n\n\t/**\n\t * Stores the last accessed version of the root.\n\t * @remarks\n\t * Anything which can delete this field must clear it.\n\t * Currently \"clear\" is the only case.\n\t */\n\tprivate lazyRootCache: FlexTreeField | undefined;\n\n\tpublic constructor(\n\t\tpublic readonly schemaPolicy: SchemaPolicy,\n\t\tpublic readonly checkout: ITreeCheckout,\n\t\t/**\n\t\t * An object which handles node key generation and conversion\n\t\t */\n\t\tpublic readonly nodeKeyManager: NodeIdentifierManager,\n\t) {\n\t\tthis.eventUnregister = [\n\t\t\tthis.checkout.forest.events.on(\"beforeChange\", () => {\n\t\t\t\tthis.prepareForEdit();\n\t\t\t}),\n\t\t];\n\n\t\tassert(\n\t\t\t!this.checkout.forest.anchors.slots.has(ContextSlot),\n\t\t\t0x92b /* Cannot create second flex-tree from checkout */,\n\t\t);\n\t\tthis.checkout.forest.anchors.slots.set(ContextSlot, this);\n\t}\n\n\tpublic isHydrated(): this is FlexTreeHydratedContext {\n\t\tdebugAssert(() => !this.disposed || \"Disposed\");\n\t\treturn true;\n\t}\n\n\tpublic isDisposed(): boolean {\n\t\treturn this.disposed;\n\t}\n\n\tpublic get schema(): TreeStoredSchema {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\t/**\n\t * Called before editing.\n\t * Clears all cursors so editing can proceed.\n\t */\n\tprivate prepareForEdit(): void {\n\t\tassert(this.disposed === false, 0x802 /* use after dispose */);\n\t\tfor (const target of this.withCursors) {\n\t\t\ttarget.prepareForEdit();\n\t\t}\n\t\tassert(this.withCursors.size === 0, 0x773 /* prepareForEdit should remove all cursors */);\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tassert(this.disposed === false, 0x803 /* double dispose */);\n\t\tthis.disposed = true;\n\t\tthis.clear();\n\t\tfor (const unregister of this.eventUnregister) {\n\t\t\tunregister();\n\t\t}\n\t\tthis.eventUnregister.length = 0;\n\n\t\tconst deleted = this.checkout.forest.anchors.slots.delete(ContextSlot);\n\t\tassert(deleted, 0x8c4 /* unexpected dispose */);\n\t}\n\n\t/**\n\t * Release any cursors and anchors held by tree entities created in this context.\n\t * @remarks\n\t * Ensures the cashed references to those entities on the Anchors are also cleared.\n\t * The tree entities are invalid to use after this, but the context may still be used\n\t * to create new trees starting from the root.\n\t */\n\tpublic clear(): void {\n\t\tfor (const target of this.withAnchors) {\n\t\t\ttarget[disposeSymbol]();\n\t\t}\n\t\tthis.lazyRootCache = undefined;\n\t\tassert(this.withCursors.size === 0, 0x774 /* free should remove all cursors */);\n\t\tassert(this.withAnchors.size === 0, 0x775 /* free should remove all anchors */);\n\t}\n\n\t/**\n\t * Gets the root field of the tree.\n\t * @remarks\n\t * This is a cached value: it should not be disposed by the accessor.\n\t * Like all other fields from this context, it will become invalid to use after {@link clear} is called or the {@link disposeSymbol} method is called.\n\t */\n\tpublic get root(): FlexTreeField {\n\t\tassert(this.disposed === false, 0x804 /* use after dispose */);\n\n\t\tthis.lazyRootCache ??= this.detachedField(rootField, this.schema.rootFieldSchema.kind);\n\t\treturn this.lazyRootCache;\n\t}\n\n\t/**\n\t * Returns a new {@link FlexTreeField} that will live as long as the caller allows up to the next call to {@link clear} or disposal of the context.\n\t * @remarks\n\t * Due to limited support for detached fields, not all operations are supported.\n\t * Additionally if the detached field's content is deleted, the field will become out of schema if it is required: it must not be used after that point.\n\t */\n\tpublic detachedField(key: DetachedField, schema: FieldKindIdentifier): FlexTreeField {\n\t\tassert(this.disposed === false, 0xb9c /* use after dispose */);\n\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"root\");\n\t\tmoveToDetachedField(this.checkout.forest, cursor, key);\n\t\tconst field = makeField(this, schema, cursor);\n\t\tcursor.free();\n\t\treturn field;\n\t}\n\n\tpublic get events(): Listenable<ForestEvents> {\n\t\treturn this.checkout.forest.events;\n\t}\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAMN,UAAU,EACV,mBAAmB,EACnB,SAAS,GACT,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAoB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKtE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AA4D3C;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,EAAW,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,OAAO,OAAO;IAoBnB,YACiB,YAA0B,EAC1B,QAAuB;IACvC;;OAEG;IACa,cAAqC;QALrC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,aAAQ,GAAR,QAAQ,CAAe;QAIvB,mBAAc,GAAd,cAAc,CAAuB;QAzBtC,gBAAW,GAAoB,IAAI,GAAG,EAAE,CAAC;QACzC,gBAAW,GAAoB,IAAI,GAAG,EAAE,CAAC;QAQjD,aAAQ,GAAG,KAAK,CAAC;QAkBxB,IAAI,CAAC,SAAS,GAAG;YAChB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;gBACnD,IAAI,CAAC,cAAc,EAAE,CAAC;YACvB,CAAC,CAAC;SACF,CAAC;QAEF,MAAM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AAC,CAAC;QAC9C,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport { assert, debugAssert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype DetachedField,\n\ttype FieldKindIdentifier,\n\ttype ForestEvents,\n\ttype SchemaPolicy,\n\ttype TreeStoredSchema,\n\tanchorSlot,\n\tmoveToDetachedField,\n\trootField,\n} from \"../../core/index.js\";\nimport type { ITreeCheckout } from \"../../shared-tree/index.js\";\nimport { type IDisposable, disposeSymbol } from \"../../util/index.js\";\nimport type { NodeIdentifierManager } from \"../node-identifier/index.js\";\n\nimport type { FlexTreeField } from \"./flexTreeTypes.js\";\nimport type { LazyEntity } from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\n\n/**\n * Context for FlexTrees.\n */\nexport interface FlexTreeContext {\n\t/**\n\t * Schema used within this context.\n\t * All data must conform to these schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\n\t/**\n\t * SchemaPolicy used within this context.\n\t */\n\treadonly schemaPolicy: SchemaPolicy;\n\n\t/**\n\t * If true, this context is the canonical context instance for a given view,\n\t * and its schema include all schema from the document.\n\t *\n\t * If false, this context was created for use in a unhydrated tree, and the full document schema is unknown.\n\t */\n\tisHydrated(): this is FlexTreeHydratedContext;\n\n\t/**\n\t * If true, none of the nodes in this context can be used.\n\t */\n\tisDisposed(): boolean;\n}\n\n/**\n * Subset of a hydrated context which can be used in more cases (like before the root and events are set up).\n */\nexport interface FlexTreeHydratedContextMinimal {\n\t/**\n\t * The {@link NodeIdentifierManager} responsible for allocating and compressing identifiers for nodes in this context.\n\t */\n\treadonly nodeKeyManager: NodeIdentifierManager;\n\n\t/**\n\t * The checkout object associated with this context.\n\t */\n\treadonly checkout: ITreeCheckout;\n}\n\n/**\n * A common context of a \"forest\" of FlexTrees.\n * It handles group operations like transforming cursors into anchors for edits.\n */\nexport interface FlexTreeHydratedContext\n\textends FlexTreeContext,\n\t\tFlexTreeHydratedContextMinimal {\n\treadonly events: Listenable<ForestEvents>;\n\t/**\n\t * Gets the root field of the tree.\n\t */\n\tget root(): FlexTreeField;\n}\n\n/**\n * Creating multiple flex tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.\n * This slot is used to detect if one already exists and error if creating a second.\n */\nexport const ContextSlot = anchorSlot<Context>();\n\n/**\n * Implementation of `FlexTreeHydratedContext`.\n *\n * @remarks An editor is required to edit the FlexTree.\n *\n * A {@link FlexTreeContext} which is used to manage the cursors and anchors within the FlexTrees:\n * This is necessary for supporting using this tree across edits to the forest, and not leaking memory.\n *\n * This context and the trees it produces observe the kinds of fields from the schema\n */\nexport class Context implements FlexTreeHydratedContext, IDisposable {\n\tpublic readonly withCursors: Set<LazyEntity> = new Set();\n\tpublic readonly withAnchors: Set<LazyEntity> = new Set();\n\n\t/**\n\t * Callbacks to run when disposing.\n\t *\n\t * Mainly event un-registration.\n\t */\n\tprivate readonly onDispose: (() => void)[];\n\tprivate disposed = false;\n\n\t/**\n\t * Stores the last accessed version of the root.\n\t * @remarks\n\t * Anything which can delete this field must clear it.\n\t * Currently \"clear\" is the only case.\n\t */\n\tprivate lazyRootCache: FlexTreeField | undefined;\n\n\tpublic constructor(\n\t\tpublic readonly schemaPolicy: SchemaPolicy,\n\t\tpublic readonly checkout: ITreeCheckout,\n\t\t/**\n\t\t * An object which handles node key generation and conversion\n\t\t */\n\t\tpublic readonly nodeKeyManager: NodeIdentifierManager,\n\t) {\n\t\tthis.onDispose = [\n\t\t\tthis.checkout.forest.events.on(\"beforeChange\", () => {\n\t\t\t\tthis.prepareForEdit();\n\t\t\t}),\n\t\t];\n\n\t\tassert(\n\t\t\t!this.checkout.forest.anchors.slots.has(ContextSlot),\n\t\t\t0x92b /* Cannot create second flex-tree from checkout */,\n\t\t);\n\t\tthis.checkout.forest.anchors.slots.set(ContextSlot, this);\n\t}\n\n\tpublic isHydrated(): this is FlexTreeHydratedContext {\n\t\tdebugAssert(() => !this.disposed || \"Disposed\");\n\t\treturn true;\n\t}\n\n\tpublic isDisposed(): boolean {\n\t\treturn this.disposed;\n\t}\n\n\tpublic get schema(): TreeStoredSchema {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\t/**\n\t * Called before editing.\n\t * Clears all cursors so editing can proceed.\n\t */\n\tprivate prepareForEdit(): void {\n\t\tassert(this.disposed === false, 0x802 /* use after dispose */);\n\t\tfor (const target of this.withCursors) {\n\t\t\ttarget.prepareForEdit();\n\t\t}\n\t\tassert(this.withCursors.size === 0, 0x773 /* prepareForEdit should remove all cursors */);\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tassert(this.disposed === false, 0x803 /* double dispose */);\n\t\tthis.disposed = true;\n\t\tthis.clear();\n\t\tfor (const unregister of this.onDispose) {\n\t\t\tunregister();\n\t\t}\n\t\tthis.onDispose.length = 0;\n\n\t\tconst deleted = this.checkout.forest.anchors.slots.delete(ContextSlot);\n\t\tassert(deleted, 0x8c4 /* unexpected dispose */);\n\t}\n\n\t/**\n\t * Release any cursors and anchors held by tree entities created in this context.\n\t * @remarks\n\t * Ensures the cashed references to those entities on the Anchors are also cleared.\n\t * The tree entities are invalid to use after this, but the context may still be used\n\t * to create new trees starting from the root.\n\t */\n\tpublic clear(): void {\n\t\tfor (const target of this.withAnchors) {\n\t\t\ttarget[disposeSymbol]();\n\t\t}\n\t\tthis.lazyRootCache = undefined;\n\t\tassert(this.withCursors.size === 0, 0x774 /* free should remove all cursors */);\n\t\tassert(this.withAnchors.size === 0, 0x775 /* free should remove all anchors */);\n\t}\n\n\t/**\n\t * Gets the root field of the tree.\n\t * @remarks\n\t * This is a cached value: it should not be disposed by the accessor.\n\t * Like all other fields from this context, it will become invalid to use after {@link clear} is called or the {@link disposeSymbol} method is called.\n\t */\n\tpublic get root(): FlexTreeField {\n\t\tassert(this.disposed === false, 0x804 /* use after dispose */);\n\n\t\tthis.lazyRootCache ??= this.detachedField(rootField, this.schema.rootFieldSchema.kind);\n\t\treturn this.lazyRootCache;\n\t}\n\n\t/**\n\t * Returns a new {@link FlexTreeField} that will live as long as the caller allows up to the next call to {@link clear} or disposal of the context.\n\t * @remarks\n\t * Due to limited support for detached fields, not all operations are supported.\n\t * Additionally if the detached field's content is deleted, the field will become out of schema if it is required: it must not be used after that point.\n\t */\n\tpublic detachedField(key: DetachedField, schema: FieldKindIdentifier): FlexTreeField {\n\t\tassert(this.disposed === false, 0xb9c /* use after dispose */);\n\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"root\");\n\t\tmoveToDetachedField(this.checkout.forest, cursor, key);\n\t\tconst field = makeField(this, schema, cursor);\n\t\tcursor.free();\n\t\treturn field;\n\t}\n\n\tpublic get events(): Listenable<ForestEvents> {\n\t\treturn this.checkout.forest.events;\n\t}\n}\n"]}
@@ -6,6 +6,7 @@ export { type FlexTreeField, type FlexTreeNode, type FlexTreeEntity, type FlexTr
6
6
  export { type FlexTreeContext, type FlexTreeHydratedContext, Context, ContextSlot, type FlexTreeHydratedContextMinimal, } from "./context.js";
7
7
  export { type FlexTreeNodeEvents } from "./treeEvents.js";
8
8
  export { assertFlexTreeEntityNotFreed, LazyEntity, } from "./lazyEntity.js";
9
+ export { getOrCreateHydratedFlexTreeNode } from "./lazyNode.js";
9
10
  export { getSchemaAndPolicy, indexForAt } from "./utilities.js";
10
11
  export { treeStatusFromAnchorCache } from "./utilities.js";
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,UAAU,EACV,KAAK,sBAAsB,EAC3B,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GACzB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,OAAO,EACP,WAAW,EACX,KAAK,8BAA8B,GACnC,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EACN,4BAA4B,EAC5B,UAAU,GACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,UAAU,EACV,KAAK,sBAAsB,EAC3B,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GACzB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,OAAO,EACP,WAAW,EACX,KAAK,8BAA8B,GACnC,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EACN,4BAA4B,EAC5B,UAAU,GACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -5,6 +5,7 @@
5
5
  export { TreeStatus, flexTreeMarker, FlexTreeEntityKind, isFlexTreeNode, flexTreeSlot, } from "./flexTreeTypes.js";
6
6
  export { Context, ContextSlot, } from "./context.js";
7
7
  export { assertFlexTreeEntityNotFreed, LazyEntity, } from "./lazyEntity.js";
8
+ export { getOrCreateHydratedFlexTreeNode } from "./lazyNode.js";
8
9
  export { getSchemaAndPolicy, indexForAt } from "./utilities.js";
9
10
  export { treeStatusFromAnchorCache } from "./utilities.js";
10
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAQN,UAAU,EAEV,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,YAAY,GAIZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAGN,OAAO,EACP,WAAW,GAEX,MAAM,cAAc,CAAC;AAItB,OAAO,EACN,4BAA4B,EAC5B,UAAU,GACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeEntity,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\tTreeStatus,\n\ttype FlexTreeUnknownUnboxed,\n\tflexTreeMarker,\n\tFlexTreeEntityKind,\n\tisFlexTreeNode,\n\tflexTreeSlot,\n\ttype FlexibleNodeContent,\n\ttype FlexibleFieldContent,\n\ttype HydratedFlexTreeNode,\n} from \"./flexTreeTypes.js\";\n\nexport {\n\ttype FlexTreeContext,\n\ttype FlexTreeHydratedContext,\n\tContext,\n\tContextSlot,\n\ttype FlexTreeHydratedContextMinimal,\n} from \"./context.js\";\n\nexport { type FlexTreeNodeEvents } from \"./treeEvents.js\";\n\nexport {\n\tassertFlexTreeEntityNotFreed,\n\tLazyEntity,\n} from \"./lazyEntity.js\";\n\nexport { getSchemaAndPolicy, indexForAt } from \"./utilities.js\";\n\nexport { treeStatusFromAnchorCache } from \"./utilities.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAQN,UAAU,EAEV,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,YAAY,GAIZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAGN,OAAO,EACP,WAAW,GAEX,MAAM,cAAc,CAAC;AAItB,OAAO,EACN,4BAA4B,EAC5B,UAAU,GACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeEntity,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\tTreeStatus,\n\ttype FlexTreeUnknownUnboxed,\n\tflexTreeMarker,\n\tFlexTreeEntityKind,\n\tisFlexTreeNode,\n\tflexTreeSlot,\n\ttype FlexibleNodeContent,\n\ttype FlexibleFieldContent,\n\ttype HydratedFlexTreeNode,\n} from \"./flexTreeTypes.js\";\n\nexport {\n\ttype FlexTreeContext,\n\ttype FlexTreeHydratedContext,\n\tContext,\n\tContextSlot,\n\ttype FlexTreeHydratedContextMinimal,\n} from \"./context.js\";\n\nexport { type FlexTreeNodeEvents } from \"./treeEvents.js\";\n\nexport {\n\tassertFlexTreeEntityNotFreed,\n\tLazyEntity,\n} from \"./lazyEntity.js\";\n\nexport { getOrCreateHydratedFlexTreeNode } from \"./lazyNode.js\";\n\nexport { getSchemaAndPolicy, indexForAt } from \"./utilities.js\";\n\nexport { treeStatusFromAnchorCache } from \"./utilities.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"lazyField.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyField.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAGN,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EAKzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAGN,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACN,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,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eAAe,CAC9B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,WAAW,GACtB,sBAAsB,CA8BxB"}
@@ -10,7 +10,7 @@ import { FieldKinds, MappedEditBuilder, } from "../default-schema/index.js";
10
10
  import { cursorForMapTreeField } from "../mapTreeCursor.js";
11
11
  import { FlexTreeEntityKind, TreeStatus, flexTreeMarker, flexTreeSlot, } from "./flexTreeTypes.js";
12
12
  import { LazyEntity } from "./lazyEntity.js";
13
- import { makeTree } from "./lazyNode.js";
13
+ import { getOrCreateHydratedFlexTreeNode } from "./lazyNode.js";
14
14
  import { indexForAt, treeStatusFromAnchorCache } from "./utilities.js";
15
15
  /**
16
16
  * Reuse fields.
@@ -88,7 +88,7 @@ export class LazyField extends LazyEntity {
88
88
  }
89
89
  const cursor = this.cursor;
90
90
  cursor.exitField();
91
- const output = makeTree(this.context, cursor);
91
+ const output = getOrCreateHydratedFlexTreeNode(this.context, cursor);
92
92
  cursor.enterField(this.key);
93
93
  return output;
94
94
  }
@@ -112,13 +112,13 @@ export class LazyField extends LazyEntity {
112
112
  if (finalIndex === undefined) {
113
113
  return undefined;
114
114
  }
115
- return inCursorNode(this.cursor, finalIndex, (cursor) => makeTree(this.context, cursor));
115
+ return inCursorNode(this.cursor, finalIndex, (cursor) => getOrCreateHydratedFlexTreeNode(this.context, cursor));
116
116
  }
117
117
  map(callbackfn) {
118
118
  return mapCursorField(this.cursor, (cursor) => callbackfn(unboxedFlexNode(this.context, cursor, this.anchor), cursor.fieldIndex));
119
119
  }
120
120
  [Symbol.iterator]() {
121
- return iterateCursorField(this.cursor, (cursor) => makeTree(this.context, cursor));
121
+ return iterateCursorField(this.cursor, (cursor) => getOrCreateHydratedFlexTreeNode(this.context, cursor));
122
122
  }
123
123
  getFieldPath() {
124
124
  return { parent: this.parent?.anchorNode, field: this.key };
@@ -226,7 +226,7 @@ export function unboxedFlexNode(context, cursor, fieldAnchor) {
226
226
  return value;
227
227
  }
228
228
  // Try accessing cached child node via anchors.
229
- // This avoids O(depth) related costs from makeTree in the cached case.
229
+ // This avoids O(depth) related costs from getOrCreateHydratedFlexTreeNode in the cached case.
230
230
  const anchor = fieldAnchor.parent;
231
231
  let child;
232
232
  if (anchor !== undefined) {
@@ -247,6 +247,6 @@ export function unboxedFlexNode(context, cursor, fieldAnchor) {
247
247
  return cached;
248
248
  }
249
249
  }
250
- return makeTree(context, cursor);
250
+ return getOrCreateHydratedFlexTreeNode(context, cursor);
251
251
  }
252
252
  //# sourceMappingURL=lazyField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lazyField.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyField.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,EAWN,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,YAAY,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EACN,UAAU,EACV,iBAAiB,GAKjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAI5D,OAAO,EACN,kBAAkB,EAUlB,UAAU,EACV,cAAc,EACd,YAAY,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAqB,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAEvE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,GAAwD,IAAI,OAAO,EAAE,CAAC;AAEtF,MAAM,UAAU,SAAS,CACxB,OAAgB,EAChB,MAA2B,EAC3B,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,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC7C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,MAAM,CAAC;QACf,CAAC;IACF,CAAC;IAED,OAAO,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAClC,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 {\n\ttype AnchorNode,\n\tCursorLocationType,\n\ttype ExclusiveMapTree,\n\ttype FieldAnchor,\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype ITreeCursorSynchronous,\n\ttype ITreeSubscriptionCursor,\n\ttype NormalizedFieldUpPath,\n\ttype TreeNavigationResult,\n\tinCursorNode,\n\titerateCursorField,\n\tmapCursorField,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport { disposeSymbol, getOrCreate } from \"../../util/index.js\";\nimport {\n\tFieldKinds,\n\tMappedEditBuilder,\n\ttype IDefaultEditBuilder,\n\ttype OptionalFieldEditBuilder,\n\ttype SequenceFieldEditBuilder,\n\ttype ValueFieldEditBuilder,\n} from \"../default-schema/index.js\";\nimport { cursorForMapTreeField } from \"../mapTreeCursor.js\";\nimport type { FlexFieldKind } from \"../modular-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport {\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeUnknownUnboxed,\n\ttype FlexibleFieldContent,\n\ttype FlexibleNodeContent,\n\ttype HydratedFlexTreeNode,\n\tTreeStatus,\n\tflexTreeMarker,\n\tflexTreeSlot,\n} from \"./flexTreeTypes.js\";\nimport { LazyEntity } from \"./lazyEntity.js\";\nimport { type LazyTreeNode, makeTree } from \"./lazyNode.js\";\nimport { indexForAt, treeStatusFromAnchorCache } from \"./utilities.js\";\n\n/**\n * Reuse fields.\n * Since field currently own cursors and register themselves for disposal when the node hit end of life,\n * not reusing them results in memory leaks every time the field is accessed.\n * Since the fields stay alive until the node is end of life reusing them this way is safe.\n *\n * This ins't a perfect solution:\n *\n * - This can cause leaks, like map nodes will keep all accessed field objects around. Since other things cause this same leak already, its not too bad.\n * - This does not cache the root.\n * - Finding the parent anchor to do the caching on has significant cost.\n *\n * Despite these limitations, this cache provides a large performance win in some common cases (over 10x), especially with how simple tree requests far more field objects than necessary currently.\n */\nconst fieldCache: WeakMap<LazyTreeNode, Map<FieldKey, FlexTreeField>> = new WeakMap();\n\nexport function makeField(\n\tcontext: Context,\n\tschema: FieldKindIdentifier,\n\tcursor: ITreeSubscriptionCursor,\n): FlexTreeField {\n\tconst fieldAnchor = cursor.buildFieldAnchor();\n\tlet usedAnchor = false;\n\n\tconst makeFlexTreeField = (): FlexTreeField => {\n\t\tusedAnchor = true;\n\t\tconst field = new (\n\t\t\tkindToClass.get(schema) ?? fail(0xb0f /* missing field implementation */)\n\t\t)(context, schema, cursor, fieldAnchor);\n\t\treturn field;\n\t};\n\n\tif (fieldAnchor.parent === undefined) {\n\t\treturn makeFlexTreeField();\n\t}\n\n\t// For the common case (all but roots), cache field associated with its node's anchor and field key.\n\tconst anchorNode =\n\t\tcontext.checkout.forest.anchors.locate(fieldAnchor.parent) ??\n\t\tfail(0xb10 /* missing anchor */);\n\n\t// Since anchor-set could be reused across a flex tree context getting disposed, key off the flex tree node not the anchor.\n\tconst cacheKey = anchorNode.slots.get(flexTreeSlot);\n\n\t// If there is no flex tree parent node, skip caching: this is not expected to be a hot path, but should probably be fixed at some point.\n\tif (cacheKey === undefined) {\n\t\treturn makeFlexTreeField();\n\t}\n\n\tconst innerCache = getOrCreate(\n\t\tfieldCache,\n\t\tcacheKey,\n\t\t() => new Map<FieldKey, FlexTreeField>(),\n\t);\n\tconst result = getOrCreate(innerCache, fieldAnchor.fieldKey, makeFlexTreeField);\n\tif (!usedAnchor) {\n\t\t// The anchor must be disposed to avoid leaking. In the case of a cache hit,\n\t\t// we are not transferring ownership to a new FlexTreeField, so it must be disposed of here to avoid the leak.\n\t\tcontext.checkout.forest.anchors.forget(fieldAnchor.parent);\n\t}\n\treturn result;\n}\n\n/**\n * Base type for fields implementing {@link FlexTreeField} using cursors.\n */\nexport abstract class LazyField extends LazyEntity<FieldAnchor> implements FlexTreeField {\n\tpublic get [flexTreeMarker](): FlexTreeEntityKind.Field {\n\t\treturn FlexTreeEntityKind.Field;\n\t}\n\tpublic readonly key: FieldKey;\n\n\t/**\n\t * If this field ends its lifetime before the Anchor does, this needs to be invoked to avoid a double free\n\t * if/when the Anchor is destroyed.\n\t */\n\tprivate readonly offAfterDestroy?: () => void;\n\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tpublic readonly schema: FieldKindIdentifier,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tfieldAnchor: FieldAnchor,\n\t) {\n\t\tsuper(context, cursor, fieldAnchor);\n\t\tassert(cursor.mode === CursorLocationType.Fields, 0x77b /* must be in fields mode */);\n\t\tthis.key = cursor.getFieldKey();\n\t\t// Fields currently live as long as their parent does.\n\t\t// For root fields, this means forever, but other cases can be cleaned up when their parent anchor is deleted.\n\t\tif (fieldAnchor.parent !== undefined) {\n\t\t\tconst anchorNode =\n\t\t\t\tcontext.checkout.forest.anchors.locate(fieldAnchor.parent) ??\n\t\t\t\tfail(0xb11 /* parent anchor node should always exist since field is under a node */);\n\t\t\tthis.offAfterDestroy = anchorNode.events.on(\"afterDestroy\", () => {\n\t\t\t\tthis[disposeSymbol]();\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic is<TKind2 extends FlexFieldKind>(kind: TKind2): this is FlexTreeTypedField<TKind2> {\n\t\tassert(\n\t\t\tthis.context.schemaPolicy.fieldKinds.get(kind.identifier) === kind,\n\t\t\t0xa26 /* Narrowing must be done to a kind that exists in this context */,\n\t\t);\n\n\t\treturn this.schema === kind.identifier;\n\t}\n\n\tpublic get parent(): HydratedFlexTreeNode | undefined {\n\t\tif (this.anchor.parent === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst cursor = this.cursor;\n\t\tcursor.exitField();\n\t\tconst output = makeTree(this.context, cursor);\n\t\tcursor.enterField(this.key);\n\t\treturn output;\n\t}\n\n\tprotected override tryMoveCursorToAnchor(\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.context.checkout.forest.tryMoveCursorToField(this.anchor, cursor);\n\t}\n\n\tprotected override forgetAnchor(): void {\n\t\tthis.offAfterDestroy?.();\n\t\tif (this.anchor.parent === undefined) return;\n\t\tthis.context.checkout.forest.anchors.forget(this.anchor.parent);\n\t}\n\n\tpublic get length(): number {\n\t\treturn this.cursor.getFieldLength();\n\t}\n\n\tpublic atIndex(index: number): FlexTreeUnknownUnboxed {\n\t\treturn inCursorNode(this.cursor, index, (cursor) =>\n\t\t\tunboxedFlexNode(this.context, cursor, this.anchor),\n\t\t);\n\t}\n\n\tpublic boxedAt(index: number): HydratedFlexTreeNode | undefined {\n\t\tconst finalIndex = indexForAt(index, this.length);\n\n\t\tif (finalIndex === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn inCursorNode(this.cursor, finalIndex, (cursor) => makeTree(this.context, cursor));\n\t}\n\n\tpublic map<U>(callbackfn: (value: FlexTreeUnknownUnboxed, index: number) => U): U[] {\n\t\treturn mapCursorField(this.cursor, (cursor) =>\n\t\t\tcallbackfn(unboxedFlexNode(this.context, cursor, this.anchor), cursor.fieldIndex),\n\t\t);\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<HydratedFlexTreeNode> {\n\t\treturn iterateCursorField(this.cursor, (cursor) => makeTree(this.context, cursor));\n\t}\n\n\tpublic getFieldPath(): NormalizedFieldUpPath {\n\t\treturn { parent: this.parent?.anchorNode, field: this.key };\n\t}\n\n\t/**\n\t * Returns the path to this field to use for editing. Throws iff this path is not {@link TreeStatus#InDocument}.\n\t * This path is not valid to hold onto across edits: this must be recalled for each edit.\n\t */\n\tpublic getFieldPathForEditing(): NormalizedFieldUpPath {\n\t\tif (!this.isFreed()) {\n\t\t\tif (\n\t\t\t\t// Only allow editing if we are the root document field...\n\t\t\t\t(this.parent === undefined && this.anchor.fieldKey === rootFieldKey) ||\n\t\t\t\t// ...or are under a node in the document\n\t\t\t\t(this.parent !== undefined &&\n\t\t\t\t\ttreeStatusFromAnchorCache(this.parent.anchorNode) === TreeStatus.InDocument)\n\t\t\t) {\n\t\t\t\treturn this.getFieldPath();\n\t\t\t}\n\t\t}\n\n\t\tthrow new UsageError(\"Editing only allowed on fields with TreeStatus.InDocument status\");\n\t}\n\n\tprotected getEditor(): IDefaultEditBuilder<ITreeCursorSynchronous> {\n\t\treturn new MappedEditBuilder(\n\t\t\tthis.context.checkout.editor,\n\t\t\t(cursor: ITreeCursorSynchronous) => this.context.checkout.forest.chunkField(cursor),\n\t\t);\n\t}\n}\n\nexport class LazySequence extends LazyField implements FlexTreeSequenceField {\n\tpublic at(index: number): FlexTreeUnknownUnboxed | undefined {\n\t\tconst finalIndex = indexForAt(index, this.length);\n\n\t\tif (finalIndex === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn this.atIndex(finalIndex);\n\t}\n\tpublic get asArray(): readonly FlexTreeUnknownUnboxed[] {\n\t\treturn this.map((x) => x);\n\t}\n\n\tpublic editor: SequenceFieldEditBuilder<FlexibleFieldContent> = {\n\t\tinsert: (index, newContent) => {\n\t\t\tthis.sequenceEditor().insert(index, cursorForMapTreeField(newContent));\n\t\t},\n\t\tremove: (index, count) => {\n\t\t\tthis.sequenceEditor().remove(index, count);\n\t\t},\n\t};\n\n\tprivate sequenceEditor(): SequenceFieldEditBuilder<ITreeCursorSynchronous> {\n\t\tconst fieldPath = this.getFieldPathForEditing();\n\t\treturn this.getEditor().sequenceField(fieldPath);\n\t}\n}\n\nexport class LazyValueField extends LazyField implements FlexTreeRequiredField {\n\tpublic editor: ValueFieldEditBuilder<FlexibleNodeContent> = {\n\t\tset: (newContent) => {\n\t\t\tthis.valueFieldEditor().set(cursorForMapTreeField([newContent]));\n\t\t},\n\t};\n\n\tprivate valueFieldEditor(): ValueFieldEditBuilder<ITreeCursorSynchronous> {\n\t\tconst fieldPath = this.getFieldPathForEditing();\n\t\tconst fieldEditor = this.getEditor().valueField(fieldPath);\n\t\treturn fieldEditor;\n\t}\n\n\tpublic get content(): FlexTreeUnknownUnboxed {\n\t\treturn this.atIndex(0);\n\t}\n}\n\nexport class LazyOptionalField extends LazyField implements FlexTreeOptionalField {\n\tpublic editor: OptionalFieldEditBuilder<ExclusiveMapTree> = {\n\t\tset: (newContent, wasEmpty) => {\n\t\t\tthis.optionalEditor().set(\n\t\t\t\tnewContent !== undefined ? cursorForMapTreeField([newContent]) : newContent,\n\t\t\t\twasEmpty,\n\t\t\t);\n\t\t},\n\t};\n\n\tprivate optionalEditor(): OptionalFieldEditBuilder<ITreeCursorSynchronous> {\n\t\tconst fieldPath = this.getFieldPathForEditing();\n\t\tconst fieldEditor = this.getEditor().optionalField(fieldPath);\n\t\treturn fieldEditor;\n\t}\n\n\tpublic get content(): FlexTreeUnknownUnboxed | undefined {\n\t\treturn this.length === 0 ? undefined : this.atIndex(0);\n\t}\n}\n\nexport class LazyForbiddenField extends LazyField {}\n\ntype Builder = new (\n\tcontext: Context,\n\t// Correct use of these builders requires the builder of the matching type to be used.\n\tschema: FieldKindIdentifier,\n\tcursor: ITreeSubscriptionCursor,\n\tfieldAnchor: FieldAnchor,\n) => LazyField;\n\nconst builderList: [FieldKindIdentifier, Builder][] = [\n\t[FieldKinds.forbidden.identifier, LazyForbiddenField],\n\t[FieldKinds.optional.identifier, LazyOptionalField],\n\t[FieldKinds.sequence.identifier, LazySequence],\n\t[FieldKinds.required.identifier, LazyValueField],\n\t[FieldKinds.identifier.identifier, LazyValueField],\n];\n\nconst kindToClass: ReadonlyMap<FieldKindIdentifier, Builder> = new Map(builderList);\n\n/**\n * Returns the flex tree node, or the value if it has one.\n */\nexport function unboxedFlexNode(\n\tcontext: Context,\n\tcursor: ITreeSubscriptionCursor,\n\tfieldAnchor: FieldAnchor,\n): FlexTreeUnknownUnboxed {\n\tconst value = cursor.value;\n\tif (value !== undefined) {\n\t\treturn value;\n\t}\n\n\t// Try accessing cached child node via anchors.\n\t// This avoids O(depth) related costs from makeTree in the cached case.\n\tconst anchor = fieldAnchor.parent;\n\tlet child: AnchorNode | undefined;\n\tif (anchor !== undefined) {\n\t\tconst anchorNode = context.checkout.forest.anchors.locate(anchor);\n\t\tassert(anchorNode !== undefined, 0xa4c /* missing anchor */);\n\t\tchild = anchorNode.childIfAnchored(fieldAnchor.fieldKey, cursor.fieldIndex);\n\t} else {\n\t\tchild = context.checkout.forest.anchors.find({\n\t\t\tparent: undefined,\n\t\t\tparentField: fieldAnchor.fieldKey,\n\t\t\tparentIndex: cursor.fieldIndex,\n\t\t});\n\t}\n\n\tif (child !== undefined) {\n\t\tconst cached = child.slots.get(flexTreeSlot);\n\t\tif (cached !== undefined) {\n\t\t\treturn cached;\n\t\t}\n\t}\n\n\treturn makeTree(context, cursor);\n}\n"]}
1
+ {"version":3,"file":"lazyField.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyField.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,EAWN,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,YAAY,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EACN,UAAU,EACV,iBAAiB,GAKjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,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AoB,CAAC,CAAC;QAC7D,KAAK,GAAG,UAAU,CAAC,eAAe,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IAC7E,CAAC;SAAM,CAAC;QACP,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;YAC5C,MAAM,EAAE,SAAS;YACjB,WAAW,EAAE,WAAW,CAAC,QAAQ;YACjC,WAAW,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC7C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,MAAM,CAAC;QACf,CAAC;IACF,CAAC;IAED,OAAO,+BAA+B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACzD,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 {\n\ttype AnchorNode,\n\tCursorLocationType,\n\ttype ExclusiveMapTree,\n\ttype FieldAnchor,\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype ITreeCursorSynchronous,\n\ttype ITreeSubscriptionCursor,\n\ttype NormalizedFieldUpPath,\n\ttype TreeNavigationResult,\n\tinCursorNode,\n\titerateCursorField,\n\tmapCursorField,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport { disposeSymbol, getOrCreate } from \"../../util/index.js\";\nimport {\n\tFieldKinds,\n\tMappedEditBuilder,\n\ttype IDefaultEditBuilder,\n\ttype OptionalFieldEditBuilder,\n\ttype SequenceFieldEditBuilder,\n\ttype ValueFieldEditBuilder,\n} from \"../default-schema/index.js\";\nimport { cursorForMapTreeField } from \"../mapTreeCursor.js\";\nimport type { FlexFieldKind } from \"../modular-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport {\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeUnknownUnboxed,\n\ttype FlexibleFieldContent,\n\ttype FlexibleNodeContent,\n\ttype HydratedFlexTreeNode,\n\tTreeStatus,\n\tflexTreeMarker,\n\tflexTreeSlot,\n} from \"./flexTreeTypes.js\";\nimport { LazyEntity } from \"./lazyEntity.js\";\nimport { type LazyTreeNode, getOrCreateHydratedFlexTreeNode } from \"./lazyNode.js\";\nimport { indexForAt, treeStatusFromAnchorCache } from \"./utilities.js\";\n\n/**\n * Reuse fields.\n * Since field currently own cursors and register themselves for disposal when the node hit end of life,\n * not reusing them results in memory leaks every time the field is accessed.\n * Since the fields stay alive until the node is end of life reusing them this way is safe.\n *\n * This ins't a perfect solution:\n *\n * - This can cause leaks, like map nodes will keep all accessed field objects around. Since other things cause this same leak already, its not too bad.\n * - This does not cache the root.\n * - Finding the parent anchor to do the caching on has significant cost.\n *\n * Despite these limitations, this cache provides a large performance win in some common cases (over 10x), especially with how simple tree requests far more field objects than necessary currently.\n */\nconst fieldCache: WeakMap<LazyTreeNode, Map<FieldKey, FlexTreeField>> = new WeakMap();\n\nexport function makeField(\n\tcontext: Context,\n\tschema: FieldKindIdentifier,\n\tcursor: ITreeSubscriptionCursor,\n): FlexTreeField {\n\tconst fieldAnchor = cursor.buildFieldAnchor();\n\tlet usedAnchor = false;\n\n\tconst makeFlexTreeField = (): FlexTreeField => {\n\t\tusedAnchor = true;\n\t\tconst field = new (\n\t\t\tkindToClass.get(schema) ?? fail(0xb0f /* missing field implementation */)\n\t\t)(context, schema, cursor, fieldAnchor);\n\t\treturn field;\n\t};\n\n\tif (fieldAnchor.parent === undefined) {\n\t\treturn makeFlexTreeField();\n\t}\n\n\t// For the common case (all but roots), cache field associated with its node's anchor and field key.\n\tconst anchorNode =\n\t\tcontext.checkout.forest.anchors.locate(fieldAnchor.parent) ??\n\t\tfail(0xb10 /* missing anchor */);\n\n\t// Since anchor-set could be reused across a flex tree context getting disposed, key off the flex tree node not the anchor.\n\tconst cacheKey = anchorNode.slots.get(flexTreeSlot);\n\n\t// If there is no flex tree parent node, skip caching: this is not expected to be a hot path, but should probably be fixed at some point.\n\tif (cacheKey === undefined) {\n\t\treturn makeFlexTreeField();\n\t}\n\n\tconst innerCache = getOrCreate(\n\t\tfieldCache,\n\t\tcacheKey,\n\t\t() => new Map<FieldKey, FlexTreeField>(),\n\t);\n\tconst result = getOrCreate(innerCache, fieldAnchor.fieldKey, makeFlexTreeField);\n\tif (!usedAnchor) {\n\t\t// The anchor must be disposed to avoid leaking. In the case of a cache hit,\n\t\t// we are not transferring ownership to a new FlexTreeField, so it must be disposed of here to avoid the leak.\n\t\tcontext.checkout.forest.anchors.forget(fieldAnchor.parent);\n\t}\n\treturn result;\n}\n\n/**\n * Base type for fields implementing {@link FlexTreeField} using cursors.\n */\nexport abstract class LazyField extends LazyEntity<FieldAnchor> implements FlexTreeField {\n\tpublic get [flexTreeMarker](): FlexTreeEntityKind.Field {\n\t\treturn FlexTreeEntityKind.Field;\n\t}\n\tpublic readonly key: FieldKey;\n\n\t/**\n\t * If this field ends its lifetime before the Anchor does, this needs to be invoked to avoid a double free\n\t * if/when the Anchor is destroyed.\n\t */\n\tprivate readonly offAfterDestroy?: () => void;\n\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tpublic readonly schema: FieldKindIdentifier,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tfieldAnchor: FieldAnchor,\n\t) {\n\t\tsuper(context, cursor, fieldAnchor);\n\t\tassert(cursor.mode === CursorLocationType.Fields, 0x77b /* must be in fields mode */);\n\t\tthis.key = cursor.getFieldKey();\n\t\t// Fields currently live as long as their parent does.\n\t\t// For root fields, this means forever, but other cases can be cleaned up when their parent anchor is deleted.\n\t\tif (fieldAnchor.parent !== undefined) {\n\t\t\tconst anchorNode =\n\t\t\t\tcontext.checkout.forest.anchors.locate(fieldAnchor.parent) ??\n\t\t\t\tfail(0xb11 /* parent anchor node should always exist since field is under a node */);\n\t\t\tthis.offAfterDestroy = anchorNode.events.on(\"afterDestroy\", () => {\n\t\t\t\tthis[disposeSymbol]();\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic is<TKind2 extends FlexFieldKind>(kind: TKind2): this is FlexTreeTypedField<TKind2> {\n\t\tassert(\n\t\t\tthis.context.schemaPolicy.fieldKinds.get(kind.identifier) === kind,\n\t\t\t0xa26 /* Narrowing must be done to a kind that exists in this context */,\n\t\t);\n\n\t\treturn this.schema === kind.identifier;\n\t}\n\n\tpublic get parent(): HydratedFlexTreeNode | undefined {\n\t\tif (this.anchor.parent === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst cursor = this.cursor;\n\t\tcursor.exitField();\n\t\tconst output = getOrCreateHydratedFlexTreeNode(this.context, cursor);\n\t\tcursor.enterField(this.key);\n\t\treturn output;\n\t}\n\n\tprotected override tryMoveCursorToAnchor(\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.context.checkout.forest.tryMoveCursorToField(this.anchor, cursor);\n\t}\n\n\tprotected override forgetAnchor(): void {\n\t\tthis.offAfterDestroy?.();\n\t\tif (this.anchor.parent === undefined) return;\n\t\tthis.context.checkout.forest.anchors.forget(this.anchor.parent);\n\t}\n\n\tpublic get length(): number {\n\t\treturn this.cursor.getFieldLength();\n\t}\n\n\tpublic atIndex(index: number): FlexTreeUnknownUnboxed {\n\t\treturn inCursorNode(this.cursor, index, (cursor) =>\n\t\t\tunboxedFlexNode(this.context, cursor, this.anchor),\n\t\t);\n\t}\n\n\tpublic boxedAt(index: number): HydratedFlexTreeNode | undefined {\n\t\tconst finalIndex = indexForAt(index, this.length);\n\n\t\tif (finalIndex === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn inCursorNode(this.cursor, finalIndex, (cursor) =>\n\t\t\tgetOrCreateHydratedFlexTreeNode(this.context, cursor),\n\t\t);\n\t}\n\n\tpublic map<U>(callbackfn: (value: FlexTreeUnknownUnboxed, index: number) => U): U[] {\n\t\treturn mapCursorField(this.cursor, (cursor) =>\n\t\t\tcallbackfn(unboxedFlexNode(this.context, cursor, this.anchor), cursor.fieldIndex),\n\t\t);\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<HydratedFlexTreeNode> {\n\t\treturn iterateCursorField(this.cursor, (cursor) =>\n\t\t\tgetOrCreateHydratedFlexTreeNode(this.context, cursor),\n\t\t);\n\t}\n\n\tpublic getFieldPath(): NormalizedFieldUpPath {\n\t\treturn { parent: this.parent?.anchorNode, field: this.key };\n\t}\n\n\t/**\n\t * Returns the path to this field to use for editing. Throws iff this path is not {@link TreeStatus#InDocument}.\n\t * This path is not valid to hold onto across edits: this must be recalled for each edit.\n\t */\n\tpublic getFieldPathForEditing(): NormalizedFieldUpPath {\n\t\tif (!this.isFreed()) {\n\t\t\tif (\n\t\t\t\t// Only allow editing if we are the root document field...\n\t\t\t\t(this.parent === undefined && this.anchor.fieldKey === rootFieldKey) ||\n\t\t\t\t// ...or are under a node in the document\n\t\t\t\t(this.parent !== undefined &&\n\t\t\t\t\ttreeStatusFromAnchorCache(this.parent.anchorNode) === TreeStatus.InDocument)\n\t\t\t) {\n\t\t\t\treturn this.getFieldPath();\n\t\t\t}\n\t\t}\n\n\t\tthrow new UsageError(\"Editing only allowed on fields with TreeStatus.InDocument status\");\n\t}\n\n\tprotected getEditor(): IDefaultEditBuilder<ITreeCursorSynchronous> {\n\t\treturn new MappedEditBuilder(\n\t\t\tthis.context.checkout.editor,\n\t\t\t(cursor: ITreeCursorSynchronous) => this.context.checkout.forest.chunkField(cursor),\n\t\t);\n\t}\n}\n\nexport class LazySequence extends LazyField implements FlexTreeSequenceField {\n\tpublic at(index: number): FlexTreeUnknownUnboxed | undefined {\n\t\tconst finalIndex = indexForAt(index, this.length);\n\n\t\tif (finalIndex === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn this.atIndex(finalIndex);\n\t}\n\tpublic get asArray(): readonly FlexTreeUnknownUnboxed[] {\n\t\treturn this.map((x) => x);\n\t}\n\n\tpublic editor: SequenceFieldEditBuilder<FlexibleFieldContent> = {\n\t\tinsert: (index, newContent) => {\n\t\t\tthis.sequenceEditor().insert(index, cursorForMapTreeField(newContent));\n\t\t},\n\t\tremove: (index, count) => {\n\t\t\tthis.sequenceEditor().remove(index, count);\n\t\t},\n\t};\n\n\tprivate sequenceEditor(): SequenceFieldEditBuilder<ITreeCursorSynchronous> {\n\t\tconst fieldPath = this.getFieldPathForEditing();\n\t\treturn this.getEditor().sequenceField(fieldPath);\n\t}\n}\n\nexport class LazyValueField extends LazyField implements FlexTreeRequiredField {\n\tpublic editor: ValueFieldEditBuilder<FlexibleNodeContent> = {\n\t\tset: (newContent) => {\n\t\t\tthis.valueFieldEditor().set(cursorForMapTreeField([newContent]));\n\t\t},\n\t};\n\n\tprivate valueFieldEditor(): ValueFieldEditBuilder<ITreeCursorSynchronous> {\n\t\tconst fieldPath = this.getFieldPathForEditing();\n\t\tconst fieldEditor = this.getEditor().valueField(fieldPath);\n\t\treturn fieldEditor;\n\t}\n\n\tpublic get content(): FlexTreeUnknownUnboxed {\n\t\treturn this.atIndex(0);\n\t}\n}\n\nexport class LazyOptionalField extends LazyField implements FlexTreeOptionalField {\n\tpublic editor: OptionalFieldEditBuilder<ExclusiveMapTree> = {\n\t\tset: (newContent, wasEmpty) => {\n\t\t\tthis.optionalEditor().set(\n\t\t\t\tnewContent !== undefined ? cursorForMapTreeField([newContent]) : newContent,\n\t\t\t\twasEmpty,\n\t\t\t);\n\t\t},\n\t};\n\n\tprivate optionalEditor(): OptionalFieldEditBuilder<ITreeCursorSynchronous> {\n\t\tconst fieldPath = this.getFieldPathForEditing();\n\t\tconst fieldEditor = this.getEditor().optionalField(fieldPath);\n\t\treturn fieldEditor;\n\t}\n\n\tpublic get content(): FlexTreeUnknownUnboxed | undefined {\n\t\treturn this.length === 0 ? undefined : this.atIndex(0);\n\t}\n}\n\nexport class LazyForbiddenField extends LazyField {}\n\ntype Builder = new (\n\tcontext: Context,\n\t// Correct use of these builders requires the builder of the matching type to be used.\n\tschema: FieldKindIdentifier,\n\tcursor: ITreeSubscriptionCursor,\n\tfieldAnchor: FieldAnchor,\n) => LazyField;\n\nconst builderList: [FieldKindIdentifier, Builder][] = [\n\t[FieldKinds.forbidden.identifier, LazyForbiddenField],\n\t[FieldKinds.optional.identifier, LazyOptionalField],\n\t[FieldKinds.sequence.identifier, LazySequence],\n\t[FieldKinds.required.identifier, LazyValueField],\n\t[FieldKinds.identifier.identifier, LazyValueField],\n];\n\nconst kindToClass: ReadonlyMap<FieldKindIdentifier, Builder> = new Map(builderList);\n\n/**\n * Returns the flex tree node, or the value if it has one.\n */\nexport function unboxedFlexNode(\n\tcontext: Context,\n\tcursor: ITreeSubscriptionCursor,\n\tfieldAnchor: FieldAnchor,\n): FlexTreeUnknownUnboxed {\n\tconst value = cursor.value;\n\tif (value !== undefined) {\n\t\treturn value;\n\t}\n\n\t// Try accessing cached child node via anchors.\n\t// This avoids O(depth) related costs from getOrCreateHydratedFlexTreeNode in the cached case.\n\tconst anchor = fieldAnchor.parent;\n\tlet child: AnchorNode | undefined;\n\tif (anchor !== undefined) {\n\t\tconst anchorNode = context.checkout.forest.anchors.locate(anchor);\n\t\tassert(anchorNode !== undefined, 0xa4c /* missing anchor */);\n\t\tchild = anchorNode.childIfAnchored(fieldAnchor.fieldKey, cursor.fieldIndex);\n\t} else {\n\t\tchild = context.checkout.forest.anchors.find({\n\t\t\tparent: undefined,\n\t\t\tparentField: fieldAnchor.fieldKey,\n\t\t\tparentIndex: cursor.fieldIndex,\n\t\t});\n\t}\n\n\tif (child !== undefined) {\n\t\tconst cached = child.slots.get(flexTreeSlot);\n\t\tif (cached !== undefined) {\n\t\t\treturn cached;\n\t\t}\n\t}\n\n\treturn getOrCreateHydratedFlexTreeNode(context, cursor);\n}\n"]}
@@ -7,9 +7,11 @@ import type { Context } from "./context.js";
7
7
  import { FlexTreeEntityKind, type FlexTreeField, type HydratedFlexTreeNode, flexTreeMarker } from "./flexTreeTypes.js";
8
8
  import { LazyEntity } from "./lazyEntity.js";
9
9
  /**
10
+ * Get or create a {@link HydratedFlexTreeNode} for the given context at node indicated by the cursor.
11
+ * @remarks
10
12
  * This does not take ownership of this cursor: Node will fork it as needed.
11
13
  */
12
- export declare function makeTree(context: Context, cursor: ITreeSubscriptionCursor): LazyTreeNode;
14
+ export declare function getOrCreateHydratedFlexTreeNode(context: Context, cursor: ITreeSubscriptionCursor): HydratedFlexTreeNode;
13
15
  /**
14
16
  * Lazy implementation of {@link FlexTreeNode}.
15
17
  */
@@ -1 +1 @@
1
- {"version":3,"file":"lazyNode.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,MAAM,EACX,KAAK,UAAU,EAEf,KAAK,QAAQ,EAEb,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAE7B,KAAK,KAAK,EAIV,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACN,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,cAAc,EAEd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,uBAAuB,GAAG,YAAY,CAaxF;AASD;;GAEG;AACH,qBAAa,YAAa,SAAQ,UAAU,CAAC,MAAM,CAAE,YAAW,oBA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AAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CA8CnF;IAEM,IAAI,IAAI,gBAAgB,CAAC,QAAQ,CAAC;CAGzC"}
@@ -22,9 +22,11 @@ import { FlexTreeEntityKind, flexTreeMarker, flexTreeSlot, } from "./flexTreeTyp
22
22
  import { LazyEntity } from "./lazyEntity.js";
23
23
  import { makeField } from "./lazyField.js";
24
24
  /**
25
+ * Get or create a {@link HydratedFlexTreeNode} for the given context at node indicated by the cursor.
26
+ * @remarks
25
27
  * This does not take ownership of this cursor: Node will fork it as needed.
26
28
  */
27
- export function makeTree(context, cursor) {
29
+ export function getOrCreateHydratedFlexTreeNode(context, cursor) {
28
30
  const anchor = cursor.buildAnchor();
29
31
  const anchorNode = context.checkout.forest.anchors.locate(anchor) ??
30
32
  fail(0xb12 /* cursor should point to a node that is not the root of the AnchorSet */);
@@ -1 +1 @@
1
- {"version":3,"file":"lazyNode.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAEnE,OAAO,EAWN,aAAa,EACb,eAAe,EACf,YAAY,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGxD,OAAO,EACN,kBAAkB,EAGlB,cAAc,EACd,YAAY,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAgB,EAAE,MAA+B;IACzE,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,UAAU,GACf,OAAO,CA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CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,UAAU,GACf,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;gBAC9C,IAAI,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;YACxD,WAAW,GAAG,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACnD,CAAC;QAED,MAAM,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QACpE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAExB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;IAC1C,CAAC;IAEM,IAAI;QACV,OAAO,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;IAChF,CAAC;CACD","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\";\n\nimport {\n\ttype Anchor,\n\ttype AnchorNode,\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype ITreeSubscriptionCursor,\n\ttype TreeNavigationResult,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype Value,\n\tinCursorField,\n\tmapCursorFields,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport { disposeSymbol } from \"../../util/index.js\";\nimport { FieldKinds } from \"../default-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport {\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype HydratedFlexTreeNode,\n\tflexTreeMarker,\n\tflexTreeSlot,\n} from \"./flexTreeTypes.js\";\nimport { LazyEntity } from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\n\n/**\n * This does not take ownership of this cursor: Node will fork it as needed.\n */\nexport function makeTree(context: Context, cursor: ITreeSubscriptionCursor): LazyTreeNode {\n\tconst anchor = cursor.buildAnchor();\n\tconst anchorNode =\n\t\tcontext.checkout.forest.anchors.locate(anchor) ??\n\t\tfail(0xb12 /* cursor should point to a node that is not the root of the AnchorSet */);\n\tconst cached = anchorNode.slots.get(flexTreeSlot);\n\tif (cached !== undefined) {\n\t\tcontext.checkout.forest.anchors.forget(anchor);\n\t\tassert(cached.context === context, 0x782 /* contexts must match */);\n\t\tassert(cached instanceof LazyTreeNode, 0x92c /* Expected LazyTreeNode */);\n\t\treturn cached;\n\t}\n\treturn new LazyTreeNode(context, cursor.type, cursor, anchorNode, anchor);\n}\n\nfunction cleanupTree(anchor: AnchorNode): void {\n\tconst cached =\n\t\tanchor.slots.get(flexTreeSlot) ?? fail(0xb13 /* tree should only be cleaned up once */);\n\tassert(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);\n\tcached[disposeSymbol]();\n}\n\n/**\n * Lazy implementation of {@link FlexTreeNode}.\n */\nexport class LazyTreeNode extends LazyEntity<Anchor> implements HydratedFlexTreeNode {\n\tpublic get [flexTreeMarker](): FlexTreeEntityKind.Node {\n\t\treturn FlexTreeEntityKind.Node;\n\t}\n\n\t// Using JS private here prevents it from showing up as a enumerable own property, or conflicting with struct fields.\n\treadonly #removeDeleteCallback: () => void;\n\n\tprivate readonly storedSchema: TreeNodeStoredSchema;\n\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tpublic readonly type: TreeNodeSchemaIdentifier,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tpublic readonly anchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, cursor, anchor);\n\t\tthis.storedSchema =\n\t\t\tcontext.schema.nodeSchema.get(this.type) ?? fail(0xb14 /* missing schema */);\n\t\tassert(cursor.mode === CursorLocationType.Nodes, 0x783 /* must be in nodes mode */);\n\t\tanchorNode.slots.set(flexTreeSlot, this);\n\t\tthis.#removeDeleteCallback = anchorNode.events.on(\"afterDestroy\", cleanupTree);\n\t}\n\n\tpublic isHydrated(): this is HydratedFlexTreeNode {\n\t\treturn true;\n\t}\n\n\tprotected override tryMoveCursorToAnchor(\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.context.checkout.forest.tryMoveCursorToNode(this.anchor, cursor);\n\t}\n\n\tprotected override forgetAnchor(): void {\n\t\t// This type unconditionally has an anchor, so `forgetAnchor` is always called and cleanup can be done here:\n\t\t// After this point this node will not be usable,\n\t\t// so remove it from the anchor incase a different context (or the same context later) uses this AnchorSet.\n\t\tthis.anchorNode.slots.delete(flexTreeSlot);\n\t\tthis.#removeDeleteCallback();\n\t\tthis.context.checkout.forest.anchors.forget(this.anchor);\n\t}\n\n\tpublic get value(): Value {\n\t\treturn this.cursor.value;\n\t}\n\n\tpublic readonly fields: Pick<Map<FieldKey, FlexTreeField>, typeof Symbol.iterator | \"get\"> =\n\t\t{\n\t\t\tget: (key: FieldKey): FlexTreeField | undefined => this.tryGetField(key),\n\t\t\t[Symbol.iterator]: (): IterableIterator<[FieldKey, FlexTreeField]> =>\n\t\t\t\tmapCursorFields(this.cursor, (cursor) => {\n\t\t\t\t\tconst key: FieldKey = cursor.getFieldKey();\n\t\t\t\t\tconst pair: [FieldKey, FlexTreeField] = [\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tmakeField(this.context, this.storedSchema.getFieldSchema(key).kind, cursor),\n\t\t\t\t\t];\n\t\t\t\t\treturn pair;\n\t\t\t\t}).values(),\n\t\t};\n\n\tpublic tryGetField(fieldKey: FieldKey): FlexTreeField | undefined {\n\t\tconst schema = this.storedSchema.getFieldSchema(fieldKey);\n\t\treturn inCursorField(this.cursor, fieldKey, (cursor) => {\n\t\t\tif (cursor.getFieldLength() === 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn makeField(this.context, schema.kind, cursor);\n\t\t});\n\t}\n\n\tpublic getBoxed(key: FieldKey): FlexTreeField {\n\t\tconst fieldSchema = this.storedSchema.getFieldSchema(key);\n\t\treturn inCursorField(this.cursor, key, (cursor) => {\n\t\t\treturn makeField(this.context, fieldSchema.kind, cursor);\n\t\t});\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<FlexTreeField> {\n\t\treturn mapCursorFields(this.cursor, (cursor) =>\n\t\t\tmakeField(\n\t\t\t\tthis.context,\n\t\t\t\tthis.storedSchema.getFieldSchema(cursor.getFieldKey()).kind,\n\t\t\t\tcursor,\n\t\t\t),\n\t\t).values();\n\t}\n\n\tpublic get parentField(): { readonly parent: FlexTreeField; readonly index: number } {\n\t\tconst cursor = this.cursor;\n\t\tconst index = this.anchorNode.parentIndex;\n\t\tassert(cursor.fieldIndex === index, 0x786 /* mismatched indexes */);\n\t\tconst key = this.anchorNode.parentField;\n\n\t\tcursor.exitNode();\n\t\tassert(key === cursor.getFieldKey(), 0x787 /* mismatched keys */);\n\t\tlet fieldSchema: FieldKindIdentifier;\n\n\t\t// Check if the current node is in a detached sequence.\n\t\tif (this.anchorNode.parent === undefined) {\n\t\t\t// Parent field is a detached sequence, and thus needs special handling for its schema.\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (key === rootFieldKey) {\n\t\t\t\tfieldSchema = this.context.schema.rootFieldSchema.kind;\n\t\t\t} else {\n\t\t\t\t// All fields (in the flex tree API) have a schema.\n\t\t\t\t// Since currently there is no known schema for detached field other than the special default root:\n\t\t\t\t// give all other detached fields a schema of sequence of anything.\n\t\t\t\t// That schema is the only one that is safe since its the only field schema that allows any possible field content.\n\t\t\t\t//\n\t\t\t\t// TODO:\n\t\t\t\t// if any of the following are done this schema will need to be more specific:\n\t\t\t\t// 1. Editing APIs start exposing user created detached sequences.\n\t\t\t\t// 2. Remove (and its inverse) start working on subsequences or fields contents (like everything in a sequence or optional field) and not just single nodes.\n\t\t\t\t// 3. Possibly other unknown cases.\n\t\t\t\t// Additionally this approach makes it possible for a user to take a FlexTree node, get its parent, check its schema, down cast based on that, then edit that detached field (ex: removing the node in it).\n\t\t\t\t// This MIGHT work properly with existing merge resolution logic (it must keep client in sync and be unable to violate schema), but this either needs robust testing or to be explicitly banned (error before sending the op).\n\t\t\t\t// Issues like replacing a node in the a removed sequenced then undoing the remove could easily violate schema if not everything works exactly right!\n\t\t\t\tfieldSchema = FieldKinds.sequence.identifier;\n\t\t\t}\n\t\t} else {\n\t\t\tcursor.exitField();\n\t\t\tconst parentType = cursor.type;\n\t\t\tcursor.enterField(key);\n\t\t\tconst nodeSchema =\n\t\t\t\tthis.context.schema.nodeSchema.get(parentType) ??\n\t\t\t\tfail(0xb15 /* requested schema that does not exist */);\n\t\t\tfieldSchema = nodeSchema.getFieldSchema(key).kind;\n\t\t}\n\n\t\tconst proxifiedField = makeField(this.context, fieldSchema, cursor);\n\t\tcursor.enterNode(index);\n\n\t\treturn { parent: proxifiedField, index };\n\t}\n\n\tpublic keys(): IterableIterator<FieldKey> {\n\t\treturn mapCursorFields(this.cursor, (cursor) => cursor.getFieldKey()).values();\n\t}\n}\n"]}
1
+ {"version":3,"file":"lazyNode.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAEnE,OAAO,EAWN,aAAa,EACb,eAAe,EACf,YAAY,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGxD,OAAO,EACN,kBAAkB,EAGlB,cAAc,EACd,YAAY,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,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,WAAW,GAAG,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC9C,CAAC;QACF,CAAC;aAAM,CAAC;YACP,MAAM,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC;YAC/B,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,UAAU,GACf,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;gBAC9C,IAAI,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;YACxD,WAAW,GAAG,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACnD,CAAC;QAED,MAAM,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QACpE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAExB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;IAC1C,CAAC;IAEM,IAAI;QACV,OAAO,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;IAChF,CAAC;CACD","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\";\n\nimport {\n\ttype Anchor,\n\ttype AnchorNode,\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype ITreeSubscriptionCursor,\n\ttype TreeNavigationResult,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype Value,\n\tinCursorField,\n\tmapCursorFields,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport { disposeSymbol } from \"../../util/index.js\";\nimport { FieldKinds } from \"../default-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport {\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype HydratedFlexTreeNode,\n\tflexTreeMarker,\n\tflexTreeSlot,\n} from \"./flexTreeTypes.js\";\nimport { LazyEntity } from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\n\n/**\n * Get or create a {@link HydratedFlexTreeNode} for the given context at node indicated by the cursor.\n * @remarks\n * This does not take ownership of this cursor: Node will fork it as needed.\n */\nexport function getOrCreateHydratedFlexTreeNode(\n\tcontext: Context,\n\tcursor: ITreeSubscriptionCursor,\n): HydratedFlexTreeNode {\n\tconst anchor = cursor.buildAnchor();\n\tconst anchorNode =\n\t\tcontext.checkout.forest.anchors.locate(anchor) ??\n\t\tfail(0xb12 /* cursor should point to a node that is not the root of the AnchorSet */);\n\tconst cached = anchorNode.slots.get(flexTreeSlot);\n\tif (cached !== undefined) {\n\t\tcontext.checkout.forest.anchors.forget(anchor);\n\t\tassert(cached.context === context, 0x782 /* contexts must match */);\n\t\tassert(cached instanceof LazyTreeNode, 0x92c /* Expected LazyTreeNode */);\n\t\treturn cached;\n\t}\n\treturn new LazyTreeNode(context, cursor.type, cursor, anchorNode, anchor);\n}\n\nfunction cleanupTree(anchor: AnchorNode): void {\n\tconst cached =\n\t\tanchor.slots.get(flexTreeSlot) ?? fail(0xb13 /* tree should only be cleaned up once */);\n\tassert(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);\n\tcached[disposeSymbol]();\n}\n\n/**\n * Lazy implementation of {@link FlexTreeNode}.\n */\nexport class LazyTreeNode extends LazyEntity<Anchor> implements HydratedFlexTreeNode {\n\tpublic get [flexTreeMarker](): FlexTreeEntityKind.Node {\n\t\treturn FlexTreeEntityKind.Node;\n\t}\n\n\t// Using JS private here prevents it from showing up as a enumerable own property, or conflicting with struct fields.\n\treadonly #removeDeleteCallback: () => void;\n\n\tprivate readonly storedSchema: TreeNodeStoredSchema;\n\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tpublic readonly type: TreeNodeSchemaIdentifier,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tpublic readonly anchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, cursor, anchor);\n\t\tthis.storedSchema =\n\t\t\tcontext.schema.nodeSchema.get(this.type) ?? fail(0xb14 /* missing schema */);\n\t\tassert(cursor.mode === CursorLocationType.Nodes, 0x783 /* must be in nodes mode */);\n\t\tanchorNode.slots.set(flexTreeSlot, this);\n\t\tthis.#removeDeleteCallback = anchorNode.events.on(\"afterDestroy\", cleanupTree);\n\t}\n\n\tpublic isHydrated(): this is HydratedFlexTreeNode {\n\t\treturn true;\n\t}\n\n\tprotected override tryMoveCursorToAnchor(\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.context.checkout.forest.tryMoveCursorToNode(this.anchor, cursor);\n\t}\n\n\tprotected override forgetAnchor(): void {\n\t\t// This type unconditionally has an anchor, so `forgetAnchor` is always called and cleanup can be done here:\n\t\t// After this point this node will not be usable,\n\t\t// so remove it from the anchor incase a different context (or the same context later) uses this AnchorSet.\n\t\tthis.anchorNode.slots.delete(flexTreeSlot);\n\t\tthis.#removeDeleteCallback();\n\t\tthis.context.checkout.forest.anchors.forget(this.anchor);\n\t}\n\n\tpublic get value(): Value {\n\t\treturn this.cursor.value;\n\t}\n\n\tpublic readonly fields: Pick<Map<FieldKey, FlexTreeField>, typeof Symbol.iterator | \"get\"> =\n\t\t{\n\t\t\tget: (key: FieldKey): FlexTreeField | undefined => this.tryGetField(key),\n\t\t\t[Symbol.iterator]: (): IterableIterator<[FieldKey, FlexTreeField]> =>\n\t\t\t\tmapCursorFields(this.cursor, (cursor) => {\n\t\t\t\t\tconst key: FieldKey = cursor.getFieldKey();\n\t\t\t\t\tconst pair: [FieldKey, FlexTreeField] = [\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tmakeField(this.context, this.storedSchema.getFieldSchema(key).kind, cursor),\n\t\t\t\t\t];\n\t\t\t\t\treturn pair;\n\t\t\t\t}).values(),\n\t\t};\n\n\tpublic tryGetField(fieldKey: FieldKey): FlexTreeField | undefined {\n\t\tconst schema = this.storedSchema.getFieldSchema(fieldKey);\n\t\treturn inCursorField(this.cursor, fieldKey, (cursor) => {\n\t\t\tif (cursor.getFieldLength() === 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn makeField(this.context, schema.kind, cursor);\n\t\t});\n\t}\n\n\tpublic getBoxed(key: FieldKey): FlexTreeField {\n\t\tconst fieldSchema = this.storedSchema.getFieldSchema(key);\n\t\treturn inCursorField(this.cursor, key, (cursor) => {\n\t\t\treturn makeField(this.context, fieldSchema.kind, cursor);\n\t\t});\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<FlexTreeField> {\n\t\treturn mapCursorFields(this.cursor, (cursor) =>\n\t\t\tmakeField(\n\t\t\t\tthis.context,\n\t\t\t\tthis.storedSchema.getFieldSchema(cursor.getFieldKey()).kind,\n\t\t\t\tcursor,\n\t\t\t),\n\t\t).values();\n\t}\n\n\tpublic get parentField(): { readonly parent: FlexTreeField; readonly index: number } {\n\t\tconst cursor = this.cursor;\n\t\tconst index = this.anchorNode.parentIndex;\n\t\tassert(cursor.fieldIndex === index, 0x786 /* mismatched indexes */);\n\t\tconst key = this.anchorNode.parentField;\n\n\t\tcursor.exitNode();\n\t\tassert(key === cursor.getFieldKey(), 0x787 /* mismatched keys */);\n\t\tlet fieldSchema: FieldKindIdentifier;\n\n\t\t// Check if the current node is in a detached sequence.\n\t\tif (this.anchorNode.parent === undefined) {\n\t\t\t// Parent field is a detached sequence, and thus needs special handling for its schema.\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (key === rootFieldKey) {\n\t\t\t\tfieldSchema = this.context.schema.rootFieldSchema.kind;\n\t\t\t} else {\n\t\t\t\t// All fields (in the flex tree API) have a schema.\n\t\t\t\t// Since currently there is no known schema for detached field other than the special default root:\n\t\t\t\t// give all other detached fields a schema of sequence of anything.\n\t\t\t\t// That schema is the only one that is safe since its the only field schema that allows any possible field content.\n\t\t\t\t//\n\t\t\t\t// TODO:\n\t\t\t\t// if any of the following are done this schema will need to be more specific:\n\t\t\t\t// 1. Editing APIs start exposing user created detached sequences.\n\t\t\t\t// 2. Remove (and its inverse) start working on subsequences or fields contents (like everything in a sequence or optional field) and not just single nodes.\n\t\t\t\t// 3. Possibly other unknown cases.\n\t\t\t\t// Additionally this approach makes it possible for a user to take a FlexTree node, get its parent, check its schema, down cast based on that, then edit that detached field (ex: removing the node in it).\n\t\t\t\t// This MIGHT work properly with existing merge resolution logic (it must keep client in sync and be unable to violate schema), but this either needs robust testing or to be explicitly banned (error before sending the op).\n\t\t\t\t// Issues like replacing a node in the a removed sequenced then undoing the remove could easily violate schema if not everything works exactly right!\n\t\t\t\tfieldSchema = FieldKinds.sequence.identifier;\n\t\t\t}\n\t\t} else {\n\t\t\tcursor.exitField();\n\t\t\tconst parentType = cursor.type;\n\t\t\tcursor.enterField(key);\n\t\t\tconst nodeSchema =\n\t\t\t\tthis.context.schema.nodeSchema.get(parentType) ??\n\t\t\t\tfail(0xb15 /* requested schema that does not exist */);\n\t\t\tfieldSchema = nodeSchema.getFieldSchema(key).kind;\n\t\t}\n\n\t\tconst proxifiedField = makeField(this.context, fieldSchema, cursor);\n\t\tcursor.enterNode(index);\n\n\t\treturn { parent: proxifiedField, index };\n\t}\n\n\tpublic keys(): IterableIterator<FieldKey> {\n\t\treturn mapCursorFields(this.cursor, (cursor) => cursor.getFieldKey()).values();\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"forestSummarizer.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/forestSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B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AgB,CAAC,EAAE,iBAAiB,CAAC;QACrC,yBAAyB,CAAC,EAAE,sCAAsC,CAAC;KACnE,GAAG,qBAAqB;IAIZ,IAAI,CAChB,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,oBAAoB,GACzB,OAAO,CAAC,IAAI,CAAC;CAgChB"}
@@ -7,8 +7,7 @@ import { assert } from "@fluidframework/core-utils/internal";
7
7
  import { createSingleBlobSummary } from "@fluidframework/shared-object-base/internal";
8
8
  import { applyDelta, forEachField, makeDetachedFieldIndex, } from "../../core/index.js";
9
9
  import { idAllocatorFromMaxId } from "../../util/index.js";
10
- // eslint-disable-next-line import/no-internal-modules
11
- import { chunkFieldSingle, defaultChunkPolicy } from "../chunked-forest/chunkTree.js";
10
+ import { chunkFieldSingle, defaultChunkPolicy } from "../chunked-forest/index.js";
12
11
  import { makeForestSummarizerCodec } from "./codec.js";
13
12
  /**
14
13
  * The storage key for the blob in the summary containing tree data
@@ -1 +1 @@
1
- {"version":3,"file":"forestSummarizer.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/forestSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAQ7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAGtF,OAAO,EASN,UAAU,EACV,YAAY,EACZ,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,sDAAsD;AACtD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGtF,OAAO,EAAoB,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,GAAG,YAAY,CAAC;AAEjC;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAK5B;;O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CAAC;YACrF,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAC;YAC9D,UAAU,CACT,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,YAAY,CAAC,EAAE,EACxC,SAAS,EACT,IAAI,CAAC,MAAM,EACX,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,CACxE,CAAC;QACH,CAAC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { createSingleBlobSummary } from \"@fluidframework/shared-object-base/internal\";\n\nimport type { CodecWriteOptions } from \"../../codec/index.js\";\nimport {\n\ttype DeltaDetachedNodeBuild,\n\ttype DeltaFieldChanges,\n\ttype FieldKey,\n\ttype IEditableForest,\n\ttype ITreeCursorSynchronous,\n\ttype ITreeSubscriptionCursor,\n\ttype RevisionTagCodec,\n\tTreeNavigationResult,\n\tapplyDelta,\n\tforEachField,\n\tmakeDetachedFieldIndex,\n} from \"../../core/index.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"../../shared-tree-core/index.js\";\nimport { idAllocatorFromMaxId } from \"../../util/index.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport { chunkFieldSingle, defaultChunkPolicy } from \"../chunked-forest/chunkTree.js\";\nimport type { FieldBatchCodec, FieldBatchEncodingContext } from \"../chunked-forest/index.js\";\n\nimport { type ForestCodec, makeForestSummarizerCodec } from \"./codec.js\";\nimport type { Format } from \"./format.js\";\n/**\n * The storage key for the blob in the summary containing tree data\n */\nconst treeBlobKey = \"ForestTree\";\n\n/**\n * Provides methods for summarizing and loading a forest.\n */\nexport class ForestSummarizer implements Summarizable {\n\tpublic readonly key = \"Forest\";\n\n\tprivate readonly codec: ForestCodec;\n\n\t/**\n\t * @param encoderContext - The schema if provided here must be mutated by the caller to keep it up to date.\n\t */\n\tpublic constructor(\n\t\tprivate readonly forest: IEditableForest,\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tfieldBatchCodec: FieldBatchCodec,\n\t\tprivate readonly encoderContext: FieldBatchEncodingContext,\n\t\toptions: CodecWriteOptions,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t) {\n\t\t// TODO: this should take in CodecWriteOptions, and use it to pick the write version.\n\t\tthis.codec = makeForestSummarizerCodec(options, fieldBatchCodec);\n\t}\n\n\t/**\n\t * Synchronous monolithic summarization of tree content.\n\t *\n\t * TODO: when perf matters, this should be replaced with a chunked async version using a binary format.\n\t *\n\t * @returns a snapshot of the forest's tree as a string.\n\t */\n\tprivate getTreeString(stringify: SummaryElementStringifier): string {\n\t\tconst rootCursor = this.forest.getCursorAboveDetachedFields();\n\t\tconst fieldMap: Map<FieldKey, ITreeCursorSynchronous & ITreeSubscriptionCursor> =\n\t\t\tnew Map();\n\t\t// TODO: Encode all detached fields in one operation for better performance and compression\n\t\tforEachField(rootCursor, (cursor) => {\n\t\t\tconst key = cursor.getFieldKey();\n\t\t\tconst innerCursor = this.forest.allocateCursor(\"getTreeString\");\n\t\t\tassert(\n\t\t\t\tthis.forest.tryMoveCursorToField({ fieldKey: key, parent: undefined }, innerCursor) ===\n\t\t\t\t\tTreeNavigationResult.Ok,\n\t\t\t\t0x892 /* failed to navigate to field */,\n\t\t\t);\n\t\t\tfieldMap.set(key, innerCursor as ITreeCursorSynchronous & ITreeSubscriptionCursor);\n\t\t});\n\t\tconst encoded = this.codec.encode(fieldMap, this.encoderContext);\n\n\t\tfieldMap.forEach((value) => value.free());\n\t\treturn stringify(encoded);\n\t}\n\n\tpublic summarize(props: {\n\t\tstringify: SummaryElementStringifier;\n\t\tfullTree?: boolean;\n\t\ttrackState?: boolean;\n\t\ttelemetryContext?: ITelemetryContext;\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext;\n\t}): ISummaryTreeWithStats {\n\t\treturn createSingleBlobSummary(treeBlobKey, this.getTreeString(props.stringify));\n\t}\n\n\tpublic async load(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\tif (await services.contains(treeBlobKey)) {\n\t\t\tconst treeBuffer = await services.readBlob(treeBlobKey);\n\t\t\tconst treeBufferString = bufferToString(treeBuffer, \"utf8\");\n\t\t\t// TODO: this code is parsing data without an optional validator, this should be defined in a typebox schema as part of the\n\t\t\t// forest summary format.\n\t\t\tconst fields = this.codec.decode(parse(treeBufferString) as Format, this.encoderContext);\n\t\t\tconst allocator = idAllocatorFromMaxId();\n\t\t\tconst fieldChanges: [FieldKey, DeltaFieldChanges][] = [];\n\t\t\tconst build: DeltaDetachedNodeBuild[] = [];\n\t\t\tfor (const [fieldKey, field] of fields) {\n\t\t\t\tconst chunked = chunkFieldSingle(field, {\n\t\t\t\t\tpolicy: defaultChunkPolicy,\n\t\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t\t});\n\t\t\t\tconst buildId = { minor: allocator.allocate(chunked.topLevelLength) };\n\t\t\t\tbuild.push({\n\t\t\t\t\tid: buildId,\n\t\t\t\t\ttrees: chunked,\n\t\t\t\t});\n\t\t\t\tfieldChanges.push([fieldKey, [{ count: chunked.topLevelLength, attach: buildId }]]);\n\t\t\t}\n\n\t\t\tassert(this.forest.isEmpty, 0x797 /* forest must be empty */);\n\t\t\tapplyDelta(\n\t\t\t\t{ build, fields: new Map(fieldChanges) },\n\t\t\t\tundefined,\n\t\t\t\tthis.forest,\n\t\t\t\tmakeDetachedFieldIndex(\"init\", this.revisionTagCodec, this.idCompressor),\n\t\t\t);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"forestSummarizer.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/forestSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAQ7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAGtF,OAAO,EASN,UAAU,EACV,YAAY,EACZ,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGlF,OAAO,EAAoB,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,GAAG,YAAY,CAAC;AAEjC;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAK5B;;OAEG;IACH,YACkB,MAAuB,EACvB,gBAAkC,EACnD,eAAgC,EACf,cAAyC,EAC1D,OAA0B,EACT,YAA2B;QAL3B,WAAM,GAAN,MAAM,CAAiB;QACvB,qBAAgB,GAAhB,gBAAgB,CAAkB;QAElC,mBAAc,GAAd,cAAc,CAA2B;QAEzC,iBAAY,GAAZ,YAAY,CAAe;QAb7B,QAAG,GAAG,QAAQ,CAAC;QAe9B,qFAAqF;QACrF,IAAI,CAAC,KAAK,GAAG,yBAAyB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;OAMG;IACK,aAAa,CAAC,SAAoC;QACzD,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,4BAA4B,EAAE,CAAC;QAC9D,MAAM,QAAQ,GACb,IAAI,GAAG,EAAE,CAAC;QACX,2FAA2F;QAC3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AAC,cAAc,CAAC,CAAC;YACzF,MAAM,SAAS,GAAG,oBAAoB,EAAE,CAAC;YACzC,MAAM,YAAY,GAAoC,EAAE,CAAC;YACzD,MAAM,KAAK,GAA6B,EAAE,CAAC;YAC3C,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,CAAC;gBACxC,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,EAAE;oBACvC,MAAM,EAAE,kBAAkB;oBAC1B,YAAY,EAAE,IAAI,CAAC,YAAY;iBAC/B,CAAC,CAAC;gBACH,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;gBACtE,KAAK,CAAC,IAAI,CAAC;oBACV,EAAE,EAAE,OAAO;oBACX,KAAK,EAAE,OAAO;iBACd,CAAC,CAAC;gBACH,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;YACrF,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAC;YAC9D,UAAU,CACT,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,YAAY,CAAC,EAAE,EACxC,SAAS,EACT,IAAI,CAAC,MAAM,EACX,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,CACxE,CAAC;QACH,CAAC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { createSingleBlobSummary } from \"@fluidframework/shared-object-base/internal\";\n\nimport type { CodecWriteOptions } from \"../../codec/index.js\";\nimport {\n\ttype DeltaDetachedNodeBuild,\n\ttype DeltaFieldChanges,\n\ttype FieldKey,\n\ttype IEditableForest,\n\ttype ITreeCursorSynchronous,\n\ttype ITreeSubscriptionCursor,\n\ttype RevisionTagCodec,\n\tTreeNavigationResult,\n\tapplyDelta,\n\tforEachField,\n\tmakeDetachedFieldIndex,\n} from \"../../core/index.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"../../shared-tree-core/index.js\";\nimport { idAllocatorFromMaxId } from \"../../util/index.js\";\nimport { chunkFieldSingle, defaultChunkPolicy } from \"../chunked-forest/index.js\";\nimport type { FieldBatchCodec, FieldBatchEncodingContext } from \"../chunked-forest/index.js\";\n\nimport { type ForestCodec, makeForestSummarizerCodec } from \"./codec.js\";\nimport type { Format } from \"./format.js\";\n/**\n * The storage key for the blob in the summary containing tree data\n */\nconst treeBlobKey = \"ForestTree\";\n\n/**\n * Provides methods for summarizing and loading a forest.\n */\nexport class ForestSummarizer implements Summarizable {\n\tpublic readonly key = \"Forest\";\n\n\tprivate readonly codec: ForestCodec;\n\n\t/**\n\t * @param encoderContext - The schema if provided here must be mutated by the caller to keep it up to date.\n\t */\n\tpublic constructor(\n\t\tprivate readonly forest: IEditableForest,\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tfieldBatchCodec: FieldBatchCodec,\n\t\tprivate readonly encoderContext: FieldBatchEncodingContext,\n\t\toptions: CodecWriteOptions,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t) {\n\t\t// TODO: this should take in CodecWriteOptions, and use it to pick the write version.\n\t\tthis.codec = makeForestSummarizerCodec(options, fieldBatchCodec);\n\t}\n\n\t/**\n\t * Synchronous monolithic summarization of tree content.\n\t *\n\t * TODO: when perf matters, this should be replaced with a chunked async version using a binary format.\n\t *\n\t * @returns a snapshot of the forest's tree as a string.\n\t */\n\tprivate getTreeString(stringify: SummaryElementStringifier): string {\n\t\tconst rootCursor = this.forest.getCursorAboveDetachedFields();\n\t\tconst fieldMap: Map<FieldKey, ITreeCursorSynchronous & ITreeSubscriptionCursor> =\n\t\t\tnew Map();\n\t\t// TODO: Encode all detached fields in one operation for better performance and compression\n\t\tforEachField(rootCursor, (cursor) => {\n\t\t\tconst key = cursor.getFieldKey();\n\t\t\tconst innerCursor = this.forest.allocateCursor(\"getTreeString\");\n\t\t\tassert(\n\t\t\t\tthis.forest.tryMoveCursorToField({ fieldKey: key, parent: undefined }, innerCursor) ===\n\t\t\t\t\tTreeNavigationResult.Ok,\n\t\t\t\t0x892 /* failed to navigate to field */,\n\t\t\t);\n\t\t\tfieldMap.set(key, innerCursor as ITreeCursorSynchronous & ITreeSubscriptionCursor);\n\t\t});\n\t\tconst encoded = this.codec.encode(fieldMap, this.encoderContext);\n\n\t\tfieldMap.forEach((value) => value.free());\n\t\treturn stringify(encoded);\n\t}\n\n\tpublic summarize(props: {\n\t\tstringify: SummaryElementStringifier;\n\t\tfullTree?: boolean;\n\t\ttrackState?: boolean;\n\t\ttelemetryContext?: ITelemetryContext;\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext;\n\t}): ISummaryTreeWithStats {\n\t\treturn createSingleBlobSummary(treeBlobKey, this.getTreeString(props.stringify));\n\t}\n\n\tpublic async load(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\tif (await services.contains(treeBlobKey)) {\n\t\t\tconst treeBuffer = await services.readBlob(treeBlobKey);\n\t\t\tconst treeBufferString = bufferToString(treeBuffer, \"utf8\");\n\t\t\t// TODO: this code is parsing data without an optional validator, this should be defined in a typebox schema as part of the\n\t\t\t// forest summary format.\n\t\t\tconst fields = this.codec.decode(parse(treeBufferString) as Format, this.encoderContext);\n\t\t\tconst allocator = idAllocatorFromMaxId();\n\t\t\tconst fieldChanges: [FieldKey, DeltaFieldChanges][] = [];\n\t\t\tconst build: DeltaDetachedNodeBuild[] = [];\n\t\t\tfor (const [fieldKey, field] of fields) {\n\t\t\t\tconst chunked = chunkFieldSingle(field, {\n\t\t\t\t\tpolicy: defaultChunkPolicy,\n\t\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t\t});\n\t\t\t\tconst buildId = { minor: allocator.allocate(chunked.topLevelLength) };\n\t\t\t\tbuild.push({\n\t\t\t\t\tid: buildId,\n\t\t\t\t\ttrees: chunked,\n\t\t\t\t});\n\t\t\t\tfieldChanges.push([fieldKey, [{ count: chunked.topLevelLength, attach: buildId }]]);\n\t\t\t}\n\n\t\t\tassert(this.forest.isEmpty, 0x797 /* forest must be empty */);\n\t\t\tapplyDelta(\n\t\t\t\t{ build, fields: new Map(fieldChanges) },\n\t\t\t\tundefined,\n\t\t\t\tthis.forest,\n\t\t\t\tmakeDetachedFieldIndex(\"init\", this.revisionTagCodec, this.idCompressor),\n\t\t\t);\n\t\t}\n\t}\n}\n"]}
@@ -12,12 +12,12 @@ export { stackTreeNodeCursor, type CursorAdapter, prefixPath, prefixFieldPath, t
12
12
  export { cursorForJsonableTreeNode, cursorForJsonableTreeField, jsonableTreeFromCursor, jsonableTreeFromFieldCursor, jsonableTreeFromForest, } from "./treeTextCursor.js";
13
13
  import * as SequenceField from "./sequence-field/index.js";
14
14
  export { SequenceField };
15
- export { isNeverField, ModularEditBuilder, type FieldEditDescription as EditDescription, type FieldChangeHandler, type FieldChangeRebaser, type FieldEditor, type FieldChangeMap, type FieldChange, type FieldChangeset, type ToDelta, type ModularChangeset, makeModularChangeCodecFamily, type NodeChangeComposer, type NodeChangeInverter, type NodeChangeRebaser, type NodeChangePruner, type CrossFieldManager, CrossFieldTarget, FlexFieldKind, type FullSchemaPolicy, allowsRepoSuperset, type GenericChangeset, genericFieldKind, type HasFieldChanges, type NodeExistsConstraint, FieldKindWithEditor, ModularChangeFamily, type RelevantRemovedRootsFromChild, EncodedModularChangeset, updateRefreshers, type NodeId, type FieldChangeEncodingContext, type FieldKindConfiguration, type FieldKindConfigurationEntry, getAllowedContentDiscrepancies, isRepoSuperset, type AllowedTypeDiscrepancy, type FieldKindDiscrepancy, type ValueSchemaDiscrepancy, type FieldDiscrepancy, type NodeDiscrepancy, type NodeKindDiscrepancy, type NodeFieldsDiscrepancy, isNeverTree, type LinearExtension, type Realizer, fieldRealizer, PosetComparisonResult, comparePosetElements, posetLte, } from "./modular-schema/index.js";
15
+ export { isNeverField, ModularEditBuilder, type FieldEditDescription as EditDescription, type FieldChangeHandler, type FieldChangeRebaser, type FieldEditor, type FieldChangeMap, type FieldChange, type FieldChangeset, type ToDelta, type ModularChangeset, makeModularChangeCodecFamily, type NodeChangeComposer, type NodeChangeInverter, type NodeChangeRebaser, type NodeChangePruner, type CrossFieldManager, CrossFieldTarget, FlexFieldKind, type FullSchemaPolicy, allowsRepoSuperset, type GenericChangeset, genericFieldKind, type HasFieldChanges, type NodeExistsConstraint, FieldKindWithEditor, ModularChangeFamily, type RelevantRemovedRootsFromChild, EncodedModularChangeset, updateRefreshers, type NodeId, type FieldChangeEncodingContext, type FieldKindConfiguration, type FieldKindConfigurationEntry, isNeverTree, } from "./modular-schema/index.js";
16
16
  export { mapRootChanges } from "./deltaUtils.js";
17
17
  export { type TreeChunk, chunkTree, chunkFieldSingle, buildChunkedForest, defaultChunkPolicy, type FieldBatch, type FieldBatchCodec, makeTreeChunker, makeFieldBatchCodec, fluidVersionToFieldBatchCodecWriteVersion, type FieldBatchEncodingContext, } from "./chunked-forest/index.js";
18
18
  export { compareLocalNodeIdentifiers, createNodeIdentifierManager, isStableNodeIdentifier, type LocalNodeIdentifier, MockNodeIdentifierManager, type NodeIdentifierManager, nodeKeyTreeIdentifier, type StableNodeIdentifier, } from "./node-identifier/index.js";
19
19
  export { FieldKinds, type Required, type Optional, type Sequence, type Identifier, type Forbidden, type DefaultChangeset, DefaultChangeFamily, DefaultEditBuilder, type IDefaultEditBuilder, type ValueFieldEditBuilder, type OptionalFieldEditBuilder, type SequenceFieldEditBuilder, defaultSchemaPolicy, fieldKinds, fieldKindConfigurations, intoDelta, relevantRemovedRoots, SchemaValidationError, isNodeInSchema, isFieldInSchema, inSchemaOrThrow, } from "./default-schema/index.js";
20
- export { type FlexTreeOptionalField, type FlexTreeRequiredField, type FlexTreeSequenceField, type FlexTreeContext, type FlexTreeHydratedContext, type FlexTreeTypedField, type FlexTreeEntity, type FlexTreeField, type FlexTreeNode, TreeStatus, Context, type FlexTreeNodeEvents, type FlexTreeUnknownUnboxed, isFlexTreeNode, ContextSlot, flexTreeMarker, assertFlexTreeEntityNotFreed, flexTreeSlot, getSchemaAndPolicy, LazyEntity, treeStatusFromAnchorCache, indexForAt, FlexTreeEntityKind, type FlexibleNodeContent, type FlexibleFieldContent, type FlexTreeHydratedContextMinimal, type HydratedFlexTreeNode, } from "./flex-tree/index.js";
20
+ export { type FlexTreeOptionalField, type FlexTreeRequiredField, type FlexTreeSequenceField, type FlexTreeContext, type FlexTreeHydratedContext, type FlexTreeTypedField, type FlexTreeEntity, type FlexTreeField, type FlexTreeNode, TreeStatus, Context, type FlexTreeNodeEvents, type FlexTreeUnknownUnboxed, isFlexTreeNode, ContextSlot, flexTreeMarker, assertFlexTreeEntityNotFreed, flexTreeSlot, getSchemaAndPolicy, LazyEntity, treeStatusFromAnchorCache, indexForAt, FlexTreeEntityKind, type FlexibleNodeContent, type FlexibleFieldContent, type FlexTreeHydratedContextMinimal, type HydratedFlexTreeNode, getOrCreateHydratedFlexTreeNode, } from "./flex-tree/index.js";
21
21
  export { TreeCompressionStrategy } from "./treeCompressionUtils.js";
22
22
  export { valueSchemaAllows } from "./valueUtilities.js";
23
23
  export { DetachedFieldIndexSummarizer } from "./detachedFieldIndexSummarizer.js";
@@ -1 +1 @@
1
- {"version":3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K,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,UAAU,EACV,OAAO,EACP,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,cAAc,EACd,WAAW,EAEX,cAAc,EACd,4BAA4B,EAC5B,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,yBAAyB,EACzB,UAAU,EACV,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,8BAA8B,EACnC,KAAK,oBAAoB,EACzB,+BAA+B,GAC/B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF,OAAO,EACN,KAAK,YAAY,EACjB,sBAAsB,EACtB,mBAAmB,GACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,EACN,KAAK,SAAS,EACd,eAAe,EACf,UAAU,EACV,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,cAAc,GACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -13,14 +13,14 @@ export { cursorForJsonableTreeNode, cursorForJsonableTreeField, jsonableTreeFrom
13
13
  // Split this up into separate import and export for compatibility with API-Extractor.
14
14
  import * as SequenceField from "./sequence-field/index.js";
15
15
  export { SequenceField };
16
- export { isNeverField, ModularEditBuilder, makeModularChangeCodecFamily, CrossFieldTarget, FlexFieldKind, allowsRepoSuperset, genericFieldKind, FieldKindWithEditor, ModularChangeFamily, EncodedModularChangeset, updateRefreshers, getAllowedContentDiscrepancies, isRepoSuperset, isNeverTree, fieldRealizer, PosetComparisonResult, comparePosetElements, posetLte, } from "./modular-schema/index.js";
16
+ export { isNeverField, ModularEditBuilder, makeModularChangeCodecFamily, CrossFieldTarget, FlexFieldKind, allowsRepoSuperset, genericFieldKind, FieldKindWithEditor, ModularChangeFamily, EncodedModularChangeset, updateRefreshers, isNeverTree, } from "./modular-schema/index.js";
17
17
  export { mapRootChanges } from "./deltaUtils.js";
18
18
  export { chunkTree, chunkFieldSingle, buildChunkedForest, defaultChunkPolicy, makeTreeChunker, makeFieldBatchCodec, fluidVersionToFieldBatchCodecWriteVersion, } from "./chunked-forest/index.js";
19
19
  export { compareLocalNodeIdentifiers, createNodeIdentifierManager, isStableNodeIdentifier, MockNodeIdentifierManager, nodeKeyTreeIdentifier, } from "./node-identifier/index.js";
20
20
  export { FieldKinds, DefaultChangeFamily, DefaultEditBuilder, defaultSchemaPolicy, fieldKinds, fieldKindConfigurations, intoDelta, relevantRemovedRoots, SchemaValidationError, isNodeInSchema, isFieldInSchema, inSchemaOrThrow, } from "./default-schema/index.js";
21
21
  export { TreeStatus, Context, isFlexTreeNode, ContextSlot,
22
22
  // Internal
23
- flexTreeMarker, assertFlexTreeEntityNotFreed, flexTreeSlot, getSchemaAndPolicy, LazyEntity, treeStatusFromAnchorCache, indexForAt, FlexTreeEntityKind, } from "./flex-tree/index.js";
23
+ flexTreeMarker, assertFlexTreeEntityNotFreed, flexTreeSlot, getSchemaAndPolicy, LazyEntity, treeStatusFromAnchorCache, indexForAt, FlexTreeEntityKind, getOrCreateHydratedFlexTreeNode, } from "./flex-tree/index.js";
24
24
  export { TreeCompressionStrategy } from "./treeCompressionUtils.js";
25
25
  export { valueSchemaAllows } from "./valueUtilities.js";
26
26
  export { DetachedFieldIndexSummarizer } from "./detachedFieldIndexSummarizer.js";