@fluidframework/tree 2.3.0-288113 → 2.3.1

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 (869) hide show
  1. package/.dependency-cruiser-known-violations.json +28 -40
  2. package/.vscode/Tree.code-workspace +0 -2
  3. package/CHANGELOG.md +92 -0
  4. package/README.md +6 -0
  5. package/alpha.d.ts +11 -0
  6. package/api-extractor/api-extractor-lint-alpha.cjs.json +5 -0
  7. package/api-extractor/api-extractor-lint-alpha.esm.json +5 -0
  8. package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
  9. package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
  10. package/api-extractor/api-extractor.current.json +8 -0
  11. package/api-extractor/api-extractor.legacy.json +4 -0
  12. package/api-extractor.json +1 -1
  13. package/api-report/tree.alpha.api.md +21 -42
  14. package/api-report/tree.beta.api.md +21 -11
  15. package/api-report/tree.legacy.alpha.api.md +562 -0
  16. package/api-report/tree.legacy.public.api.md +559 -0
  17. package/api-report/tree.public.api.md +8 -13
  18. package/dist/alpha.d.ts +102 -0
  19. package/dist/beta.d.ts +6 -2
  20. package/dist/core/index.d.ts +1 -1
  21. package/dist/core/index.d.ts.map +1 -1
  22. package/dist/core/index.js +2 -2
  23. package/dist/core/index.js.map +1 -1
  24. package/dist/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
  25. package/dist/core/revertible.d.ts.map +1 -0
  26. package/dist/core/revertible.js.map +1 -0
  27. package/dist/core/schema-stored/format.d.ts +3 -3
  28. package/dist/core/schema-stored/format.js +1 -1
  29. package/dist/core/schema-stored/format.js.map +1 -1
  30. package/dist/core/schema-stored/schema.d.ts +2 -7
  31. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  32. package/dist/core/schema-stored/schema.js +4 -6
  33. package/dist/core/schema-stored/schema.js.map +1 -1
  34. package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  35. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  36. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  37. package/dist/core/tree/anchorSet.js +6 -2
  38. package/dist/core/tree/anchorSet.js.map +1 -1
  39. package/dist/core/tree/detachedFieldIndex.d.ts +0 -1
  40. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  41. package/dist/core/tree/detachedFieldIndex.js +1 -0
  42. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  43. package/dist/core/tree/visitDelta.d.ts +7 -2
  44. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  45. package/dist/core/tree/visitDelta.js.map +1 -1
  46. package/dist/events/emitter.d.ts +127 -0
  47. package/dist/events/emitter.d.ts.map +1 -0
  48. package/dist/events/{events.js → emitter.js} +48 -30
  49. package/dist/events/emitter.js.map +1 -0
  50. package/dist/events/index.d.ts +2 -1
  51. package/dist/events/index.d.ts.map +1 -1
  52. package/dist/events/index.js +4 -5
  53. package/dist/events/index.js.map +1 -1
  54. package/dist/events/interop.d.ts +36 -0
  55. package/dist/events/interop.d.ts.map +1 -0
  56. package/dist/{core/revertible/index.d.ts → events/interop.js} +3 -2
  57. package/dist/events/interop.js.map +1 -0
  58. package/dist/events/listeners.d.ts +65 -0
  59. package/dist/events/listeners.d.ts.map +1 -0
  60. package/{lib/core/revertible/index.d.ts → dist/events/listeners.js} +3 -2
  61. package/dist/events/listeners.js.map +1 -0
  62. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
  63. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  64. package/dist/feature-libraries/chunked-forest/chunkTree.js +36 -15
  65. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
  67. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/chunkedForest.js +12 -5
  69. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
  71. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/uniformChunk.js +28 -2
  73. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  74. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
  75. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  76. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
  77. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  78. package/dist/feature-libraries/flex-map-tree/index.d.ts +1 -1
  79. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  80. package/dist/feature-libraries/flex-map-tree/index.js +2 -1
  81. package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
  82. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +35 -33
  83. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  84. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +82 -103
  85. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  86. package/dist/feature-libraries/flex-tree/context.d.ts +30 -14
  87. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  88. package/dist/feature-libraries/flex-tree/context.js +10 -7
  89. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  90. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -190
  91. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  92. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +15 -3
  93. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  94. package/dist/feature-libraries/flex-tree/index.d.ts +2 -3
  95. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  96. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  97. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +3 -3
  98. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  99. package/dist/feature-libraries/flex-tree/lazyEntity.js +2 -10
  100. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  101. package/dist/feature-libraries/flex-tree/lazyField.d.ts +26 -28
  102. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  103. package/dist/feature-libraries/flex-tree/lazyField.js +11 -14
  104. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  105. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +5 -26
  106. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  107. package/dist/feature-libraries/flex-tree/lazyNode.js +23 -74
  108. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  109. package/dist/feature-libraries/flex-tree/unboxed.d.ts +4 -16
  110. package/dist/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
  111. package/dist/feature-libraries/flex-tree/unboxed.js +7 -41
  112. package/dist/feature-libraries/flex-tree/unboxed.js.map +1 -1
  113. package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -2
  114. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  115. package/dist/feature-libraries/flex-tree/utilities.js +3 -6
  116. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  117. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  118. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -1
  119. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  120. package/dist/feature-libraries/index.d.ts +3 -5
  121. package/dist/feature-libraries/index.d.ts.map +1 -1
  122. package/dist/feature-libraries/index.js +5 -11
  123. package/dist/feature-libraries/index.js.map +1 -1
  124. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  125. package/dist/feature-libraries/modular-schema/comparison.js +3 -6
  126. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  127. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  128. package/dist/feature-libraries/modular-schema/discrepancies.js +3 -13
  129. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  130. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
  131. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  132. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -1
  133. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  134. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +12 -5
  135. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  136. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
  137. package/dist/feature-libraries/schema-index/format.d.ts +3 -3
  138. package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  139. package/dist/feature-libraries/storedToViewSchema.js +2 -4
  140. package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
  141. package/dist/feature-libraries/typed-schema/flexList.d.ts +3 -3
  142. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  143. package/dist/feature-libraries/typed-schema/index.d.ts +2 -2
  144. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  145. package/dist/feature-libraries/typed-schema/index.js +2 -2
  146. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  147. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  148. package/dist/feature-libraries/typed-schema/schemaCollection.js +8 -10
  149. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  150. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
  151. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  152. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +5 -37
  153. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  154. package/dist/feature-libraries/typed-schema/view.d.ts +4 -6
  155. package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
  156. package/dist/feature-libraries/typed-schema/view.js +5 -4
  157. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  158. package/dist/index.d.ts +4 -4
  159. package/dist/index.d.ts.map +1 -1
  160. package/dist/index.js +33 -36
  161. package/dist/index.js.map +1 -1
  162. package/dist/legacy.d.ts +83 -0
  163. package/dist/packageVersion.d.ts +1 -1
  164. package/dist/packageVersion.d.ts.map +1 -1
  165. package/dist/packageVersion.js +1 -1
  166. package/dist/packageVersion.js.map +1 -1
  167. package/dist/public.d.ts +0 -1
  168. package/dist/shared-tree/checkoutFlexTreeView.d.ts +53 -0
  169. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
  170. package/dist/shared-tree/{treeView.js → checkoutFlexTreeView.js} +28 -6
  171. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -0
  172. package/dist/shared-tree/index.d.ts +3 -3
  173. package/dist/shared-tree/index.d.ts.map +1 -1
  174. package/dist/shared-tree/index.js +2 -2
  175. package/dist/shared-tree/index.js.map +1 -1
  176. package/dist/shared-tree/schematizeTree.d.ts +15 -4
  177. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  178. package/dist/shared-tree/schematizeTree.js +7 -8
  179. package/dist/shared-tree/schematizeTree.js.map +1 -1
  180. package/dist/shared-tree/schematizingTreeView.d.ts +9 -4
  181. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  182. package/dist/shared-tree/schematizingTreeView.js +25 -12
  183. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  184. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  185. package/dist/shared-tree/sharedTree.js +2 -2
  186. package/dist/shared-tree/sharedTree.js.map +1 -1
  187. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
  188. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  189. package/dist/shared-tree/sharedTreeChangeEnricher.js +6 -2
  190. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  191. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
  192. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  193. package/dist/shared-tree/sharedTreeChangeFamily.js +3 -2
  194. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  195. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
  196. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  197. package/dist/shared-tree/sharedTreeEditBuilder.js +2 -2
  198. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  199. package/dist/shared-tree/treeApi.d.ts +1 -3
  200. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  201. package/dist/shared-tree/treeApi.js +6 -4
  202. package/dist/shared-tree/treeApi.js.map +1 -1
  203. package/dist/shared-tree/treeCheckout.d.ts +2 -13
  204. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  205. package/dist/shared-tree/treeCheckout.js +17 -1
  206. package/dist/shared-tree/treeCheckout.js.map +1 -1
  207. package/dist/shared-tree-core/branch.js +1 -1
  208. package/dist/shared-tree-core/branch.js.map +1 -1
  209. package/dist/simple-tree/api/create.d.ts.map +1 -1
  210. package/dist/simple-tree/api/create.js +1 -1
  211. package/dist/simple-tree/api/create.js.map +1 -1
  212. package/{lib/simple-tree → dist/simple-tree/api}/getJsonSchema.d.ts +1 -1
  213. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -0
  214. package/dist/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
  215. package/dist/simple-tree/api/getJsonSchema.js.map +1 -0
  216. package/{lib/simple-tree → dist/simple-tree/api}/getSimpleSchema.d.ts +1 -1
  217. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
  218. package/dist/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
  219. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -0
  220. package/dist/simple-tree/api/index.d.ts +5 -0
  221. package/dist/simple-tree/api/index.d.ts.map +1 -1
  222. package/dist/simple-tree/api/index.js +7 -1
  223. package/dist/simple-tree/api/index.js.map +1 -1
  224. package/{lib/simple-tree → dist/simple-tree/api}/jsonSchema.d.ts +1 -1
  225. package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -0
  226. package/dist/simple-tree/api/jsonSchema.js.map +1 -0
  227. package/dist/simple-tree/api/schemaFactory.d.ts +45 -14
  228. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  229. package/dist/simple-tree/api/schemaFactory.js +43 -12
  230. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  231. package/dist/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +4 -4
  232. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -0
  233. package/dist/simple-tree/api/simpleSchema.js.map +1 -0
  234. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
  235. package/dist/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +4 -4
  236. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
  237. package/dist/simple-tree/api/tree.d.ts +1 -21
  238. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  239. package/dist/simple-tree/api/tree.js +3 -38
  240. package/dist/simple-tree/api/tree.js.map +1 -1
  241. package/dist/simple-tree/api/treeApiBeta.d.ts +79 -0
  242. package/dist/simple-tree/api/treeApiBeta.d.ts.map +1 -0
  243. package/dist/simple-tree/api/treeApiBeta.js +26 -0
  244. package/dist/simple-tree/api/treeApiBeta.js.map +1 -0
  245. package/dist/simple-tree/api/treeNodeApi.d.ts +1 -1
  246. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  247. package/dist/simple-tree/api/treeNodeApi.js +21 -19
  248. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  249. package/dist/simple-tree/api/verboseTree.js +2 -2
  250. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  251. package/dist/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
  252. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
  253. package/dist/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +4 -4
  254. package/{lib/simple-tree → dist/simple-tree/api}/viewSchemaToSimpleSchema.js.map +1 -1
  255. package/dist/simple-tree/arrayNode.d.ts +2 -2
  256. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  257. package/dist/simple-tree/arrayNode.js +30 -21
  258. package/dist/simple-tree/arrayNode.js.map +1 -1
  259. package/dist/simple-tree/core/index.d.ts +3 -3
  260. package/dist/simple-tree/core/index.d.ts.map +1 -1
  261. package/dist/simple-tree/core/index.js +4 -1
  262. package/dist/simple-tree/core/index.js.map +1 -1
  263. package/dist/simple-tree/core/schemaCaching.d.ts +5 -0
  264. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -1
  265. package/dist/simple-tree/core/schemaCaching.js +10 -1
  266. package/dist/simple-tree/core/schemaCaching.js.map +1 -1
  267. package/dist/simple-tree/core/treeNodeKernel.d.ts +61 -3
  268. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  269. package/dist/simple-tree/core/treeNodeKernel.js +166 -13
  270. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  271. package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -1
  272. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  273. package/dist/simple-tree/core/types.d.ts +17 -20
  274. package/dist/simple-tree/core/types.d.ts.map +1 -1
  275. package/dist/simple-tree/core/types.js.map +1 -1
  276. package/dist/simple-tree/core/withType.d.ts +3 -2
  277. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  278. package/dist/simple-tree/core/withType.js.map +1 -1
  279. package/dist/simple-tree/index.d.ts +7 -9
  280. package/dist/simple-tree/index.d.ts.map +1 -1
  281. package/dist/simple-tree/index.js +15 -6
  282. package/dist/simple-tree/index.js.map +1 -1
  283. package/dist/simple-tree/leafNodeSchema.d.ts +7 -9
  284. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  285. package/dist/simple-tree/leafNodeSchema.js +13 -11
  286. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  287. package/dist/simple-tree/mapNode.d.ts +1 -1
  288. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  289. package/dist/simple-tree/mapNode.js +38 -29
  290. package/dist/simple-tree/mapNode.js.map +1 -1
  291. package/dist/simple-tree/objectNode.d.ts +9 -7
  292. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  293. package/dist/simple-tree/objectNode.js +37 -31
  294. package/dist/simple-tree/objectNode.js.map +1 -1
  295. package/dist/simple-tree/proxies.d.ts +1 -14
  296. package/dist/simple-tree/proxies.d.ts.map +1 -1
  297. package/dist/simple-tree/proxies.js +12 -15
  298. package/dist/simple-tree/proxies.js.map +1 -1
  299. package/dist/simple-tree/proxyBinding.d.ts +2 -62
  300. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  301. package/dist/simple-tree/proxyBinding.js +8 -181
  302. package/dist/simple-tree/proxyBinding.js.map +1 -1
  303. package/dist/simple-tree/schemaTypes.d.ts +7 -7
  304. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  305. package/dist/simple-tree/schemaTypes.js +4 -4
  306. package/dist/simple-tree/schemaTypes.js.map +1 -1
  307. package/dist/simple-tree/toFlexSchema.d.ts +11 -1
  308. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  309. package/dist/simple-tree/toFlexSchema.js +54 -31
  310. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  311. package/dist/simple-tree/toMapTree.d.ts +25 -37
  312. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  313. package/dist/simple-tree/toMapTree.js +53 -16
  314. package/dist/simple-tree/toMapTree.js.map +1 -1
  315. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  316. package/dist/simple-tree/treeNodeValid.js +7 -10
  317. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  318. package/dist/simple-tree/typesUnsafe.d.ts +13 -13
  319. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  320. package/dist/simple-tree/walkSchema.d.ts +26 -0
  321. package/dist/simple-tree/walkSchema.d.ts.map +1 -0
  322. package/dist/simple-tree/walkSchema.js +49 -0
  323. package/dist/simple-tree/walkSchema.js.map +1 -0
  324. package/dist/treeFactory.d.ts +2 -1
  325. package/dist/treeFactory.d.ts.map +1 -1
  326. package/dist/treeFactory.js +2 -1
  327. package/dist/treeFactory.js.map +1 -1
  328. package/dist/util/typeUtils.d.ts +2 -2
  329. package/dist/util/typeUtils.js.map +1 -1
  330. package/legacy.d.ts +11 -0
  331. package/lib/alpha.d.ts +102 -0
  332. package/lib/beta.d.ts +6 -2
  333. package/lib/core/index.d.ts +1 -1
  334. package/lib/core/index.d.ts.map +1 -1
  335. package/lib/core/index.js +1 -1
  336. package/lib/core/index.js.map +1 -1
  337. package/lib/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
  338. package/lib/core/revertible.d.ts.map +1 -0
  339. package/lib/core/revertible.js.map +1 -0
  340. package/lib/core/schema-stored/format.d.ts +3 -3
  341. package/lib/core/schema-stored/format.js +1 -1
  342. package/lib/core/schema-stored/format.js.map +1 -1
  343. package/lib/core/schema-stored/schema.d.ts +2 -7
  344. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  345. package/lib/core/schema-stored/schema.js +4 -6
  346. package/lib/core/schema-stored/schema.js.map +1 -1
  347. package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  348. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  349. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  350. package/lib/core/tree/anchorSet.js +6 -2
  351. package/lib/core/tree/anchorSet.js.map +1 -1
  352. package/lib/core/tree/detachedFieldIndex.d.ts +0 -1
  353. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  354. package/lib/core/tree/detachedFieldIndex.js +1 -0
  355. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  356. package/lib/core/tree/visitDelta.d.ts +7 -2
  357. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  358. package/lib/core/tree/visitDelta.js.map +1 -1
  359. package/lib/events/emitter.d.ts +127 -0
  360. package/lib/events/emitter.d.ts.map +1 -0
  361. package/lib/events/{events.js → emitter.js} +48 -29
  362. package/lib/events/emitter.js.map +1 -0
  363. package/lib/events/index.d.ts +2 -1
  364. package/lib/events/index.d.ts.map +1 -1
  365. package/lib/events/index.js +1 -1
  366. package/lib/events/index.js.map +1 -1
  367. package/lib/events/interop.d.ts +36 -0
  368. package/lib/events/interop.d.ts.map +1 -0
  369. package/{src/core/revertible/index.ts → lib/events/interop.js} +2 -2
  370. package/lib/events/interop.js.map +1 -0
  371. package/lib/events/listeners.d.ts +65 -0
  372. package/lib/events/listeners.d.ts.map +1 -0
  373. package/lib/{core/revertible/index.js → events/listeners.js} +2 -2
  374. package/lib/events/listeners.js.map +1 -0
  375. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
  376. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  377. package/lib/feature-libraries/chunked-forest/chunkTree.js +37 -16
  378. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  379. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
  380. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  381. package/lib/feature-libraries/chunked-forest/chunkedForest.js +12 -5
  382. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  383. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
  384. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  385. package/lib/feature-libraries/chunked-forest/uniformChunk.js +28 -2
  386. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  387. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
  388. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  389. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
  390. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  391. package/lib/feature-libraries/flex-map-tree/index.d.ts +1 -1
  392. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  393. package/lib/feature-libraries/flex-map-tree/index.js +1 -1
  394. package/lib/feature-libraries/flex-map-tree/index.js.map +1 -1
  395. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +35 -33
  396. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  397. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +83 -104
  398. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  399. package/lib/feature-libraries/flex-tree/context.d.ts +30 -14
  400. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  401. package/lib/feature-libraries/flex-tree/context.js +10 -7
  402. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  403. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -190
  404. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  405. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +15 -2
  406. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  407. package/lib/feature-libraries/flex-tree/index.d.ts +2 -3
  408. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  409. package/lib/feature-libraries/flex-tree/index.js +1 -1
  410. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  411. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +3 -3
  412. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  413. package/lib/feature-libraries/flex-tree/lazyEntity.js +2 -10
  414. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  415. package/lib/feature-libraries/flex-tree/lazyField.d.ts +26 -28
  416. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  417. package/lib/feature-libraries/flex-tree/lazyField.js +11 -13
  418. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  419. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +5 -26
  420. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  421. package/lib/feature-libraries/flex-tree/lazyNode.js +23 -72
  422. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  423. package/lib/feature-libraries/flex-tree/unboxed.d.ts +4 -16
  424. package/lib/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
  425. package/lib/feature-libraries/flex-tree/unboxed.js +5 -37
  426. package/lib/feature-libraries/flex-tree/unboxed.js.map +1 -1
  427. package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -2
  428. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  429. package/lib/feature-libraries/flex-tree/utilities.js +3 -6
  430. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  431. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  432. package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -1
  433. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  434. package/lib/feature-libraries/index.d.ts +3 -5
  435. package/lib/feature-libraries/index.d.ts.map +1 -1
  436. package/lib/feature-libraries/index.js +5 -5
  437. package/lib/feature-libraries/index.js.map +1 -1
  438. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  439. package/lib/feature-libraries/modular-schema/comparison.js +3 -6
  440. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  441. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  442. package/lib/feature-libraries/modular-schema/discrepancies.js +3 -13
  443. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  444. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
  445. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  446. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -1
  447. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  448. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +12 -5
  449. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  450. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
  451. package/lib/feature-libraries/schema-index/format.d.ts +3 -3
  452. package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  453. package/lib/feature-libraries/storedToViewSchema.js +3 -5
  454. package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
  455. package/lib/feature-libraries/typed-schema/flexList.d.ts +3 -3
  456. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  457. package/lib/feature-libraries/typed-schema/index.d.ts +2 -2
  458. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  459. package/lib/feature-libraries/typed-schema/index.js +2 -2
  460. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  461. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  462. package/lib/feature-libraries/typed-schema/schemaCollection.js +9 -11
  463. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  464. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
  465. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  466. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +5 -36
  467. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  468. package/lib/feature-libraries/typed-schema/view.d.ts +4 -6
  469. package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
  470. package/lib/feature-libraries/typed-schema/view.js +5 -4
  471. package/lib/feature-libraries/typed-schema/view.js.map +1 -1
  472. package/lib/index.d.ts +4 -4
  473. package/lib/index.d.ts.map +1 -1
  474. package/lib/index.js +3 -5
  475. package/lib/index.js.map +1 -1
  476. package/lib/legacy.d.ts +83 -0
  477. package/lib/packageVersion.d.ts +1 -1
  478. package/lib/packageVersion.d.ts.map +1 -1
  479. package/lib/packageVersion.js +1 -1
  480. package/lib/packageVersion.js.map +1 -1
  481. package/lib/public.d.ts +0 -1
  482. package/lib/shared-tree/checkoutFlexTreeView.d.ts +53 -0
  483. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
  484. package/lib/shared-tree/{treeView.js → checkoutFlexTreeView.js} +26 -5
  485. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -0
  486. package/lib/shared-tree/index.d.ts +3 -3
  487. package/lib/shared-tree/index.d.ts.map +1 -1
  488. package/lib/shared-tree/index.js +1 -1
  489. package/lib/shared-tree/index.js.map +1 -1
  490. package/lib/shared-tree/schematizeTree.d.ts +15 -4
  491. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  492. package/lib/shared-tree/schematizeTree.js +8 -9
  493. package/lib/shared-tree/schematizeTree.js.map +1 -1
  494. package/lib/shared-tree/schematizingTreeView.d.ts +9 -4
  495. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  496. package/lib/shared-tree/schematizingTreeView.js +26 -13
  497. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  498. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  499. package/lib/shared-tree/sharedTree.js +2 -2
  500. package/lib/shared-tree/sharedTree.js.map +1 -1
  501. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
  502. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  503. package/lib/shared-tree/sharedTreeChangeEnricher.js +6 -2
  504. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  505. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
  506. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  507. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -2
  508. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  509. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
  510. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  511. package/lib/shared-tree/sharedTreeEditBuilder.js +2 -2
  512. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  513. package/lib/shared-tree/treeApi.d.ts +1 -3
  514. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  515. package/lib/shared-tree/treeApi.js +7 -5
  516. package/lib/shared-tree/treeApi.js.map +1 -1
  517. package/lib/shared-tree/treeCheckout.d.ts +2 -13
  518. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  519. package/lib/shared-tree/treeCheckout.js +18 -2
  520. package/lib/shared-tree/treeCheckout.js.map +1 -1
  521. package/lib/shared-tree-core/branch.js +1 -1
  522. package/lib/shared-tree-core/branch.js.map +1 -1
  523. package/lib/simple-tree/api/create.d.ts.map +1 -1
  524. package/lib/simple-tree/api/create.js +2 -2
  525. package/lib/simple-tree/api/create.js.map +1 -1
  526. package/{dist/simple-tree → lib/simple-tree/api}/getJsonSchema.d.ts +1 -1
  527. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -0
  528. package/lib/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
  529. package/lib/simple-tree/api/getJsonSchema.js.map +1 -0
  530. package/{dist/simple-tree → lib/simple-tree/api}/getSimpleSchema.d.ts +1 -1
  531. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
  532. package/lib/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
  533. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -0
  534. package/lib/simple-tree/api/index.d.ts +5 -0
  535. package/lib/simple-tree/api/index.d.ts.map +1 -1
  536. package/lib/simple-tree/api/index.js +3 -0
  537. package/lib/simple-tree/api/index.js.map +1 -1
  538. package/{dist/simple-tree → lib/simple-tree/api}/jsonSchema.d.ts +1 -1
  539. package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -0
  540. package/lib/simple-tree/api/jsonSchema.js.map +1 -0
  541. package/lib/simple-tree/api/schemaFactory.d.ts +45 -14
  542. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  543. package/lib/simple-tree/api/schemaFactory.js +43 -12
  544. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  545. package/lib/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +4 -4
  546. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -0
  547. package/lib/simple-tree/api/simpleSchema.js.map +1 -0
  548. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
  549. package/lib/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +4 -4
  550. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
  551. package/lib/simple-tree/api/tree.d.ts +1 -21
  552. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  553. package/lib/simple-tree/api/tree.js +2 -34
  554. package/lib/simple-tree/api/tree.js.map +1 -1
  555. package/lib/simple-tree/api/treeApiBeta.d.ts +79 -0
  556. package/lib/simple-tree/api/treeApiBeta.d.ts.map +1 -0
  557. package/lib/simple-tree/api/treeApiBeta.js +23 -0
  558. package/lib/simple-tree/api/treeApiBeta.js.map +1 -0
  559. package/lib/simple-tree/api/treeNodeApi.d.ts +1 -1
  560. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  561. package/lib/simple-tree/api/treeNodeApi.js +23 -21
  562. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  563. package/lib/simple-tree/api/verboseTree.js +1 -1
  564. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  565. package/lib/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
  566. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
  567. package/lib/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +4 -4
  568. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -0
  569. package/lib/simple-tree/arrayNode.d.ts +2 -2
  570. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  571. package/lib/simple-tree/arrayNode.js +33 -24
  572. package/lib/simple-tree/arrayNode.js.map +1 -1
  573. package/lib/simple-tree/core/index.d.ts +3 -3
  574. package/lib/simple-tree/core/index.d.ts.map +1 -1
  575. package/lib/simple-tree/core/index.js +2 -2
  576. package/lib/simple-tree/core/index.js.map +1 -1
  577. package/lib/simple-tree/core/schemaCaching.d.ts +5 -0
  578. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -1
  579. package/lib/simple-tree/core/schemaCaching.js +8 -0
  580. package/lib/simple-tree/core/schemaCaching.js.map +1 -1
  581. package/lib/simple-tree/core/treeNodeKernel.d.ts +61 -3
  582. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  583. package/lib/simple-tree/core/treeNodeKernel.js +156 -5
  584. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  585. package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -1
  586. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  587. package/lib/simple-tree/core/types.d.ts +17 -20
  588. package/lib/simple-tree/core/types.d.ts.map +1 -1
  589. package/lib/simple-tree/core/types.js.map +1 -1
  590. package/lib/simple-tree/core/withType.d.ts +3 -2
  591. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  592. package/lib/simple-tree/core/withType.js.map +1 -1
  593. package/lib/simple-tree/index.d.ts +7 -9
  594. package/lib/simple-tree/index.d.ts.map +1 -1
  595. package/lib/simple-tree/index.js +5 -5
  596. package/lib/simple-tree/index.js.map +1 -1
  597. package/lib/simple-tree/leafNodeSchema.d.ts +7 -9
  598. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  599. package/lib/simple-tree/leafNodeSchema.js +14 -12
  600. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  601. package/lib/simple-tree/mapNode.d.ts +1 -1
  602. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  603. package/lib/simple-tree/mapNode.js +38 -29
  604. package/lib/simple-tree/mapNode.js.map +1 -1
  605. package/lib/simple-tree/objectNode.d.ts +9 -7
  606. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  607. package/lib/simple-tree/objectNode.js +40 -34
  608. package/lib/simple-tree/objectNode.js.map +1 -1
  609. package/lib/simple-tree/proxies.d.ts +1 -14
  610. package/lib/simple-tree/proxies.d.ts.map +1 -1
  611. package/lib/simple-tree/proxies.js +11 -14
  612. package/lib/simple-tree/proxies.js.map +1 -1
  613. package/lib/simple-tree/proxyBinding.d.ts +2 -62
  614. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  615. package/lib/simple-tree/proxyBinding.js +6 -174
  616. package/lib/simple-tree/proxyBinding.js.map +1 -1
  617. package/lib/simple-tree/schemaTypes.d.ts +7 -7
  618. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  619. package/lib/simple-tree/schemaTypes.js +4 -4
  620. package/lib/simple-tree/schemaTypes.js.map +1 -1
  621. package/lib/simple-tree/toFlexSchema.d.ts +11 -1
  622. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  623. package/lib/simple-tree/toFlexSchema.js +29 -8
  624. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  625. package/lib/simple-tree/toMapTree.d.ts +25 -37
  626. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  627. package/lib/simple-tree/toMapTree.js +54 -17
  628. package/lib/simple-tree/toMapTree.js.map +1 -1
  629. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  630. package/lib/simple-tree/treeNodeValid.js +8 -11
  631. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  632. package/lib/simple-tree/typesUnsafe.d.ts +13 -13
  633. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  634. package/lib/simple-tree/walkSchema.d.ts +26 -0
  635. package/lib/simple-tree/walkSchema.d.ts.map +1 -0
  636. package/lib/simple-tree/walkSchema.js +43 -0
  637. package/lib/simple-tree/walkSchema.js.map +1 -0
  638. package/lib/treeFactory.d.ts +2 -1
  639. package/lib/treeFactory.d.ts.map +1 -1
  640. package/lib/treeFactory.js +2 -1
  641. package/lib/treeFactory.js.map +1 -1
  642. package/lib/tsdoc-metadata.json +1 -1
  643. package/lib/util/typeUtils.d.ts +2 -2
  644. package/lib/util/typeUtils.js.map +1 -1
  645. package/package.json +57 -25
  646. package/src/core/index.ts +1 -1
  647. package/src/core/{revertible/revertible.ts → revertible.ts} +15 -0
  648. package/src/core/schema-stored/format.ts +1 -1
  649. package/src/core/schema-stored/schema.ts +6 -13
  650. package/src/core/tree/anchorSet.ts +18 -3
  651. package/src/core/tree/detachedFieldIndex.ts +6 -5
  652. package/src/core/tree/visitDelta.ts +7 -2
  653. package/src/events/{events.ts → emitter.ts} +52 -139
  654. package/src/events/index.ts +7 -7
  655. package/src/events/interop.ts +49 -0
  656. package/src/events/listeners.ts +68 -0
  657. package/src/feature-libraries/chunked-forest/chunkTree.ts +63 -18
  658. package/src/feature-libraries/chunked-forest/chunkedForest.ts +18 -4
  659. package/src/feature-libraries/chunked-forest/uniformChunk.ts +33 -0
  660. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +5 -3
  661. package/src/feature-libraries/flex-map-tree/index.ts +1 -0
  662. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +135 -210
  663. package/src/feature-libraries/flex-tree/README.md +4 -75
  664. package/src/feature-libraries/flex-tree/context.ts +37 -16
  665. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +69 -291
  666. package/src/feature-libraries/flex-tree/index.ts +7 -13
  667. package/src/feature-libraries/flex-tree/lazyEntity.ts +2 -11
  668. package/src/feature-libraries/flex-tree/lazyField.ts +49 -73
  669. package/src/feature-libraries/flex-tree/lazyNode.ts +25 -154
  670. package/src/feature-libraries/flex-tree/unboxed.ts +9 -68
  671. package/src/feature-libraries/flex-tree/utilities.ts +4 -8
  672. package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -1
  673. package/src/feature-libraries/index.ts +2 -27
  674. package/src/feature-libraries/modular-schema/comparison.ts +4 -6
  675. package/src/feature-libraries/modular-schema/discrepancies.ts +7 -16
  676. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -1
  677. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +14 -4
  678. package/src/feature-libraries/storedToViewSchema.ts +5 -6
  679. package/src/feature-libraries/typed-schema/flexList.ts +3 -3
  680. package/src/feature-libraries/typed-schema/index.ts +1 -3
  681. package/src/feature-libraries/typed-schema/schemaCollection.ts +15 -17
  682. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +35 -127
  683. package/src/feature-libraries/typed-schema/view.ts +4 -13
  684. package/src/index.ts +4 -8
  685. package/src/packageVersion.ts +1 -1
  686. package/src/shared-tree/checkoutFlexTreeView.ts +89 -0
  687. package/src/shared-tree/index.ts +2 -7
  688. package/src/shared-tree/schematizeTree.ts +23 -12
  689. package/src/shared-tree/schematizingTreeView.ts +34 -24
  690. package/src/shared-tree/sharedTree.ts +6 -1
  691. package/src/shared-tree/sharedTreeChangeEnricher.ts +6 -1
  692. package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
  693. package/src/shared-tree/sharedTreeEditBuilder.ts +9 -4
  694. package/src/shared-tree/treeApi.ts +10 -10
  695. package/src/shared-tree/treeCheckout.ts +26 -15
  696. package/src/shared-tree-core/branch.ts +1 -1
  697. package/src/simple-tree/ProxyBinding.md +23 -23
  698. package/src/simple-tree/api/create.ts +8 -3
  699. package/src/simple-tree/{getJsonSchema.ts → api/getJsonSchema.ts} +3 -3
  700. package/src/simple-tree/{getSimpleSchema.ts → api/getSimpleSchema.ts} +3 -3
  701. package/src/simple-tree/api/index.ts +20 -0
  702. package/src/simple-tree/{jsonSchema.ts → api/jsonSchema.ts} +1 -1
  703. package/src/simple-tree/api/schemaFactory.ts +44 -13
  704. package/src/simple-tree/{simpleSchema.ts → api/simpleSchema.ts} +4 -4
  705. package/src/simple-tree/{simpleSchemaToJsonSchema.ts → api/simpleSchemaToJsonSchema.ts} +4 -4
  706. package/src/simple-tree/api/tree.ts +2 -71
  707. package/src/simple-tree/api/treeApiBeta.ts +101 -0
  708. package/src/simple-tree/api/treeNodeApi.ts +32 -23
  709. package/src/simple-tree/api/verboseTree.ts +1 -1
  710. package/src/simple-tree/{viewSchemaToSimpleSchema.ts → api/viewSchemaToSimpleSchema.ts} +5 -5
  711. package/src/simple-tree/arrayNode.ts +37 -31
  712. package/src/simple-tree/core/index.ts +4 -1
  713. package/src/simple-tree/core/schemaCaching.ts +10 -0
  714. package/src/simple-tree/core/treeNodeKernel.ts +198 -5
  715. package/src/simple-tree/core/treeNodeSchema.ts +1 -1
  716. package/src/simple-tree/core/types.ts +16 -27
  717. package/src/simple-tree/core/withType.ts +3 -1
  718. package/src/simple-tree/index.ts +29 -21
  719. package/src/simple-tree/leafNodeSchema.ts +24 -28
  720. package/src/simple-tree/mapNode.ts +47 -29
  721. package/src/simple-tree/objectNode.ts +51 -46
  722. package/src/simple-tree/proxies.ts +22 -51
  723. package/src/simple-tree/proxyBinding.ts +3 -254
  724. package/src/simple-tree/schemaTypes.ts +8 -8
  725. package/src/simple-tree/toFlexSchema.ts +40 -7
  726. package/src/simple-tree/toMapTree.ts +113 -79
  727. package/src/simple-tree/treeNodeValid.ts +10 -13
  728. package/src/simple-tree/typesUnsafe.ts +13 -13
  729. package/src/simple-tree/walkSchema.ts +81 -0
  730. package/src/treeFactory.ts +2 -1
  731. package/src/util/typeUtils.ts +2 -2
  732. package/dist/core/revertible/index.d.ts.map +0 -1
  733. package/dist/core/revertible/index.js +0 -10
  734. package/dist/core/revertible/index.js.map +0 -1
  735. package/dist/core/revertible/revertible.d.ts.map +0 -1
  736. package/dist/core/revertible/revertible.js.map +0 -1
  737. package/dist/domains/index.d.ts +0 -8
  738. package/dist/domains/index.d.ts.map +0 -1
  739. package/dist/domains/index.js +0 -20
  740. package/dist/domains/index.js.map +0 -1
  741. package/dist/domains/json/index.d.ts +0 -7
  742. package/dist/domains/json/index.d.ts.map +0 -1
  743. package/dist/domains/json/index.js +0 -17
  744. package/dist/domains/json/index.js.map +0 -1
  745. package/dist/domains/json/jsonCursor.d.ts +0 -52
  746. package/dist/domains/json/jsonCursor.d.ts.map +0 -1
  747. package/dist/domains/json/jsonCursor.js +0 -197
  748. package/dist/domains/json/jsonCursor.js.map +0 -1
  749. package/dist/domains/json/jsonDomainSchema.d.ts +0 -24
  750. package/dist/domains/json/jsonDomainSchema.d.ts.map +0 -1
  751. package/dist/domains/json/jsonDomainSchema.js +0 -32
  752. package/dist/domains/json/jsonDomainSchema.js.map +0 -1
  753. package/dist/domains/leafDomain.d.ts +0 -72
  754. package/dist/domains/leafDomain.d.ts.map +0 -1
  755. package/dist/domains/leafDomain.js +0 -88
  756. package/dist/domains/leafDomain.js.map +0 -1
  757. package/dist/domains/schemaBuilder.d.ts +0 -103
  758. package/dist/domains/schemaBuilder.d.ts.map +0 -1
  759. package/dist/domains/schemaBuilder.js +0 -121
  760. package/dist/domains/schemaBuilder.js.map +0 -1
  761. package/dist/domains/testRecursiveDomain.d.ts +0 -17
  762. package/dist/domains/testRecursiveDomain.d.ts.map +0 -1
  763. package/dist/domains/testRecursiveDomain.js +0 -35
  764. package/dist/domains/testRecursiveDomain.js.map +0 -1
  765. package/dist/events/events.d.ts +0 -207
  766. package/dist/events/events.d.ts.map +0 -1
  767. package/dist/events/events.js.map +0 -1
  768. package/dist/feature-libraries/schemaBuilder.d.ts +0 -31
  769. package/dist/feature-libraries/schemaBuilder.d.ts.map +0 -1
  770. package/dist/feature-libraries/schemaBuilder.js +0 -40
  771. package/dist/feature-libraries/schemaBuilder.js.map +0 -1
  772. package/dist/feature-libraries/schemaBuilderBase.d.ts +0 -191
  773. package/dist/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
  774. package/dist/feature-libraries/schemaBuilderBase.js +0 -201
  775. package/dist/feature-libraries/schemaBuilderBase.js.map +0 -1
  776. package/dist/shared-tree/treeView.d.ts +0 -73
  777. package/dist/shared-tree/treeView.d.ts.map +0 -1
  778. package/dist/shared-tree/treeView.js.map +0 -1
  779. package/dist/simple-tree/getJsonSchema.d.ts.map +0 -1
  780. package/dist/simple-tree/getJsonSchema.js.map +0 -1
  781. package/dist/simple-tree/getSimpleSchema.d.ts.map +0 -1
  782. package/dist/simple-tree/getSimpleSchema.js.map +0 -1
  783. package/dist/simple-tree/jsonSchema.d.ts.map +0 -1
  784. package/dist/simple-tree/jsonSchema.js.map +0 -1
  785. package/dist/simple-tree/simpleSchema.d.ts.map +0 -1
  786. package/dist/simple-tree/simpleSchema.js.map +0 -1
  787. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
  788. package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
  789. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
  790. package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +0 -1
  791. package/lib/core/revertible/index.d.ts.map +0 -1
  792. package/lib/core/revertible/index.js.map +0 -1
  793. package/lib/core/revertible/revertible.d.ts.map +0 -1
  794. package/lib/core/revertible/revertible.js.map +0 -1
  795. package/lib/domains/index.d.ts +0 -8
  796. package/lib/domains/index.d.ts.map +0 -1
  797. package/lib/domains/index.js +0 -8
  798. package/lib/domains/index.js.map +0 -1
  799. package/lib/domains/json/index.d.ts +0 -7
  800. package/lib/domains/json/index.d.ts.map +0 -1
  801. package/lib/domains/json/index.js +0 -7
  802. package/lib/domains/json/index.js.map +0 -1
  803. package/lib/domains/json/jsonCursor.d.ts +0 -52
  804. package/lib/domains/json/jsonCursor.d.ts.map +0 -1
  805. package/lib/domains/json/jsonCursor.js +0 -192
  806. package/lib/domains/json/jsonCursor.js.map +0 -1
  807. package/lib/domains/json/jsonDomainSchema.d.ts +0 -24
  808. package/lib/domains/json/jsonDomainSchema.d.ts.map +0 -1
  809. package/lib/domains/json/jsonDomainSchema.js +0 -29
  810. package/lib/domains/json/jsonDomainSchema.js.map +0 -1
  811. package/lib/domains/leafDomain.d.ts +0 -72
  812. package/lib/domains/leafDomain.d.ts.map +0 -1
  813. package/lib/domains/leafDomain.js +0 -85
  814. package/lib/domains/leafDomain.js.map +0 -1
  815. package/lib/domains/schemaBuilder.d.ts +0 -103
  816. package/lib/domains/schemaBuilder.d.ts.map +0 -1
  817. package/lib/domains/schemaBuilder.js +0 -117
  818. package/lib/domains/schemaBuilder.js.map +0 -1
  819. package/lib/domains/testRecursiveDomain.d.ts +0 -17
  820. package/lib/domains/testRecursiveDomain.d.ts.map +0 -1
  821. package/lib/domains/testRecursiveDomain.js +0 -32
  822. package/lib/domains/testRecursiveDomain.js.map +0 -1
  823. package/lib/events/events.d.ts +0 -207
  824. package/lib/events/events.d.ts.map +0 -1
  825. package/lib/events/events.js.map +0 -1
  826. package/lib/feature-libraries/schemaBuilder.d.ts +0 -31
  827. package/lib/feature-libraries/schemaBuilder.d.ts.map +0 -1
  828. package/lib/feature-libraries/schemaBuilder.js +0 -36
  829. package/lib/feature-libraries/schemaBuilder.js.map +0 -1
  830. package/lib/feature-libraries/schemaBuilderBase.d.ts +0 -191
  831. package/lib/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
  832. package/lib/feature-libraries/schemaBuilderBase.js +0 -195
  833. package/lib/feature-libraries/schemaBuilderBase.js.map +0 -1
  834. package/lib/shared-tree/treeView.d.ts +0 -73
  835. package/lib/shared-tree/treeView.d.ts.map +0 -1
  836. package/lib/shared-tree/treeView.js.map +0 -1
  837. package/lib/simple-tree/getJsonSchema.d.ts.map +0 -1
  838. package/lib/simple-tree/getJsonSchema.js.map +0 -1
  839. package/lib/simple-tree/getSimpleSchema.d.ts.map +0 -1
  840. package/lib/simple-tree/getSimpleSchema.js.map +0 -1
  841. package/lib/simple-tree/jsonSchema.d.ts.map +0 -1
  842. package/lib/simple-tree/jsonSchema.js.map +0 -1
  843. package/lib/simple-tree/simpleSchema.d.ts.map +0 -1
  844. package/lib/simple-tree/simpleSchema.js.map +0 -1
  845. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
  846. package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
  847. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
  848. package/src/domains/README.md +0 -6
  849. package/src/domains/fence.json +0 -5
  850. package/src/domains/index.ts +0 -19
  851. package/src/domains/json/fence.json +0 -5
  852. package/src/domains/json/index.ts +0 -13
  853. package/src/domains/json/jsonCursor.ts +0 -247
  854. package/src/domains/json/jsonDomainSchema.ts +0 -47
  855. package/src/domains/leafDomain.ts +0 -97
  856. package/src/domains/schemaBuilder.ts +0 -153
  857. package/src/domains/testRecursiveDomain.ts +0 -38
  858. package/src/events/fence.json +0 -5
  859. package/src/feature-libraries/schemaBuilder.ts +0 -45
  860. package/src/feature-libraries/schemaBuilderBase.ts +0 -393
  861. package/src/shared-tree/treeView.ts +0 -113
  862. /package/dist/core/{revertible/revertible.js → revertible.js} +0 -0
  863. /package/dist/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
  864. /package/dist/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
  865. /package/dist/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
  866. /package/lib/core/{revertible/revertible.js → revertible.js} +0 -0
  867. /package/lib/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
  868. /package/lib/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
  869. /package/lib/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
