@fluidframework/tree 2.1.0-276985 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (583) hide show
  1. package/.eslintrc.cjs +7 -0
  2. package/.vscode/Tree.code-workspace +9 -2
  3. package/CHANGELOG.md +38 -0
  4. package/README.md +55 -12
  5. package/api-report/tree.alpha.api.md +2 -1
  6. package/api-report/tree.beta.api.md +2 -1
  7. package/api-report/tree.public.api.md +2 -1
  8. package/beta.d.ts +1 -1
  9. package/dist/beta.d.ts +1 -1
  10. package/dist/core/forest/editableForest.d.ts +6 -3
  11. package/dist/core/forest/editableForest.d.ts.map +1 -1
  12. package/dist/core/forest/editableForest.js +16 -4
  13. package/dist/core/forest/editableForest.js.map +1 -1
  14. package/dist/core/index.d.ts +1 -1
  15. package/dist/core/index.d.ts.map +1 -1
  16. package/dist/core/index.js +3 -1
  17. package/dist/core/index.js.map +1 -1
  18. package/dist/core/rebase/index.d.ts +1 -1
  19. package/dist/core/rebase/index.d.ts.map +1 -1
  20. package/dist/core/rebase/index.js +3 -1
  21. package/dist/core/rebase/index.js.map +1 -1
  22. package/dist/core/rebase/types.d.ts +2 -0
  23. package/dist/core/rebase/types.d.ts.map +1 -1
  24. package/dist/core/rebase/types.js +9 -1
  25. package/dist/core/rebase/types.js.map +1 -1
  26. package/dist/core/tree/anchorSet.d.ts +1 -0
  27. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  28. package/dist/core/tree/anchorSet.js +13 -0
  29. package/dist/core/tree/anchorSet.js.map +1 -1
  30. package/dist/core/tree/detachedFieldIndex.d.ts +48 -11
  31. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  32. package/dist/core/tree/detachedFieldIndex.js +144 -20
  33. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  34. package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  35. package/dist/core/tree/detachedFieldIndexCodec.js +13 -4
  36. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  37. package/dist/core/tree/detachedFieldIndexFormat.d.ts +1 -1
  38. package/dist/core/tree/detachedFieldIndexFormat.d.ts.map +1 -1
  39. package/dist/core/tree/detachedFieldIndexFormat.js.map +1 -1
  40. package/dist/core/tree/detachedFieldIndexTypes.d.ts +39 -4
  41. package/dist/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  42. package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
  43. package/dist/core/tree/index.d.ts +2 -1
  44. package/dist/core/tree/index.d.ts.map +1 -1
  45. package/dist/core/tree/index.js.map +1 -1
  46. package/dist/core/tree/visitDelta.d.ts +3 -1
  47. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  48. package/dist/core/tree/visitDelta.js +31 -15
  49. package/dist/core/tree/visitDelta.js.map +1 -1
  50. package/dist/core/tree/visitorUtils.d.ts +3 -3
  51. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  52. package/dist/core/tree/visitorUtils.js +4 -4
  53. package/dist/core/tree/visitorUtils.js.map +1 -1
  54. package/dist/events/events.d.ts +4 -1
  55. package/dist/events/events.d.ts.map +1 -1
  56. package/dist/events/events.js.map +1 -1
  57. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +1 -1
  58. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  59. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  60. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -0
  61. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  62. package/dist/feature-libraries/editableTreeBinder.js +1 -1
  63. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  64. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +1 -10
  65. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  66. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +0 -72
  67. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  68. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +1 -51
  69. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  70. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +0 -2
  71. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  72. package/dist/feature-libraries/flex-tree/index.d.ts +3 -2
  73. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  74. package/dist/feature-libraries/flex-tree/index.js +5 -1
  75. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  76. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +1 -2
  77. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  78. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  79. package/dist/feature-libraries/flex-tree/lazyField.d.ts +1 -6
  80. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  81. package/dist/feature-libraries/flex-tree/lazyField.js +11 -32
  82. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  83. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +1 -5
  84. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  85. package/dist/feature-libraries/flex-tree/lazyNode.js +0 -30
  86. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  87. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  88. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  89. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  90. package/dist/feature-libraries/index.d.ts +3 -3
  91. package/dist/feature-libraries/index.d.ts.map +1 -1
  92. package/dist/feature-libraries/index.js +6 -3
  93. package/dist/feature-libraries/index.js.map +1 -1
  94. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +11 -0
  95. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  96. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  97. package/dist/feature-libraries/modular-schema/discrepancies.d.ts +96 -0
  98. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -0
  99. package/dist/feature-libraries/modular-schema/discrepancies.js +264 -0
  100. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -0
  101. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -2
  102. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  103. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  104. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  105. package/dist/feature-libraries/modular-schema/genericFieldKind.js +3 -0
  106. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  107. package/dist/feature-libraries/modular-schema/index.d.ts +2 -1
  108. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  109. package/dist/feature-libraries/modular-schema/index.js +3 -1
  110. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  111. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  112. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +42 -26
  113. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  114. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +51 -2
  115. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  116. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +827 -245
  117. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  118. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  119. package/dist/feature-libraries/modular-schema/modularChangeFormat.js +2 -0
  120. package/dist/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -1
  121. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +44 -1
  122. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  123. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  124. package/dist/feature-libraries/node-key/index.d.ts +0 -1
  125. package/dist/feature-libraries/node-key/index.d.ts.map +1 -1
  126. package/dist/feature-libraries/node-key/index.js +1 -3
  127. package/dist/feature-libraries/node-key/index.js.map +1 -1
  128. package/dist/feature-libraries/object-forest/objectForest.d.ts +3 -2
  129. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  130. package/dist/feature-libraries/object-forest/objectForest.js +5 -4
  131. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  132. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  133. package/dist/feature-libraries/optional-field/optionalField.js +1 -0
  134. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  135. package/dist/feature-libraries/sequence-field/index.d.ts +1 -1
  136. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  137. package/dist/feature-libraries/sequence-field/index.js +1 -2
  138. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  139. package/dist/feature-libraries/sequence-field/invert.js +1 -1
  140. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  141. package/dist/feature-libraries/sequence-field/rebase.js +6 -1
  142. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  143. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  144. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +1 -0
  145. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  146. package/dist/feature-libraries/sequence-field/utils.d.ts +2 -17
  147. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  148. package/dist/feature-libraries/sequence-field/utils.js +31 -39
  149. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  150. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +1 -0
  151. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  152. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +2 -0
  153. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  154. package/dist/index.d.ts +1 -1
  155. package/dist/index.d.ts.map +1 -1
  156. package/dist/index.js.map +1 -1
  157. package/dist/packageVersion.d.ts +1 -1
  158. package/dist/packageVersion.d.ts.map +1 -1
  159. package/dist/packageVersion.js +1 -1
  160. package/dist/packageVersion.js.map +1 -1
  161. package/dist/public.d.ts +1 -1
  162. package/dist/shared-tree/schematizingTreeView.d.ts +4 -2
  163. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  164. package/dist/shared-tree/schematizingTreeView.js +240 -184
  165. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  166. package/dist/shared-tree/sharedTree.d.ts +5 -1
  167. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  168. package/dist/shared-tree/sharedTree.js +157 -90
  169. package/dist/shared-tree/sharedTree.js.map +1 -1
  170. package/dist/shared-tree/sharedTreeChangeEnricher.js +1 -1
  171. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  172. package/dist/shared-tree/treeApi.js +1 -1
  173. package/dist/shared-tree/treeApi.js.map +1 -1
  174. package/dist/shared-tree/treeCheckout.d.ts +10 -1
  175. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  176. package/dist/shared-tree/treeCheckout.js +47 -3
  177. package/dist/shared-tree/treeCheckout.js.map +1 -1
  178. package/dist/shared-tree/treeView.d.ts.map +1 -1
  179. package/dist/shared-tree/treeView.js +7 -3
  180. package/dist/shared-tree/treeView.js.map +1 -1
  181. package/dist/shared-tree-core/branch.d.ts +6 -0
  182. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  183. package/dist/shared-tree-core/branch.js +3 -0
  184. package/dist/shared-tree-core/branch.js.map +1 -1
  185. package/dist/shared-tree-core/sharedTreeCore.d.ts +8 -6
  186. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  187. package/dist/shared-tree-core/sharedTreeCore.js +271 -209
  188. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  189. package/dist/simple-tree/arrayNode.d.ts +4 -0
  190. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  191. package/dist/simple-tree/arrayNode.js +36 -19
  192. package/dist/simple-tree/arrayNode.js.map +1 -1
  193. package/dist/simple-tree/index.d.ts +3 -3
  194. package/dist/simple-tree/index.d.ts.map +1 -1
  195. package/dist/simple-tree/index.js +2 -1
  196. package/dist/simple-tree/index.js.map +1 -1
  197. package/dist/simple-tree/leafNodeSchema.d.ts +22 -1
  198. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  199. package/dist/simple-tree/leafNodeSchema.js +2 -1
  200. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  201. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  202. package/dist/simple-tree/mapNode.js.map +1 -1
  203. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  204. package/dist/simple-tree/objectNode.js +2 -1
  205. package/dist/simple-tree/objectNode.js.map +1 -1
  206. package/dist/simple-tree/proxies.d.ts.map +1 -1
  207. package/dist/simple-tree/proxies.js +9 -25
  208. package/dist/simple-tree/proxies.js.map +1 -1
  209. package/dist/simple-tree/proxyBinding.d.ts +4 -0
  210. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  211. package/dist/simple-tree/proxyBinding.js +23 -1
  212. package/dist/simple-tree/proxyBinding.js.map +1 -1
  213. package/dist/simple-tree/schemaFactory.d.ts +16 -1
  214. package/dist/simple-tree/schemaFactory.d.ts.map +1 -1
  215. package/dist/simple-tree/schemaFactory.js +32 -4
  216. package/dist/simple-tree/schemaFactory.js.map +1 -1
  217. package/dist/simple-tree/schemaTypes.d.ts +36 -1
  218. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  219. package/dist/simple-tree/schemaTypes.js.map +1 -1
  220. package/dist/simple-tree/toFlexSchema.d.ts +2 -2
  221. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  222. package/dist/simple-tree/toFlexSchema.js +3 -2
  223. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  224. package/dist/simple-tree/tree.d.ts +4 -1
  225. package/dist/simple-tree/tree.d.ts.map +1 -1
  226. package/dist/simple-tree/tree.js +48 -1
  227. package/dist/simple-tree/tree.js.map +1 -1
  228. package/dist/simple-tree/treeNodeApi.d.ts +2 -75
  229. package/dist/simple-tree/treeNodeApi.d.ts.map +1 -1
  230. package/dist/simple-tree/treeNodeApi.js +17 -25
  231. package/dist/simple-tree/treeNodeApi.js.map +1 -1
  232. package/dist/simple-tree/treeNodeKernel.d.ts +26 -0
  233. package/dist/simple-tree/treeNodeKernel.d.ts.map +1 -0
  234. package/dist/simple-tree/treeNodeKernel.js +83 -0
  235. package/dist/simple-tree/treeNodeKernel.js.map +1 -0
  236. package/dist/simple-tree/types.d.ts +95 -3
  237. package/dist/simple-tree/types.d.ts.map +1 -1
  238. package/dist/simple-tree/types.js +120 -21
  239. package/dist/simple-tree/types.js.map +1 -1
  240. package/dist/util/breakable.d.ts +83 -0
  241. package/dist/util/breakable.d.ts.map +1 -0
  242. package/dist/util/breakable.js +178 -0
  243. package/dist/util/breakable.js.map +1 -0
  244. package/dist/util/index.d.ts +3 -2
  245. package/dist/util/index.d.ts.map +1 -1
  246. package/dist/util/index.js +9 -2
  247. package/dist/util/index.js.map +1 -1
  248. package/dist/util/nestedMap.d.ts +17 -3
  249. package/dist/util/nestedMap.d.ts.map +1 -1
  250. package/dist/util/nestedMap.js +21 -1
  251. package/dist/util/nestedMap.js.map +1 -1
  252. package/dist/util/utils.d.ts +7 -0
  253. package/dist/util/utils.d.ts.map +1 -1
  254. package/dist/util/utils.js +15 -1
  255. package/dist/util/utils.js.map +1 -1
  256. package/internal.d.ts +1 -1
  257. package/lib/beta.d.ts +1 -1
  258. package/lib/core/forest/editableForest.d.ts +6 -3
  259. package/lib/core/forest/editableForest.d.ts.map +1 -1
  260. package/lib/core/forest/editableForest.js +17 -5
  261. package/lib/core/forest/editableForest.js.map +1 -1
  262. package/lib/core/index.d.ts +1 -1
  263. package/lib/core/index.d.ts.map +1 -1
  264. package/lib/core/index.js +1 -1
  265. package/lib/core/index.js.map +1 -1
  266. package/lib/core/rebase/index.d.ts +1 -1
  267. package/lib/core/rebase/index.d.ts.map +1 -1
  268. package/lib/core/rebase/index.js +1 -1
  269. package/lib/core/rebase/index.js.map +1 -1
  270. package/lib/core/rebase/types.d.ts +2 -0
  271. package/lib/core/rebase/types.d.ts.map +1 -1
  272. package/lib/core/rebase/types.js +7 -1
  273. package/lib/core/rebase/types.js.map +1 -1
  274. package/lib/core/tree/anchorSet.d.ts +1 -0
  275. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  276. package/lib/core/tree/anchorSet.js +13 -0
  277. package/lib/core/tree/anchorSet.js.map +1 -1
  278. package/lib/core/tree/detachedFieldIndex.d.ts +48 -11
  279. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  280. package/lib/core/tree/detachedFieldIndex.js +145 -21
  281. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  282. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  283. package/lib/core/tree/detachedFieldIndexCodec.js +13 -4
  284. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  285. package/lib/core/tree/detachedFieldIndexFormat.d.ts +1 -1
  286. package/lib/core/tree/detachedFieldIndexFormat.d.ts.map +1 -1
  287. package/lib/core/tree/detachedFieldIndexFormat.js.map +1 -1
  288. package/lib/core/tree/detachedFieldIndexTypes.d.ts +39 -4
  289. package/lib/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  290. package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
  291. package/lib/core/tree/index.d.ts +2 -1
  292. package/lib/core/tree/index.d.ts.map +1 -1
  293. package/lib/core/tree/index.js.map +1 -1
  294. package/lib/core/tree/visitDelta.d.ts +3 -1
  295. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  296. package/lib/core/tree/visitDelta.js +31 -15
  297. package/lib/core/tree/visitDelta.js.map +1 -1
  298. package/lib/core/tree/visitorUtils.d.ts +3 -3
  299. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  300. package/lib/core/tree/visitorUtils.js +4 -4
  301. package/lib/core/tree/visitorUtils.js.map +1 -1
  302. package/lib/events/events.d.ts +4 -1
  303. package/lib/events/events.d.ts.map +1 -1
  304. package/lib/events/events.js.map +1 -1
  305. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +1 -1
  306. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  307. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  308. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -0
  309. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  310. package/lib/feature-libraries/editableTreeBinder.js +1 -1
  311. package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
  312. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +1 -10
  313. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  314. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +2 -74
  315. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  316. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +1 -51
  317. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  318. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +0 -2
  319. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  320. package/lib/feature-libraries/flex-tree/index.d.ts +3 -2
  321. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  322. package/lib/feature-libraries/flex-tree/index.js +2 -1
  323. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  324. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +1 -2
  325. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  326. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  327. package/lib/feature-libraries/flex-tree/lazyField.d.ts +1 -6
  328. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  329. package/lib/feature-libraries/flex-tree/lazyField.js +13 -34
  330. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  331. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +1 -5
  332. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  333. package/lib/feature-libraries/flex-tree/lazyNode.js +3 -33
  334. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  335. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  336. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  337. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  338. package/lib/feature-libraries/index.d.ts +3 -3
  339. package/lib/feature-libraries/index.d.ts.map +1 -1
  340. package/lib/feature-libraries/index.js +3 -3
  341. package/lib/feature-libraries/index.js.map +1 -1
  342. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +11 -0
  343. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  344. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  345. package/lib/feature-libraries/modular-schema/discrepancies.d.ts +96 -0
  346. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -0
  347. package/lib/feature-libraries/modular-schema/discrepancies.js +260 -0
  348. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -0
  349. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -2
  350. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  351. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  352. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  353. package/lib/feature-libraries/modular-schema/genericFieldKind.js +3 -0
  354. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  355. package/lib/feature-libraries/modular-schema/index.d.ts +2 -1
  356. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  357. package/lib/feature-libraries/modular-schema/index.js +1 -0
  358. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  359. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  360. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +42 -26
  361. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  362. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +51 -2
  363. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  364. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +826 -247
  365. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  366. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  367. package/lib/feature-libraries/modular-schema/modularChangeFormat.js +2 -0
  368. package/lib/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -1
  369. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +44 -1
  370. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  371. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  372. package/lib/feature-libraries/node-key/index.d.ts +0 -1
  373. package/lib/feature-libraries/node-key/index.d.ts.map +1 -1
  374. package/lib/feature-libraries/node-key/index.js +0 -1
  375. package/lib/feature-libraries/node-key/index.js.map +1 -1
  376. package/lib/feature-libraries/object-forest/objectForest.d.ts +3 -2
  377. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  378. package/lib/feature-libraries/object-forest/objectForest.js +5 -4
  379. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  380. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  381. package/lib/feature-libraries/optional-field/optionalField.js +1 -0
  382. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  383. package/lib/feature-libraries/sequence-field/index.d.ts +1 -1
  384. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  385. package/lib/feature-libraries/sequence-field/index.js +1 -1
  386. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  387. package/lib/feature-libraries/sequence-field/invert.js +1 -1
  388. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  389. package/lib/feature-libraries/sequence-field/rebase.js +6 -1
  390. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  391. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  392. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +2 -1
  393. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  394. package/lib/feature-libraries/sequence-field/utils.d.ts +2 -17
  395. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  396. package/lib/feature-libraries/sequence-field/utils.js +31 -39
  397. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  398. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +1 -0
  399. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  400. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +4 -2
  401. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  402. package/lib/index.d.ts +1 -1
  403. package/lib/index.d.ts.map +1 -1
  404. package/lib/index.js.map +1 -1
  405. package/lib/packageVersion.d.ts +1 -1
  406. package/lib/packageVersion.d.ts.map +1 -1
  407. package/lib/packageVersion.js +1 -1
  408. package/lib/packageVersion.js.map +1 -1
  409. package/lib/public.d.ts +1 -1
  410. package/lib/shared-tree/schematizingTreeView.d.ts +4 -2
  411. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  412. package/lib/shared-tree/schematizingTreeView.js +242 -185
  413. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  414. package/lib/shared-tree/sharedTree.d.ts +5 -1
  415. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  416. package/lib/shared-tree/sharedTree.js +158 -90
  417. package/lib/shared-tree/sharedTree.js.map +1 -1
  418. package/lib/shared-tree/sharedTreeChangeEnricher.js +1 -1
  419. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  420. package/lib/shared-tree/treeApi.js +1 -1
  421. package/lib/shared-tree/treeApi.js.map +1 -1
  422. package/lib/shared-tree/treeCheckout.d.ts +10 -1
  423. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  424. package/lib/shared-tree/treeCheckout.js +47 -3
  425. package/lib/shared-tree/treeCheckout.js.map +1 -1
  426. package/lib/shared-tree/treeView.d.ts.map +1 -1
  427. package/lib/shared-tree/treeView.js +4 -0
  428. package/lib/shared-tree/treeView.js.map +1 -1
  429. package/lib/shared-tree-core/branch.d.ts +6 -0
  430. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  431. package/lib/shared-tree-core/branch.js +3 -0
  432. package/lib/shared-tree-core/branch.js.map +1 -1
  433. package/lib/shared-tree-core/sharedTreeCore.d.ts +8 -6
  434. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  435. package/lib/shared-tree-core/sharedTreeCore.js +273 -210
  436. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  437. package/lib/simple-tree/arrayNode.d.ts +4 -0
  438. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  439. package/lib/simple-tree/arrayNode.js +39 -22
  440. package/lib/simple-tree/arrayNode.js.map +1 -1
  441. package/lib/simple-tree/index.d.ts +3 -3
  442. package/lib/simple-tree/index.d.ts.map +1 -1
  443. package/lib/simple-tree/index.js +1 -1
  444. package/lib/simple-tree/index.js.map +1 -1
  445. package/lib/simple-tree/leafNodeSchema.d.ts +22 -1
  446. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  447. package/lib/simple-tree/leafNodeSchema.js +1 -1
  448. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  449. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  450. package/lib/simple-tree/mapNode.js.map +1 -1
  451. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  452. package/lib/simple-tree/objectNode.js +3 -2
  453. package/lib/simple-tree/objectNode.js.map +1 -1
  454. package/lib/simple-tree/proxies.d.ts.map +1 -1
  455. package/lib/simple-tree/proxies.js +9 -25
  456. package/lib/simple-tree/proxies.js.map +1 -1
  457. package/lib/simple-tree/proxyBinding.d.ts +4 -0
  458. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  459. package/lib/simple-tree/proxyBinding.js +19 -0
  460. package/lib/simple-tree/proxyBinding.js.map +1 -1
  461. package/lib/simple-tree/schemaFactory.d.ts +16 -1
  462. package/lib/simple-tree/schemaFactory.d.ts.map +1 -1
  463. package/lib/simple-tree/schemaFactory.js +30 -3
  464. package/lib/simple-tree/schemaFactory.js.map +1 -1
  465. package/lib/simple-tree/schemaTypes.d.ts +36 -1
  466. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  467. package/lib/simple-tree/schemaTypes.js.map +1 -1
  468. package/lib/simple-tree/toFlexSchema.d.ts +2 -2
  469. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  470. package/lib/simple-tree/toFlexSchema.js +3 -2
  471. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  472. package/lib/simple-tree/tree.d.ts +4 -1
  473. package/lib/simple-tree/tree.d.ts.map +1 -1
  474. package/lib/simple-tree/tree.js +44 -0
  475. package/lib/simple-tree/tree.js.map +1 -1
  476. package/lib/simple-tree/treeNodeApi.d.ts +2 -75
  477. package/lib/simple-tree/treeNodeApi.d.ts.map +1 -1
  478. package/lib/simple-tree/treeNodeApi.js +20 -28
  479. package/lib/simple-tree/treeNodeApi.js.map +1 -1
  480. package/lib/simple-tree/treeNodeKernel.d.ts +26 -0
  481. package/lib/simple-tree/treeNodeKernel.d.ts.map +1 -0
  482. package/lib/simple-tree/treeNodeKernel.js +79 -0
  483. package/lib/simple-tree/treeNodeKernel.js.map +1 -0
  484. package/lib/simple-tree/types.d.ts +95 -3
  485. package/lib/simple-tree/types.d.ts.map +1 -1
  486. package/lib/simple-tree/types.js +121 -22
  487. package/lib/simple-tree/types.js.map +1 -1
  488. package/lib/util/breakable.d.ts +83 -0
  489. package/lib/util/breakable.d.ts.map +1 -0
  490. package/lib/util/breakable.js +171 -0
  491. package/lib/util/breakable.js.map +1 -0
  492. package/lib/util/index.d.ts +3 -2
  493. package/lib/util/index.d.ts.map +1 -1
  494. package/lib/util/index.js +3 -2
  495. package/lib/util/index.js.map +1 -1
  496. package/lib/util/nestedMap.d.ts +17 -3
  497. package/lib/util/nestedMap.d.ts.map +1 -1
  498. package/lib/util/nestedMap.js +19 -0
  499. package/lib/util/nestedMap.js.map +1 -1
  500. package/lib/util/utils.d.ts +7 -0
  501. package/lib/util/utils.d.ts.map +1 -1
  502. package/lib/util/utils.js +13 -0
  503. package/lib/util/utils.js.map +1 -1
  504. package/package.json +29 -27
  505. package/src/core/forest/editableForest.ts +25 -4
  506. package/src/core/index.ts +2 -0
  507. package/src/core/rebase/index.ts +2 -0
  508. package/src/core/rebase/types.ts +17 -0
  509. package/src/core/tree/anchorSet.ts +14 -0
  510. package/src/core/tree/detachedFieldIndex.ts +217 -35
  511. package/src/core/tree/detachedFieldIndexCodec.ts +17 -8
  512. package/src/core/tree/detachedFieldIndexFormat.ts +1 -1
  513. package/src/core/tree/detachedFieldIndexTypes.ts +41 -5
  514. package/src/core/tree/index.ts +2 -1
  515. package/src/core/tree/visitDelta.ts +58 -16
  516. package/src/core/tree/visitorUtils.ts +7 -4
  517. package/src/events/events.ts +4 -2
  518. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +1 -1
  519. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -0
  520. package/src/feature-libraries/editableTreeBinder.ts +1 -1
  521. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +1 -95
  522. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +0 -62
  523. package/src/feature-libraries/flex-tree/index.ts +7 -2
  524. package/src/feature-libraries/flex-tree/lazyEntity.ts +0 -3
  525. package/src/feature-libraries/flex-tree/lazyField.ts +15 -47
  526. package/src/feature-libraries/flex-tree/lazyNode.ts +1 -48
  527. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -0
  528. package/src/feature-libraries/index.ts +4 -2
  529. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +18 -0
  530. package/src/feature-libraries/modular-schema/discrepancies.ts +395 -0
  531. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +10 -2
  532. package/src/feature-libraries/modular-schema/genericFieldKind.ts +3 -0
  533. package/src/feature-libraries/modular-schema/index.ts +2 -0
  534. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +81 -35
  535. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +1521 -444
  536. package/src/feature-libraries/modular-schema/modularChangeFormat.ts +2 -0
  537. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +51 -0
  538. package/src/feature-libraries/node-key/index.ts +0 -1
  539. package/src/feature-libraries/object-forest/objectForest.ts +7 -3
  540. package/src/feature-libraries/optional-field/optionalField.ts +1 -0
  541. package/src/feature-libraries/sequence-field/index.ts +0 -2
  542. package/src/feature-libraries/sequence-field/invert.ts +1 -1
  543. package/src/feature-libraries/sequence-field/rebase.ts +7 -1
  544. package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +2 -1
  545. package/src/feature-libraries/sequence-field/utils.ts +37 -85
  546. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +10 -0
  547. package/src/index.ts +0 -1
  548. package/src/packageVersion.ts +1 -1
  549. package/src/shared-tree/schematizingTreeView.ts +6 -2
  550. package/src/shared-tree/sharedTree.ts +12 -1
  551. package/src/shared-tree/sharedTreeChangeEnricher.ts +1 -1
  552. package/src/shared-tree/treeApi.ts +1 -1
  553. package/src/shared-tree/treeCheckout.ts +60 -5
  554. package/src/shared-tree/treeView.ts +5 -0
  555. package/src/shared-tree-core/branch.ts +10 -0
  556. package/src/shared-tree-core/sharedTreeCore.ts +25 -6
  557. package/src/simple-tree/arrayNode.ts +50 -23
  558. package/src/simple-tree/index.ts +3 -3
  559. package/src/simple-tree/leafNodeSchema.ts +1 -1
  560. package/src/simple-tree/mapNode.ts +2 -2
  561. package/src/simple-tree/objectNode.ts +9 -3
  562. package/src/simple-tree/proxies.ts +10 -33
  563. package/src/simple-tree/proxyBinding.ts +23 -0
  564. package/src/simple-tree/schemaFactory.ts +37 -2
  565. package/src/simple-tree/schemaTypes.ts +36 -1
  566. package/src/simple-tree/toFlexSchema.ts +5 -4
  567. package/src/simple-tree/tree.ts +68 -4
  568. package/src/simple-tree/treeNodeApi.ts +29 -111
  569. package/src/simple-tree/treeNodeKernel.ts +91 -0
  570. package/src/simple-tree/types.ts +292 -31
  571. package/src/util/breakable.ts +214 -0
  572. package/src/util/index.ts +11 -0
  573. package/src/util/nestedMap.ts +33 -3
  574. package/src/util/utils.ts +17 -0
  575. package/dist/feature-libraries/node-key/nodeKeyIndex.d.ts +0 -41
  576. package/dist/feature-libraries/node-key/nodeKeyIndex.d.ts.map +0 -1
  577. package/dist/feature-libraries/node-key/nodeKeyIndex.js +0 -101
  578. package/dist/feature-libraries/node-key/nodeKeyIndex.js.map +0 -1
  579. package/lib/feature-libraries/node-key/nodeKeyIndex.d.ts +0 -41
  580. package/lib/feature-libraries/node-key/nodeKeyIndex.d.ts.map +0 -1
  581. package/lib/feature-libraries/node-key/nodeKeyIndex.js +0 -97
  582. package/lib/feature-libraries/node-key/nodeKeyIndex.js.map +0 -1
  583. package/src/feature-libraries/node-key/nodeKeyIndex.ts +0 -132
