@fluidframework/tree 2.41.0 → 2.43.0-343119

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 (673) hide show
  1. package/.vscode/settings.json +1 -0
  2. package/CHANGELOG.md +33 -0
  3. package/api-report/tree.alpha.api.md +70 -28
  4. package/api-report/tree.beta.api.md +33 -0
  5. package/dist/alpha.d.ts +12 -6
  6. package/dist/beta.d.ts +6 -1
  7. package/dist/codec/codec.d.ts +23 -3
  8. package/dist/codec/codec.d.ts.map +1 -1
  9. package/dist/codec/codec.js.map +1 -1
  10. package/dist/codec/index.d.ts +1 -1
  11. package/dist/codec/index.d.ts.map +1 -1
  12. package/dist/codec/index.js.map +1 -1
  13. package/dist/codec/versioned/codec.d.ts +35 -2
  14. package/dist/codec/versioned/codec.d.ts.map +1 -1
  15. package/dist/codec/versioned/codec.js +38 -3
  16. package/dist/codec/versioned/codec.js.map +1 -1
  17. package/dist/core/index.d.ts +1 -1
  18. package/dist/core/index.d.ts.map +1 -1
  19. package/dist/core/index.js +5 -2
  20. package/dist/core/index.js.map +1 -1
  21. package/dist/core/schema-stored/formatV2.d.ts +80 -0
  22. package/dist/core/schema-stored/formatV2.d.ts.map +1 -0
  23. package/dist/core/schema-stored/formatV2.js +55 -0
  24. package/dist/core/schema-stored/formatV2.js.map +1 -0
  25. package/dist/core/schema-stored/index.d.ts +3 -1
  26. package/dist/core/schema-stored/index.d.ts.map +1 -1
  27. package/dist/core/schema-stored/index.js +5 -2
  28. package/dist/core/schema-stored/index.js.map +1 -1
  29. package/dist/core/schema-stored/schema.d.ts +49 -17
  30. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  31. package/dist/core/schema-stored/schema.js +65 -22
  32. package/dist/core/schema-stored/schema.js.map +1 -1
  33. package/dist/core/tree/detachedFieldIndex.d.ts +2 -2
  34. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  35. package/dist/core/tree/detachedFieldIndex.js +5 -1
  36. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  37. package/dist/core/tree/mapTree.d.ts +2 -1
  38. package/dist/core/tree/mapTree.d.ts.map +1 -1
  39. package/dist/core/tree/mapTree.js +11 -5
  40. package/dist/core/tree/mapTree.js.map +1 -1
  41. package/dist/core/tree/visitorUtils.d.ts +2 -2
  42. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  43. package/dist/core/tree/visitorUtils.js.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +9 -7
  45. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +13 -9
  47. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +3 -3
  49. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +6 -6
  51. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts +1 -1
  53. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +3 -3
  55. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  56. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -2
  57. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  58. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  59. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +4 -3
  60. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  61. package/dist/feature-libraries/default-schema/schemaChecker.js +4 -3
  62. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  63. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +8 -3
  64. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  65. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +2 -5
  66. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  67. package/dist/feature-libraries/flex-tree/context.d.ts +14 -6
  68. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  69. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  70. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +48 -29
  71. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  72. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +4 -0
  73. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  74. package/dist/feature-libraries/flex-tree/index.d.ts +2 -3
  75. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  76. package/dist/feature-libraries/flex-tree/index.js +1 -7
  77. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  78. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +2 -2
  79. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  80. package/dist/feature-libraries/flex-tree/lazyEntity.js +3 -0
  81. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  82. package/dist/feature-libraries/flex-tree/lazyField.d.ts +6 -7
  83. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  84. package/dist/feature-libraries/flex-tree/lazyField.js +2 -5
  85. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  86. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +8 -7
  87. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  88. package/dist/feature-libraries/flex-tree/lazyNode.js +17 -6
  89. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  90. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +10 -5
  91. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  92. package/dist/feature-libraries/forest-summary/forestSummarizer.js +9 -12
  93. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  94. package/dist/feature-libraries/index.d.ts +2 -2
  95. package/dist/feature-libraries/index.d.ts.map +1 -1
  96. package/dist/feature-libraries/index.js +4 -3
  97. package/dist/feature-libraries/index.js.map +1 -1
  98. package/dist/feature-libraries/mapTreeCursor.d.ts +53 -3
  99. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  100. package/dist/feature-libraries/mapTreeCursor.js +45 -7
  101. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  102. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +1 -1
  103. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +2 -0
  104. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
  105. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
  106. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  107. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +5 -5
  108. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  109. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  110. package/dist/feature-libraries/object-forest/objectForest.js +2 -0
  111. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  112. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  113. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -4
  114. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  115. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -36
  116. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  117. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js +3 -3
  118. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  119. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  120. package/dist/feature-libraries/schema-index/codec.js +59 -9
  121. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  122. package/dist/feature-libraries/schema-index/formatV1.d.ts +1 -1
  123. package/dist/feature-libraries/schema-index/formatV2.d.ts +42 -0
  124. package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -0
  125. package/dist/feature-libraries/schema-index/formatV2.js +26 -0
  126. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -0
  127. package/dist/feature-libraries/schema-index/index.d.ts +2 -1
  128. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  129. package/dist/feature-libraries/schema-index/index.js +4 -2
  130. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  131. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +7 -2
  132. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  133. package/dist/feature-libraries/schema-index/schemaSummarizer.js +6 -6
  134. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  135. package/dist/feature-libraries/treeCursorUtils.d.ts +5 -1
  136. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  137. package/dist/feature-libraries/treeCursorUtils.js +8 -2
  138. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  139. package/dist/index.d.ts +3 -3
  140. package/dist/index.d.ts.map +1 -1
  141. package/dist/index.js.map +1 -1
  142. package/dist/packageVersion.d.ts +1 -1
  143. package/dist/packageVersion.d.ts.map +1 -1
  144. package/dist/packageVersion.js +1 -1
  145. package/dist/packageVersion.js.map +1 -1
  146. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  147. package/dist/shared-tree/schematizeTree.js +1 -0
  148. package/dist/shared-tree/schematizeTree.js.map +1 -1
  149. package/dist/shared-tree/schematizingTreeView.d.ts +11 -1
  150. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  151. package/dist/shared-tree/schematizingTreeView.js +36 -22
  152. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  153. package/dist/shared-tree/sharedTree.d.ts +8 -4
  154. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  155. package/dist/shared-tree/sharedTree.js +35 -5
  156. package/dist/shared-tree/sharedTree.js.map +1 -1
  157. package/dist/shared-tree/tree.d.ts.map +1 -1
  158. package/dist/shared-tree/tree.js +8 -24
  159. package/dist/shared-tree/tree.js.map +1 -1
  160. package/dist/shared-tree/treeAlpha.d.ts +2 -3
  161. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  162. package/dist/shared-tree/treeAlpha.js +4 -5
  163. package/dist/shared-tree/treeAlpha.js.map +1 -1
  164. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  165. package/dist/shared-tree/treeCheckout.js +5 -2
  166. package/dist/shared-tree/treeCheckout.js.map +1 -1
  167. package/dist/shared-tree-core/editManagerSummarizer.d.ts +8 -3
  168. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  169. package/dist/shared-tree-core/editManagerSummarizer.js +2 -5
  170. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  171. package/dist/shared-tree-core/sharedTreeCore.d.ts +18 -7
  172. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  173. package/dist/shared-tree-core/sharedTreeCore.js +15 -2
  174. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  175. package/dist/simple-tree/api/configuration.d.ts +2 -2
  176. package/dist/simple-tree/api/configuration.js +1 -1
  177. package/dist/simple-tree/api/configuration.js.map +1 -1
  178. package/dist/simple-tree/api/create.d.ts +9 -4
  179. package/dist/simple-tree/api/create.d.ts.map +1 -1
  180. package/dist/simple-tree/api/create.js +29 -16
  181. package/dist/simple-tree/api/create.js.map +1 -1
  182. package/dist/simple-tree/api/customTree.d.ts +4 -0
  183. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  184. package/dist/simple-tree/api/customTree.js +9 -1
  185. package/dist/simple-tree/api/customTree.js.map +1 -1
  186. package/dist/simple-tree/api/index.d.ts +1 -1
  187. package/dist/simple-tree/api/index.d.ts.map +1 -1
  188. package/dist/simple-tree/api/index.js +1 -2
  189. package/dist/simple-tree/api/index.js.map +1 -1
  190. package/dist/simple-tree/api/schemaCompatibilityTester.js +1 -1
  191. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  192. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  193. package/dist/simple-tree/api/schemaCreationUtilities.js +3 -3
  194. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  195. package/dist/simple-tree/api/schemaFactory.d.ts +25 -13
  196. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  197. package/dist/simple-tree/api/schemaFactory.js +42 -9
  198. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  199. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +41 -11
  200. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  201. package/dist/simple-tree/api/schemaFactoryAlpha.js +31 -4
  202. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  203. package/dist/simple-tree/api/storedSchema.js +2 -2
  204. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  205. package/dist/simple-tree/api/treeChangeEvents.d.ts +8 -3
  206. package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  207. package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
  208. package/dist/simple-tree/api/treeNodeApi.d.ts +14 -3
  209. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  210. package/dist/simple-tree/api/treeNodeApi.js +32 -17
  211. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  212. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  213. package/dist/simple-tree/api/verboseTree.js +12 -9
  214. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  215. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  216. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +5 -0
  217. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  218. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  219. package/dist/simple-tree/core/getOrCreateNode.js +2 -1
  220. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  221. package/dist/simple-tree/core/index.d.ts +2 -2
  222. package/dist/simple-tree/core/index.d.ts.map +1 -1
  223. package/dist/simple-tree/core/index.js +3 -4
  224. package/dist/simple-tree/core/index.js.map +1 -1
  225. package/dist/simple-tree/core/treeNodeKernel.d.ts +15 -25
  226. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  227. package/dist/simple-tree/core/treeNodeKernel.js +27 -34
  228. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  229. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +129 -64
  230. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  231. package/dist/simple-tree/core/unhydratedFlexTree.js +175 -207
  232. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  233. package/dist/simple-tree/index.d.ts +5 -5
  234. package/dist/simple-tree/index.d.ts.map +1 -1
  235. package/dist/simple-tree/index.js +5 -5
  236. package/dist/simple-tree/index.js.map +1 -1
  237. package/dist/simple-tree/leafNodeSchema.d.ts +2 -0
  238. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  239. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  240. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -1
  241. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  242. package/dist/simple-tree/node-kinds/array/arrayNode.js +8 -7
  243. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  244. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  245. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  246. package/dist/simple-tree/node-kinds/index.js +1 -2
  247. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  248. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +3 -2
  249. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  250. package/dist/simple-tree/node-kinds/map/mapNode.js +6 -4
  251. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  252. package/dist/simple-tree/node-kinds/object/index.d.ts +1 -1
  253. package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  254. package/dist/simple-tree/node-kinds/object/index.js +1 -2
  255. package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
  256. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +5 -15
  257. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  258. package/dist/simple-tree/node-kinds/object/objectNode.js +15 -44
  259. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  260. package/dist/simple-tree/prepareForInsertion.d.ts +20 -6
  261. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  262. package/dist/simple-tree/prepareForInsertion.js +31 -20
  263. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  264. package/dist/simple-tree/schemaTypes.d.ts +56 -9
  265. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  266. package/dist/simple-tree/schemaTypes.js +28 -1
  267. package/dist/simple-tree/schemaTypes.js.map +1 -1
  268. package/dist/simple-tree/simpleSchema.d.ts +22 -4
  269. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  270. package/dist/simple-tree/simpleSchema.js.map +1 -1
  271. package/dist/simple-tree/toStoredSchema.d.ts +8 -1
  272. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  273. package/dist/simple-tree/toStoredSchema.js +19 -7
  274. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  275. package/{lib/simple-tree/toMapTree.d.ts → dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts} +12 -23
  276. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -0
  277. package/dist/simple-tree/{toMapTree.js → unhydratedFlexTreeFromInsertable.js} +103 -185
  278. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -0
  279. package/dist/tableSchema.d.ts +1 -1
  280. package/dist/treeFactory.d.ts.map +1 -1
  281. package/dist/treeFactory.js +6 -1
  282. package/dist/treeFactory.js.map +1 -1
  283. package/dist/util/index.d.ts +1 -1
  284. package/dist/util/index.d.ts.map +1 -1
  285. package/dist/util/index.js +2 -1
  286. package/dist/util/index.js.map +1 -1
  287. package/dist/util/typeUtils.d.ts +2 -2
  288. package/dist/util/typeUtils.js.map +1 -1
  289. package/dist/util/utils.d.ts +6 -0
  290. package/dist/util/utils.d.ts.map +1 -1
  291. package/dist/util/utils.js +8 -1
  292. package/dist/util/utils.js.map +1 -1
  293. package/docs/user-facing/schema-evolution.md +1 -1
  294. package/lib/alpha.d.ts +12 -6
  295. package/lib/beta.d.ts +6 -1
  296. package/lib/codec/codec.d.ts +23 -3
  297. package/lib/codec/codec.d.ts.map +1 -1
  298. package/lib/codec/codec.js.map +1 -1
  299. package/lib/codec/index.d.ts +1 -1
  300. package/lib/codec/index.d.ts.map +1 -1
  301. package/lib/codec/index.js.map +1 -1
  302. package/lib/codec/versioned/codec.d.ts +35 -2
  303. package/lib/codec/versioned/codec.d.ts.map +1 -1
  304. package/lib/codec/versioned/codec.js +36 -2
  305. package/lib/codec/versioned/codec.js.map +1 -1
  306. package/lib/core/index.d.ts +1 -1
  307. package/lib/core/index.d.ts.map +1 -1
  308. package/lib/core/index.js +1 -1
  309. package/lib/core/index.js.map +1 -1
  310. package/lib/core/schema-stored/formatV2.d.ts +80 -0
  311. package/lib/core/schema-stored/formatV2.d.ts.map +1 -0
  312. package/lib/core/schema-stored/formatV2.js +52 -0
  313. package/lib/core/schema-stored/formatV2.js.map +1 -0
  314. package/lib/core/schema-stored/index.d.ts +3 -1
  315. package/lib/core/schema-stored/index.d.ts.map +1 -1
  316. package/lib/core/schema-stored/index.js +3 -1
  317. package/lib/core/schema-stored/index.js.map +1 -1
  318. package/lib/core/schema-stored/schema.d.ts +49 -17
  319. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  320. package/lib/core/schema-stored/schema.js +63 -21
  321. package/lib/core/schema-stored/schema.js.map +1 -1
  322. package/lib/core/tree/detachedFieldIndex.d.ts +2 -2
  323. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  324. package/lib/core/tree/detachedFieldIndex.js +6 -2
  325. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  326. package/lib/core/tree/mapTree.d.ts +2 -1
  327. package/lib/core/tree/mapTree.d.ts.map +1 -1
  328. package/lib/core/tree/mapTree.js +11 -5
  329. package/lib/core/tree/mapTree.js.map +1 -1
  330. package/lib/core/tree/visitorUtils.d.ts +2 -2
  331. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  332. package/lib/core/tree/visitorUtils.js.map +1 -1
  333. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +9 -7
  334. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  335. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +11 -7
  336. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  337. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +3 -3
  338. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  339. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +7 -7
  340. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  341. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts +1 -1
  342. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  343. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +3 -3
  344. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  345. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -2
  346. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  347. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  348. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +4 -3
  349. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  350. package/lib/feature-libraries/default-schema/schemaChecker.js +4 -3
  351. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  352. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +8 -3
  353. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  354. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +2 -5
  355. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  356. package/lib/feature-libraries/flex-tree/context.d.ts +14 -6
  357. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  358. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  359. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +48 -29
  360. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  361. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +4 -0
  362. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  363. package/lib/feature-libraries/flex-tree/index.d.ts +2 -3
  364. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  365. package/lib/feature-libraries/flex-tree/index.js +0 -1
  366. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  367. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +2 -2
  368. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  369. package/lib/feature-libraries/flex-tree/lazyEntity.js +3 -0
  370. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  371. package/lib/feature-libraries/flex-tree/lazyField.d.ts +6 -7
  372. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  373. package/lib/feature-libraries/flex-tree/lazyField.js +3 -6
  374. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  375. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +8 -7
  376. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  377. package/lib/feature-libraries/flex-tree/lazyNode.js +17 -6
  378. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  379. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +10 -5
  380. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  381. package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -7
  382. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  383. package/lib/feature-libraries/index.d.ts +2 -2
  384. package/lib/feature-libraries/index.d.ts.map +1 -1
  385. package/lib/feature-libraries/index.js +2 -2
  386. package/lib/feature-libraries/index.js.map +1 -1
  387. package/lib/feature-libraries/mapTreeCursor.d.ts +53 -3
  388. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  389. package/lib/feature-libraries/mapTreeCursor.js +43 -7
  390. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  391. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +1 -1
  392. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +2 -0
  393. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
  394. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
  395. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  396. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +5 -5
  397. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  398. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  399. package/lib/feature-libraries/object-forest/objectForest.js +2 -0
  400. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  401. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  402. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -4
  403. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  404. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -36
  405. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  406. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js +3 -3
  407. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  408. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  409. package/lib/feature-libraries/schema-index/codec.js +60 -10
  410. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  411. package/lib/feature-libraries/schema-index/formatV1.d.ts +1 -1
  412. package/lib/feature-libraries/schema-index/formatV2.d.ts +42 -0
  413. package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -0
  414. package/lib/feature-libraries/schema-index/formatV2.js +23 -0
  415. package/lib/feature-libraries/schema-index/formatV2.js.map +1 -0
  416. package/lib/feature-libraries/schema-index/index.d.ts +2 -1
  417. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  418. package/lib/feature-libraries/schema-index/index.js +2 -1
  419. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  420. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +7 -2
  421. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  422. package/lib/feature-libraries/schema-index/schemaSummarizer.js +6 -6
  423. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  424. package/lib/feature-libraries/treeCursorUtils.d.ts +5 -1
  425. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  426. package/lib/feature-libraries/treeCursorUtils.js +8 -2
  427. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  428. package/lib/index.d.ts +3 -3
  429. package/lib/index.d.ts.map +1 -1
  430. package/lib/index.js.map +1 -1
  431. package/lib/packageVersion.d.ts +1 -1
  432. package/lib/packageVersion.d.ts.map +1 -1
  433. package/lib/packageVersion.js +1 -1
  434. package/lib/packageVersion.js.map +1 -1
  435. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  436. package/lib/shared-tree/schematizeTree.js +1 -0
  437. package/lib/shared-tree/schematizeTree.js.map +1 -1
  438. package/lib/shared-tree/schematizingTreeView.d.ts +11 -1
  439. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  440. package/lib/shared-tree/schematizingTreeView.js +34 -21
  441. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  442. package/lib/shared-tree/sharedTree.d.ts +8 -4
  443. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  444. package/lib/shared-tree/sharedTree.js +36 -6
  445. package/lib/shared-tree/sharedTree.js.map +1 -1
  446. package/lib/shared-tree/tree.d.ts.map +1 -1
  447. package/lib/shared-tree/tree.js +2 -18
  448. package/lib/shared-tree/tree.js.map +1 -1
  449. package/lib/shared-tree/treeAlpha.d.ts +2 -3
  450. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  451. package/lib/shared-tree/treeAlpha.js +6 -7
  452. package/lib/shared-tree/treeAlpha.js.map +1 -1
  453. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  454. package/lib/shared-tree/treeCheckout.js +6 -3
  455. package/lib/shared-tree/treeCheckout.js.map +1 -1
  456. package/lib/shared-tree-core/editManagerSummarizer.d.ts +8 -3
  457. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  458. package/lib/shared-tree-core/editManagerSummarizer.js +2 -5
  459. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  460. package/lib/shared-tree-core/sharedTreeCore.d.ts +18 -7
  461. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  462. package/lib/shared-tree-core/sharedTreeCore.js +15 -2
  463. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  464. package/lib/simple-tree/api/configuration.d.ts +2 -2
  465. package/lib/simple-tree/api/configuration.js +1 -1
  466. package/lib/simple-tree/api/configuration.js.map +1 -1
  467. package/lib/simple-tree/api/create.d.ts +9 -4
  468. package/lib/simple-tree/api/create.d.ts.map +1 -1
  469. package/lib/simple-tree/api/create.js +22 -9
  470. package/lib/simple-tree/api/create.js.map +1 -1
  471. package/lib/simple-tree/api/customTree.d.ts +4 -0
  472. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  473. package/lib/simple-tree/api/customTree.js +7 -0
  474. package/lib/simple-tree/api/customTree.js.map +1 -1
  475. package/lib/simple-tree/api/index.d.ts +1 -1
  476. package/lib/simple-tree/api/index.d.ts.map +1 -1
  477. package/lib/simple-tree/api/index.js +1 -1
  478. package/lib/simple-tree/api/index.js.map +1 -1
  479. package/lib/simple-tree/api/schemaCompatibilityTester.js +1 -1
  480. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  481. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  482. package/lib/simple-tree/api/schemaCreationUtilities.js +3 -3
  483. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  484. package/lib/simple-tree/api/schemaFactory.d.ts +25 -13
  485. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  486. package/lib/simple-tree/api/schemaFactory.js +44 -11
  487. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  488. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +41 -11
  489. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  490. package/lib/simple-tree/api/schemaFactoryAlpha.js +31 -4
  491. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  492. package/lib/simple-tree/api/storedSchema.js +2 -2
  493. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  494. package/lib/simple-tree/api/treeChangeEvents.d.ts +8 -3
  495. package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  496. package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
  497. package/lib/simple-tree/api/treeNodeApi.d.ts +14 -3
  498. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  499. package/lib/simple-tree/api/treeNodeApi.js +35 -20
  500. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  501. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  502. package/lib/simple-tree/api/verboseTree.js +13 -10
  503. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  504. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  505. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +5 -0
  506. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  507. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  508. package/lib/simple-tree/core/getOrCreateNode.js +3 -2
  509. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  510. package/lib/simple-tree/core/index.d.ts +2 -2
  511. package/lib/simple-tree/core/index.d.ts.map +1 -1
  512. package/lib/simple-tree/core/index.js +2 -2
  513. package/lib/simple-tree/core/index.js.map +1 -1
  514. package/lib/simple-tree/core/treeNodeKernel.d.ts +15 -25
  515. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  516. package/lib/simple-tree/core/treeNodeKernel.js +25 -33
  517. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  518. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +129 -64
  519. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  520. package/lib/simple-tree/core/unhydratedFlexTree.js +174 -208
  521. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  522. package/lib/simple-tree/index.d.ts +5 -5
  523. package/lib/simple-tree/index.d.ts.map +1 -1
  524. package/lib/simple-tree/index.js +3 -3
  525. package/lib/simple-tree/index.js.map +1 -1
  526. package/lib/simple-tree/leafNodeSchema.d.ts +2 -0
  527. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  528. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  529. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -1
  530. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  531. package/lib/simple-tree/node-kinds/array/arrayNode.js +7 -6
  532. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  533. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  534. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  535. package/lib/simple-tree/node-kinds/index.js +1 -1
  536. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  537. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +3 -2
  538. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  539. package/lib/simple-tree/node-kinds/map/mapNode.js +8 -6
  540. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  541. package/lib/simple-tree/node-kinds/object/index.d.ts +1 -1
  542. package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  543. package/lib/simple-tree/node-kinds/object/index.js +1 -1
  544. package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
  545. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +5 -15
  546. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  547. package/lib/simple-tree/node-kinds/object/objectNode.js +6 -34
  548. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  549. package/lib/simple-tree/prepareForInsertion.d.ts +20 -6
  550. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  551. package/lib/simple-tree/prepareForInsertion.js +30 -20
  552. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  553. package/lib/simple-tree/schemaTypes.d.ts +56 -9
  554. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  555. package/lib/simple-tree/schemaTypes.js +28 -1
  556. package/lib/simple-tree/schemaTypes.js.map +1 -1
  557. package/lib/simple-tree/simpleSchema.d.ts +22 -4
  558. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  559. package/lib/simple-tree/simpleSchema.js.map +1 -1
  560. package/lib/simple-tree/toStoredSchema.d.ts +8 -1
  561. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  562. package/lib/simple-tree/toStoredSchema.js +17 -5
  563. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  564. package/{dist/simple-tree/toMapTree.d.ts → lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts} +12 -23
  565. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -0
  566. package/lib/simple-tree/{toMapTree.js → unhydratedFlexTreeFromInsertable.js} +105 -186
  567. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -0
  568. package/lib/tableSchema.d.ts +1 -1
  569. package/lib/treeFactory.d.ts.map +1 -1
  570. package/lib/treeFactory.js +6 -1
  571. package/lib/treeFactory.js.map +1 -1
  572. package/lib/util/index.d.ts +1 -1
  573. package/lib/util/index.d.ts.map +1 -1
  574. package/lib/util/index.js +1 -1
  575. package/lib/util/index.js.map +1 -1
  576. package/lib/util/typeUtils.d.ts +2 -2
  577. package/lib/util/typeUtils.js.map +1 -1
  578. package/lib/util/utils.d.ts +6 -0
  579. package/lib/util/utils.d.ts.map +1 -1
  580. package/lib/util/utils.js +6 -0
  581. package/lib/util/utils.js.map +1 -1
  582. package/package.json +21 -21
  583. package/src/codec/codec.ts +24 -3
  584. package/src/codec/index.ts +1 -0
  585. package/src/codec/versioned/codec.ts +42 -5
  586. package/src/core/index.ts +3 -1
  587. package/src/core/schema-stored/formatV2.ts +78 -0
  588. package/src/core/schema-stored/index.ts +4 -1
  589. package/src/core/schema-stored/schema.ts +123 -33
  590. package/src/core/tree/detachedFieldIndex.ts +13 -4
  591. package/src/core/tree/mapTree.ts +22 -7
  592. package/src/core/tree/visitorUtils.ts +2 -2
  593. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +16 -11
  594. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +16 -7
  595. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +4 -4
  596. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +3 -2
  597. package/src/feature-libraries/default-schema/schemaChecker.ts +7 -6
  598. package/src/feature-libraries/detachedFieldIndexSummarizer.ts +9 -16
  599. package/src/feature-libraries/flex-tree/context.ts +17 -7
  600. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +57 -33
  601. package/src/feature-libraries/flex-tree/index.ts +4 -8
  602. package/src/feature-libraries/flex-tree/lazyEntity.ts +5 -1
  603. package/src/feature-libraries/flex-tree/lazyField.ts +12 -13
  604. package/src/feature-libraries/flex-tree/lazyNode.ts +21 -8
  605. package/src/feature-libraries/forest-summary/forestSummarizer.ts +12 -18
  606. package/src/feature-libraries/index.ts +10 -1
  607. package/src/feature-libraries/mapTreeCursor.ts +112 -16
  608. package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +2 -0
  609. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +9 -5
  610. package/src/feature-libraries/object-forest/objectForest.ts +3 -0
  611. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +11 -6
  612. package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +3 -3
  613. package/src/feature-libraries/schema-index/codec.ts +73 -14
  614. package/src/feature-libraries/schema-index/formatV2.ts +30 -0
  615. package/src/feature-libraries/schema-index/index.ts +2 -1
  616. package/src/feature-libraries/schema-index/schemaSummarizer.ts +11 -18
  617. package/src/feature-libraries/treeCursorUtils.ts +21 -10
  618. package/src/index.ts +6 -0
  619. package/src/packageVersion.ts +1 -1
  620. package/src/shared-tree/schematizeTree.ts +1 -0
  621. package/src/shared-tree/schematizingTreeView.ts +40 -22
  622. package/src/shared-tree/sharedTree.ts +51 -15
  623. package/src/shared-tree/tree.ts +5 -20
  624. package/src/shared-tree/treeAlpha.ts +23 -12
  625. package/src/shared-tree/treeCheckout.ts +6 -3
  626. package/src/shared-tree-core/editManagerSummarizer.ts +9 -16
  627. package/src/shared-tree-core/sharedTreeCore.ts +33 -24
  628. package/src/simple-tree/api/configuration.ts +3 -3
  629. package/src/simple-tree/api/create.ts +49 -19
  630. package/src/simple-tree/api/customTree.ts +10 -0
  631. package/src/simple-tree/api/index.ts +1 -4
  632. package/src/simple-tree/api/schemaCompatibilityTester.ts +1 -1
  633. package/src/simple-tree/api/schemaCreationUtilities.ts +3 -3
  634. package/src/simple-tree/api/schemaFactory.ts +78 -24
  635. package/src/simple-tree/api/schemaFactoryAlpha.ts +53 -8
  636. package/src/simple-tree/api/storedSchema.ts +4 -4
  637. package/src/simple-tree/api/treeChangeEvents.ts +8 -3
  638. package/src/simple-tree/api/treeNodeApi.ts +48 -27
  639. package/src/simple-tree/api/verboseTree.ts +15 -12
  640. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +5 -0
  641. package/src/simple-tree/core/getOrCreateNode.ts +4 -2
  642. package/src/simple-tree/core/index.ts +2 -3
  643. package/src/simple-tree/core/treeNodeKernel.ts +38 -55
  644. package/src/simple-tree/core/unhydratedFlexTree.ts +231 -292
  645. package/src/simple-tree/index.ts +6 -3
  646. package/src/simple-tree/leafNodeSchema.ts +2 -0
  647. package/src/simple-tree/node-kinds/array/arrayNode.ts +17 -13
  648. package/src/simple-tree/node-kinds/index.ts +0 -1
  649. package/src/simple-tree/node-kinds/map/mapNode.ts +17 -11
  650. package/src/simple-tree/node-kinds/object/index.ts +0 -1
  651. package/src/simple-tree/node-kinds/object/objectNode.ts +15 -49
  652. package/src/simple-tree/prepareForInsertion.ts +54 -43
  653. package/src/simple-tree/schemaTypes.ts +103 -13
  654. package/src/simple-tree/simpleSchema.ts +27 -5
  655. package/src/simple-tree/toStoredSchema.ts +22 -5
  656. package/src/simple-tree/{toMapTree.ts → unhydratedFlexTreeFromInsertable.ts} +134 -226
  657. package/src/treeFactory.ts +6 -1
  658. package/src/util/index.ts +1 -0
  659. package/src/util/typeUtils.ts +2 -2
  660. package/src/util/utils.ts +9 -0
  661. package/dist/feature-libraries/flex-tree/navigation.d.ts +0 -46
  662. package/dist/feature-libraries/flex-tree/navigation.d.ts.map +0 -1
  663. package/dist/feature-libraries/flex-tree/navigation.js +0 -104
  664. package/dist/feature-libraries/flex-tree/navigation.js.map +0 -1
  665. package/dist/simple-tree/toMapTree.d.ts.map +0 -1
  666. package/dist/simple-tree/toMapTree.js.map +0 -1
  667. package/lib/feature-libraries/flex-tree/navigation.d.ts +0 -46
  668. package/lib/feature-libraries/flex-tree/navigation.d.ts.map +0 -1
  669. package/lib/feature-libraries/flex-tree/navigation.js +0 -97
  670. package/lib/feature-libraries/flex-tree/navigation.js.map +0 -1
  671. package/lib/simple-tree/toMapTree.d.ts.map +0 -1
  672. package/lib/simple-tree/toMapTree.js.map +0 -1
  673. package/src/feature-libraries/flex-tree/navigation.ts +0 -121
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type Anchor, type AnchorNode, type FieldKey, type ITreeCursorSynchronous, type ITreeSubscriptionCursor, type TreeNavigationResult, type TreeNodeSchemaIdentifier, type Value } from "../../core/index.js";
5
+ import { type Anchor, type AnchorNode, type FieldKey, type ITreeSubscriptionCursor, type TreeNavigationResult, type TreeNodeSchemaIdentifier, type Value } from "../../core/index.js";
6
6
  import type { Context } from "./context.js";