@@ -16,13 +16,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
16
16
  var _LazyTreeNode_removeDeleteCallback;
17
17
  import { assert } from "@fluidframework/core-utils/internal";
18
18
  import { inCursorField, mapCursorFields, rootFieldKey, } from "../../core/index.js";
19
- import { brand, disposeSymbol, fail } from "../../util/index.js";
19
+ import { disposeSymbol, fail } from "../../util/index.js";
20
20
  import { FieldKinds } from "../default-schema/index.js";
21
- import { Any, FlexFieldSchema, schemaIsLeaf, schemaIsMap, schemaIsObjectNode, } from "../typed-schema/index.js";
21
+ import { FlexFieldSchema } from "../typed-schema/index.js";
22
22
  import { FlexTreeEntityKind, flexTreeMarker, flexTreeSlot, } from "./flexTreeTypes.js";
23
23
  import { LazyEntity, anchorSymbol, cursorSymbol, forgetAnchorSymbol, tryMoveCursorToAnchorSymbol, } from "./lazyEntity.js";
24
24
  import { makeField } from "./lazyField.js";
25
- import { unboxedField } from "./unboxed.js";
26
25
  /**
27
26
  * @param cursor - This does not take ownership of this cursor: Node will fork it as needed.
28
27
  */
@@ -37,27 +36,14 @@ export function makeTree(context, cursor) {
37
36
  assert(cached instanceof LazyTreeNode, 0x92c /* Expected LazyTreeNode */);
38
37
  return cached;
39
38
  }