@@ -16,6 +16,13 @@ import type { MapGetSet } from "./utils.js";
16
16
  */
17
17
  export type NestedMap<Key1, Key2, Value> = Map<Key1, Map<Key2, Value>>;
18
18
 
19
+ /**
20
+ * A read-only version of {@link NestedMap}.
21
+ *
22
+ * @internal
23
+ */
24
+ export type ReadonlyNestedMap<Key1, Key2, Value> = ReadonlyMap<Key1, ReadonlyMap<Key2, Value>>;
25
+
19
26
  /**
20
27
  * If (key1, key2) already has a value in the map, it is returned, otherwise value is added under (key1, key2) and undefined is returned.
21
28
  *
@@ -51,7 +58,7 @@ export function tryAddToNestedMap<Key1, Key2, Value>(
51
58
  * @internal
52
59
  */
53
60
  export function populateNestedMap<Key1, Key2, Value>(
54
- source: ReadonlyMap<Key1, ReadonlyMap<Key2, Value>>,
61
+ source: ReadonlyNestedMap<Key1, Key2, Value>,
55
62
  destination: NestedMap<Key1, Key2, Value>,
56
63
  override: boolean,
57
64
  ): void {
@@ -187,7 +194,7 @@ export function deleteFromNestedMap<Key1, Key2, Value>(
187
194
  * Converts a nested map to a flat list of triplets.
188
195
  */
189
196
  export function nestedMapToFlatList<Key1, Key2, Value>(
190
- map: NestedMap<Key1, Key2, Value>,
197
+ map: ReadonlyNestedMap<Key1, Key2, Value>,
191
198
  ): [Key1, Key2, Value][] {
192
199
  const list: [Key1, Key2, Value][] = [];
193
200
  map.forEach((innerMap, key1) => {
@@ -212,7 +219,7 @@ export function nestedMapFromFlatList<Key1, Key2, Value>(
212
219
  }
213
220
 
214
221
  export function forEachInNestedMap<Key1, Key2, Value>(
215
- map: NestedMap<Key1, Key2, Value>,
222
+ map: ReadonlyNestedMap<Key1, Key2, Value>,
216
223
  delegate: (value: Value, key1: Key1, key2: Key2) => void,
217
224
  ): void {
218
225
  map.forEach((innerMap, keyFirst) => {
@@ -222,6 +229,29 @@ export function forEachInNestedMap<Key1, Key2, Value>(
222
229
  });
223
230
  }
224
231
 
232
+ /**
233
+ * Maps the `input` map values using the provided `delegate`.
234
+ *
235
+ * @param input - The `NestedMap` whose contents are being mapped.
236
+ * @param delegate - The delegate to use for mapping values,
237
+ * @returns A new `NestedMap` with the same keys as `input`, but with the values produced by `delegate`.
238
+ */
239
+ export function mapNestedMap<Key1, Key2, ValueIn, ValueOut = ValueIn>(
240
+ input: ReadonlyNestedMap<Key1, Key2, ValueIn>,
241
+ delegate: (value: ValueIn, key1: Key1, key2: Key2) => ValueOut,
242
+ ): NestedMap<Key1, Key2, ValueOut> {
243
+ const output = new Map<Key1, Map<Key2, ValueOut>>();
244
+ input.forEach((inputInnerMap, keyFirst) => {
245
+ const outputInnerMap = new Map<Key2, ValueOut>();
246
+ inputInnerMap.forEach((val, keySecond) => {
247
+ const mappedValue = delegate(val, keyFirst, keySecond);
248
+ outputInnerMap.set(keySecond, mappedValue);
249
+ });
250
+ output.set(keyFirst, outputInnerMap);
251
+ });
252
+ return output;
253
+ }
254
+
225
255
  /**
226
256
  * Map with two keys; same semantics as NestedMap, but maintains a size count for the entire collection.
227
257
  * Note: undefined is not supported as a value, and will cause incorrect behavior.
package/src/util/utils.ts CHANGED
@@ -174,6 +174,23 @@ export function* mapIterable<T, U>(
174
174
  }
175
175
  }
176
176
 
177
+ /**
178
+ * Filter one iterable into another
179
+ * @param iterable - the iterable to filter
180
+ * @param filter - the predicate function to run on each element of the iterable
181
+ * @returns a new iterable including only the elements that passed the filter predicate
182
+ */
183
+ export function* filterIterable<T>(
184
+ iterable: Iterable<T>,
185
+ filter: (t: T) => boolean,
186
+ ): IterableIterator<T> {
187
+ for (const t of iterable) {
188
+ if (filter(t)) {
189
+ yield t;
190
+ }
191
+ }
192
+ }
193
+
177
194
  /**
178
195
  * Finds the first element in the given iterable that satisfies a predicate.
179
196
  * @param iterable - The iterable to search for an eligible element
@@ -1,41 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { type FieldKey } from "../../core/index.js";
6
- import type { FlexTreeContext, FlexTreeObjectNode } from "../flex-tree/index.js";
7
- import { type FlexTreeSchema } from "../typed-schema/index.js";
8
- import { type LocalNodeKey } from "./nodeKey.js";
9
- /**
10
- * The node key index records nodes with {@link LocalNodeKey}s and allows them to be looked up by key.
11
- */
12
- export declare class NodeKeyIndex implements ReadonlyMap<LocalNodeKey, FlexTreeObjectNode> {
13
- readonly fieldKey: FieldKey;
14
- private readonly nodes;
15
- constructor(fieldKey: FieldKey, keys?: Iterable<[LocalNodeKey, FlexTreeObjectNode]>);
16
- /**
17
- * Returns true if the given schema contains the node key type, otherwise false
18
- */
19
- static hasNodeKeyTreeSchema(schema: FlexTreeSchema): boolean;
20
- /**
21
- * Search the tree for all nodes with keys, and record them in this index for lookup.
22
- * This should be called each time the tree changes; each call to scan forgets all existing keys.
23
- * @param context - the flex tree context in which to search for node keys
24
- */
25
- scanKeys(context: FlexTreeContext): void;
26
- /**
27
- * Create a copy of this index which can be mutated without affecting this one.
28
- */
29
- clone(context: FlexTreeContext): NodeKeyIndex;
30
- forEach(callbackfn: (value: FlexTreeObjectNode, key: LocalNodeKey, map: ReadonlyMap<LocalNodeKey, FlexTreeObjectNode>) => void, thisArg?: unknown): void;
31
- get(key: LocalNodeKey): FlexTreeObjectNode | undefined;
32
- has(key: LocalNodeKey): boolean;
33
- get size(): number;
34
- entries(): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]>;
35
- keys(): IterableIterator<LocalNodeKey>;
36
- values(): IterableIterator<FlexTreeObjectNode>;
37
- [Symbol.iterator](): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]>;
38
- private findKeys;
39
- private findKeysInField;
40
- }
41
- //# sourceMappingURL=nodeKeyIndex.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodeKeyIndex.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/nodeKeyIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,QAAQ,EAAe,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EACX,eAAe,EAGf,kBAAkB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,KAAK,cAAc,EAGnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,KAAK,YAAY,EAAyB,MAAM,cAAc,CAAC;AAExE;;GAEG;AACH,qBAAa,YAAa,YAAW,WAAW,CAAC,YAAY,EAAE,kBAAkB,CAAC;aAKhE,QAAQ,EAAE,QAAQ;IAHnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwC;gBAG7C,QAAQ,EAAE,QAAQ,EAClC,IAAI,GAAE,QAAQ,CAAC,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAM;IAKxD;;OAEG;WACW,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO;IASnE;;;;OAIG;IAEI,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAa/C;;OAEG;IACI,KAAK,CAAC,OAAO,EAAE,eAAe,GAAG,YAAY;IAO7C,OAAO,CACb,UAAU,EAAE,CACX,KAAK,EAAE,kBAAkB,EACzB,GAAG,EAAE,YAAY,EACjB,GAAG,EAAE,WAAW,CAAC,YAAY,EAAE,kBAAkB,CAAC,KAC9C,IAAI,EACT,OAAO,CAAC,EAAE,OAAO,GACf,IAAI;IAGA,GAAG,CAAC,GAAG,EAAE,YAAY,GAAG,kBAAkB,GAAG,SAAS;IAGtD,GAAG,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO;IAGtC,IAAW,IAAI,IAAI,MAAM,CAExB;IACM,OAAO,IAAI,gBAAgB,CAAC,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;IAG/D,IAAI,IAAI,gBAAgB,CAAC,YAAY,CAAC;IAGtC,MAAM,IAAI,gBAAgB,CAAC,kBAAkB,CAAC;IAG9C,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;IAKhF,OAAO,CAAE,QAAQ;IAcjB,OAAO,CAAE,eAAe;CAOxB"}
@@ -1,101 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.NodeKeyIndex = void 0;
8
- const internal_1 = require("@fluidframework/core-utils/internal");
9
- const index_js_1 = require("../../core/index.js");
10
- const index_js_2 = require("../typed-schema/index.js");
11
- const nodeKey_js_1 = require("./nodeKey.js");
12
- /**
13
- * The node key index records nodes with {@link LocalNodeKey}s and allows them to be looked up by key.
14
- */
15
- class NodeKeyIndex {
16
- constructor(fieldKey, keys = []) {
17
- this.fieldKey = fieldKey;
18
- this.nodes = new Map(keys);
19
- }
20
- /**
21
- * Returns true if the given schema contains the node key type, otherwise false
22
- */
23
- static hasNodeKeyTreeSchema(schema) {
24
- // TODO: make TreeStoredSchema contain ViewSchema and compare by reference to nodeKeyTreeSchema.
25
- const treeSchema = schema.nodeSchema.get(nodeKey_js_1.nodeKeyTreeIdentifier);
26
- if (!(treeSchema instanceof index_js_2.LeafNodeSchema)) {
27
- return false;
28
- }
29
- return treeSchema.leafValue === index_js_1.ValueSchema.String;
30
- }
31
- /**
32
- * Search the tree for all nodes with keys, and record them in this index for lookup.
33
- * This should be called each time the tree changes; each call to scan forgets all existing keys.
34
- * @param context - the flex tree context in which to search for node keys
35
- */
36
- // TODO: This can be optimized by responding to deltas/changes to the tree, rather than rescanning the whole tree every time
37
- scanKeys(context) {
38
- this.nodes.clear();
39
- if (NodeKeyIndex.hasNodeKeyTreeSchema(context.schema)) {
40
- for (const [id, node] of this.findKeysInField(context.root)) {
41
- // TODO:
42
- // This invariant (that there is only one node with a given key) is not enforced by tree, so it should not assert.
43
- // Multiple nodes (including deleted ones), might occur with the same key.
44
- (0, internal_1.assert)(!this.nodes.has(id), 0x6e1 /* Encountered duplicate node key */);
45
- this.nodes.set(id, node);
46
- }
47
- }
48
- }
49
- /**
50
- * Create a copy of this index which can be mutated without affecting this one.
51
- */
52
- clone(context) {
53
- const indexClone = new NodeKeyIndex(this.fieldKey);
54
- indexClone.scanKeys(context);
55
- return indexClone;
56
- }
57
- // #region ReadonlyMap interface
58
- forEach(callbackfn, thisArg) {
59
- return this.nodes.forEach(callbackfn, thisArg);
60
- }
61
- get(key) {
62
- return this.nodes.get(key);
63
- }
64
- has(key) {
65
- return this.nodes.has(key);
66
- }
67
- get size() {
68
- return this.nodes.size;
69
- }
70
- entries() {
71
- return this.nodes.entries();
72
- }
73
- keys() {
74
- return this.nodes.keys();
75
- }
76
- values() {
77
- return this.nodes.values();
78
- }
79
- [Symbol.iterator]() {
80
- return this.nodes[Symbol.iterator]();
81
- }
82
- // #endregion ReadonlyMap interface
83
- *findKeys(node) {
84
- if ((0, index_js_2.schemaIsObjectNode)(node.schema)) {
85
- const key = node.localNodeKey;
86
- if (key !== undefined) {
87
- yield [key, node];
88
- }
89
- }
90
- for (const f of node.boxedIterator()) {
91
- yield* this.findKeysInField(f);
92
- }
93
- }
94
- *findKeysInField(f) {
95
- for (const child of f.boxedIterator()) {
96
- yield* this.findKeys(child);
97
- }
98
- }
99
- }
100
- exports.NodeKeyIndex = NodeKeyIndex;
101
- //# sourceMappingURL=nodeKeyIndex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodeKeyIndex.js","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/nodeKeyIndex.ts"],"names":[],"mappings":"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","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 { type FieldKey, ValueSchema } from \"../../core/index.js\";\nimport type {\n\tFlexTreeContext,\n\tFlexTreeField,\n\tFlexTreeNode,\n\tFlexTreeObjectNode,\n} from \"../flex-tree/index.js\";\nimport {\n\ttype FlexTreeSchema,\n\tLeafNodeSchema,\n\tschemaIsObjectNode,\n} from \"../typed-schema/index.js\";\n\nimport { type LocalNodeKey, nodeKeyTreeIdentifier } from \"./nodeKey.js\";\n\n/**\n * The node key index records nodes with {@link LocalNodeKey}s and allows them to be looked up by key.\n */\nexport class NodeKeyIndex implements ReadonlyMap<LocalNodeKey, FlexTreeObjectNode> {\n\t// TODO: The data structure that holds the nodes can likely be optimized to better support cloning\n\tprivate readonly nodes: Map<LocalNodeKey, FlexTreeObjectNode>;\n\n\tpublic constructor(\n\t\tpublic readonly fieldKey: FieldKey,\n\t\tkeys: Iterable<[LocalNodeKey, FlexTreeObjectNode]> = [],\n\t) {\n\t\tthis.nodes = new Map(keys);\n\t}\n\n\t/**\n\t * Returns true if the given schema contains the node key type, otherwise false\n\t */\n\tpublic static hasNodeKeyTreeSchema(schema: FlexTreeSchema): boolean {\n\t\t// TODO: make TreeStoredSchema contain ViewSchema and compare by reference to nodeKeyTreeSchema.\n\t\tconst treeSchema = schema.nodeSchema.get(nodeKeyTreeIdentifier);\n\t\tif (!(treeSchema instanceof LeafNodeSchema)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn treeSchema.leafValue === ValueSchema.String;\n\t}\n\n\t/**\n\t * Search the tree for all nodes with keys, and record them in this index for lookup.\n\t * This should be called each time the tree changes; each call to scan forgets all existing keys.\n\t * @param context - the flex tree context in which to search for node keys\n\t */\n\t// TODO: This can be optimized by responding to deltas/changes to the tree, rather than rescanning the whole tree every time\n\tpublic scanKeys(context: FlexTreeContext): void {\n\t\tthis.nodes.clear();\n\t\tif (NodeKeyIndex.hasNodeKeyTreeSchema(context.schema)) {\n\t\t\tfor (const [id, node] of this.findKeysInField(context.root)) {\n\t\t\t\t// TODO:\n\t\t\t\t// This invariant (that there is only one node with a given key) is not enforced by tree, so it should not assert.\n\t\t\t\t// Multiple nodes (including deleted ones), might occur with the same key.\n\t\t\t\tassert(!this.nodes.has(id), 0x6e1 /* Encountered duplicate node key */);\n\t\t\t\tthis.nodes.set(id, node);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Create a copy of this index which can be mutated without affecting this one.\n\t */\n\tpublic clone(context: FlexTreeContext): NodeKeyIndex {\n\t\tconst indexClone = new NodeKeyIndex(this.fieldKey);\n\t\tindexClone.scanKeys(context);\n\t\treturn indexClone;\n\t}\n\n\t// #region ReadonlyMap interface\n\tpublic forEach(\n\t\tcallbackfn: (\n\t\t\tvalue: FlexTreeObjectNode,\n\t\t\tkey: LocalNodeKey,\n\t\t\tmap: ReadonlyMap<LocalNodeKey, FlexTreeObjectNode>,\n\t\t) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\treturn this.nodes.forEach(callbackfn, thisArg);\n\t}\n\tpublic get(key: LocalNodeKey): FlexTreeObjectNode | undefined {\n\t\treturn this.nodes.get(key);\n\t}\n\tpublic has(key: LocalNodeKey): boolean {\n\t\treturn this.nodes.has(key);\n\t}\n\tpublic get size(): number {\n\t\treturn this.nodes.size;\n\t}\n\tpublic entries(): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]> {\n\t\treturn this.nodes.entries();\n\t}\n\tpublic keys(): IterableIterator<LocalNodeKey> {\n\t\treturn this.nodes.keys();\n\t}\n\tpublic values(): IterableIterator<FlexTreeObjectNode> {\n\t\treturn this.nodes.values();\n\t}\n\tpublic [Symbol.iterator](): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]> {\n\t\treturn this.nodes[Symbol.iterator]();\n\t}\n\t// #endregion ReadonlyMap interface\n\n\tprivate *findKeys(\n\t\tnode: FlexTreeNode,\n\t): Iterable<[key: LocalNodeKey, node: FlexTreeObjectNode]> {\n\t\tif (schemaIsObjectNode(node.schema)) {\n\t\t\tconst key = (node as FlexTreeObjectNode).localNodeKey;\n\t\t\tif (key !== undefined) {\n\t\t\t\tyield [key, node as FlexTreeObjectNode];\n\t\t\t}\n\t\t}\n\t\tfor (const f of node.boxedIterator()) {\n\t\t\tyield* this.findKeysInField(f);\n\t\t}\n\t}\n\n\tprivate *findKeysInField(\n\t\tf: FlexTreeField,\n\t): Iterable<[key: LocalNodeKey, node: FlexTreeObjectNode]> {\n\t\tfor (const child of f.boxedIterator()) {\n\t\t\tyield* this.findKeys(child);\n\t\t}\n\t}\n}\n"]}
@@ -1,41 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { type FieldKey } from "../../core/index.js";
6
- import type { FlexTreeContext, FlexTreeObjectNode } from "../flex-tree/index.js";
7
- import { type FlexTreeSchema } from "../typed-schema/index.js";
8
- import { type LocalNodeKey } from "./nodeKey.js";
9
- /**
10
- * The node key index records nodes with {@link LocalNodeKey}s and allows them to be looked up by key.
11
- */
12
- export declare class NodeKeyIndex implements ReadonlyMap<LocalNodeKey, FlexTreeObjectNode> {
13
- readonly fieldKey: FieldKey;
14
- private readonly nodes;
15
- constructor(fieldKey: FieldKey, keys?: Iterable<[LocalNodeKey, FlexTreeObjectNode]>);
16
- /**
17
- * Returns true if the given schema contains the node key type, otherwise false
18
- */
19
- static hasNodeKeyTreeSchema(schema: FlexTreeSchema): boolean;
20
- /**
21
- * Search the tree for all nodes with keys, and record them in this index for lookup.
22
- * This should be called each time the tree changes; each call to scan forgets all existing keys.
23
- * @param context - the flex tree context in which to search for node keys
24
- */
25
- scanKeys(context: FlexTreeContext): void;
26
- /**
27
- * Create a copy of this index which can be mutated without affecting this one.
28
- */
29
- clone(context: FlexTreeContext): NodeKeyIndex;
30
- forEach(callbackfn: (value: FlexTreeObjectNode, key: LocalNodeKey, map: ReadonlyMap<LocalNodeKey, FlexTreeObjectNode>) => void, thisArg?: unknown): void;
31
- get(key: LocalNodeKey): FlexTreeObjectNode | undefined;
32
- has(key: LocalNodeKey): boolean;
33
- get size(): number;
34
- entries(): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]>;
35
- keys(): IterableIterator<LocalNodeKey>;
36
- values(): IterableIterator<FlexTreeObjectNode>;
37
- [Symbol.iterator](): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]>;
38
- private findKeys;
39
- private findKeysInField;
40
- }
41
- //# sourceMappingURL=nodeKeyIndex.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodeKeyIndex.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/nodeKeyIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,QAAQ,EAAe,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EACX,eAAe,EAGf,kBAAkB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,KAAK,cAAc,EAGnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,KAAK,YAAY,EAAyB,MAAM,cAAc,CAAC;AAExE;;GAEG;AACH,qBAAa,YAAa,YAAW,WAAW,CAAC,YAAY,EAAE,kBAAkB,CAAC;aAKhE,QAAQ,EAAE,QAAQ;IAHnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwC;gBAG7C,QAAQ,EAAE,QAAQ,EAClC,IAAI,GAAE,QAAQ,CAAC,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAM;IAKxD;;OAEG;WACW,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO;IASnE;;;;OAIG;IAEI,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAa/C;;OAEG;IACI,KAAK,CAAC,OAAO,EAAE,eAAe,GAAG,YAAY;IAO7C,OAAO,CACb,UAAU,EAAE,CACX,KAAK,EAAE,kBAAkB,EACzB,GAAG,EAAE,YAAY,EACjB,GAAG,EAAE,WAAW,CAAC,YAAY,EAAE,kBAAkB,CAAC,KAC9C,IAAI,EACT,OAAO,CAAC,EAAE,OAAO,GACf,IAAI;IAGA,GAAG,CAAC,GAAG,EAAE,YAAY,GAAG,kBAAkB,GAAG,SAAS;IAGtD,GAAG,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO;IAGtC,IAAW,IAAI,IAAI,MAAM,CAExB;IACM,OAAO,IAAI,gBAAgB,CAAC,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;IAG/D,IAAI,IAAI,gBAAgB,CAAC,YAAY,CAAC;IAGtC,MAAM,IAAI,gBAAgB,CAAC,kBAAkB,CAAC;IAG9C,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;IAKhF,OAAO,CAAE,QAAQ;IAcjB,OAAO,CAAE,eAAe;CAOxB"}
@@ -1,97 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { assert } from "@fluidframework/core-utils/internal";
6
- import { ValueSchema } from "../../core/index.js";
7
- import { LeafNodeSchema, schemaIsObjectNode, } from "../typed-schema/index.js";
8
- import { nodeKeyTreeIdentifier } from "./nodeKey.js";
9
- /**
10
- * The node key index records nodes with {@link LocalNodeKey}s and allows them to be looked up by key.
11
- */
12
- export class NodeKeyIndex {
13
- constructor(fieldKey, keys = []) {
14
- this.fieldKey = fieldKey;
15
- this.nodes = new Map(keys);
16
- }
17
- /**
18
- * Returns true if the given schema contains the node key type, otherwise false
19
- */
20
- static hasNodeKeyTreeSchema(schema) {
21
- // TODO: make TreeStoredSchema contain ViewSchema and compare by reference to nodeKeyTreeSchema.
22
- const treeSchema = schema.nodeSchema.get(nodeKeyTreeIdentifier);
23
- if (!(treeSchema instanceof LeafNodeSchema)) {
24
- return false;
25
- }
26
- return treeSchema.leafValue === ValueSchema.String;
27
- }
28
- /**
29
- * Search the tree for all nodes with keys, and record them in this index for lookup.
30
- * This should be called each time the tree changes; each call to scan forgets all existing keys.
31
- * @param context - the flex tree context in which to search for node keys
32
- */
33
- // TODO: This can be optimized by responding to deltas/changes to the tree, rather than rescanning the whole tree every time
34
- scanKeys(context) {
35
- this.nodes.clear();
36
- if (NodeKeyIndex.hasNodeKeyTreeSchema(context.schema)) {
37
- for (const [id, node] of this.findKeysInField(context.root)) {
38
- // TODO:
39
- // This invariant (that there is only one node with a given key) is not enforced by tree, so it should not assert.
40
- // Multiple nodes (including deleted ones), might occur with the same key.
41
- assert(!this.nodes.has(id), 0x6e1 /* Encountered duplicate node key */);
42
- this.nodes.set(id, node);
43
- }
44
- }
45
- }
46
- /**
47
- * Create a copy of this index which can be mutated without affecting this one.
48
- */
49
- clone(context) {
50
- const indexClone = new NodeKeyIndex(this.fieldKey);
51
- indexClone.scanKeys(context);
52
- return indexClone;
53
- }
54
- // #region ReadonlyMap interface
55
- forEach(callbackfn, thisArg) {
56
- return this.nodes.forEach(callbackfn, thisArg);
57
- }
58
- get(key) {
59
- return this.nodes.get(key);
60
- }
61
- has(key) {
62
- return this.nodes.has(key);
63
- }
64
- get size() {
65
- return this.nodes.size;
66
- }
67
- entries() {
68
- return this.nodes.entries();
69
- }
70
- keys() {
71
- return this.nodes.keys();
72
- }
73
- values() {
74
- return this.nodes.values();
75
- }
76
- [Symbol.iterator]() {
77
- return this.nodes[Symbol.iterator]();
78
- }
79
- // #endregion ReadonlyMap interface
80
- *findKeys(node) {
81
- if (schemaIsObjectNode(node.schema)) {
82
- const key = node.localNodeKey;
83
- if (key !== undefined) {
84
- yield [key, node];
85
- }
86
- }
87
- for (const f of node.boxedIterator()) {
88
- yield* this.findKeysInField(f);
89
- }
90
- }
91
- *findKeysInField(f) {
92
- for (const child of f.boxedIterator()) {
93
- yield* this.findKeys(child);
94
- }
95
- }
96
- }
97
- //# sourceMappingURL=nodeKeyIndex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodeKeyIndex.js","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/nodeKeyIndex.ts"],"names":[],"mappings":"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","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 { type FieldKey, ValueSchema } from \"../../core/index.js\";\nimport type {\n\tFlexTreeContext,\n\tFlexTreeField,\n\tFlexTreeNode,\n\tFlexTreeObjectNode,\n} from \"../flex-tree/index.js\";\nimport {\n\ttype FlexTreeSchema,\n\tLeafNodeSchema,\n\tschemaIsObjectNode,\n} from \"../typed-schema/index.js\";\n\nimport { type LocalNodeKey, nodeKeyTreeIdentifier } from \"./nodeKey.js\";\n\n/**\n * The node key index records nodes with {@link LocalNodeKey}s and allows them to be looked up by key.\n */\nexport class NodeKeyIndex implements ReadonlyMap<LocalNodeKey, FlexTreeObjectNode> {\n\t// TODO: The data structure that holds the nodes can likely be optimized to better support cloning\n\tprivate readonly nodes: Map<LocalNodeKey, FlexTreeObjectNode>;\n\n\tpublic constructor(\n\t\tpublic readonly fieldKey: FieldKey,\n\t\tkeys: Iterable<[LocalNodeKey, FlexTreeObjectNode]> = [],\n\t) {\n\t\tthis.nodes = new Map(keys);\n\t}\n\n\t/**\n\t * Returns true if the given schema contains the node key type, otherwise false\n\t */\n\tpublic static hasNodeKeyTreeSchema(schema: FlexTreeSchema): boolean {\n\t\t// TODO: make TreeStoredSchema contain ViewSchema and compare by reference to nodeKeyTreeSchema.\n\t\tconst treeSchema = schema.nodeSchema.get(nodeKeyTreeIdentifier);\n\t\tif (!(treeSchema instanceof LeafNodeSchema)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn treeSchema.leafValue === ValueSchema.String;\n\t}\n\n\t/**\n\t * Search the tree for all nodes with keys, and record them in this index for lookup.\n\t * This should be called each time the tree changes; each call to scan forgets all existing keys.\n\t * @param context - the flex tree context in which to search for node keys\n\t */\n\t// TODO: This can be optimized by responding to deltas/changes to the tree, rather than rescanning the whole tree every time\n\tpublic scanKeys(context: FlexTreeContext): void {\n\t\tthis.nodes.clear();\n\t\tif (NodeKeyIndex.hasNodeKeyTreeSchema(context.schema)) {\n\t\t\tfor (const [id, node] of this.findKeysInField(context.root)) {\n\t\t\t\t// TODO:\n\t\t\t\t// This invariant (that there is only one node with a given key) is not enforced by tree, so it should not assert.\n\t\t\t\t// Multiple nodes (including deleted ones), might occur with the same key.\n\t\t\t\tassert(!this.nodes.has(id), 0x6e1 /* Encountered duplicate node key */);\n\t\t\t\tthis.nodes.set(id, node);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Create a copy of this index which can be mutated without affecting this one.\n\t */\n\tpublic clone(context: FlexTreeContext): NodeKeyIndex {\n\t\tconst indexClone = new NodeKeyIndex(this.fieldKey);\n\t\tindexClone.scanKeys(context);\n\t\treturn indexClone;\n\t}\n\n\t// #region ReadonlyMap interface\n\tpublic forEach(\n\t\tcallbackfn: (\n\t\t\tvalue: FlexTreeObjectNode,\n\t\t\tkey: LocalNodeKey,\n\t\t\tmap: ReadonlyMap<LocalNodeKey, FlexTreeObjectNode>,\n\t\t) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\treturn this.nodes.forEach(callbackfn, thisArg);\n\t}\n\tpublic get(key: LocalNodeKey): FlexTreeObjectNode | undefined {\n\t\treturn this.nodes.get(key);\n\t}\n\tpublic has(key: LocalNodeKey): boolean {\n\t\treturn this.nodes.has(key);\n\t}\n\tpublic get size(): number {\n\t\treturn this.nodes.size;\n\t}\n\tpublic entries(): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]> {\n\t\treturn this.nodes.entries();\n\t}\n\tpublic keys(): IterableIterator<LocalNodeKey> {\n\t\treturn this.nodes.keys();\n\t}\n\tpublic values(): IterableIterator<FlexTreeObjectNode> {\n\t\treturn this.nodes.values();\n\t}\n\tpublic [Symbol.iterator](): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]> {\n\t\treturn this.nodes[Symbol.iterator]();\n\t}\n\t// #endregion ReadonlyMap interface\n\n\tprivate *findKeys(\n\t\tnode: FlexTreeNode,\n\t): Iterable<[key: LocalNodeKey, node: FlexTreeObjectNode]> {\n\t\tif (schemaIsObjectNode(node.schema)) {\n\t\t\tconst key = (node as FlexTreeObjectNode).localNodeKey;\n\t\t\tif (key !== undefined) {\n\t\t\t\tyield [key, node as FlexTreeObjectNode];\n\t\t\t}\n\t\t}\n\t\tfor (const f of node.boxedIterator()) {\n\t\t\tyield* this.findKeysInField(f);\n\t\t}\n\t}\n\n\tprivate *findKeysInField(\n\t\tf: FlexTreeField,\n\t): Iterable<[key: LocalNodeKey, node: FlexTreeObjectNode]> {\n\t\tfor (const child of f.boxedIterator()) {\n\t\t\tyield* this.findKeys(child);\n\t\t}\n\t}\n}\n"]}
@@ -1,132 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- import { assert } from "@fluidframework/core-utils/internal";
7
-
8
- import { type FieldKey, ValueSchema } from "../../core/index.js";
9
- import type {
10
- FlexTreeContext,
11
- FlexTreeField,
12
- FlexTreeNode,
13
- FlexTreeObjectNode,
14
- } from "../flex-tree/index.js";
15
- import {
16
- type FlexTreeSchema,
17
- LeafNodeSchema,
18
- schemaIsObjectNode,
19
- } from "../typed-schema/index.js";
20
-
21
- import { type LocalNodeKey, nodeKeyTreeIdentifier } from "./nodeKey.js";
22
-
23
- /**
24
- * The node key index records nodes with {@link LocalNodeKey}s and allows them to be looked up by key.
25
- */
26
- export class NodeKeyIndex implements ReadonlyMap<LocalNodeKey, FlexTreeObjectNode> {
27
- // TODO: The data structure that holds the nodes can likely be optimized to better support cloning
28
- private readonly nodes: Map<LocalNodeKey, FlexTreeObjectNode>;
29
-
30
- public constructor(
31
- public readonly fieldKey: FieldKey,
32
- keys: Iterable<[LocalNodeKey, FlexTreeObjectNode]> = [],
33
- ) {
34
- this.nodes = new Map(keys);
35
- }
36
-
37
- /**
38
- * Returns true if the given schema contains the node key type, otherwise false
39
- */
40
- public static hasNodeKeyTreeSchema(schema: FlexTreeSchema): boolean {
41
- // TODO: make TreeStoredSchema contain ViewSchema and compare by reference to nodeKeyTreeSchema.
42
- const treeSchema = schema.nodeSchema.get(nodeKeyTreeIdentifier);
43
- if (!(treeSchema instanceof LeafNodeSchema)) {
44
- return false;
45
- }
46
- return treeSchema.leafValue === ValueSchema.String;
47
- }
48
-
49
- /**
50
- * Search the tree for all nodes with keys, and record them in this index for lookup.
51
- * This should be called each time the tree changes; each call to scan forgets all existing keys.
52
- * @param context - the flex tree context in which to search for node keys
53
- */
54
- // TODO: This can be optimized by responding to deltas/changes to the tree, rather than rescanning the whole tree every time
55
- public scanKeys(context: FlexTreeContext): void {
56
- this.nodes.clear();
57
- if (NodeKeyIndex.hasNodeKeyTreeSchema(context.schema)) {
58
- for (const [id, node] of this.findKeysInField(context.root)) {
59
- // TODO:
60
- // This invariant (that there is only one node with a given key) is not enforced by tree, so it should not assert.
61
- // Multiple nodes (including deleted ones), might occur with the same key.
62
- assert(!this.nodes.has(id), 0x6e1 /* Encountered duplicate node key */);
63
- this.nodes.set(id, node);
64
- }
65
- }
66
- }
67
-
68
- /**
69
- * Create a copy of this index which can be mutated without affecting this one.
70
- */
71
- public clone(context: FlexTreeContext): NodeKeyIndex {
72
- const indexClone = new NodeKeyIndex(this.fieldKey);
73
- indexClone.scanKeys(context);
74
- return indexClone;
75
- }
76
-
77
- // #region ReadonlyMap interface
78
- public forEach(
79
- callbackfn: (
80
- value: FlexTreeObjectNode,
81
- key: LocalNodeKey,
82
- map: ReadonlyMap<LocalNodeKey, FlexTreeObjectNode>,
83
- ) => void,
84
- thisArg?: unknown,
85
- ): void {
86
- return this.nodes.forEach(callbackfn, thisArg);
87
- }
88
- public get(key: LocalNodeKey): FlexTreeObjectNode | undefined {
89
- return this.nodes.get(key);
90
- }
91
- public has(key: LocalNodeKey): boolean {
92
- return this.nodes.has(key);
93
- }
94
- public get size(): number {
95
- return this.nodes.size;
96
- }
97
- public entries(): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]> {
98
- return this.nodes.entries();
99
- }
100
- public keys(): IterableIterator<LocalNodeKey> {
101
- return this.nodes.keys();
102
- }
103
- public values(): IterableIterator<FlexTreeObjectNode> {
104
- return this.nodes.values();
105
- }
106
- public [Symbol.iterator](): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]> {
107
- return this.nodes[Symbol.iterator]();
108
- }
109
- // #endregion ReadonlyMap interface
110
-
111
- private *findKeys(
112
- node: FlexTreeNode,
113
- ): Iterable<[key: LocalNodeKey, node: FlexTreeObjectNode]> {
114
- if (schemaIsObjectNode(node.schema)) {
115
- const key = (node as FlexTreeObjectNode).localNodeKey;
116
- if (key !== undefined) {
117
- yield [key, node as FlexTreeObjectNode];
118
- }
119
- }
120
- for (const f of node.boxedIterator()) {
121
- yield* this.findKeysInField(f);
122
- }
123
- }
124
-
125
- private *findKeysInField(
126
- f: FlexTreeField,
127
- ): Iterable<[key: LocalNodeKey, node: FlexTreeObjectNode]> {
128
- for (const child of f.boxedIterator()) {
129
- yield* this.findKeys(child);
130
- }
131
- }
132
- }