7
- import { FlexTreeEntityKind, type FlexTreeField, type FlexTreeNode, flexTreeMarker } from "./flexTreeTypes.js";
7
+ import { FlexTreeEntityKind, type FlexTreeField, type HydratedFlexTreeNode, flexTreeMarker } from "./flexTreeTypes.js";
8
8
  import { LazyEntity } from "./lazyEntity.js";
9
9
  /**
10
10
  * This does not take ownership of this cursor: Node will fork it as needed.
@@ -13,20 +13,21 @@ export declare function makeTree(context: Context, cursor: ITreeSubscriptionCurs
13
13
  /**
14
14
  * Lazy implementation of {@link FlexTreeNode}.
15
15
  */
16
- export declare class LazyTreeNode extends LazyEntity<Anchor> implements FlexTreeNode {
16
+ export declare class LazyTreeNode extends LazyEntity<Anchor> implements HydratedFlexTreeNode {
17
17
  #private;
18
- readonly schema: TreeNodeSchemaIdentifier;
18
+ readonly type: TreeNodeSchemaIdentifier;
19
19
  readonly anchorNode: AnchorNode;
20
20
  get [flexTreeMarker](): FlexTreeEntityKind.Node;
21
21
  private readonly storedSchema;
22
- constructor(context: Context, schema: TreeNodeSchemaIdentifier, cursor: ITreeSubscriptionCursor, anchorNode: AnchorNode, anchor: Anchor);
23
- borrowCursor(): ITreeCursorSynchronous;
22
+ constructor(context: Context, type: TreeNodeSchemaIdentifier, cursor: ITreeSubscriptionCursor, anchorNode: AnchorNode, anchor: Anchor);
23
+ isHydrated(): this is HydratedFlexTreeNode;
24
24
  protected tryMoveCursorToAnchor(cursor: ITreeSubscriptionCursor): TreeNavigationResult;
25
25
  protected forgetAnchor(): void;
26
26
  get value(): Value;
27
+ readonly fields: Pick<Map<FieldKey, FlexTreeField>, typeof Symbol.iterator | "get">;
27
28
  tryGetField(fieldKey: FieldKey): FlexTreeField | undefined;
28
29
  getBoxed(key: FieldKey): FlexTreeField;
29
- boxedIterator(): IterableIterator<FlexTreeField>;
30
+ [Symbol.iterator](): IterableIterator<FlexTreeField>;
30
31
  get parentField(): {
31
32
  readonly parent: FlexTreeField;
32
33
  readonly index: number;
@@ -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,EACb,KAAK,sBAAsB,EAE3B,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,YAAY,EACjB,cAAc,EAEd,MAAM,oBAA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W,IAAI;QAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CA8CnF;IAEM,IAAI,IAAI,gBAAgB,CAAC,QAAQ,CAAC;CAGzC"}
@@ -53,20 +53,31 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
53
53
  get [(_LazyTreeNode_removeDeleteCallback = new WeakMap(), flexTreeTypes_js_1.flexTreeMarker)]() {
54
54
  return flexTreeTypes_js_1.FlexTreeEntityKind.Node;
55
55
  }
56
- constructor(context, schema, cursor, anchorNode, anchor) {
56
+ constructor(context, type, cursor, anchorNode, anchor) {
57
57
  super(context, cursor, anchor);
58
- this.schema = schema;
58
+ this.type = type;
59
59
  this.anchorNode = anchorNode;
60
60
  // Using JS private here prevents it from showing up as a enumerable own property, or conflicting with struct fields.
61
61
  _LazyTreeNode_removeDeleteCallback.set(this, void 0);
62
+ this.fields = {
63
+ get: (key) => this.tryGetField(key),
64
+ [Symbol.iterator]: () => (0, index_js_1.mapCursorFields)(this.cursor, (cursor) => {
65
+ const key = cursor.getFieldKey();
66
+ const pair = [
67
+ key,
68
+ (0, lazyField_js_1.makeField)(this.context, this.storedSchema.getFieldSchema(key).kind, cursor),
69
+ ];
70
+ return pair;
71
+ }).values(),
72
+ };
62
73
  this.storedSchema =
63
- context.schema.nodeSchema.get(this.schema) ?? (0, internal_1.fail)(0xb14 /* missing schema */);
74
+ context.schema.nodeSchema.get(this.type) ?? (0, internal_1.fail)(0xb14 /* missing schema */);
64
75
  (0, internal_1.assert)(cursor.mode === 0 /* CursorLocationType.Nodes */, 0x783 /* must be in nodes mode */);
65
76
  anchorNode.slots.set(flexTreeTypes_js_1.flexTreeSlot, this);
66
77
  __classPrivateFieldSet(this, _LazyTreeNode_removeDeleteCallback, anchorNode.events.on("afterDestroy", cleanupTree), "f");
67
78
  }
68
- borrowCursor() {
69
- return this.cursor;
79
+ isHydrated() {
80
+ return true;
70
81
  }
71
82
  tryMoveCursorToAnchor(cursor) {
72
83
  return this.context.checkout.forest.tryMoveCursorToNode(this.anchor, cursor);
@@ -97,7 +108,7 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
97
108
  return (0, lazyField_js_1.makeField)(this.context, fieldSchema.kind, cursor);
98
109
  });
99
110
  }
100
- boxedIterator() {
111
+ [Symbol.iterator]() {
101
112
  return (0, index_js_1.mapCursorFields)(this.cursor, (cursor) => (0, lazyField_js_1.makeField)(this.context, this.storedSchema.getFieldSchema(cursor.getFieldKey()).kind, cursor)).values();
102
113
  }
103
114
  get parentField() {
@@ -1 +1 @@
1
- {"version":3,"file":"lazyNode.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,kEAAmE;AAEnE,kDAe6B;AAC7B,kDAAoD;AACpD,yDAAwD;AAGxD,yDAM4B;AAC5B,mDAA6C;AAC7C,iDAA2C;AAE3C;;GAEG;AACH,SAAgB,QAAQ,CAAC,OAAgB,EAAE,MAA+B;IACzE,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,UAAU,GACf,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;QAC9C,IAAA,eAAI,EAAC,KAAK,CAAC,yEAAyE,CAAC,CAAC;IACvF,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,+BAAY,CAAC,CAAC;IAClD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAA,iBAAM,EAAC,MAAM,CAAC,OAAO,KAAK,OAAO,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACpE,IAAA,iBAAM,EAAC,MAAM,YAAY,YAAY,EAAE,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mH;gBACnH,EAAE;gBACF,QAAQ;gBACR,8EAA8E;gBAC9E,kEAAkE;gBAClE,4JAA4J;gBAC5J,mCAAmC;gBACnC,2MAA2M;gBAC3M,8NAA8N;gBAC9N,qJAAqJ;gBACrJ,WAAW,GAAG,qBAAU,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,IAAA,eAAI,EAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;YACxD,WAAW,GAAG,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACnD,CAAC;QAED,MAAM,cAAc,GAAG,IAAA,wBAAS,EAAC,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,IAAA,0BAAe,EAAC,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;IAChF,CAAC;CACD;AA9HD,oCA8HC","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 ITreeCursorSynchronous,\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 FlexTreeNode,\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 FlexTreeNode {\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 schema: 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.schema) ?? 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 borrowCursor(): ITreeCursorSynchronous {\n\t\treturn this.cursor as ITreeCursorSynchronous;\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 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 boxedIterator(): 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,kEAAmE;AAEnE,kDAc6B;AAC7B,kDAAoD;AACpD,yDAAwD;AAGxD,yDAM4B;AAC5B,mDAA6C;AAC7C,iDAA2C;AAE3C;;GAEG;AACH,SAAgB,QAAQ,CAAC,OAAgB,EAAE,MAA+B;IACzE,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,UAAU,GACf,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;QAC9C,IAAA,eAAI,EAAC,KAAK,CAAC,yEAAyE,CAAC,CAAC;IACvF,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,GA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YACvB,MAAM,UAAU,GACf,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;gBAC9C,IAAA,eAAI,EAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;YACxD,WAAW,GAAG,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACnD,CAAC;QAED,MAAM,cAAc,GAAG,IAAA,wBAAS,EAAC,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,IAAA,0BAAe,EAAC,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;IAChF,CAAC;CACD;AA5ID,oCA4IC","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"]}
@@ -4,8 +4,8 @@
4
4
  */
5
5
  import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
6
6
  import type { IIdCompressor } from "@fluidframework/id-compressor";
7
- import type { ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions/internal";
8
- import { type ICodecOptions } from "../../codec/index.js";
7
+ import type { IExperimentalIncrementalSummaryContext, ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions/internal";
8
+ import type { CodecWriteOptions } from "../../codec/index.js";
9
9
  import { type IEditableForest, type RevisionTagCodec } from "../../core/index.js";
10
10
  import type { Summarizable, SummaryElementParser, SummaryElementStringifier } from "../../shared-tree-core/index.js";
11
11
  import type { FieldBatchCodec, FieldBatchEncodingContext } from "../chunked-forest/index.js";
@@ -22,7 +22,7 @@ export declare class ForestSummarizer implements Summarizable {
22
22
  /**
23
23
  * @param encoderContext - The schema if provided here must be mutated by the caller to keep it up to date.
24
24
  */
25
- constructor(forest: IEditableForest, revisionTagCodec: RevisionTagCodec, fieldBatchCodec: FieldBatchCodec, encoderContext: FieldBatchEncodingContext, options: ICodecOptions | undefined, idCompressor: IIdCompressor);
25
+ constructor(forest: IEditableForest, revisionTagCodec: RevisionTagCodec, fieldBatchCodec: FieldBatchCodec, encoderContext: FieldBatchEncodingContext, options: CodecWriteOptions, idCompressor: IIdCompressor);
26
26
  /**
27
27
  * Synchronous monolithic summarization of tree content.
28
28
  *
@@ -31,8 +31,13 @@ export declare class ForestSummarizer implements Summarizable {
31
31
  * @returns a snapshot of the forest's tree as a string.
32
32
  */
33
33
  private getTreeString;
34
- getAttachSummary(stringify: SummaryElementStringifier, fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
35
- summarize(stringify: SummaryElementStringifier, fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
34
+ summarize(props: {
35
+ stringify: SummaryElementStringifier;
36
+ fullTree?: boolean;
37
+ trackState?: boolean;
38
+ telemetryContext?: ITelemetryContext;
39
+ incrementalSummaryContext?: IExperimentalIncrementalSummaryContext;
40
+ }): ISummaryTreeWithStats;
36
41
  load(services: IChannelStorageService, parse: SummaryElementParser): Promise<void>;
37
42
  }
38
43
  //# sourceMappingURL=forestSummarizer.d.ts.map
@@ -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,CAAC;AACnE,OAAO,KAAK,EACX,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,8CAA8C,CAAC;A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iB,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"}
@@ -8,9 +8,8 @@ exports.ForestSummarizer = void 0;
8
8
  const client_utils_1 = require("@fluid-internal/client-utils");
9
9
  const internal_1 = require("@fluidframework/core-utils/internal");
10
10
  const internal_2 = require("@fluidframework/shared-object-base/internal");
11
- const index_js_1 = require("../../codec/index.js");
12
- const index_js_2 = require("../../core/index.js");
13
- const index_js_3 = require("../../util/index.js");
11
+ const index_js_1 = require("../../core/index.js");
12
+ const index_js_2 = require("../../util/index.js");
14
13
  // eslint-disable-next-line import/no-internal-modules
15
14
  const chunkTree_js_1 = require("../chunked-forest/chunkTree.js");
16
15
  const codec_js_1 = require("./codec.js");
@@ -25,12 +24,13 @@ class ForestSummarizer {
25
24
  /**
26
25
  * @param encoderContext - The schema if provided here must be mutated by the caller to keep it up to date.
27
26
  */
28
- constructor(forest, revisionTagCodec, fieldBatchCodec, encoderContext, options = { jsonValidator: index_js_1.noopValidator }, idCompressor) {
27
+ constructor(forest, revisionTagCodec, fieldBatchCodec, encoderContext, options, idCompressor) {
29
28
  this.forest = forest;
30
29
  this.revisionTagCodec = revisionTagCodec;
31
30
  this.encoderContext = encoderContext;
32
31
  this.idCompressor = idCompressor;
33
32
  this.key = "Forest";
33
+ // TODO: this should take in CodecWriteOptions, and use it to pick the write version.
34
34
  this.codec = (0, codec_js_1.makeForestSummarizerCodec)(options, fieldBatchCodec);
35
35
  }
36
36
  /**
@@ -44,7 +44,7 @@ class ForestSummarizer {
44
44
  const rootCursor = this.forest.getCursorAboveDetachedFields();
45
45
  const fieldMap = new Map();
46
46
  // TODO: Encode all detached fields in one operation for better performance and compression
47
- (0, index_js_2.forEachField)(rootCursor, (cursor) => {
47
+ (0, index_js_1.forEachField)(rootCursor, (cursor) => {
48
48
  const key = cursor.getFieldKey();
49
49
  const innerCursor = this.forest.allocateCursor("getTreeString");
50
50
  (0, internal_1.assert)(this.forest.tryMoveCursorToField({ fieldKey: key, parent: undefined }, innerCursor) ===
@@ -55,11 +55,8 @@ class ForestSummarizer {
55
55
  fieldMap.forEach((value) => value.free());
56
56
  return stringify(encoded);
57
57
  }
58
- getAttachSummary(stringify, fullTree, trackState, telemetryContext) {
59
- return (0, internal_2.createSingleBlobSummary)(treeBlobKey, this.getTreeString(stringify));
60
- }
61
- async summarize(stringify, fullTree, trackState, telemetryContext) {
62
- return (0, internal_2.createSingleBlobSummary)(treeBlobKey, this.getTreeString(stringify));
58
+ summarize(props) {
59
+ return (0, internal_2.createSingleBlobSummary)(treeBlobKey, this.getTreeString(props.stringify));
63
60
  }
64
61
  async load(services, parse) {
65
62
  if (await services.contains(treeBlobKey)) {
@@ -68,7 +65,7 @@ class ForestSummarizer {
68
65
  // TODO: this code is parsing data without an optional validator, this should be defined in a typebox schema as part of the
69
66
  // forest summary format.
70
67
  const fields = this.codec.decode(parse(treeBufferString), this.encoderContext);
71
- const allocator = (0, index_js_3.idAllocatorFromMaxId)();
68
+ const allocator = (0, index_js_2.idAllocatorFromMaxId)();
72
69
  const fieldChanges = [];
73
70
  const build = [];
74
71
  for (const [fieldKey, field] of fields) {
@@ -84,7 +81,7 @@ class ForestSummarizer {
84
81
  fieldChanges.push([fieldKey, [{ count: chunked.topLevelLength, attach: buildId }]]);
85
82
  }
86
83
  (0, internal_1.assert)(this.forest.isEmpty, 0x797 /* forest must be empty */);
87
- (0, index_js_2.applyDelta)({ build, fields: new Map(fieldChanges) }, undefined, this.forest, (0, index_js_2.makeDetachedFieldIndex)("init", this.revisionTagCodec, this.idCompressor));
84
+ (0, index_js_1.applyDelta)({ build, fields: new Map(fieldChanges) }, undefined, this.forest, (0, index_js_1.makeDetachedFieldIndex)("init", this.revisionTagCodec, this.idCompressor));
88
85
  }
89
86
  }
90
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"forestSummarizer.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/forestSummarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,kEAA6D;AAO7D,0EAAsF;AAEtF,mDAAyE;AACzE,kDAY6B;AAM7B,kDAA2D;AAC3D,sDAAsD;AACtD,iEAAsF;AAGtF,yCAAyE;AAEzE;;GAEG;AACH,MAAM,WAAW,GAAG,YAAY,CAAC;AAEjC;;GAEG;AACH,MAAa,gBAAgB;IAK5B;;OAEG;IACH,YACkB,MAAuB,EACvB,gBAAkC,EACnD,eAAgC,EACf,cAAyC,EAC1D,UAAyB,EAAE,aAAa,EAAE,wBAAa,EAAE,EACxC,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,IAAI,CAAC,KAAK,GAAG,IAAA,oCAAyB,EAAC,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;QAC3F,IAAA,uBAAY,EAAC,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE;YACnC,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;YACjC,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;YAChE,IAAA,iBAAM,EACL,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,WAAW,CAAC;+CAC3D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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,IAAA,+BAAgB,EAAC,KAAK,EAAE;oBACvC,MAAM,EAAE,iCAAkB;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,IAAA,iBAAM,EAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAC;YAC9D,IAAA,qBAAU,EACT,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,YAAY,CAAC,EAAE,EACxC,SAAS,EACT,IAAI,CAAC,MAAM,EACX,IAAA,iCAAsB,EAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,CACxE,CAAC;QACH,CAAC;IACF,CAAC;CACD;AApGD,4CAoGC","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\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { createSingleBlobSummary } from \"@fluidframework/shared-object-base/internal\";\n\nimport { type ICodecOptions, noopValidator } 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: ICodecOptions = { jsonValidator: noopValidator },\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t) {\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 getAttachSummary(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\treturn createSingleBlobSummary(treeBlobKey, this.getTreeString(stringify));\n\t}\n\n\tpublic async summarize(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\treturn createSingleBlobSummary(treeBlobKey, this.getTreeString(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,+DAA8D;AAC9D,kEAA6D;AAQ7D,0EAAsF;AAGtF,kDAY6B;AAM7B,kDAA2D;AAC3D,sDAAsD;AACtD,iEAAsF;AAGtF,yCAAyE;AAEzE;;GAEG;AACH,MAAM,WAAW,GAAG,YAAY,CAAC;AAEjC;;GAEG;AACH,MAAa,gBAAgB;IAK5B;;OAEG;IACH,YACkB,MAAuB,EACvB,gBAAkC,EACnD,eAAgC,EACf,cAAyC,EAC1D,OAA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,iBAAM,EAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAC;YAC9D,IAAA,qBAAU,EACT,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,YAAY,CAAC,EAAE,EACxC,SAAS,EACT,IAAI,CAAC,MAAM,EACX,IAAA,iCAAsB,EAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,CACxE,CAAC;QACH,CAAC;IACF,CAAC;CACD;AA7FD,4CA6FC","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"]}
@@ -5,7 +5,7 @@
5
5
  export { type DownPath, toDownPath, } from "./editableTreeBinder.js";
6
6
  export { allowsValue, assertAllowedValue, isTreeValue } from "./valueUtilities.js";
7
7
  export { ForestSummarizer } from "./forest-summary/index.js";
8
- export { cursorForMapTreeField, cursorForMapTreeNode, mapTreeFromCursor, mapTreeFieldFromCursor, } from "./mapTreeCursor.js";
8
+ export { cursorForMapTreeField, cursorForMapTreeNode, mapTreeFromCursor, mapTreeFieldFromCursor, type MinimalMapTreeNodeView, mapTreeFieldsWithField, mapTreeWithField, type MapTreeFieldViewGeneric, type MapTreeNodeViewGeneric, type MinimalFieldMap, } from "./mapTreeCursor.js";
9
9
  export { buildForest } from "./object-forest/index.js";
10
10
  export { SchemaSummarizer, encodeTreeSchema, makeSchemaCodec, makeSchemaCodecs, } from "./schema-index/index.js";
11
11
  export { stackTreeNodeCursor, type CursorAdapter, prefixPath, prefixFieldPath, type CursorWithNode, stackTreeFieldCursor, } from "./treeCursorUtils.js";
@@ -17,7 +17,7 @@ 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, Skip, 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, } 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, } 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,"file":"index.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,QAAQ,EACb,UAAU,GACV,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEnF,OAAO,EAAE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V,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,GACzB,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"}
@@ -27,8 +27,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
27
27
  return result;
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.fluidVersionToFieldBatchCodecWriteVersion = exports.makeFieldBatchCodec = exports.makeTreeChunker = exports.defaultChunkPolicy = exports.buildChunkedForest = exports.chunkFieldSingle = exports.chunkTree = exports.mapRootChanges = exports.posetLte = exports.comparePosetElements = exports.PosetComparisonResult = exports.fieldRealizer = exports.isNeverTree = exports.isRepoSuperset = exports.getAllowedContentDiscrepancies = exports.updateRefreshers = exports.EncodedModularChangeset = exports.ModularChangeFamily = exports.FieldKindWithEditor = exports.genericFieldKind = exports.allowsRepoSuperset = exports.FlexFieldKind = exports.CrossFieldTarget = exports.makeModularChangeCodecFamily = exports.ModularEditBuilder = exports.isNeverField = exports.SequenceField = exports.jsonableTreeFromForest = exports.jsonableTreeFromFieldCursor = exports.jsonableTreeFromCursor = exports.cursorForJsonableTreeField = exports.cursorForJsonableTreeNode = exports.stackTreeFieldCursor = exports.prefixFieldPath = exports.prefixPath = exports.stackTreeNodeCursor = exports.makeSchemaCodecs = exports.makeSchemaCodec = exports.encodeTreeSchema = exports.SchemaSummarizer = exports.buildForest = exports.mapTreeFieldFromCursor = exports.mapTreeFromCursor = exports.cursorForMapTreeNode = exports.cursorForMapTreeField = exports.ForestSummarizer = exports.isTreeValue = exports.assertAllowedValue = exports.allowsValue = exports.toDownPath = void 0;
31
- exports.initializeForest = exports.hasElement = exports.AnchorTreeIndex = exports.makeMitigatedChangeFamily = exports.EncodedSchemaChange = exports.makeSchemaChangeCodecs = exports.DetachedFieldIndexSummarizer = exports.valueSchemaAllows = exports.TreeCompressionStrategy = exports.FlexTreeEntityKind = exports.indexForAt = exports.treeStatusFromAnchorCache = exports.LazyEntity = exports.getSchemaAndPolicy = exports.flexTreeSlot = exports.assertFlexTreeEntityNotFreed = exports.flexTreeMarker = exports.ContextSlot = exports.isFlexTreeNode = exports.Context = exports.TreeStatus = exports.Skip = exports.inSchemaOrThrow = exports.isFieldInSchema = exports.isNodeInSchema = exports.SchemaValidationError = exports.relevantRemovedRoots = exports.intoDelta = exports.fieldKindConfigurations = exports.fieldKinds = exports.defaultSchemaPolicy = exports.DefaultEditBuilder = exports.DefaultChangeFamily = exports.FieldKinds = exports.nodeKeyTreeIdentifier = exports.MockNodeIdentifierManager = exports.isStableNodeIdentifier = exports.createNodeIdentifierManager = exports.compareLocalNodeIdentifiers = void 0;
30
+ exports.makeTreeChunker = exports.defaultChunkPolicy = exports.buildChunkedForest = exports.chunkFieldSingle = exports.chunkTree = exports.mapRootChanges = exports.posetLte = exports.comparePosetElements = exports.PosetComparisonResult = exports.fieldRealizer = exports.isNeverTree = exports.isRepoSuperset = exports.getAllowedContentDiscrepancies = exports.updateRefreshers = exports.EncodedModularChangeset = exports.ModularChangeFamily = exports.FieldKindWithEditor = exports.genericFieldKind = exports.allowsRepoSuperset = exports.FlexFieldKind = exports.CrossFieldTarget = exports.makeModularChangeCodecFamily = exports.ModularEditBuilder = exports.isNeverField = exports.SequenceField = exports.jsonableTreeFromForest = exports.jsonableTreeFromFieldCursor = exports.jsonableTreeFromCursor = exports.cursorForJsonableTreeField = exports.cursorForJsonableTreeNode = exports.stackTreeFieldCursor = exports.prefixFieldPath = exports.prefixPath = exports.stackTreeNodeCursor = exports.makeSchemaCodecs = exports.makeSchemaCodec = exports.encodeTreeSchema = exports.SchemaSummarizer = exports.buildForest = exports.mapTreeWithField = exports.mapTreeFieldsWithField = exports.mapTreeFieldFromCursor = exports.mapTreeFromCursor = exports.cursorForMapTreeNode = exports.cursorForMapTreeField = exports.ForestSummarizer = exports.isTreeValue = exports.assertAllowedValue = exports.allowsValue = exports.toDownPath = void 0;
31
+ exports.initializeForest = exports.hasElement = exports.AnchorTreeIndex = exports.makeMitigatedChangeFamily = exports.EncodedSchemaChange = exports.makeSchemaChangeCodecs = exports.DetachedFieldIndexSummarizer = exports.valueSchemaAllows = exports.TreeCompressionStrategy = exports.FlexTreeEntityKind = exports.indexForAt = exports.treeStatusFromAnchorCache = exports.LazyEntity = exports.getSchemaAndPolicy = exports.flexTreeSlot = exports.assertFlexTreeEntityNotFreed = exports.flexTreeMarker = exports.ContextSlot = exports.isFlexTreeNode = exports.Context = exports.TreeStatus = exports.inSchemaOrThrow = exports.isFieldInSchema = exports.isNodeInSchema = exports.SchemaValidationError = exports.relevantRemovedRoots = exports.intoDelta = exports.fieldKindConfigurations = exports.fieldKinds = exports.defaultSchemaPolicy = exports.DefaultEditBuilder = exports.DefaultChangeFamily = exports.FieldKinds = exports.nodeKeyTreeIdentifier = exports.MockNodeIdentifierManager = exports.isStableNodeIdentifier = exports.createNodeIdentifierManager = exports.compareLocalNodeIdentifiers = exports.fluidVersionToFieldBatchCodecWriteVersion = exports.makeFieldBatchCodec = void 0;
32
32
  var editableTreeBinder_js_1 = require("./editableTreeBinder.js");
33
33
  Object.defineProperty(exports, "toDownPath", { enumerable: true, get: function () { return editableTreeBinder_js_1.toDownPath; } });
34
34
  var valueUtilities_js_1 = require("./valueUtilities.js");
@@ -42,6 +42,8 @@ Object.defineProperty(exports, "cursorForMapTreeField", { enumerable: true, get:
42
42
  Object.defineProperty(exports, "cursorForMapTreeNode", { enumerable: true, get: function () { return mapTreeCursor_js_1.cursorForMapTreeNode; } });
43
43
  Object.defineProperty(exports, "mapTreeFromCursor", { enumerable: true, get: function () { return mapTreeCursor_js_1.mapTreeFromCursor; } });
44
44
  Object.defineProperty(exports, "mapTreeFieldFromCursor", { enumerable: true, get: function () { return mapTreeCursor_js_1.mapTreeFieldFromCursor; } });
45
+ Object.defineProperty(exports, "mapTreeFieldsWithField", { enumerable: true, get: function () { return mapTreeCursor_js_1.mapTreeFieldsWithField; } });
46
+ Object.defineProperty(exports, "mapTreeWithField", { enumerable: true, get: function () { return mapTreeCursor_js_1.mapTreeWithField; } });
45
47
  var index_js_2 = require("./object-forest/index.js");
46
48
  Object.defineProperty(exports, "buildForest", { enumerable: true, get: function () { return index_js_2.buildForest; } });
47
49
  var index_js_3 = require("./schema-index/index.js");
@@ -112,7 +114,6 @@ Object.defineProperty(exports, "isNodeInSchema", { enumerable: true, get: functi
112
114
  Object.defineProperty(exports, "isFieldInSchema", { enumerable: true, get: function () { return index_js_7.isFieldInSchema; } });
113
115
  Object.defineProperty(exports, "inSchemaOrThrow", { enumerable: true, get: function () { return index_js_7.inSchemaOrThrow; } });
114
116
  var index_js_8 = require("./flex-tree/index.js");
115
- Object.defineProperty(exports, "Skip", { enumerable: true, get: function () { return index_js_8.Skip; } });
116
117
  Object.defineProperty(exports, "TreeStatus", { enumerable: true, get: function () { return index_js_8.TreeStatus; } });
117
118
  Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return index_js_8.Context; } });
118
119
  Object.defineProperty(exports, "isFlexTreeNode", { enumerable: true, get: function () { return index_js_8.isFlexTreeNode; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/feature-libraries/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iEAGiC;AADhC,mHAAA,UAAU,OAAA;AAEX,yDAAmF;AAA1E,gHAAA,WAAW,OAAA;AAAE,uHAAA,kBAAkB,OAAA;AAAE,gHAAA,WAAW,OAAA;AAErD,sDAA6D;AAApD,4GAAA,gBAAgB,OAAA;AACzB,uDAK4B;AAJ3B,yHAAA,qBAAqB,OAAA;AACrB,wHAAA,oBAAoB,OAAA;AACpB,qHAAA,iBAAiB,OAAA;AACjB,0HAAA,sBAAsB,OAAA;AAEvB,qDAAuD;AAA9C,uGAAA,WAAW,OAAA;AACpB,oDAKiC;AAJhC,4GAAA,gBAAgB,OAAA;AAChB,4GAAA,gBAAgB,OAAA;AAChB,2GAAA,eAAe,OAAA;AACf,4GAAA,gBAAgB,OAAA;AAEjB,2DAO8B;AAN7B,yHAAA,mBAAmB,OAAA;AAEnB,gHAAA,UAAU,OAAA;AACV,qHAAA,eAAe,OAAA;AAEf,0HAAA,oBAAoB,OAAA;AAErB,yDAM6B;AAL5B,8HAAA,yBAAyB,OAAA;AACzB,+HAAA,0BAA0B,OAAA;AAC1B,2HAAA,sBAAsB,OAAA;AACtB,gIAAA,2BAA2B,OAAA;AAC3B,2HAAA,sBAAsB,OAAA;AAGvB,sFAAsF;AACtF,yEAA2D;AAClD,sCAAa;AAEtB,sDAmDmC;AAlDlC,wGAAA,YAAY,OAAA;AACZ,8GAAA,kBAAkB,OAAA;AAUlB,wHAAA,4BAA4B,OAAA;AAM5B,4GAAA,gBAAgB,OAAA;AAChB,yGAAA,aAAa,OAAA;AAEb,8GAAA,kBAAkB,OAAA;AAElB,4GAAA,gBAAgB,OAAA;AAGhB,+GAAA,mBAAmB,OA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AY,OAAA;AACZ,8GAAA,kBAAkB,OAAA;AAClB,sGAAA,UAAU,OAAA;AACV,qHAAA,yBAAyB,OAAA;AACzB,sGAAA,UAAU,OAAA;AACV,8GAAA,kBAAkB,OAAA;AAGnB,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAEhC,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAE1B,qFAAiF;AAAxE,+IAAA,4BAA4B,OAAA;AAErC,oDAIiC;AAFhC,kHAAA,sBAAsB,OAAA;AACtB,+GAAA,mBAAmB,OAAA;AAGpB,uEAAuE;AAA9D,qIAAA,yBAAyB,OAAA;AAElC,iDAO6B;AAL5B,4GAAA,eAAe,OAAA;AACf,uGAAA,UAAU,OAAA;AAMX,6DAAyD;AAAhD,uHAAA,gBAAgB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype DownPath,\n\ttoDownPath,\n} from \"./editableTreeBinder.js\";\nexport { allowsValue, assertAllowedValue, isTreeValue } from \"./valueUtilities.js\";\n\nexport { ForestSummarizer } from \"./forest-summary/index.js\";\nexport {\n\tcursorForMapTreeField,\n\tcursorForMapTreeNode,\n\tmapTreeFromCursor,\n\tmapTreeFieldFromCursor,\n} from \"./mapTreeCursor.js\";\nexport { buildForest } from \"./object-forest/index.js\";\nexport {\n\tSchemaSummarizer,\n\tencodeTreeSchema,\n\tmakeSchemaCodec,\n\tmakeSchemaCodecs,\n} from \"./schema-index/index.js\";\nexport {\n\tstackTreeNodeCursor,\n\ttype CursorAdapter,\n\tprefixPath,\n\tprefixFieldPath,\n\ttype CursorWithNode,\n\tstackTreeFieldCursor,\n} from \"./treeCursorUtils.js\";\nexport {\n\tcursorForJsonableTreeNode,\n\tcursorForJsonableTreeField,\n\tjsonableTreeFromCursor,\n\tjsonableTreeFromFieldCursor,\n\tjsonableTreeFromForest,\n} from \"./treeTextCursor.js\";\n\n// Split this up into separate import and export for compatibility with API-Extractor.\nimport * as SequenceField from \"./sequence-field/index.js\";\nexport { SequenceField };\n\nexport {\n\tisNeverField,\n\tModularEditBuilder,\n\ttype FieldEditDescription as EditDescription,\n\ttype FieldChangeHandler,\n\ttype FieldChangeRebaser,\n\ttype FieldEditor,\n\ttype FieldChangeMap,\n\ttype FieldChange,\n\ttype FieldChangeset,\n\ttype ToDelta,\n\ttype ModularChangeset,\n\tmakeModularChangeCodecFamily,\n\ttype NodeChangeComposer,\n\ttype NodeChangeInverter,\n\ttype NodeChangeRebaser,\n\ttype NodeChangePruner,\n\ttype CrossFieldManager,\n\tCrossFieldTarget,\n\tFlexFieldKind,\n\ttype FullSchemaPolicy,\n\tallowsRepoSuperset,\n\ttype GenericChangeset,\n\tgenericFieldKind,\n\ttype HasFieldChanges,\n\ttype NodeExistsConstraint,\n\tFieldKindWithEditor,\n\tModularChangeFamily,\n\ttype RelevantRemovedRootsFromChild,\n\tEncodedModularChangeset,\n\tupdateRefreshers,\n\ttype NodeId,\n\ttype FieldChangeEncodingContext,\n\ttype FieldKindConfiguration,\n\ttype FieldKindConfigurationEntry,\n\tgetAllowedContentDiscrepancies,\n\tisRepoSuperset,\n\ttype AllowedTypeDiscrepancy,\n\ttype FieldKindDiscrepancy,\n\ttype ValueSchemaDiscrepancy,\n\ttype FieldDiscrepancy,\n\ttype NodeDiscrepancy,\n\ttype NodeKindDiscrepancy,\n\ttype NodeFieldsDiscrepancy,\n\tisNeverTree,\n\ttype LinearExtension,\n\ttype Realizer,\n\tfieldRealizer,\n\tPosetComparisonResult,\n\tcomparePosetElements,\n\tposetLte,\n} from \"./modular-schema/index.js\";\n\nexport { mapRootChanges } from \"./deltaUtils.js\";\n\nexport {\n\ttype TreeChunk,\n\tchunkTree,\n\tchunkFieldSingle,\n\tbuildChunkedForest,\n\tdefaultChunkPolicy,\n\ttype FieldBatch,\n\ttype FieldBatchCodec,\n\tmakeTreeChunker,\n\tmakeFieldBatchCodec,\n\tfluidVersionToFieldBatchCodecWriteVersion,\n\ttype FieldBatchEncodingContext,\n} from \"./chunked-forest/index.js\";\n\nexport {\n\tcompareLocalNodeIdentifiers,\n\tcreateNodeIdentifierManager,\n\tisStableNodeIdentifier,\n\ttype LocalNodeIdentifier,\n\tMockNodeIdentifierManager,\n\ttype NodeIdentifierManager,\n\tnodeKeyTreeIdentifier,\n\ttype StableNodeIdentifier,\n} from \"./node-identifier/index.js\";\n\nexport {\n\tFieldKinds,\n\ttype Required,\n\ttype Optional,\n\ttype Sequence,\n\ttype Identifier,\n\ttype Forbidden,\n\ttype DefaultChangeset,\n\tDefaultChangeFamily,\n\tDefaultEditBuilder,\n\ttype IDefaultEditBuilder,\n\ttype ValueFieldEditBuilder,\n\ttype OptionalFieldEditBuilder,\n\ttype SequenceFieldEditBuilder,\n\tdefaultSchemaPolicy,\n\tfieldKinds,\n\tfieldKindConfigurations,\n\tintoDelta,\n\trelevantRemovedRoots,\n\tSchemaValidationError,\n\tisNodeInSchema,\n\tisFieldInSchema,\n\tinSchemaOrThrow,\n} from \"./default-schema/index.js\";\n\nexport {\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\tSkip,\n\ttype FlexTreeContext,\n\ttype FlexTreeHydratedContext,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeEntity,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\tTreeStatus,\n\tContext,\n\ttype FlexTreeNodeEvents,\n\ttype FlexTreeUnknownUnboxed,\n\tisFlexTreeNode,\n\tContextSlot,\n\t// Internal\n\tflexTreeMarker,\n\tassertFlexTreeEntityNotFreed,\n\tflexTreeSlot,\n\tgetSchemaAndPolicy,\n\tLazyEntity,\n\ttreeStatusFromAnchorCache,\n\tindexForAt,\n\tFlexTreeEntityKind,\n} from \"./flex-tree/index.js\";\n\nexport { TreeCompressionStrategy } from \"./treeCompressionUtils.js\";\n\nexport { valueSchemaAllows } from \"./valueUtilities.js\";\n\nexport { DetachedFieldIndexSummarizer } from \"./detachedFieldIndexSummarizer.js\";\n\nexport {\n\ttype SchemaChange,\n\tmakeSchemaChangeCodecs,\n\tEncodedSchemaChange,\n} from \"./schema-edits/index.js\";\n\nexport { makeMitigatedChangeFamily } from \"./mitigatedChangeFamily.js\";\n\nexport {\n\ttype KeyFinder,\n\tAnchorTreeIndex,\n\thasElement,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype TreeIndexNodes,\n} from \"./indexing/index.js\";\n\nexport { initializeForest } from \"./initializeForest.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/feature-libraries/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iEAGiC;AADhC,mHAAA,UAAU,OAAA;AAEX,yDAAmF;AAA1E,gHAAA,WAAW,OAAA;AAAE,uHAAA,kBAAkB,OAAA;AAAE,gHAAA,WAAW,OAAA;AAErD,sDAA6D;AAApD,4GAAA,gBAAgB,OAAA;AACzB,uDAW4B;AAV3B,yHAAA,qBAAqB,OAAA;AACrB,wHAAA,oBAAoB,OAAA;AACpB,qHAAA,iBAAiB,OAAA;AACjB,0HAAA,sBAAsB,OAAA;AAEtB,0HAAA,sBAAsB,OAAA;AACtB,oHAAA,gBAAgB,OAAA;AAKjB,qDAAuD;AAA9C,uGAAA,WAAW,OAAA;AACpB,oDAKiC;AAJhC,4GAAA,gBAAgB,OAAA;AAChB,4GAAA,gBAAgB,OAAA;AAChB,2GAAA,eAAe,OAAA;AACf,4GAAA,gBAAgB,OAAA;AAEjB,2DAO8B;AAN7B,yHAAA,mBAAmB,OAAA;AAEnB,gHAAA,UAAU,OAAA;AACV,qHAAA,eAAe,OAAA;AAEf,0HAAA,oBAAoB,OAAA;AAErB,yDAM6B;AAL5B,8HAAA,yBAAyB,OAAA;AACzB,+HAAA,0BAA0B,OAAA;AAC1B,2HAAA,sBAAsB,OAAA;AACtB,gIAAA,2BAA2B,OAAA;AAC3B,2HAAA,s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B,0GAAA,cAAc,OAAA;AACd,2GAAA,eAAe,OAAA;AACf,2GAAA,eAAe,OAAA;AAGhB,iDA6B8B;AAnB7B,sGAAA,UAAU,OAAA;AACV,mGAAA,OAAO,OAAA;AAGP,0GAAA,cAAc,OAAA;AACd,uGAAA,WAAW,OAAA;AACX,WAAW;AACX,0GAAA,cAAc,OAAA;AACd,wHAAA,4BAA4B,OAAA;AAC5B,wGAAA,YAAY,OAAA;AACZ,8GAAA,kBAAkB,OAAA;AAClB,sGAAA,UAAU,OAAA;AACV,qHAAA,yBAAyB,OAAA;AACzB,sGAAA,UAAU,OAAA;AACV,8GAAA,kBAAkB,OAAA;AAOnB,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAEhC,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAE1B,qFAAiF;AAAxE,+IAAA,4BAA4B,OAAA;AAErC,oDAIiC;AAFhC,kHAAA,sBAAsB,OAAA;AACtB,+GAAA,mBAAmB,OAAA;AAGpB,uEAAuE;AAA9D,qIAAA,yBAAyB,OAAA;AAElC,iDAO6B;AAL5B,4GAAA,eAAe,OAAA;AACf,uGAAA,UAAU,OAAA;AAMX,6DAAyD;AAAhD,uHAAA,gBAAgB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype DownPath,\n\ttoDownPath,\n} from \"./editableTreeBinder.js\";\nexport { allowsValue, assertAllowedValue, isTreeValue } from \"./valueUtilities.js\";\n\nexport { ForestSummarizer } from \"./forest-summary/index.js\";\nexport {\n\tcursorForMapTreeField,\n\tcursorForMapTreeNode,\n\tmapTreeFromCursor,\n\tmapTreeFieldFromCursor,\n\ttype MinimalMapTreeNodeView,\n\tmapTreeFieldsWithField,\n\tmapTreeWithField,\n\ttype MapTreeFieldViewGeneric,\n\ttype MapTreeNodeViewGeneric,\n\ttype MinimalFieldMap,\n} from \"./mapTreeCursor.js\";\nexport { buildForest } from \"./object-forest/index.js\";\nexport {\n\tSchemaSummarizer,\n\tencodeTreeSchema,\n\tmakeSchemaCodec,\n\tmakeSchemaCodecs,\n} from \"./schema-index/index.js\";\nexport {\n\tstackTreeNodeCursor,\n\ttype CursorAdapter,\n\tprefixPath,\n\tprefixFieldPath,\n\ttype CursorWithNode,\n\tstackTreeFieldCursor,\n} from \"./treeCursorUtils.js\";\nexport {\n\tcursorForJsonableTreeNode,\n\tcursorForJsonableTreeField,\n\tjsonableTreeFromCursor,\n\tjsonableTreeFromFieldCursor,\n\tjsonableTreeFromForest,\n} from \"./treeTextCursor.js\";\n\n// Split this up into separate import and export for compatibility with API-Extractor.\nimport * as SequenceField from \"./sequence-field/index.js\";\nexport { SequenceField };\n\nexport {\n\tisNeverField,\n\tModularEditBuilder,\n\ttype FieldEditDescription as EditDescription,\n\ttype FieldChangeHandler,\n\ttype FieldChangeRebaser,\n\ttype FieldEditor,\n\ttype FieldChangeMap,\n\ttype FieldChange,\n\ttype FieldChangeset,\n\ttype ToDelta,\n\ttype ModularChangeset,\n\tmakeModularChangeCodecFamily,\n\ttype NodeChangeComposer,\n\ttype NodeChangeInverter,\n\ttype NodeChangeRebaser,\n\ttype NodeChangePruner,\n\ttype CrossFieldManager,\n\tCrossFieldTarget,\n\tFlexFieldKind,\n\ttype FullSchemaPolicy,\n\tallowsRepoSuperset,\n\ttype GenericChangeset,\n\tgenericFieldKind,\n\ttype HasFieldChanges,\n\ttype NodeExistsConstraint,\n\tFieldKindWithEditor,\n\tModularChangeFamily,\n\ttype RelevantRemovedRootsFromChild,\n\tEncodedModularChangeset,\n\tupdateRefreshers,\n\ttype NodeId,\n\ttype FieldChangeEncodingContext,\n\ttype FieldKindConfiguration,\n\ttype FieldKindConfigurationEntry,\n\tgetAllowedContentDiscrepancies,\n\tisRepoSuperset,\n\ttype AllowedTypeDiscrepancy,\n\ttype FieldKindDiscrepancy,\n\ttype ValueSchemaDiscrepancy,\n\ttype FieldDiscrepancy,\n\ttype NodeDiscrepancy,\n\ttype NodeKindDiscrepancy,\n\ttype NodeFieldsDiscrepancy,\n\tisNeverTree,\n\ttype LinearExtension,\n\ttype Realizer,\n\tfieldRealizer,\n\tPosetComparisonResult,\n\tcomparePosetElements,\n\tposetLte,\n} from \"./modular-schema/index.js\";\n\nexport { mapRootChanges } from \"./deltaUtils.js\";\n\nexport {\n\ttype TreeChunk,\n\tchunkTree,\n\tchunkFieldSingle,\n\tbuildChunkedForest,\n\tdefaultChunkPolicy,\n\ttype FieldBatch,\n\ttype FieldBatchCodec,\n\tmakeTreeChunker,\n\tmakeFieldBatchCodec,\n\tfluidVersionToFieldBatchCodecWriteVersion,\n\ttype FieldBatchEncodingContext,\n} from \"./chunked-forest/index.js\";\n\nexport {\n\tcompareLocalNodeIdentifiers,\n\tcreateNodeIdentifierManager,\n\tisStableNodeIdentifier,\n\ttype LocalNodeIdentifier,\n\tMockNodeIdentifierManager,\n\ttype NodeIdentifierManager,\n\tnodeKeyTreeIdentifier,\n\ttype StableNodeIdentifier,\n} from \"./node-identifier/index.js\";\n\nexport {\n\tFieldKinds,\n\ttype Required,\n\ttype Optional,\n\ttype Sequence,\n\ttype Identifier,\n\ttype Forbidden,\n\ttype DefaultChangeset,\n\tDefaultChangeFamily,\n\tDefaultEditBuilder,\n\ttype IDefaultEditBuilder,\n\ttype ValueFieldEditBuilder,\n\ttype OptionalFieldEditBuilder,\n\ttype SequenceFieldEditBuilder,\n\tdefaultSchemaPolicy,\n\tfieldKinds,\n\tfieldKindConfigurations,\n\tintoDelta,\n\trelevantRemovedRoots,\n\tSchemaValidationError,\n\tisNodeInSchema,\n\tisFieldInSchema,\n\tinSchemaOrThrow,\n} from \"./default-schema/index.js\";\n\nexport {\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\ttype FlexTreeContext,\n\ttype FlexTreeHydratedContext,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeEntity,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\tTreeStatus,\n\tContext,\n\ttype FlexTreeNodeEvents,\n\ttype FlexTreeUnknownUnboxed,\n\tisFlexTreeNode,\n\tContextSlot,\n\t// Internal\n\tflexTreeMarker,\n\tassertFlexTreeEntityNotFreed,\n\tflexTreeSlot,\n\tgetSchemaAndPolicy,\n\tLazyEntity,\n\ttreeStatusFromAnchorCache,\n\tindexForAt,\n\tFlexTreeEntityKind,\n\ttype FlexibleNodeContent,\n\ttype FlexibleFieldContent,\n\ttype FlexTreeHydratedContextMinimal,\n\ttype HydratedFlexTreeNode,\n} from \"./flex-tree/index.js\";\n\nexport { TreeCompressionStrategy } from \"./treeCompressionUtils.js\";\n\nexport { valueSchemaAllows } from \"./valueUtilities.js\";\n\nexport { DetachedFieldIndexSummarizer } from \"./detachedFieldIndexSummarizer.js\";\n\nexport {\n\ttype SchemaChange,\n\tmakeSchemaChangeCodecs,\n\tEncodedSchemaChange,\n} from \"./schema-edits/index.js\";\n\nexport { makeMitigatedChangeFamily } from \"./mitigatedChangeFamily.js\";\n\nexport {\n\ttype KeyFinder,\n\tAnchorTreeIndex,\n\thasElement,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype TreeIndexNodes,\n} from \"./indexing/index.js\";\n\nexport { initializeForest } from \"./initializeForest.js\";\n"]}
@@ -2,16 +2,66 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type DetachedField, type ExclusiveMapTree, type ITreeCursor, type MapTree } from "../core/index.js";
5
+ import { type DetachedField, type ExclusiveMapTree, type FieldKey, type ITreeCursor, type NodeData } from "../core/index.js";
6
6
  import { type CursorWithNode } from "./treeCursorUtils.js";
7
+ /**
8
+ * A generic variant of {@link MapTree} that can be used to strongly type trees implementing a MapTree-like API.
9
+ * @remarks
10
+ * Due to how TypeScript handles recursive generic types, explicitly named extension interfaces work best for parameterizing this, and a default type parameter can't be provided.
11
+ * @see {@link MinimalMapTreeNodeView} for a minimal configuration of this interface.
12
+ */
13
+ export interface MapTreeNodeViewGeneric<TNode> extends NodeData {
14
+ /**
15
+ * The non-empty fields on this node.
16
+ * @remarks
17
+ * This is the subset of map needed to view the tree.
18
+ * Theoretically `Symbol.iterator` and "keys" are redundant.
19
+ */
20
+ readonly fields: MinimalFieldMap<MapTreeFieldViewGeneric<TNode>>;
21
+ }
22
+ /**
23
+ * A minimal map for the fields of a {@link MapTreeNodeViewGeneric}.
24
+ * @remarks
25
+ * Subset of map, so can be implemented by `Map<FieldKey, TField>`.
26
+ */
27
+ export interface MinimalFieldMap<TField> {
28
+ [Symbol.iterator]: () => Iterator<[FieldKey, TField]>;
29
+ get: (key: FieldKey) => TField | undefined;
30
+ }
31
+ /**
32
+ * A field in {@link MapTreeNodeViewGeneric}.
33
+ * @remarks
34
+ * Subset of array, so can be implemented by `TNode[]`.
35
+ */
36
+ export interface MapTreeFieldViewGeneric<TNode> {
37
+ readonly [Symbol.iterator]: () => Iterator<TNode>;
38
+ readonly length: number;
39
+ }
40
+ /**
41
+ * Like {@link MapTree} but with the minimal properties needed for reading.
42
+ */
43
+ export interface MinimalMapTreeNodeView extends MapTreeNodeViewGeneric<MinimalMapTreeNodeView> {
44
+ }
7
45
  /**
8
46
  * Returns an {@link ITreeCursorSynchronous} in nodes mode for a single {@link MapTree}.
9
47
  */
10
- export declare function cursorForMapTreeNode(root: MapTree): CursorWithNode<MapTree>;
48
+ export declare function cursorForMapTreeNode<T extends MapTreeNodeViewGeneric<T>>(root: T): CursorWithNode<T>;
49
+ /**
50
+ * Creates an {@link ExclusiveMapTree} with a single field and no value.
51
+ * @remarks
52
+ * This handles ensuring the field is omitted if empty, and defaults to making the node above the root.
53
+ */
54
+ export declare function mapTreeWithField(children: ExclusiveMapTree[], key?: FieldKey, type?: import("../core/index.js").TreeNodeSchemaIdentifier): ExclusiveMapTree;
55
+ /**
56
+ * Creates a Map suitable for use as {@link MapTree.fields} with a single field.
57
+ * @remarks
58
+ * This handles ensuring the field is omitted if empty.
59
+ */
60
+ export declare function mapTreeFieldsWithField<T extends readonly unknown[]>(children: T, key: FieldKey): Map<FieldKey, T>;
11
61
  /**
12
62
  * Returns an {@link ITreeCursorSynchronous} in fields mode for a MapTree field.
13
63
  */
14
- export declare function cursorForMapTreeField(root: readonly MapTree[], detachedField?: DetachedField): CursorWithNode<MapTree>;
64
+ export declare function cursorForMapTreeField<T extends MapTreeNodeViewGeneric<T>>(root: readonly T[], detachedField?: DetachedField): CursorWithNode<T>;
15
65
  /**
16
66
  * Extract a MapTree from the contents of the given ITreeCursor's current node.
17
67
  */
@@ -1 +1 @@
1
- {"version":3,"file":"mapTreeCursor.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/mapTreeCursor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAEN,KAAK,aAAa,EAClB,KAAK,gBAAgB,EAErB,KAAK,WAAW,EAChB,KAAK,OAAO,EAKZ,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEN,KAAK,cAAc,EAGnB,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,CAE3E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,SAAS,OAAO,EAAE,EACxB,aAAa,GAAE,aAAyB,GACtC,cAAc,CAAC,OAAO,CAAC,CAUzB;AASD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,gBAAgB,CAevE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,GAAG,gBAAgB,EAAE,CAG9E"}
1
+ {"version":3,"file":"mapTreeCursor.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/mapTreeCursor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAEN,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,QAAQ,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EAAE,CAAC,CAAC,CAElB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,sBAAsB,CAAC,CAAC,CAAC,EACxE,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,aAAa,GAAE,aAAyB,GACtC,cAAc,CAAC,CAAC,CAAC,CAQnB;AAsBD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,gBAAgB,CAevE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,GAAG,gBAAgB,EAAE,CAG9E"}
@@ -4,33 +4,71 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.mapTreeFieldFromCursor = exports.mapTreeFromCursor = exports.cursorForMapTreeField = exports.cursorForMapTreeNode = void 0;
7
+ exports.mapTreeFieldFromCursor = exports.mapTreeFromCursor = exports.cursorForMapTreeField = exports.mapTreeFieldsWithField = exports.mapTreeWithField = exports.cursorForMapTreeNode = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const index_js_1 = require("../core/index.js");
10
10
  const treeCursorUtils_js_1 = require("./treeCursorUtils.js");
11
+ {
12
+ }
11
13
  /**
12
14
  * Returns an {@link ITreeCursorSynchronous} in nodes mode for a single {@link MapTree}.
13
15
  */
14
16
  function cursorForMapTreeNode(root) {
15
- return (0, treeCursorUtils_js_1.stackTreeNodeCursor)(adapter, root);
17
+ // There doesn't seem to be a clean way to get TypeScript to type check this without casting
18
+ // without declaring the adapter inside this generic function and needlessly recreating it on every call.
19
+ const adapterTyped = adapter;
20
+ return (0, treeCursorUtils_js_1.stackTreeNodeCursor)(adapterTyped, root);
16
21
  }
17
22
  exports.cursorForMapTreeNode = cursorForMapTreeNode;
23
+ /**
24
+ * Creates an {@link ExclusiveMapTree} with a single field and no value.
25
+ * @remarks
26
+ * This handles ensuring the field is omitted if empty, and defaults to making the node above the root.
27
+ */
28
+ function mapTreeWithField(children, key = index_js_1.rootFieldKey, type = index_js_1.aboveRootPlaceholder) {
29
+ return {
30
+ type,
31
+ fields: mapTreeFieldsWithField(children, key),
32
+ };
33
+ }
34
+ exports.mapTreeWithField = mapTreeWithField;
35
+ /**
36
+ * Creates a Map suitable for use as {@link MapTree.fields} with a single field.
37
+ * @remarks
38
+ * This handles ensuring the field is omitted if empty.
39
+ */
40
+ function mapTreeFieldsWithField(children, key) {
41
+ return new Map(children.length === 0 ? [] : [[key, children]]);
42
+ }
43
+ exports.mapTreeFieldsWithField = mapTreeFieldsWithField;
18
44
  /**
19
45
  * Returns an {@link ITreeCursorSynchronous} in fields mode for a MapTree field.
20
46
  */
21
47
  function cursorForMapTreeField(root, detachedField = index_js_1.rootField) {
22
48
  const key = (0, index_js_1.detachedFieldAsKey)(detachedField);
23
- return (0, treeCursorUtils_js_1.stackTreeFieldCursor)(adapter, {
49
+ const adapterTyped = adapter;
50
+ const dummyRoot = {
24
51
  type: index_js_1.aboveRootPlaceholder,
25
- fields: new Map([[key, root]]),
26
- }, detachedField);
52
+ fields: mapTreeFieldsWithField(root, key),
53
+ };
54
+ return (0, treeCursorUtils_js_1.stackTreeFieldCursor)(adapterTyped, dummyRoot, detachedField);
27
55
  }
28
56
  exports.cursorForMapTreeField = cursorForMapTreeField;
29
57
  const adapter = {
30
58
  value: (node) => node.value,
31
59
  type: (node) => node.type,
32
- keysFromNode: (node) => [...node.fields.keys()], // TODO: don't convert this to array here.
33
- getFieldFromNode: (node, key) => node.fields.get(key) ?? [],
60
+ keysFromNode: (node) => Array.from(node.fields, ([key, field]) => key),
61
+ getFieldFromNode: (node, key) => {
62
+ const field = node.fields.get(key);
63
+ if (field === undefined) {
64
+ return [];
65
+ }
66
+ if (Array.isArray(field)) {
67
+ return field;
68
+ }
69
+ // TODO: this copy could be avoided by using Array.at instead of indexing in `Field`, but that requires ES2022.
70
+ return [...field];
71
+ },
34
72
  };
35
73
  /**
36
74
  * Extract a MapTree from the contents of the given ITreeCursor's current node.