40
- const schema = context.schema.nodeSchema.get(cursor.type) ?? fail("missing schema");
41
- return buildSubclass(context, schema, cursor, anchorNode, anchor);
39
+ const schema = context.flexSchema.nodeSchema.get(cursor.type) ?? fail("missing schema");
40
+ return new LazyTreeNode(context, schema, cursor, anchorNode, anchor);
42
41
  }
43
42
  function cleanupTree(anchor) {
44
43
  const cached = anchor.slots.get(flexTreeSlot) ?? fail("tree should only be cleaned up once");
45
44
  assert(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);
46
45
  cached[disposeSymbol]();
47
46
  }
48
- function buildSubclass(context, schema, cursor, anchorNode, anchor) {
49
- if (schemaIsMap(schema)) {
50
- return new LazyMap(context, schema, cursor, anchorNode, anchor);
51
- }
52
- if (schemaIsLeaf(schema)) {
53
- return new LazyLeaf(context, schema, cursor, anchorNode, anchor);
54
- }
55
- if (schemaIsObjectNode(schema)) {
56
- return new LazyTreeNode(context, schema, cursor, anchorNode, anchor);
57
- }
58
- // TODO: there should be a common fallback that works for cases without a specialized implementation.
59
- fail("unrecognized node kind");
60
- }
61
47
  /**
62
48
  * Lazy implementation of {@link FlexTreeNode}.
63
49
  */
@@ -65,6 +51,9 @@ export class LazyTreeNode extends LazyEntity {
65
51
  get [(_LazyTreeNode_removeDeleteCallback = new WeakMap(), flexTreeMarker)]() {
66
52
  return FlexTreeEntityKind.Node;
67
53
  }
54
+ get schema() {
55
+ return this.flexSchema.name;
56
+ }
68
57
  constructor(context, schema, cursor, anchorNode, anchor) {
69
58
  super(context, schema, cursor, anchor);
70
59
  this.anchorNode = anchorNode;
@@ -73,12 +62,11 @@ export class LazyTreeNode extends LazyEntity {
73
62
  assert(cursor.mode === 0 /* CursorLocationType.Nodes */, 0x783 /* must be in nodes mode */);
74
63
  anchorNode.slots.set(flexTreeSlot, this);
75
64
  __classPrivateFieldSet(this, _LazyTreeNode_removeDeleteCallback, anchorNode.on("afterDestroy", cleanupTree), "f");
76
- assert(this.context.schema.nodeSchema.get(this.schema.name) !== undefined, 0x784 /* There is no explicit schema for this node type. Ensure that the type is correct and the schema for it was added to the TreeStoredSchema */);
77
- this.type = schema.name;
65
+ assert(this.context.flexSchema.nodeSchema.get(this.flexSchema.name) !== undefined, 0x784 /* There is no explicit schema for this node type. Ensure that the type is correct and the schema for it was added to the TreeStoredSchema */);
78
66
  }
79
67
  is(schema) {
80
- assert(this.context.schema.nodeSchema.get(schema.name) === schema, 0x785 /* Narrowing must be done to a schema that exists in this context */);
81
- return this.schema === schema;
68
+ assert(this.context.flexSchema.nodeSchema.get(schema.name) === schema, 0x785 /* Narrowing must be done to a schema that exists in this context */);
69
+ return this.flexSchema === schema;
82
70
  }
83
71
  [tryMoveCursorToAnchorSymbol](cursor) {
84
72
  return this.context.checkout.forest.tryMoveCursorToNode(this[anchorSymbol], cursor);
@@ -95,7 +83,7 @@ export class LazyTreeNode extends LazyEntity {
95
83
  return this[cursorSymbol].value;
96
84
  }
97
85
  tryGetField(fieldKey) {
98
- const schema = this.schema.getFieldSchema(fieldKey);
86
+ const schema = this.flexSchema.getFieldSchema(fieldKey);
99
87
  return inCursorField(this[cursorSymbol], fieldKey, (cursor) => {
100
88
  if (cursor.getFieldLength() === 0) {
101
89
  return undefined;
@@ -104,10 +92,13 @@ export class LazyTreeNode extends LazyEntity {
104
92
  });
105
93
  }
106
94
  getBoxed(key) {
107
- return getBoxedField(this, key, this.schema.getFieldSchema(key));
95
+ const fieldSchema = this.flexSchema.getFieldSchema(key);
96
+ return inCursorField(this[cursorSymbol], key, (cursor) => {
97
+ return makeField(this.context, fieldSchema, cursor);
98
+ });
108
99
  }
109
100
  boxedIterator() {
110
- return mapCursorFields(this[cursorSymbol], (cursor) => makeField(this.context, this.schema.getFieldSchema(cursor.getFieldKey()), cursor)).values();
101
+ return mapCursorFields(this[cursorSymbol], (cursor) => makeField(this.context, this.flexSchema.getFieldSchema(cursor.getFieldKey()), cursor)).values();
111
102
  }
112
103
  get parentField() {
113
104
  const cursor = this[cursorSymbol];
@@ -122,12 +113,12 @@ export class LazyTreeNode extends LazyEntity {
122
113
  // Parent field is a detached sequence, and thus needs special handling for its schema.
123
114
  // eslint-disable-next-line unicorn/prefer-ternary
124
115
  if (key === rootFieldKey) {
125
- fieldSchema = this.context.schema.rootFieldSchema;
116
+ fieldSchema = this.context.flexSchema.rootFieldSchema;
126
117
  }
127
118
  else {
128
119
  // All fields (in the flex tree API) have a schema.
129
120
  // Since currently there is no known schema for detached field other than the special default root:
130
- // give all other detached fields a schema of sequence of any.
121
+ // give all other detached fields a schema of sequence of anything.
131
122
  // That schema is the only one that is safe since its the only field schema that allows any possible field content.
132
123
  //
133
124
  // TODO:
@@ -136,16 +127,18 @@ export class LazyTreeNode extends LazyEntity {
136
127
  // 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.
137
128
  // 3. Possibly other unknown cases.
138
129
  // 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).
139
- // 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 s3ending the op).
130
+ // 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).
140
131
  // Issues like replacing a node in the a removed sequenced then undoing the remove could easily violate schema if not everything works exactly right!
141
- fieldSchema = FlexFieldSchema.create(FieldKinds.sequence, [Any]);
132
+ fieldSchema = FlexFieldSchema.create(FieldKinds.sequence, [
133
+ ...this.context.flexSchema.nodeSchema.values(),
134
+ ]);
142
135
  }
143
136
  }
144
137
  else {
145
138
  cursor.exitField();
146
139
  const parentType = cursor.type;
147
140
  cursor.enterField(key);
148
- const nodeSchema = this.context.schema.nodeSchema.get(parentType) ??
141
+ const nodeSchema = this.context.flexSchema.nodeSchema.get(parentType) ??
149
142
  fail("requested schema that does not exist");
150
143
  fieldSchema = nodeSchema.getFieldSchema(key);
151
144
  }
@@ -153,50 +146,8 @@ export class LazyTreeNode extends LazyEntity {
153
146
  cursor.enterNode(index);
154
147
  return { parent: proxifiedField, index };
155
148
  }
156
- }
157
- export class LazyMap extends LazyTreeNode {
158
- constructor(context, schema, cursor, anchorNode, anchor) {
159
- super(context, schema, cursor, anchorNode, anchor);
160
- }
161
149
  keys() {
162
150
  return mapCursorFields(this[cursorSymbol], (cursor) => cursor.getFieldKey()).values();
163
151
  }
164
- values() {
165
- return mapCursorFields(this[cursorSymbol], (cursor) => unboxedField(this.context, this.schema.info, cursor)).values();
166
- }
167
- entries() {
168
- return mapCursorFields(this[cursorSymbol], (cursor) => {
169
- const entry = [
170
- cursor.getFieldKey(),
171
- unboxedField(this.context, this.schema.info, cursor),
172
- ];
173
- return entry;
174
- }).values();
175
- }
176
- forEach(callbackFn, thisArg) {
177
- const fn = thisArg !== undefined ? callbackFn.bind(thisArg) : callbackFn;
178
- for (const [key, value] of this.entries()) {
179
- fn(value, key, this);
180
- }
181
- }
182
- getBoxed(key) {
183
- return super.getBoxed(brand(key));
184
- }
185
- [Symbol.iterator]() {
186
- return this.entries();
187
- }
188
- }
189
- export class LazyLeaf extends LazyTreeNode {
190
- constructor(context, schema, cursor, anchorNode, anchor) {
191
- super(context, schema, cursor, anchorNode, anchor);
192
- }
193
- get value() {
194
- return super.value;
195
- }
196
- }
197
- function getBoxedField(objectNode, key, fieldSchema) {
198
- return inCursorField(objectNode[cursorSymbol], key, (cursor) => {
199
- return makeField(objectNode.context, fieldSchema, cursor);
200
- });
201
152
  }
202
153
  //# sourceMappingURL=lazyNode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lazyNode.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAUN,aAAa,EACb,eAAe,EACf,YAAY,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EACN,GAAG,EACH,eAAe,EAIf,YAAY,EACZ,WAAW,EACX,kBAAkB,GAClB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACN,kBAAkB,EAQlB,cAAc,EACd,YAAY,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,2BAA2B,GAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAgB,EAAE,MAA+B;IACzE,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,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CAAC,KAAmC,CAAC;IAClD,CAAC;CACD;AAED,SAAS,aAAa,CACrB,UAAwB,EACxB,GAAa,EACb,WAA4B;IAE5B,OAAO,aAAa,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE;QAC9D,OAAO,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype Anchor,\n\ttype AnchorNode,\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype ITreeSubscriptionCursor,\n\ttype TreeNavigationResult,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeValue,\n\ttype Value,\n\tinCursorField,\n\tmapCursorFields,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport { brand, disposeSymbol, fail } from \"../../util/index.js\";\nimport { FieldKinds } from \"../default-schema/index.js\";\nimport {\n\tAny,\n\tFlexFieldSchema,\n\ttype FlexMapNodeSchema,\n\ttype FlexTreeNodeSchema,\n\ttype LeafNodeSchema,\n\tschemaIsLeaf,\n\tschemaIsMap,\n\tschemaIsObjectNode,\n} from \"../typed-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport {\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeLeafNode,\n\ttype FlexTreeMapNode,\n\ttype FlexTreeNode,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeTypedNode,\n\ttype FlexTreeUnboxField,\n\tflexTreeMarker,\n\tflexTreeSlot,\n} from \"./flexTreeTypes.js\";\nimport {\n\tLazyEntity,\n\tanchorSymbol,\n\tcursorSymbol,\n\tforgetAnchorSymbol,\n\ttryMoveCursorToAnchorSymbol,\n} from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\nimport { unboxedField } from \"./unboxed.js\";\n\n/**\n * @param cursor - 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(\"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 as LazyTreeNode;\n\t}\n\tconst schema = context.schema.nodeSchema.get(cursor.type) ?? fail(\"missing schema\");\n\treturn buildSubclass(context, schema, cursor, anchorNode, anchor);\n}\n\nfunction cleanupTree(anchor: AnchorNode): void {\n\tconst cached = anchor.slots.get(flexTreeSlot) ?? fail(\"tree should only be cleaned up once\");\n\tassert(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);\n\tcached[disposeSymbol]();\n}\n\nfunction buildSubclass(\n\tcontext: Context,\n\tschema: FlexTreeNodeSchema,\n\tcursor: ITreeSubscriptionCursor,\n\tanchorNode: AnchorNode,\n\tanchor: Anchor,\n): LazyTreeNode {\n\tif (schemaIsMap(schema)) {\n\t\treturn new LazyMap(context, schema, cursor, anchorNode, anchor);\n\t}\n\tif (schemaIsLeaf(schema)) {\n\t\treturn new LazyLeaf(context, schema, cursor, anchorNode, anchor);\n\t}\n\tif (schemaIsObjectNode(schema)) {\n\t\treturn new LazyTreeNode(context, schema, cursor, anchorNode, anchor);\n\t}\n\t// TODO: there should be a common fallback that works for cases without a specialized implementation.\n\tfail(\"unrecognized node kind\");\n}\n\n/**\n * Lazy implementation of {@link FlexTreeNode}.\n */\nexport class LazyTreeNode<TSchema extends FlexTreeNodeSchema = FlexTreeNodeSchema>\n\textends LazyEntity<TSchema, Anchor>\n\timplements FlexTreeNode\n{\n\tpublic get [flexTreeMarker](): FlexTreeEntityKind.Node {\n\t\treturn FlexTreeEntityKind.Node;\n\t}\n\t/**\n\t * Enumerable own property providing a more JS object friendly alternative to \"schema\".\n\t */\n\tpublic readonly type: TreeNodeSchemaIdentifier;\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\tpublic constructor(\n\t\tcontext: Context,\n\t\tschema: TSchema,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tpublic readonly anchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, schema, cursor, anchor);\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.on(\"afterDestroy\", cleanupTree);\n\n\t\tassert(\n\t\t\tthis.context.schema.nodeSchema.get(this.schema.name) !== undefined,\n\t\t\t0x784 /* There is no explicit schema for this node type. Ensure that the type is correct and the schema for it was added to the TreeStoredSchema */,\n\t\t);\n\n\t\tthis.type = schema.name;\n\t}\n\n\tpublic is<TSchemaInner extends FlexTreeNodeSchema>(\n\t\tschema: TSchemaInner,\n\t): this is FlexTreeTypedNode<TSchemaInner> {\n\t\tassert(\n\t\t\tthis.context.schema.nodeSchema.get(schema.name) === schema,\n\t\t\t0x785 /* Narrowing must be done to a schema that exists in this context */,\n\t\t);\n\t\treturn this.schema === (schema as unknown);\n\t}\n\n\tprotected override [tryMoveCursorToAnchorSymbol](\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.context.checkout.forest.tryMoveCursorToNode(this[anchorSymbol], cursor);\n\t}\n\n\tprotected override [forgetAnchorSymbol](): 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[anchorSymbol]);\n\t}\n\n\tpublic get value(): Value {\n\t\treturn this[cursorSymbol].value;\n\t}\n\n\tpublic tryGetField(fieldKey: FieldKey): FlexTreeField | undefined {\n\t\tconst schema = this.schema.getFieldSchema(fieldKey);\n\t\treturn inCursorField(this[cursorSymbol], 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, cursor);\n\t\t});\n\t}\n\n\tpublic getBoxed(key: FieldKey): FlexTreeField {\n\t\treturn getBoxedField(this, key, this.schema.getFieldSchema(key));\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeField> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) =>\n\t\t\tmakeField(this.context, this.schema.getFieldSchema(cursor.getFieldKey()), cursor),\n\t\t).values();\n\t}\n\n\tpublic get parentField(): { readonly parent: FlexTreeField; readonly index: number } {\n\t\tconst cursor = this[cursorSymbol];\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: FlexFieldSchema;\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;\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 any.\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 s3ending 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 = FlexFieldSchema.create(FieldKinds.sequence, [Any]);\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(\"requested schema that does not exist\");\n\t\t\tfieldSchema = nodeSchema.getFieldSchema(key);\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\nexport class LazyMap<TSchema extends FlexMapNodeSchema>\n\textends LazyTreeNode<TSchema>\n\timplements FlexTreeMapNode<TSchema>\n{\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tschema: TSchema,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tanchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, schema, cursor, anchorNode, anchor);\n\t}\n\n\tpublic keys(): IterableIterator<FieldKey> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) => cursor.getFieldKey()).values();\n\t}\n\n\tpublic values(): IterableIterator<FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">> {\n\t\treturn mapCursorFields(\n\t\t\tthis[cursorSymbol],\n\t\t\t(cursor) =>\n\t\t\t\tunboxedField(this.context, this.schema.info, cursor) as FlexTreeUnboxField<\n\t\t\t\t\tTSchema[\"info\"],\n\t\t\t\t\t\"notEmpty\"\n\t\t\t\t>,\n\t\t).values();\n\t}\n\n\tpublic entries(): IterableIterator<\n\t\t[FieldKey, FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">]\n\t> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) => {\n\t\t\tconst entry: [FieldKey, FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">] = [\n\t\t\t\tcursor.getFieldKey(),\n\t\t\t\tunboxedField(this.context, this.schema.info, cursor) as FlexTreeUnboxField<\n\t\t\t\t\tTSchema[\"info\"],\n\t\t\t\t\t\"notEmpty\"\n\t\t\t\t>,\n\t\t\t];\n\t\t\treturn entry;\n\t\t}).values();\n\t}\n\n\tpublic forEach(\n\t\tcallbackFn: (\n\t\t\tvalue: FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">,\n\t\t\tkey: FieldKey,\n\t\t\tmap: FlexTreeMapNode<TSchema>,\n\t\t) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\tconst fn = thisArg !== undefined ? callbackFn.bind(thisArg) : callbackFn;\n\t\tfor (const [key, value] of this.entries()) {\n\t\t\tfn(value, key, this);\n\t\t}\n\t}\n\n\tpublic override getBoxed(key: string): FlexTreeTypedField<TSchema[\"info\"]> {\n\t\treturn super.getBoxed(brand(key)) as FlexTreeTypedField<TSchema[\"info\"]>;\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<\n\t\t[FieldKey, FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">]\n\t> {\n\t\treturn this.entries();\n\t}\n}\n\nexport class LazyLeaf<TSchema extends LeafNodeSchema>\n\textends LazyTreeNode<TSchema>\n\timplements FlexTreeLeafNode<TSchema>\n{\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tschema: TSchema,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tanchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, schema, cursor, anchorNode, anchor);\n\t}\n\n\tpublic override get value(): TreeValue<TSchema[\"info\"]> {\n\t\treturn super.value as TreeValue<TSchema[\"info\"]>;\n\t}\n}\n\nfunction getBoxedField(\n\tobjectNode: LazyTreeNode,\n\tkey: FieldKey,\n\tfieldSchema: FlexFieldSchema,\n): FlexTreeField {\n\treturn inCursorField(objectNode[cursorSymbol], key, (cursor) => {\n\t\treturn makeField(objectNode.context, fieldSchema, cursor);\n\t});\n}\n"]}
1
+ {"version":3,"file":"lazyNode.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EASN,aAAa,EACb,eAAe,EACf,YAAY,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,eAAe,EAA2B,MAAM,0BAA0B,CAAC;AAGpF,OAAO,EACN,kBAAkB,EAGlB,cAAc,EACd,YAAY,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,2BAA2B,GAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAgB,EAAE,MAA+B;IACzE,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE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MAAM,UAAU,GACf,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;gBAClD,IAAI,CAAC,sCAAsC,CAAC,CAAC;YAC9C,WAAW,GAAG,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QAC9C,CAAC;QAED,MAAM,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QACpE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAExB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;IAC1C,CAAC;IAEM,IAAI;QACV,OAAO,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;IACvF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype Anchor,\n\ttype AnchorNode,\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype ITreeSubscriptionCursor,\n\ttype TreeNavigationResult,\n\ttype TreeNodeSchemaIdentifier,\n\ttype Value,\n\tinCursorField,\n\tmapCursorFields,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport { disposeSymbol, fail } from \"../../util/index.js\";\nimport { FieldKinds } from \"../default-schema/index.js\";\nimport { FlexFieldSchema, type FlexTreeNodeSchema } from \"../typed-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 {\n\tLazyEntity,\n\tanchorSymbol,\n\tcursorSymbol,\n\tforgetAnchorSymbol,\n\ttryMoveCursorToAnchorSymbol,\n} from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\n\n/**\n * @param cursor - 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(\"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 as LazyTreeNode;\n\t}\n\tconst schema = context.flexSchema.nodeSchema.get(cursor.type) ?? fail(\"missing schema\");\n\treturn new LazyTreeNode(context, schema, cursor, anchorNode, anchor);\n}\n\nfunction cleanupTree(anchor: AnchorNode): void {\n\tconst cached = anchor.slots.get(flexTreeSlot) ?? fail(\"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<TSchema extends FlexTreeNodeSchema = FlexTreeNodeSchema>\n\textends LazyEntity<TSchema, Anchor>\n\timplements FlexTreeNode\n{\n\tpublic get [flexTreeMarker](): FlexTreeEntityKind.Node {\n\t\treturn FlexTreeEntityKind.Node;\n\t}\n\n\tpublic get schema(): TreeNodeSchemaIdentifier {\n\t\treturn this.flexSchema.name;\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\tpublic constructor(\n\t\tcontext: Context,\n\t\tschema: TSchema,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tpublic readonly anchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, schema, cursor, anchor);\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.on(\"afterDestroy\", cleanupTree);\n\n\t\tassert(\n\t\t\tthis.context.flexSchema.nodeSchema.get(this.flexSchema.name) !== undefined,\n\t\t\t0x784 /* There is no explicit schema for this node type. Ensure that the type is correct and the schema for it was added to the TreeStoredSchema */,\n\t\t);\n\t}\n\n\tpublic is(schema: FlexTreeNodeSchema): boolean {\n\t\tassert(\n\t\t\tthis.context.flexSchema.nodeSchema.get(schema.name) === schema,\n\t\t\t0x785 /* Narrowing must be done to a schema that exists in this context */,\n\t\t);\n\t\treturn this.flexSchema === (schema as unknown);\n\t}\n\n\tprotected override [tryMoveCursorToAnchorSymbol](\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.context.checkout.forest.tryMoveCursorToNode(this[anchorSymbol], cursor);\n\t}\n\n\tprotected override [forgetAnchorSymbol](): 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[anchorSymbol]);\n\t}\n\n\tpublic get value(): Value {\n\t\treturn this[cursorSymbol].value;\n\t}\n\n\tpublic tryGetField(fieldKey: FieldKey): FlexTreeField | undefined {\n\t\tconst schema = this.flexSchema.getFieldSchema(fieldKey);\n\t\treturn inCursorField(this[cursorSymbol], 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, cursor);\n\t\t});\n\t}\n\n\tpublic getBoxed(key: FieldKey): FlexTreeField {\n\t\tconst fieldSchema = this.flexSchema.getFieldSchema(key);\n\t\treturn inCursorField(this[cursorSymbol], key, (cursor) => {\n\t\t\treturn makeField(this.context, fieldSchema, cursor);\n\t\t});\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeField> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) =>\n\t\t\tmakeField(this.context, this.flexSchema.getFieldSchema(cursor.getFieldKey()), cursor),\n\t\t).values();\n\t}\n\n\tpublic get parentField(): { readonly parent: FlexTreeField; readonly index: number } {\n\t\tconst cursor = this[cursorSymbol];\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: FlexFieldSchema;\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.flexSchema.rootFieldSchema;\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 = FlexFieldSchema.create(FieldKinds.sequence, [\n\t\t\t\t\t...this.context.flexSchema.nodeSchema.values(),\n\t\t\t\t]);\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.flexSchema.nodeSchema.get(parentType) ??\n\t\t\t\tfail(\"requested schema that does not exist\");\n\t\t\tfieldSchema = nodeSchema.getFieldSchema(key);\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[cursorSymbol], (cursor) => cursor.getFieldKey()).values();\n\t}\n}\n"]}
@@ -2,23 +2,11 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type ITreeSubscriptionCursor } from "../../core/index.js";
6
- import type { FlexFieldKind } from "../modular-schema/index.js";
7
- import { type FlexAllowedTypes, type FlexFieldSchema, type FlexTreeNodeSchema } from "../typed-schema/index.js";
5
+ import type { ITreeSubscriptionCursor } from "../../core/index.js";
8
6
  import type { Context } from "./context.js";
9
- import type { FlexTreeUnboxField, FlexTreeUnboxNode, FlexTreeUnboxNodeUnion } from "./flexTreeTypes.js";
7
+ import type { FlexTreeUnknownUnboxed } from "./flexTreeTypes.js";
10
8
  /**
11
- * See {@link FlexTreeUnboxNode} for documentation on what unwrapping this performs.
9
+ * Returns the flex tree node, of the value if it has one.
12
10
  */
13
- export declare function unboxedTree<TSchema extends FlexTreeNodeSchema>(context: Context, schema: TSchema, cursor: ITreeSubscriptionCursor): FlexTreeUnboxNode<TSchema>;
14
- /**
15
- * See {@link FlexTreeUnboxNodeUnion} for documentation on what unwrapping this performs.
16
- */
17
- export declare function unboxedUnion<TTypes extends FlexAllowedTypes>(context: Context, schema: FlexFieldSchema<FlexFieldKind, TTypes>, cursor: ITreeSubscriptionCursor): FlexTreeUnboxNodeUnion<TTypes>;
18
- /**
19
- * @param context - the common context of the field.
20
- * @param schema - the TreeFieldStoredSchema of the field.
21
- * @param cursor - the cursor, which must point to the field being proxified.
22
- */
23
- export declare function unboxedField<TSchema extends FlexFieldSchema>(context: Context, schema: TSchema, cursor: ITreeSubscriptionCursor): FlexTreeUnboxField<TSchema>;
11
+ export declare function unboxedFlexNode(context: Context, cursor: ITreeSubscriptionCursor): FlexTreeUnknownUnboxed;
24
12
  //# sourceMappingURL=unboxed.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unboxed.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,uBAAuB,EAAgB,MAAM,qBAAqB,CAAC;AAEjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAEvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAEX,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,oBAAoB,CAAC;AAI5B;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,SAAS,kBAAkB,EAC7D,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,uBAAuB,GAC7B,iBAAiB,CAAC,OAAO,CAAC,CAM5B;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,SAAS,gBAAgB,EAC3D,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,eAAe,CAAC,aAAa,EAAE,MAAM,CAAC,EAC9C,MAAM,EAAE,uBAAuB,GAC7B,sBAAsB,CAAC,MAAM,CAAC,CAMhC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,SAAS,eAAe,EAC3D,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,uBAAuB,GAC7B,kBAAkB,CAAC,OAAO,CAAC,CAkB7B"}
1
+ {"version":3,"file":"unboxed.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGjE;;GAEG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,uBAAuB,GAC7B,sBAAsB,CAMxB"}
@@ -2,47 +2,15 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { inCursorNode } from "../../core/index.js";
6
- import { FieldKinds } from "../default-schema/index.js";
7
- import { schemaIsLeaf, } from "../typed-schema/index.js";
8
- import { makeField } from "./lazyField.js";
9
5
  import { makeTree } from "./lazyNode.js";
10
6
  /**
11
- * See {@link FlexTreeUnboxNode} for documentation on what unwrapping this performs.
7
+ * Returns the flex tree node, of the value if it has one.
12
8
  */
13
- export function unboxedTree(context, schema, cursor) {
14
- if (schemaIsLeaf(schema)) {
15
- return cursor.value;
9
+ export function unboxedFlexNode(context, cursor) {
10
+ const value = cursor.value;
11
+ if (value !== undefined) {
12
+ return value;
16
13
  }
17
14
  return makeTree(context, cursor);
18
15
  }
19
- /**
20
- * See {@link FlexTreeUnboxNodeUnion} for documentation on what unwrapping this performs.
21
- */
22
- export function unboxedUnion(context, schema, cursor) {
23
- const type = schema.monomorphicChildType;
24
- if (type !== undefined) {
25
- return unboxedTree(context, type, cursor);
26
- }
27
- return makeTree(context, cursor);
28
- }
29
- /**
30
- * @param context - the common context of the field.
31
- * @param schema - the TreeFieldStoredSchema of the field.
32
- * @param cursor - the cursor, which must point to the field being proxified.
33
- */
34
- export function unboxedField(context, schema, cursor) {
35
- const kind = schema.kind;
36
- if (kind === FieldKinds.required) {
37
- return inCursorNode(cursor, 0, (innerCursor) => unboxedUnion(context, schema, innerCursor));
38
- }
39
- if (kind === FieldKinds.optional) {
40
- if (cursor.getFieldLength() === 0) {
41
- return undefined;
42
- }
43
- return inCursorNode(cursor, 0, (innerCursor) => unboxedUnion(context, schema, innerCursor));
44
- }
45
- // TODO: forbidden and nodeKey
46
- return makeField(context, schema, cursor);
47
- }
48
16
  //# sourceMappingURL=unboxed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unboxed.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgC,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAIN,YAAY,GACZ,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,MAAM,UAAU,WAAW,CAC1B,OAAgB,EAChB,MAAe,EACf,MAA+B;IAE/B,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,KAAmC,CAAC;IACnD,CAAC;IAED,OAAO,QAAQ,CAAC,OAAO,EAAE,MAAM,CAA+C,CAAC;AAChF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAC3B,OAAgB,EAChB,MAA8C,EAC9C,MAA+B;IAE/B,MAAM,IAAI,GAAG,MAAM,CAAC,oBAAoB,CAAC;IACzC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,WAAW,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAmC,CAAC;IAC7E,CAAC;IACD,OAAO,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAmC,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAC3B,OAAgB,EAChB,MAAe,EACf,MAA+B;IAE/B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IACzB,IAAI,IAAI,KAAK,UAAU,CAAC,QAAQ,EAAE,CAAC;QAClC,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,CAC9C,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CACX,CAAC;IAClC,CAAC;IACD,IAAI,IAAI,KAAK,UAAU,CAAC,QAAQ,EAAE,CAAC;QAClC,IAAI,MAAM,CAAC,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;YACnC,OAAO,SAAwC,CAAC;QACjD,CAAC;QACD,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,CAC9C,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CACX,CAAC;IAClC,CAAC;IAED,8BAA8B;IAC9B,OAAO,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAgC,CAAC;AAC1E,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ITreeSubscriptionCursor, inCursorNode } from \"../../core/index.js\";\nimport { FieldKinds } from \"../default-schema/index.js\";\nimport type { FlexFieldKind } from \"../modular-schema/index.js\";\nimport {\n\ttype FlexAllowedTypes,\n\ttype FlexFieldSchema,\n\ttype FlexTreeNodeSchema,\n\tschemaIsLeaf,\n} from \"../typed-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport type {\n\tFlexTreeNode,\n\tFlexTreeUnboxField,\n\tFlexTreeUnboxNode,\n\tFlexTreeUnboxNodeUnion,\n} from \"./flexTreeTypes.js\";\nimport { makeField } from \"./lazyField.js\";\nimport { makeTree } from \"./lazyNode.js\";\n\n/**\n * See {@link FlexTreeUnboxNode} for documentation on what unwrapping this performs.\n */\nexport function unboxedTree<TSchema extends FlexTreeNodeSchema>(\n\tcontext: Context,\n\tschema: TSchema,\n\tcursor: ITreeSubscriptionCursor,\n): FlexTreeUnboxNode<TSchema> {\n\tif (schemaIsLeaf(schema)) {\n\t\treturn cursor.value as FlexTreeUnboxNode<TSchema>;\n\t}\n\n\treturn makeTree(context, cursor) as FlexTreeNode as FlexTreeUnboxNode<TSchema>;\n}\n\n/**\n * See {@link FlexTreeUnboxNodeUnion} for documentation on what unwrapping this performs.\n */\nexport function unboxedUnion<TTypes extends FlexAllowedTypes>(\n\tcontext: Context,\n\tschema: FlexFieldSchema<FlexFieldKind, TTypes>,\n\tcursor: ITreeSubscriptionCursor,\n): FlexTreeUnboxNodeUnion<TTypes> {\n\tconst type = schema.monomorphicChildType;\n\tif (type !== undefined) {\n\t\treturn unboxedTree(context, type, cursor) as FlexTreeUnboxNodeUnion<TTypes>;\n\t}\n\treturn makeTree(context, cursor) as FlexTreeUnboxNodeUnion<TTypes>;\n}\n\n/**\n * @param context - the common context of the field.\n * @param schema - the TreeFieldStoredSchema of the field.\n * @param cursor - the cursor, which must point to the field being proxified.\n */\nexport function unboxedField<TSchema extends FlexFieldSchema>(\n\tcontext: Context,\n\tschema: TSchema,\n\tcursor: ITreeSubscriptionCursor,\n): FlexTreeUnboxField<TSchema> {\n\tconst kind = schema.kind;\n\tif (kind === FieldKinds.required) {\n\t\treturn inCursorNode(cursor, 0, (innerCursor) =>\n\t\t\tunboxedUnion(context, schema, innerCursor),\n\t\t) as FlexTreeUnboxField<TSchema>;\n\t}\n\tif (kind === FieldKinds.optional) {\n\t\tif (cursor.getFieldLength() === 0) {\n\t\t\treturn undefined as FlexTreeUnboxField<TSchema>;\n\t\t}\n\t\treturn inCursorNode(cursor, 0, (innerCursor) =>\n\t\t\tunboxedUnion(context, schema, innerCursor),\n\t\t) as FlexTreeUnboxField<TSchema>;\n\t}\n\n\t// TODO: forbidden and nodeKey\n\treturn makeField(context, schema, cursor) as FlexTreeUnboxField<TSchema>;\n}\n"]}
1
+ {"version":3,"file":"unboxed.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,MAAM,UAAU,eAAe,CAC9B,OAAgB,EAChB,MAA+B;IAE/B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAClC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITreeSubscriptionCursor } from \"../../core/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport type { FlexTreeUnknownUnboxed } from \"./flexTreeTypes.js\";\nimport { makeTree } from \"./lazyNode.js\";\n\n/**\n * Returns the flex tree node, of the value if it has one.\n */\nexport function unboxedFlexNode(\n\tcontext: Context,\n\tcursor: ITreeSubscriptionCursor,\n): FlexTreeUnknownUnboxed {\n\tconst value = cursor.value;\n\tif (value !== undefined) {\n\t\treturn value;\n\t}\n\treturn makeTree(context, cursor);\n}\n"]}
@@ -30,9 +30,9 @@ export interface DetachedFieldCache {
30
30
  * Utility function to get a {@link SchemaAndPolicy} object from a {@link FlexTreeNode} or {@link FlexTreeField}.
31
31
  * @param nodeOrField - {@link FlexTreeNode} or {@link FlexTreeField} to get the schema and policy from.
32
32
  * @returns A {@link SchemaAndPolicy} object with the stored schema and policy from the node or field provided.
33
- * If the schema information is not available on the given node or field (e.g. because it is an unhydrated node), returns `undefined`.
33
+ * For {@link Unhydrated} nodes this schema may only describe the types allowed subtree for this particular entity.
34
34
  */
35
- export declare function getSchemaAndPolicy(nodeOrField: FlexTreeEntity): SchemaAndPolicy | undefined;
35
+ export declare function getSchemaAndPolicy(nodeOrField: FlexTreeEntity): SchemaAndPolicy;
36
36
  /**
37
37
  * Indexing for {@link FlexTreeField.boxedAt} and {@link FlexTreeSequenceField.at} supports the
38
38
  * usage of negative indices, which regular indexing using `[` and `]` does not.
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/utilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,UAAU,EACf,KAAK,aAAa,EAIlB,KAAK,eAAe,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACrE;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,aAAa,GAAG,UAAU,CAEpF;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAkB5E;AAiBD,eAAO,MAAM,iBAAiB,8DAAmC,CAAC;AAElE,MAAM,WAAW,kBAAkB;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,cAAc,GAAG,eAAe,GAAG,SAAS,CAS3F;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY5E"}
1
+ {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/utilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,UAAU,EACf,KAAK,aAAa,EAIlB,KAAK,eAAe,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACrE;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,aAAa,GAAG,UAAU,CAEpF;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAkB5E;AAiBD,eAAO,MAAM,iBAAiB,8DAAmC,CAAC;AAElE,MAAM,WAAW,kBAAkB;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,cAAc,GAAG,eAAe,CAK/E;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY5E"}
@@ -54,15 +54,12 @@ export const detachedFieldSlot = anchorSlot();
54
54
  * Utility function to get a {@link SchemaAndPolicy} object from a {@link FlexTreeNode} or {@link FlexTreeField}.
55
55
  * @param nodeOrField - {@link FlexTreeNode} or {@link FlexTreeField} to get the schema and policy from.
56
56
  * @returns A {@link SchemaAndPolicy} object with the stored schema and policy from the node or field provided.
57
- * If the schema information is not available on the given node or field (e.g. because it is an unhydrated node), returns `undefined`.
57
+ * For {@link Unhydrated} nodes this schema may only describe the types allowed subtree for this particular entity.
58
58
  */
59
59
  export function getSchemaAndPolicy(nodeOrField) {
60
- if (nodeOrField.context === undefined) {
61
- return undefined;
62
- }
63
60
  return {
64
- schema: nodeOrField.context.checkout.storedSchema,
65
- policy: nodeOrField.context.schema.policy,
61
+ schema: nodeOrField.context.schema,
62
+ policy: nodeOrField.context.flexSchema.policy,
66
63
  };
67
64
  }
68
65
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/utilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,UAAU,EACV,8BAA8B,EAC9B,SAAS,GAET,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAuB,MAAM,oBAAoB,CAAC;AACrE;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,aAA4B;IACvE,OAAO,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC;AACjF,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAAsB;IAC/D,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACtD,MAAM,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,SAAS,CAAC;IAClD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,kGAAkG;QAClG,OAAO,2BAA2B,CACjC,6BAA6B,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAC3D,CAAC;IACH,CAAC;SAAM,CAAC;QACP,wFAAwF;QACxF,IAAI,KAAK,CAAC,gBAAgB,KAAK,gBAAgB,EAAE,CAAC;YACjD,OAAO,2BAA2B,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACzD,CAAC;QACD,kHAAkH;QAClH,OAAO,2BAA2B,CACjC,6BAA6B,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAC3D,CAAC;IACH,CAAC;AACF,CAAC;AAED;;GAEG;AACH,SAAS,6BAA6B,CACrC,UAAsB,EACtB,gBAAwB;IAExB,MAAM,aAAa,GAAG,8BAA8B,CAAC,UAAU,CAAC,CAAC;IACjE,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,iBAAiB,EAAE;QACvC,gBAAgB;QAChB,aAAa;KACb,CAAC,CAAC;IACH,OAAO,aAAa,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,EAAsB,CAAC;AAOlE;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAA2B;IAC7D,IAAI,WAAW,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACvC,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,OAAO;QACN,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY;QACjD,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM;KACzC,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,MAAc;IACvD,IAAI,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;IACpC,IAAI,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QACvB,UAAU,GAAG,CAAC,CAAC;IAChB,CAAC;IACD,IAAI,UAAU,GAAG,CAAC,MAAM,IAAI,UAAU,IAAI,MAAM,EAAE,CAAC;QAClD,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACpB,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;IAClC,CAAC;IACD,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype AnchorNode,\n\ttype DetachedField,\n\tanchorSlot,\n\tgetDetachedFieldContainingPath,\n\trootField,\n\ttype SchemaAndPolicy,\n} from \"../../core/index.js\";\n\nimport { TreeStatus, type FlexTreeEntity } from \"./flexTreeTypes.js\";\n/**\n * Checks the detached field and returns the TreeStatus based on whether or not the detached field is a root field.\n * @param detachedField - the detached field you want to check.\n * @returns the {@link TreeStatus} from the detached field provided.\n */\nexport function treeStatusFromDetachedField(detachedField: DetachedField): TreeStatus {\n\treturn detachedField === rootField ? TreeStatus.InDocument : TreeStatus.Removed;\n}\n\n/**\n * Determines the tree status based on the anchor cache.\n *\n * Checks the anchorNode's cache to get the tree status.\n * If the cache is undefined or stale, it is updated and the treeStatus based on its detachedField is returned.\n *\n * @param anchors - the {@link AnchorSet} to compare your anchorNode cache to.\n * @param anchorNode - the {@link AnchorNode} to get the {@link TreeStatus} of.\n * @returns - the {@link TreeStatus} of the anchorNode provided.\n */\nexport function treeStatusFromAnchorCache(anchorNode: AnchorNode): TreeStatus {\n\tconst cache = anchorNode.slots.get(detachedFieldSlot);\n\tconst { generationNumber } = anchorNode.anchorSet;\n\tif (cache === undefined) {\n\t\t// If the cache is undefined, set the cache and return the treeStatus based on the detached field.\n\t\treturn treeStatusFromDetachedField(\n\t\t\tgetCachedUpdatedDetachedField(anchorNode, generationNumber),\n\t\t);\n\t} else {\n\t\t// If the cache is up to date, return the treeStatus based on the cached detached field.\n\t\tif (cache.generationNumber === generationNumber) {\n\t\t\treturn treeStatusFromDetachedField(cache.detachedField);\n\t\t}\n\t\t// If the cache is not up to date, update the cache and return the treeStatus based on the updated detached field.\n\t\treturn treeStatusFromDetachedField(\n\t\t\tgetCachedUpdatedDetachedField(anchorNode, generationNumber),\n\t\t);\n\t}\n}\n\n/**\n * Updates the anchorNode cache with the provided generation number, and returns its detachedField.\n */\nfunction getCachedUpdatedDetachedField(\n\tanchorNode: AnchorNode,\n\tgenerationNumber: number,\n): DetachedField {\n\tconst detachedField = getDetachedFieldContainingPath(anchorNode);\n\tanchorNode.slots.set(detachedFieldSlot, {\n\t\tgenerationNumber,\n\t\tdetachedField,\n\t});\n\treturn detachedField;\n}\n\nexport const detachedFieldSlot = anchorSlot<DetachedFieldCache>();\n\nexport interface DetachedFieldCache {\n\tgenerationNumber: number;\n\tdetachedField: DetachedField;\n}\n\n/**\n * Utility function to get a {@link SchemaAndPolicy} object from a {@link FlexTreeNode} or {@link FlexTreeField}.\n * @param nodeOrField - {@link FlexTreeNode} or {@link FlexTreeField} to get the schema and policy from.\n * @returns A {@link SchemaAndPolicy} object with the stored schema and policy from the node or field provided.\n * If the schema information is not available on the given node or field (e.g. because it is an unhydrated node), returns `undefined`.\n */\nexport function getSchemaAndPolicy(nodeOrField: FlexTreeEntity): SchemaAndPolicy | undefined {\n\tif (nodeOrField.context === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tschema: nodeOrField.context.checkout.storedSchema,\n\t\tpolicy: nodeOrField.context.schema.policy,\n\t};\n}\n\n/**\n * Indexing for {@link FlexTreeField.boxedAt} and {@link FlexTreeSequenceField.at} supports the\n * usage of negative indices, which regular indexing using `[` and `]` does not.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at\n * for additional context on the semantics.\n *\n * @returns A positive index that can be used in regular indexing. Returns\n * undefined if that index would be out-of-bounds.\n */\nexport function indexForAt(index: number, length: number): number | undefined {\n\tlet finalIndex = Math.trunc(+index);\n\tif (isNaN(finalIndex)) {\n\t\tfinalIndex = 0;\n\t}\n\tif (finalIndex < -length || finalIndex >= length) {\n\t\treturn undefined;\n\t}\n\tif (finalIndex < 0) {\n\t\tfinalIndex = finalIndex + length;\n\t}\n\treturn finalIndex;\n}\n"]}
1
+ {"version":3,"file":"utilities.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/utilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,UAAU,EACV,8BAA8B,EAC9B,SAAS,GAET,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAuB,MAAM,oBAAoB,CAAC;AACrE;;;;GAIG;AACH,MAAM,UAAU,2BAA2B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AAM;KAC7C,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,MAAc;IACvD,IAAI,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;IACpC,IAAI,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QACvB,UAAU,GAAG,CAAC,CAAC;IAChB,CAAC;IACD,IAAI,UAAU,GAAG,CAAC,MAAM,IAAI,UAAU,IAAI,MAAM,EAAE,CAAC;QAClD,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACpB,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;IAClC,CAAC;IACD,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype AnchorNode,\n\ttype DetachedField,\n\tanchorSlot,\n\tgetDetachedFieldContainingPath,\n\trootField,\n\ttype SchemaAndPolicy,\n} from \"../../core/index.js\";\n\nimport { TreeStatus, type FlexTreeEntity } from \"./flexTreeTypes.js\";\n/**\n * Checks the detached field and returns the TreeStatus based on whether or not the detached field is a root field.\n * @param detachedField - the detached field you want to check.\n * @returns the {@link TreeStatus} from the detached field provided.\n */\nexport function treeStatusFromDetachedField(detachedField: DetachedField): TreeStatus {\n\treturn detachedField === rootField ? TreeStatus.InDocument : TreeStatus.Removed;\n}\n\n/**\n * Determines the tree status based on the anchor cache.\n *\n * Checks the anchorNode's cache to get the tree status.\n * If the cache is undefined or stale, it is updated and the treeStatus based on its detachedField is returned.\n *\n * @param anchors - the {@link AnchorSet} to compare your anchorNode cache to.\n * @param anchorNode - the {@link AnchorNode} to get the {@link TreeStatus} of.\n * @returns - the {@link TreeStatus} of the anchorNode provided.\n */\nexport function treeStatusFromAnchorCache(anchorNode: AnchorNode): TreeStatus {\n\tconst cache = anchorNode.slots.get(detachedFieldSlot);\n\tconst { generationNumber } = anchorNode.anchorSet;\n\tif (cache === undefined) {\n\t\t// If the cache is undefined, set the cache and return the treeStatus based on the detached field.\n\t\treturn treeStatusFromDetachedField(\n\t\t\tgetCachedUpdatedDetachedField(anchorNode, generationNumber),\n\t\t);\n\t} else {\n\t\t// If the cache is up to date, return the treeStatus based on the cached detached field.\n\t\tif (cache.generationNumber === generationNumber) {\n\t\t\treturn treeStatusFromDetachedField(cache.detachedField);\n\t\t}\n\t\t// If the cache is not up to date, update the cache and return the treeStatus based on the updated detached field.\n\t\treturn treeStatusFromDetachedField(\n\t\t\tgetCachedUpdatedDetachedField(anchorNode, generationNumber),\n\t\t);\n\t}\n}\n\n/**\n * Updates the anchorNode cache with the provided generation number, and returns its detachedField.\n */\nfunction getCachedUpdatedDetachedField(\n\tanchorNode: AnchorNode,\n\tgenerationNumber: number,\n): DetachedField {\n\tconst detachedField = getDetachedFieldContainingPath(anchorNode);\n\tanchorNode.slots.set(detachedFieldSlot, {\n\t\tgenerationNumber,\n\t\tdetachedField,\n\t});\n\treturn detachedField;\n}\n\nexport const detachedFieldSlot = anchorSlot<DetachedFieldCache>();\n\nexport interface DetachedFieldCache {\n\tgenerationNumber: number;\n\tdetachedField: DetachedField;\n}\n\n/**\n * Utility function to get a {@link SchemaAndPolicy} object from a {@link FlexTreeNode} or {@link FlexTreeField}.\n * @param nodeOrField - {@link FlexTreeNode} or {@link FlexTreeField} to get the schema and policy from.\n * @returns A {@link SchemaAndPolicy} object with the stored schema and policy from the node or field provided.\n * For {@link Unhydrated} nodes this schema may only describe the types allowed subtree for this particular entity.\n */\nexport function getSchemaAndPolicy(nodeOrField: FlexTreeEntity): SchemaAndPolicy {\n\treturn {\n\t\tschema: nodeOrField.context.schema,\n\t\tpolicy: nodeOrField.context.flexSchema.policy,\n\t};\n}\n\n/**\n * Indexing for {@link FlexTreeField.boxedAt} and {@link FlexTreeSequenceField.at} supports the\n * usage of negative indices, which regular indexing using `[` and `]` does not.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at\n * for additional context on the semantics.\n *\n * @returns A positive index that can be used in regular indexing. Returns\n * undefined if that index would be out-of-bounds.\n */\nexport function indexForAt(index: number, length: number): number | undefined {\n\tlet finalIndex = Math.trunc(+index);\n\tif (isNaN(finalIndex)) {\n\t\tfinalIndex = 0;\n\t}\n\tif (finalIndex < -length || finalIndex >= length) {\n\t\treturn undefined;\n\t}\n\tif (finalIndex < 0) {\n\t\tfinalIndex = finalIndex + length;\n\t}\n\treturn finalIndex;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"forestSummarizer.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/forestSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EACX,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,8CAA8C,CAAC;AAGtD,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAIN,KAAK,eAAe,EAGpB,KAAK,gBAAgB,EAMrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACX,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,EACzB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAI7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAMnE;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IASnD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAEjC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAE/B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAb9B,SAAgB,GAAG,YAAY;IAE/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IAEpC;;OAEG;gBAEe,MAAM,EAAE,eAAe,EACvB,gBAAgB,EAAE,gBAAgB,EACnD,eAAe,EAAE,eAAe,EACf,cAAc,EAAE,yBAAyB,EAC1D,OAAO,2BAAkD,EACxC,YAAY,EAAE,aAAa;IAK7C;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;IAqBd,gBAAgB,CACtB,SAAS,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,qBAAqB;IAIX,SAAS,CACrB,SAAS,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,qBAAqB,CAAC;IAI1B,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,sBAAsB;IAU7C,IAAI,CAChB,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,oBAAoB,GACzB,OAAO,CAAC,IAAI,CAAC;CAqChB"}
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,EACX,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,8CAA8C,CAAC;AAGtD,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAIN,KAAK,eAAe,EAGpB,KAAK,gBAAgB,EAMrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACX,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,EACzB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAI7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAMnE;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IASnD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAEjC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAE/B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAb9B,SAAgB,GAAG,YAAY;IAE/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IAEpC;;OAEG;gBAEe,MAAM,EAAE,eAAe,EACvB,gBAAgB,EAAE,gBAAgB,EACnD,eAAe,EAAE,eAAe,EACf,cAAc,EAAE,yBAAyB,EAC1D,OAAO,2BAAkD,EACxC,YAAY,EAAE,aAAa;IAK7C;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;IAqBd,gBAAgB,CACtB,SAAS,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,qBAAqB;IAIX,SAAS,CACrB,SAAS,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,qBAAqB,CAAC;IAI1B,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,sBAAsB;IAU7C,IAAI,CAChB,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,oBAAoB,GACzB,OAAO,CAAC,IAAI,CAAC;CAwChB"}
@@ -78,7 +78,10 @@ export class ForestSummarizer {
78
78
  const fieldChanges = [];
79
79
  const build = [];
80
80
  for (const [fieldKey, field] of fields) {
81
- const chunked = chunkField(field, defaultChunkPolicy);
81
+ const chunked = chunkField(field, {
82
+ policy: defaultChunkPolicy,
83
+ idCompressor: this.idCompressor,
84
+ });
82
85
  const nodeCursors = chunked.flatMap((chunk) => mapCursorField(chunk.cursor(), (cursor) => cursor.fork()));
83
86
  const buildId = { minor: allocator.allocate(nodeCursors.length) };
84
87
  build.push({
@@ -1 +1 @@
1
- {"version":3,"file":"forestSummarizer.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/forestSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAO7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAEtF,OAAO,EAAsB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EASN,UAAU,EACV,YAAY,EACZ,sBAAsB,EACtB,cAAc,GACd,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,sDAAsD;AACtD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGhF,OAAO,EAAoB,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAGzE;;GAEG;AACH,MAAM,WAAW,GAAG,YAAY,CAAC;AAEjC;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAK5B;;OAEG;IACH,YACkB,MAAuB,EACvB,gBAAkC,EACnD,eAAgC,EACf,cAAyC,EAC1D,UAAyB,EAAE,aAAa,EAAE,aAAa,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,yBAAyB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAClE,CA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AC,IAAI,CAAC;oBACjB,QAAQ;oBACR;wBACC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;qBACvD;iBACD,CAAC,CAAC;YACJ,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAC;YAC9D,UAAU,CACT,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,YAAY,CAAC,EAAE,EACxC,SAAS,EACT,IAAI,CAAC,MAAM,EACX,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,CACxE,CAAC;QACH,CAAC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIGarbageCollectionData,\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\tmapCursorField,\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 { chunkField, 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\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\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 getGCData(fullGC?: boolean): IGarbageCollectionData {\n\t\t// TODO: Properly implement garbage collection. Right now, garbage collection is performed automatically\n\t\t// by the code in SharedObject (from which SharedTreeCore extends). The `runtime.uploadBlob` API delegates\n\t\t// to the `BlobManager`, which automatically populates the summary with ISummaryAttachment entries for each\n\t\t// blob.\n\t\treturn {\n\t\t\tgcNodes: {},\n\t\t};\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 = chunkField(field, defaultChunkPolicy);\n\t\t\t\tconst nodeCursors = chunked.flatMap((chunk) =>\n\t\t\t\t\tmapCursorField(chunk.cursor(), (cursor) => cursor.fork()),\n\t\t\t\t);\n\t\t\t\tconst buildId = { minor: allocator.allocate(nodeCursors.length) };\n\t\t\t\tbuild.push({\n\t\t\t\t\tid: buildId,\n\t\t\t\t\ttrees: nodeCursors,\n\t\t\t\t});\n\t\t\t\tfieldChanges.push([\n\t\t\t\t\tfieldKey,\n\t\t\t\t\t{\n\t\t\t\t\t\tlocal: [{ count: nodeCursors.length, attach: buildId }],\n\t\t\t\t\t},\n\t\t\t\t]);\n\t\t\t}\n\n\t\t\tassert(this.forest.isEmpty, 0x797 /* forest must be empty */);\n\t\t\tapplyDelta(\n\t\t\t\t{ build, fields: new Map(fieldChanges) },\n\t\t\t\tundefined,\n\t\t\t\tthis.forest,\n\t\t\t\tmakeDetachedFieldIndex(\"init\", this.revisionTagCodec, this.idCompressor),\n\t\t\t);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"forestSummarizer.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/forestSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAO7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAEtF,OAAO,EAAsB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EASN,UAAU,EACV,YAAY,EACZ,sBAAsB,EACtB,cAAc,GACd,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,sDAAsD;AACtD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM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AM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,CAAC;gBACxC,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE;oBACjC,MAAM,EAAE,kBAAkB;oBAC1B,YAAY,EAAE,IAAI,CAAC,YAAY;iBAC/B,CAAC,CAAC;gBACH,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAC7C,cAAc,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CACzD,CAAC;gBACF,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;gBAClE,KAAK,CAAC,IAAI,CAAC;oBACV,EAAE,EAAE,OAAO;oBACX,KAAK,EAAE,WAAW;iBAClB,CAAC,CAAC;gBACH,YAAY,CAAC,IAAI,CAAC;oBACjB,QAAQ;oBACR;wBACC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;qBACvD;iBACD,CAAC,CAAC;YACJ,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAC;YAC9D,UAAU,CACT,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,YAAY,CAAC,EAAE,EACxC,SAAS,EACT,IAAI,CAAC,MAAM,EACX,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,CACxE,CAAC;QACH,CAAC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIGarbageCollectionData,\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\tmapCursorField,\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 { chunkField, 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\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\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 getGCData(fullGC?: boolean): IGarbageCollectionData {\n\t\t// TODO: Properly implement garbage collection. Right now, garbage collection is performed automatically\n\t\t// by the code in SharedObject (from which SharedTreeCore extends). The `runtime.uploadBlob` API delegates\n\t\t// to the `BlobManager`, which automatically populates the summary with ISummaryAttachment entries for each\n\t\t// blob.\n\t\treturn {\n\t\t\tgcNodes: {},\n\t\t};\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 = chunkField(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 nodeCursors = chunked.flatMap((chunk) =>\n\t\t\t\t\tmapCursorField(chunk.cursor(), (cursor) => cursor.fork()),\n\t\t\t\t);\n\t\t\t\tconst buildId = { minor: allocator.allocate(nodeCursors.length) };\n\t\t\t\tbuild.push({\n\t\t\t\t\tid: buildId,\n\t\t\t\t\ttrees: nodeCursors,\n\t\t\t\t});\n\t\t\t\tfieldChanges.push([\n\t\t\t\t\tfieldKey,\n\t\t\t\t\t{\n\t\t\t\t\t\tlocal: [{ count: nodeCursors.length, attach: buildId }],\n\t\t\t\t\t},\n\t\t\t\t]);\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"]}
@@ -15,19 +15,17 @@ export { cursorForJsonableTreeNode, cursorForJsonableTreeField, jsonableTreeFrom
15
15
  import * as SequenceField from "./sequence-field/index.js";
16
16
  export { SequenceField };
17
17
  export { isNeverField, ModularEditBuilder, type FieldEditDescription as EditDescription, type FieldChangeHandler, type FieldChangeRebaser, type FieldEditor, type FieldChangeMap, type FieldChange, type FieldChangeset, type ToDelta, type ModularChangeset, makeModularChangeCodecFamily, type NodeChangeComposer, type NodeChangeInverter, type NodeChangeRebaser, type NodeChangePruner, type CrossFieldManager, CrossFieldTarget, FlexFieldKind, type FullSchemaPolicy, allowsRepoSuperset, type GenericChangeset, genericFieldKind, type HasFieldChanges, type NodeExistsConstraint, FieldKindWithEditor, ModularChangeFamily, type RelevantRemovedRootsFromChild, EncodedModularChangeset, updateRefreshers, type NodeId, type FieldChangeEncodingContext, type FieldKindConfiguration, type FieldKindConfigurationEntry, getAllowedContentIncompatibilities, isRepoSuperset, } from "./modular-schema/index.js";
18
- export { type FlexTreeNodeSchema, type FlexAllowedTypes, FlexFieldSchema, type FlexTreeSchema, Any, type SchemaLibraryData, type LazyTreeNodeSchema, ViewSchema, type SchemaLintConfiguration, LeafNodeSchema, FlexMapNodeSchema, FlexObjectNodeSchema, schemaIsLeaf, schemaIsMap, schemaIsObjectNode, type Unenforced, type AllowedTypeSet, markEager, type FlexMapFieldSchema, type SchemaCollection, TreeNodeSchemaBase, type LazyItem, type FlexListToUnion, type ExtractItemType, isLazy, type NormalizeObjectNodeFields, type NormalizeField as NormalizeFieldSchema, type FlexObjectNodeFields, intoStoredSchema, intoStoredSchemaCollection, type NormalizeLazyItem, type FlexList, } from "./typed-schema/index.js";
19
- export { SchemaBuilderBase, type SchemaLibrary, type FlexImplicitFieldSchema, type NormalizeField, type FlexImplicitAllowedTypes, type NormalizeAllowedTypes, type SchemaBuilderOptions, normalizeAllowedTypes, normalizeField, } from "./schemaBuilderBase.js";
20
- export { SchemaBuilderInternal } from "./schemaBuilder.js";
18
+ export { type FlexTreeNodeSchema, type FlexAllowedTypes, FlexFieldSchema, type FlexTreeSchema, type SchemaLibraryData, type LazyTreeNodeSchema, ViewSchema, type SchemaLintConfiguration, LeafNodeSchema, FlexMapNodeSchema, FlexObjectNodeSchema, schemaIsLeaf, schemaIsMap, schemaIsObjectNode, type Unenforced, type AllowedTypeSet, markEager, type FlexMapFieldSchema, type SchemaCollection, TreeNodeSchemaBase, type LazyItem, type FlexListToUnion, type ExtractItemType, isLazy, type FlexObjectNodeFields, intoStoredSchema, intoStoredSchemaCollection, type NormalizeLazyItem, type FlexList, } from "./typed-schema/index.js";
21
19
  export { mapRootChanges } from "./deltaUtils.js";
22
20
  export { type TreeChunk, chunkTree, chunkFieldSingle, buildChunkedForest, defaultChunkPolicy, type FieldBatch, type FieldBatchCodec, makeTreeChunker, makeFieldBatchCodec, type FieldBatchEncodingContext, } from "./chunked-forest/index.js";
23
21
  export { compareLocalNodeKeys, createNodeKeyManager, isStableNodeKey, type LocalNodeKey, MockNodeKeyManager, type NodeKeyManager, nodeKeyTreeIdentifier, type StableNodeKey, } from "./node-key/index.js";
24
22
  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, SchemaValidationErrors, isNodeInSchema, isFieldInSchema, } from "./default-schema/index.js";
25
- export { type AssignableFieldKinds, type FlexibleFieldContent, type FlexibleNodeContent, type FlexTreeLeafNode, type FlexTreeMapNode, type FlexTreeOptionalField, type FlexTreeRequiredField, type FlexTreeSequenceField, Skip, type FlexTreeObjectNode, type FlexTreeContext, type FlexTreeTypedField, type FlexTreeTypedNode, type FlexTreeTypedNodeUnion, type FlexTreeEntity, type FlexTreeField, type FlexTreeNode, getTreeContext, type CheckTypesOverlap, TreeStatus, Context, type FlexTreeNodeEvents, type FlexTreeUnknownUnboxed, isFlexTreeNode, ContextSlot, type FlexTreeUnboxField, flexTreeMarker, FlexTreeEntityKind, assertFlexTreeEntityNotFreed, flexTreeSlot, getSchemaAndPolicy, isFreedSymbol, LazyEntity, treeStatusFromAnchorCache, } from "./flex-tree/index.js";
23
+ export { type FlexTreeOptionalField, type FlexTreeRequiredField, type FlexTreeSequenceField, Skip, type FlexTreeContext, type FlexTreeHydratedContext, type FlexTreeTypedField, type FlexTreeEntity, type FlexTreeField, type FlexTreeNode, getTreeContext, TreeStatus, Context, type FlexTreeNodeEvents, type FlexTreeUnknownUnboxed, isFlexTreeNode, ContextSlot, flexTreeMarker, assertFlexTreeEntityNotFreed, flexTreeSlot, getSchemaAndPolicy, isFreedSymbol, LazyEntity, treeStatusFromAnchorCache, } from "./flex-tree/index.js";
26
24
  export { treeSchemaFromStoredSchema } from "./storedToViewSchema.js";
27
25
  export { TreeCompressionStrategy } from "./treeCompressionUtils.js";
28
26
  export { valueSchemaAllows } from "./valueUtilities.js";
29
27
  export { DetachedFieldIndexSummarizer } from "./detachedFieldIndexSummarizer.js";
30
28
  export { type SchemaChange, makeSchemaChangeCodecs, EncodedSchemaChange, } from "./schema-edits/index.js";
31
29
  export { makeMitigatedChangeFamily } from "./mitigatedChangeFamily.js";
32
- export { type MapTreeNode, type MapTreeSequenceField, isMapTreeNode, isMapTreeSequenceField, getOrCreateMapTreeNode, tryGetMapTreeNode, } from "./flex-map-tree/index.js";
30
+ export { type MapTreeNode, type MapTreeSequenceField, isMapTreeNode, isMapTreeSequenceField, getOrCreateMapTreeNode, tryGetMapTreeNode, UnhydratedContext, } from "./flex-map-tree/index.js";
33
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
-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,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,cAAc,EACd,UAAU,EACV,OAAO,EACP,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,cAAc,EACd,WAAW,EAEX,cAAc,EACd,4BAA4B,EAC5B,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,yBAAyB,GACzB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAErE,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,WAAW,EAChB,KAAK,oBAAoB,EACzB,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,0BAA0B,CAAC"}
@@ -15,19 +15,19 @@ export { cursorForJsonableTreeNode, cursorForJsonableTreeField, jsonableTreeFrom
15
15
  import * as SequenceField from "./sequence-field/index.js";
16
16
  export { SequenceField };
17
17
  export { isNeverField, ModularEditBuilder, makeModularChangeCodecFamily, CrossFieldTarget, FlexFieldKind, allowsRepoSuperset, genericFieldKind, FieldKindWithEditor, ModularChangeFamily, EncodedModularChangeset, updateRefreshers, getAllowedContentIncompatibilities, isRepoSuperset, } from "./modular-schema/index.js";
18
- export { FlexFieldSchema, Any, ViewSchema, LeafNodeSchema, FlexMapNodeSchema, FlexObjectNodeSchema, schemaIsLeaf, schemaIsMap, schemaIsObjectNode, markEager, TreeNodeSchemaBase, isLazy, intoStoredSchema, intoStoredSchemaCollection, } from "./typed-schema/index.js";
19
- export { SchemaBuilderBase, normalizeAllowedTypes, normalizeField, } from "./schemaBuilderBase.js";
20
- export { SchemaBuilderInternal } from "./schemaBuilder.js";
18
+ export { FlexFieldSchema, ViewSchema, LeafNodeSchema, FlexMapNodeSchema, FlexObjectNodeSchema, schemaIsLeaf, schemaIsMap, schemaIsObjectNode, markEager, TreeNodeSchemaBase, isLazy, intoStoredSchema, intoStoredSchemaCollection, } from "./typed-schema/index.js";
21
19
  export { mapRootChanges } from "./deltaUtils.js";
22
20
  export { chunkTree, chunkFieldSingle, buildChunkedForest, defaultChunkPolicy, makeTreeChunker, makeFieldBatchCodec, } from "./chunked-forest/index.js";
23
21
  export { compareLocalNodeKeys, createNodeKeyManager, isStableNodeKey, MockNodeKeyManager, nodeKeyTreeIdentifier, } from "./node-key/index.js";
24
22
  export { FieldKinds, DefaultChangeFamily, DefaultEditBuilder, defaultSchemaPolicy, fieldKinds, fieldKindConfigurations, intoDelta, relevantRemovedRoots, SchemaValidationErrors, isNodeInSchema, isFieldInSchema, } from "./default-schema/index.js";
25
- export { Skip, getTreeContext, TreeStatus, Context, isFlexTreeNode, ContextSlot, flexTreeMarker, FlexTreeEntityKind, assertFlexTreeEntityNotFreed, flexTreeSlot, getSchemaAndPolicy, isFreedSymbol, LazyEntity, treeStatusFromAnchorCache, } from "./flex-tree/index.js";
23
+ export { Skip, getTreeContext, TreeStatus, Context, isFlexTreeNode, ContextSlot,
24
+ // Internal
25
+ flexTreeMarker, assertFlexTreeEntityNotFreed, flexTreeSlot, getSchemaAndPolicy, isFreedSymbol, LazyEntity, treeStatusFromAnchorCache, } from "./flex-tree/index.js";
26
26
  export { treeSchemaFromStoredSchema } from "./storedToViewSchema.js";
27
27
  export { TreeCompressionStrategy } from "./treeCompressionUtils.js";
28
28
  export { valueSchemaAllows } from "./valueUtilities.js";
29
29
  export { DetachedFieldIndexSummarizer } from "./detachedFieldIndexSummarizer.js";
30
30
  export { makeSchemaChangeCodecs, EncodedSchemaChange, } from "./schema-edits/index.js";
31
31
  export { makeMitigatedChangeFamily } from "./mitigatedChangeFamily.js";
32
- export { isMapTreeNode, isMapTreeSequenceField, getOrCreateMapTreeNode, tryGetMapTreeNode, } from "./flex-map-tree/index.js";
32
+ export { isMapTreeNode, isMapTreeSequenceField, getOrCreateMapTreeNode, tryGetMapTreeNode, UnhydratedContext, } from "./flex-map-tree/index.js";
33
33
  //# sourceMappingURL=index.js.map