@fluidframework/tree 2.41.0-337492 → 2.41.0-338401

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 (491) hide show
  1. package/api-report/tree.alpha.api.md +165 -5
  2. package/dist/alpha.d.ts +2 -0
  3. package/dist/codec/codec.d.ts +42 -7
  4. package/dist/codec/codec.d.ts.map +1 -1
  5. package/dist/codec/codec.js +50 -8
  6. package/dist/codec/codec.js.map +1 -1
  7. package/dist/core/change-family/editBuilder.d.ts.map +1 -1
  8. package/dist/core/change-family/editBuilder.js.map +1 -1
  9. package/dist/core/forest/forest.d.ts.map +1 -1
  10. package/dist/core/forest/forest.js.map +1 -1
  11. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  12. package/dist/core/schema-stored/schema.js.map +1 -1
  13. package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  14. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  15. package/dist/core/schema-stored/storedSchemaRepository.js +1 -1
  16. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  17. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  18. package/dist/core/tree/anchorSet.js +2 -2
  19. package/dist/core/tree/anchorSet.js.map +1 -1
  20. package/dist/core/tree/chunk.d.ts.map +1 -1
  21. package/dist/core/tree/chunk.js.map +1 -1
  22. package/dist/core/tree/delta.d.ts.map +1 -1
  23. package/dist/core/tree/delta.js.map +1 -1
  24. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  25. package/dist/core/tree/deltaUtil.js.map +1 -1
  26. package/dist/core/tree/detachedFieldIndex.d.ts +1 -1
  27. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  28. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  29. package/dist/core/tree/detachedFieldIndexCodec.d.ts +1 -1
  30. package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  31. package/dist/core/tree/detachedFieldIndexCodec.js +1 -1
  32. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  33. package/dist/core/tree/pathTree.d.ts.map +1 -1
  34. package/dist/core/tree/pathTree.js.map +1 -1
  35. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  36. package/dist/core/tree/treeTextFormat.js.map +1 -1
  37. package/dist/core/tree/visitDelta.d.ts +1 -1
  38. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  39. package/dist/core/tree/visitDelta.js.map +1 -1
  40. package/dist/core/tree/visitorUtils.d.ts +2 -2
  41. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  42. package/dist/core/tree/visitorUtils.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
  44. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/chunkTree.js +1 -1
  46. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
  48. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  49. package/dist/feature-libraries/chunked-forest/chunkedForest.js +1 -1
  50. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  51. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
  52. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  53. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +2 -2
  55. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  59. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +8 -2
  60. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/codecs.js +12 -1
  62. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  67. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  69. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  71. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +1 -1
  72. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  73. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  74. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  75. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  77. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  79. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  80. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  81. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  82. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  83. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  84. package/dist/feature-libraries/chunked-forest/sequenceChunk.js +4 -4
  85. package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  86. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -1
  87. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  88. package/dist/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  89. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  90. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  91. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  92. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  93. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  94. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  95. package/dist/feature-libraries/default-schema/index.js +2 -1
  96. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  97. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  98. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  99. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +4 -0
  100. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  101. package/dist/feature-libraries/default-schema/schemaChecker.js +35 -26
  102. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  103. package/dist/feature-libraries/flex-tree/context.d.ts +16 -14
  104. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  105. package/dist/feature-libraries/flex-tree/context.js +12 -18
  106. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  107. package/dist/feature-libraries/flex-tree/index.d.ts +1 -1
  108. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  109. package/dist/feature-libraries/flex-tree/index.js +1 -2
  110. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  111. package/dist/feature-libraries/flex-tree/lazyField.d.ts +1 -5
  112. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  113. package/dist/feature-libraries/flex-tree/lazyField.js +2 -16
  114. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  115. package/dist/feature-libraries/flex-tree/utilities.d.ts +6 -6
  116. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  117. package/dist/feature-libraries/flex-tree/utilities.js +6 -7
  118. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  119. package/dist/feature-libraries/index.d.ts +3 -3
  120. package/dist/feature-libraries/index.d.ts.map +1 -1
  121. package/dist/feature-libraries/index.js +3 -2
  122. package/dist/feature-libraries/index.js.map +1 -1
  123. package/dist/feature-libraries/initializeForest.d.ts.map +1 -1
  124. package/dist/feature-libraries/initializeForest.js.map +1 -1
  125. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  126. package/dist/feature-libraries/treeCursorUtils.js +1 -1
  127. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  128. package/dist/feature-libraries/valueUtilities.d.ts.map +1 -1
  129. package/dist/feature-libraries/valueUtilities.js +6 -6
  130. package/dist/feature-libraries/valueUtilities.js.map +1 -1
  131. package/dist/jsonDomainSchema.d.ts.map +1 -1
  132. package/dist/jsonDomainSchema.js.map +1 -1
  133. package/dist/packageVersion.d.ts +1 -1
  134. package/dist/packageVersion.js +1 -1
  135. package/dist/packageVersion.js.map +1 -1
  136. package/dist/serializableDomainSchema.d.ts.map +1 -1
  137. package/dist/serializableDomainSchema.js.map +1 -1
  138. package/dist/shared-tree/checkoutFlexTreeView.d.ts +7 -3
  139. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  140. package/dist/shared-tree/checkoutFlexTreeView.js +11 -2
  141. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  142. package/dist/shared-tree/schematizingTreeView.d.ts +3 -0
  143. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  144. package/dist/shared-tree/schematizingTreeView.js +10 -5
  145. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  146. package/dist/shared-tree/treeAlpha.d.ts +9 -4
  147. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  148. package/dist/shared-tree/treeAlpha.js +20 -8
  149. package/dist/shared-tree/treeAlpha.js.map +1 -1
  150. package/dist/sharedTreeAttributes.d.ts.map +1 -1
  151. package/dist/sharedTreeAttributes.js.map +1 -1
  152. package/dist/simple-tree/api/create.d.ts +5 -1
  153. package/dist/simple-tree/api/create.d.ts.map +1 -1
  154. package/dist/simple-tree/api/create.js +11 -12
  155. package/dist/simple-tree/api/create.js.map +1 -1
  156. package/dist/simple-tree/api/index.d.ts +3 -3
  157. package/dist/simple-tree/api/index.d.ts.map +1 -1
  158. package/dist/simple-tree/api/index.js +4 -2
  159. package/dist/simple-tree/api/index.js.map +1 -1
  160. package/dist/simple-tree/api/storedSchema.d.ts +1 -8
  161. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  162. package/dist/simple-tree/api/storedSchema.js +3 -14
  163. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  164. package/dist/simple-tree/api/treeNodeApi.d.ts +8 -0
  165. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  166. package/dist/simple-tree/api/treeNodeApi.js +3 -1
  167. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  168. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  169. package/dist/simple-tree/arrayNode.js +3 -9
  170. package/dist/simple-tree/arrayNode.js.map +1 -1
  171. package/dist/simple-tree/core/getOrCreateNode.js +1 -1
  172. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  173. package/dist/simple-tree/core/treeNodeKernel.d.ts +5 -17
  174. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  175. package/dist/simple-tree/core/treeNodeKernel.js +17 -48
  176. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  177. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +4 -4
  178. package/dist/simple-tree/core/unhydratedFlexTree.js +4 -4
  179. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  180. package/dist/simple-tree/getTreeNodeForField.d.ts +12 -0
  181. package/dist/simple-tree/getTreeNodeForField.d.ts.map +1 -0
  182. package/dist/simple-tree/getTreeNodeForField.js +39 -0
  183. package/dist/simple-tree/getTreeNodeForField.js.map +1 -0
  184. package/dist/simple-tree/index.d.ts +3 -2
  185. package/dist/simple-tree/index.d.ts.map +1 -1
  186. package/dist/simple-tree/index.js +10 -6
  187. package/dist/simple-tree/index.js.map +1 -1
  188. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  189. package/dist/simple-tree/mapNode.js +21 -24
  190. package/dist/simple-tree/mapNode.js.map +1 -1
  191. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  192. package/dist/simple-tree/objectNode.js +5 -7
  193. package/dist/simple-tree/objectNode.js.map +1 -1
  194. package/dist/simple-tree/prepareForInsertion.d.ts +42 -0
  195. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -0
  196. package/dist/simple-tree/prepareForInsertion.js +166 -0
  197. package/dist/simple-tree/prepareForInsertion.js.map +1 -0
  198. package/dist/simple-tree/toMapTree.d.ts +4 -9
  199. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  200. package/dist/simple-tree/toMapTree.js +4 -23
  201. package/dist/simple-tree/toMapTree.js.map +1 -1
  202. package/dist/tableSchema.d.ts +201 -104
  203. package/dist/tableSchema.d.ts.map +1 -1
  204. package/dist/tableSchema.js +155 -58
  205. package/dist/tableSchema.js.map +1 -1
  206. package/dist/treeFactory.d.ts.map +1 -1
  207. package/dist/treeFactory.js +2 -2
  208. package/dist/treeFactory.js.map +1 -1
  209. package/lib/alpha.d.ts +2 -0
  210. package/lib/codec/codec.d.ts +42 -7
  211. package/lib/codec/codec.d.ts.map +1 -1
  212. package/lib/codec/codec.js +50 -8
  213. package/lib/codec/codec.js.map +1 -1
  214. package/lib/core/change-family/editBuilder.d.ts.map +1 -1
  215. package/lib/core/change-family/editBuilder.js.map +1 -1
  216. package/lib/core/forest/forest.d.ts.map +1 -1
  217. package/lib/core/forest/forest.js.map +1 -1
  218. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  219. package/lib/core/schema-stored/schema.js.map +1 -1
  220. package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  221. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  222. package/lib/core/schema-stored/storedSchemaRepository.js +1 -1
  223. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  224. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  225. package/lib/core/tree/anchorSet.js +2 -2
  226. package/lib/core/tree/anchorSet.js.map +1 -1
  227. package/lib/core/tree/chunk.d.ts.map +1 -1
  228. package/lib/core/tree/chunk.js.map +1 -1
  229. package/lib/core/tree/delta.d.ts.map +1 -1
  230. package/lib/core/tree/delta.js.map +1 -1
  231. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  232. package/lib/core/tree/deltaUtil.js.map +1 -1
  233. package/lib/core/tree/detachedFieldIndex.d.ts +1 -1
  234. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  235. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  236. package/lib/core/tree/detachedFieldIndexCodec.d.ts +1 -1
  237. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  238. package/lib/core/tree/detachedFieldIndexCodec.js +1 -1
  239. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  240. package/lib/core/tree/pathTree.d.ts.map +1 -1
  241. package/lib/core/tree/pathTree.js.map +1 -1
  242. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  243. package/lib/core/tree/treeTextFormat.js.map +1 -1
  244. package/lib/core/tree/visitDelta.d.ts +1 -1
  245. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  246. package/lib/core/tree/visitDelta.js.map +1 -1
  247. package/lib/core/tree/visitorUtils.d.ts +2 -2
  248. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  249. package/lib/core/tree/visitorUtils.js.map +1 -1
  250. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
  251. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  252. package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -1
  253. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  254. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
  255. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  256. package/lib/feature-libraries/chunked-forest/chunkedForest.js +1 -1
  257. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  258. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
  259. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  260. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  261. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +2 -2
  262. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  263. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  264. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  265. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  266. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +8 -2
  267. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  268. package/lib/feature-libraries/chunked-forest/codec/codecs.js +10 -0
  269. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  270. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  271. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  272. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  273. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  274. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  275. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  276. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  277. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  278. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +1 -1
  279. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  280. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  281. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  282. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  283. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  284. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  285. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  286. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  287. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  288. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  289. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  290. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  291. package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -1
  292. package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  293. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -1
  294. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  295. package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  296. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  297. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  298. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  299. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  300. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  301. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  302. package/lib/feature-libraries/default-schema/index.js +1 -1
  303. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  304. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  305. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  306. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +4 -0
  307. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  308. package/lib/feature-libraries/default-schema/schemaChecker.js +33 -25
  309. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  310. package/lib/feature-libraries/flex-tree/context.d.ts +16 -14
  311. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  312. package/lib/feature-libraries/flex-tree/context.js +11 -16
  313. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  314. package/lib/feature-libraries/flex-tree/index.d.ts +1 -1
  315. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  316. package/lib/feature-libraries/flex-tree/index.js +1 -1
  317. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  318. package/lib/feature-libraries/flex-tree/lazyField.d.ts +1 -5
  319. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  320. package/lib/feature-libraries/flex-tree/lazyField.js +1 -14
  321. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  322. package/lib/feature-libraries/flex-tree/utilities.d.ts +6 -6
  323. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  324. package/lib/feature-libraries/flex-tree/utilities.js +6 -7
  325. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  326. package/lib/feature-libraries/index.d.ts +3 -3
  327. package/lib/feature-libraries/index.d.ts.map +1 -1
  328. package/lib/feature-libraries/index.js +3 -3
  329. package/lib/feature-libraries/index.js.map +1 -1
  330. package/lib/feature-libraries/initializeForest.d.ts.map +1 -1
  331. package/lib/feature-libraries/initializeForest.js.map +1 -1
  332. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  333. package/lib/feature-libraries/treeCursorUtils.js +1 -1
  334. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  335. package/lib/feature-libraries/valueUtilities.d.ts.map +1 -1
  336. package/lib/feature-libraries/valueUtilities.js +1 -1
  337. package/lib/feature-libraries/valueUtilities.js.map +1 -1
  338. package/lib/jsonDomainSchema.d.ts.map +1 -1
  339. package/lib/jsonDomainSchema.js.map +1 -1
  340. package/lib/packageVersion.d.ts +1 -1
  341. package/lib/packageVersion.js +1 -1
  342. package/lib/packageVersion.js.map +1 -1
  343. package/lib/serializableDomainSchema.d.ts.map +1 -1
  344. package/lib/serializableDomainSchema.js.map +1 -1
  345. package/lib/shared-tree/checkoutFlexTreeView.d.ts +7 -3
  346. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  347. package/lib/shared-tree/checkoutFlexTreeView.js +12 -3
  348. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  349. package/lib/shared-tree/schematizingTreeView.d.ts +3 -0
  350. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  351. package/lib/shared-tree/schematizingTreeView.js +11 -6
  352. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  353. package/lib/shared-tree/treeAlpha.d.ts +9 -4
  354. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  355. package/lib/shared-tree/treeAlpha.js +22 -10
  356. package/lib/shared-tree/treeAlpha.js.map +1 -1
  357. package/lib/sharedTreeAttributes.d.ts.map +1 -1
  358. package/lib/sharedTreeAttributes.js.map +1 -1
  359. package/lib/simple-tree/api/create.d.ts +5 -1
  360. package/lib/simple-tree/api/create.d.ts.map +1 -1
  361. package/lib/simple-tree/api/create.js +9 -11
  362. package/lib/simple-tree/api/create.js.map +1 -1
  363. package/lib/simple-tree/api/index.d.ts +3 -3
  364. package/lib/simple-tree/api/index.d.ts.map +1 -1
  365. package/lib/simple-tree/api/index.js +3 -3
  366. package/lib/simple-tree/api/index.js.map +1 -1
  367. package/lib/simple-tree/api/storedSchema.d.ts +1 -8
  368. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  369. package/lib/simple-tree/api/storedSchema.js +2 -12
  370. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  371. package/lib/simple-tree/api/treeNodeApi.d.ts +8 -0
  372. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  373. package/lib/simple-tree/api/treeNodeApi.js +2 -2
  374. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  375. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  376. package/lib/simple-tree/arrayNode.js +4 -10
  377. package/lib/simple-tree/arrayNode.js.map +1 -1
  378. package/lib/simple-tree/core/getOrCreateNode.js +2 -2
  379. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  380. package/lib/simple-tree/core/treeNodeKernel.d.ts +5 -17
  381. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  382. package/lib/simple-tree/core/treeNodeKernel.js +16 -47
  383. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  384. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +4 -4
  385. package/lib/simple-tree/core/unhydratedFlexTree.js +4 -4
  386. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  387. package/lib/simple-tree/getTreeNodeForField.d.ts +12 -0
  388. package/lib/simple-tree/getTreeNodeForField.d.ts.map +1 -0
  389. package/lib/simple-tree/getTreeNodeForField.js +35 -0
  390. package/lib/simple-tree/getTreeNodeForField.js.map +1 -0
  391. package/lib/simple-tree/index.d.ts +3 -2
  392. package/lib/simple-tree/index.d.ts.map +1 -1
  393. package/lib/simple-tree/index.js +3 -2
  394. package/lib/simple-tree/index.js.map +1 -1
  395. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  396. package/lib/simple-tree/mapNode.js +3 -6
  397. package/lib/simple-tree/mapNode.js.map +1 -1
  398. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  399. package/lib/simple-tree/objectNode.js +4 -6
  400. package/lib/simple-tree/objectNode.js.map +1 -1
  401. package/lib/simple-tree/prepareForInsertion.d.ts +42 -0
  402. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -0
  403. package/lib/simple-tree/prepareForInsertion.js +160 -0
  404. package/lib/simple-tree/prepareForInsertion.js.map +1 -0
  405. package/lib/simple-tree/toMapTree.d.ts +4 -9
  406. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  407. package/lib/simple-tree/toMapTree.js +4 -22
  408. package/lib/simple-tree/toMapTree.js.map +1 -1
  409. package/lib/tableSchema.d.ts +201 -104
  410. package/lib/tableSchema.d.ts.map +1 -1
  411. package/lib/tableSchema.js +156 -59
  412. package/lib/tableSchema.js.map +1 -1
  413. package/lib/treeFactory.d.ts.map +1 -1
  414. package/lib/treeFactory.js +2 -2
  415. package/lib/treeFactory.js.map +1 -1
  416. package/lib/tsdoc-metadata.json +1 -1
  417. package/package.json +25 -25
  418. package/src/codec/codec.ts +54 -8
  419. package/src/core/change-family/editBuilder.ts +1 -0
  420. package/src/core/forest/forest.ts +1 -1
  421. package/src/core/schema-stored/schema.ts +2 -0
  422. package/src/core/schema-stored/storedSchemaRepository.ts +2 -2
  423. package/src/core/tree/anchorSet.ts +4 -4
  424. package/src/core/tree/chunk.ts +2 -1
  425. package/src/core/tree/delta.ts +1 -0
  426. package/src/core/tree/deltaUtil.ts +1 -1
  427. package/src/core/tree/detachedFieldIndex.ts +1 -1
  428. package/src/core/tree/detachedFieldIndexCodec.ts +2 -2
  429. package/src/core/tree/pathTree.ts +1 -1
  430. package/src/core/tree/treeTextFormat.ts +1 -0
  431. package/src/core/tree/visitDelta.ts +1 -1
  432. package/src/core/tree/visitorUtils.ts +3 -2
  433. package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -2
  434. package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -3
  435. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +5 -5
  436. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +2 -2
  437. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -0
  438. package/src/feature-libraries/chunked-forest/codec/codecs.ts +15 -1
  439. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +1 -1
  440. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -0
  441. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +1 -1
  442. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +1 -1
  443. package/src/feature-libraries/chunked-forest/emptyChunk.ts +1 -0
  444. package/src/feature-libraries/chunked-forest/index.ts +1 -0
  445. package/src/feature-libraries/chunked-forest/sequenceChunk.ts +1 -1
  446. package/src/feature-libraries/chunked-forest/uniformChunk.ts +2 -3
  447. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +1 -1
  448. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -0
  449. package/src/feature-libraries/default-schema/index.ts +6 -1
  450. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +1 -0
  451. package/src/feature-libraries/default-schema/schemaChecker.ts +37 -26
  452. package/src/feature-libraries/flex-tree/context.ts +18 -20
  453. package/src/feature-libraries/flex-tree/index.ts +0 -1
  454. package/src/feature-libraries/flex-tree/lazyField.ts +2 -14
  455. package/src/feature-libraries/flex-tree/utilities.ts +8 -8
  456. package/src/feature-libraries/index.ts +2 -1
  457. package/src/feature-libraries/initializeForest.ts +1 -1
  458. package/src/feature-libraries/treeCursorUtils.ts +1 -1
  459. package/src/feature-libraries/valueUtilities.ts +1 -1
  460. package/src/jsonDomainSchema.ts +0 -1
  461. package/src/packageVersion.ts +1 -1
  462. package/src/serializableDomainSchema.ts +1 -0
  463. package/src/shared-tree/checkoutFlexTreeView.ts +10 -6
  464. package/src/shared-tree/schematizingTreeView.ts +11 -12
  465. package/src/shared-tree/treeAlpha.ts +50 -13
  466. package/src/sharedTreeAttributes.ts +1 -0
  467. package/src/simple-tree/api/create.ts +17 -16
  468. package/src/simple-tree/api/index.ts +13 -3
  469. package/src/simple-tree/api/storedSchema.ts +2 -19
  470. package/src/simple-tree/api/treeNodeApi.ts +2 -2
  471. package/src/simple-tree/arrayNode.ts +9 -20
  472. package/src/simple-tree/core/getOrCreateNode.ts +2 -2
  473. package/src/simple-tree/core/treeNodeKernel.ts +22 -53
  474. package/src/simple-tree/core/unhydratedFlexTree.ts +4 -4
  475. package/src/simple-tree/getTreeNodeForField.ts +46 -0
  476. package/src/simple-tree/index.ts +8 -5
  477. package/src/simple-tree/mapNode.ts +8 -12
  478. package/src/simple-tree/objectNode.ts +3 -12
  479. package/src/simple-tree/prepareForInsertion.ts +276 -0
  480. package/src/simple-tree/toMapTree.ts +3 -27
  481. package/src/tableSchema.ts +351 -138
  482. package/src/treeFactory.ts +2 -4
  483. package/dist/simple-tree/proxies.d.ts +0 -23
  484. package/dist/simple-tree/proxies.d.ts.map +0 -1
  485. package/dist/simple-tree/proxies.js +0 -135
  486. package/dist/simple-tree/proxies.js.map +0 -1
  487. package/lib/simple-tree/proxies.d.ts +0 -23
  488. package/lib/simple-tree/proxies.d.ts.map +0 -1
  489. package/lib/simple-tree/proxies.js +0 -130
  490. package/lib/simple-tree/proxies.js.map +0 -1
  491. package/src/simple-tree/proxies.ts +0 -191
@@ -4,7 +4,6 @@
4
4
  */
5
5
 
6
6
  import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
7
-
8
7
  import type { SharedObjectKind } from "@fluidframework/shared-object-base";
9
8
  import {
10
9
  type ISharedObject,
@@ -15,6 +14,7 @@ import {
15
14
  type SharedObjectOptions,
16
15
  type FactoryOut,
17
16
  } from "@fluidframework/shared-object-base/internal";
17
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
18
18
 
19
19
  import {
20
20
  SharedTreeKernel,
@@ -23,11 +23,9 @@ import {
23
23
  type SharedTreeOptionsInternal,
24
24
  type SharedTreeKernelView,
25
25
  } from "./shared-tree/index.js";
26
+ import { SharedTreeFactoryType, SharedTreeAttributes } from "./sharedTreeAttributes.js";
26
27
  import type { ITree } from "./simple-tree/index.js";
27
-
28
28
  import { Breakable } from "./util/index.js";
29
- import { UsageError } from "@fluidframework/telemetry-utils/internal";
30
- import { SharedTreeFactoryType, SharedTreeAttributes } from "./sharedTreeAttributes.js";
31
29
 
32
30
  /**
33
31
  * {@link ITreePrivate} extended with ISharedObject.
@@ -1,23 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { type IForestSubscription, type MapTree, type TreeValue } from "../core/index.js";
6
- import { type FlexTreeField } from "../feature-libraries/index.js";
7
- import { type TreeNode } from "./core/index.js";
8
- /**
9
- * Retrieve the associated {@link TreeNode} for the given field's content.
10
- */
11
- export declare function getTreeNodeForField(field: FlexTreeField): TreeNode | TreeValue | undefined;
12
- /**
13
- * Records any proxies in the given content tree and does the necessary bookkeeping to ensure they are synchronized with subsequent reads of the tree.
14
- * @remarks If the content tree contains any proxies, this function must be called just prior to inserting the content into the tree.
15
- * Specifically, no other content may be inserted into the tree between the invocation of this function and the insertion of `content`.
16
- * The insertion of `content` must occur or else this function will cause memory leaks.
17
- * @param content - the tree of content to be inserted, of which any of its object/map/array nodes might be a proxy
18
- * @param anchors - the {@link AnchorSet} for the tree
19
- * @returns The content after having all proxies replaced inline with plain javascript objects.
20
- * See {@link extractFactoryContent} for more details.
21
- */
22
- export declare function prepareContentForHydration(content: MapTree | readonly MapTree[] | undefined, forest: IForestSubscription): void;
23
- //# sourceMappingURL=proxies.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proxies.d.ts","sourceRoot":"","sources":["../../src/simple-tree/proxies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAEN,KAAK,mBAAmB,EACxB,KAAK,OAAO,EACZ,KAAK,SAAS,EAEd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEN,KAAK,aAAa,EAIlB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAEN,KAAK,QAAQ,EAIb,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CA0B1F;AAgBD;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACzC,OAAO,EAAE,OAAO,GAAG,SAAS,OAAO,EAAE,GAAG,SAAS,EACjD,MAAM,EAAE,mBAAmB,GACzB,IAAI,CAiBN"}
@@ -1,135 +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.prepareContentForHydration = exports.getTreeNodeForField = void 0;
8
- const internal_1 = require("@fluidframework/telemetry-utils/internal");
9
- const internal_2 = require("@fluidframework/core-utils/internal");
10
- const index_js_1 = require("../core/index.js");
11
- const index_js_2 = require("../feature-libraries/index.js");
12
- const index_js_3 = require("../util/index.js");
13
- const index_js_4 = require("./core/index.js");
14
- /**
15
- * Retrieve the associated {@link TreeNode} for the given field's content.
16
- */
17
- function getTreeNodeForField(field) {
18
- function tryToUnboxLeaves(flexField) {
19
- const maybeContent = flexField.content;
20
- return (0, index_js_2.isFlexTreeNode)(maybeContent)
21
- ? (0, index_js_4.getOrCreateNodeFromInnerNode)(maybeContent)
22
- : maybeContent;
23
- }
24
- switch (field.schema) {
25
- case index_js_2.FieldKinds.required.identifier: {
26
- const typedField = field;
27
- return tryToUnboxLeaves(typedField);
28
- }
29
- case index_js_2.FieldKinds.optional.identifier: {
30
- const typedField = field;
31
- return tryToUnboxLeaves(typedField);
32
- }
33
- case index_js_2.FieldKinds.identifier.identifier: {
34
- // Identifier fields are just value fields that hold strings
35
- return field.content;
36
- }
37
- default:
38
- (0, internal_2.fail)(0xadf /* invalid field kind */);
39
- }
40
- }
41
- exports.getTreeNodeForField = getTreeNodeForField;
42
- /**
43
- * Records any proxies in the given content tree and does the necessary bookkeeping to ensure they are synchronized with subsequent reads of the tree.
44
- * @remarks If the content tree contains any proxies, this function must be called just prior to inserting the content into the tree.
45
- * Specifically, no other content may be inserted into the tree between the invocation of this function and the insertion of `content`.
46
- * The insertion of `content` must occur or else this function will cause memory leaks.
47
- * @param content - the tree of content to be inserted, of which any of its object/map/array nodes might be a proxy
48
- * @param anchors - the {@link AnchorSet} for the tree
49
- * @returns The content after having all proxies replaced inline with plain javascript objects.
50
- * See {@link extractFactoryContent} for more details.
51
- */
52
- function prepareContentForHydration(content, forest) {
53
- if ((0, index_js_3.isReadonlyArray)(content)) {
54
- return prepareArrayContentForHydration(content, forest);
55
- }
56
- if (content !== undefined) {
57
- const proxies = {
58
- rootPath: { parent: undefined, parentField: index_js_1.EmptyKey, parentIndex: 0 },
59
- proxyPaths: [],
60
- };
61
- walkMapTree(content, proxies.rootPath, (p, proxy) => {
62
- proxies.proxyPaths.push({ path: p, proxy });
63
- });
64
- bindProxies([proxies], forest);
65
- }
66
- }
67
- exports.prepareContentForHydration = prepareContentForHydration;
68
- function prepareArrayContentForHydration(content, forest) {
69
- const proxyPaths = [];
70
- for (const item of content) {
71
- const proxyPath = {
72
- rootPath: {
73
- parent: undefined,
74
- parentField: index_js_1.EmptyKey,
75
- parentIndex: 0,
76
- },
77
- proxyPaths: [],
78
- };
79
- proxyPaths.push(proxyPath);
80
- walkMapTree(item, proxyPath.rootPath, (p, proxy) => {
81
- proxyPath.proxyPaths.push({ path: p, proxy });
82
- });
83
- }
84
- bindProxies(proxyPaths, forest);
85
- }
86
- function walkMapTree(mapTree, path, onVisitTreeNode) {
87
- if ((0, index_js_4.tryUnhydratedFlexTreeNode)(mapTree)?.parentField.parent.parent !== undefined) {
88
- throw new internal_1.UsageError("Attempted to insert a node which is already under a parent. If this is desired, remove the node from its parent before inserting it elsewhere.");
89
- }
90
- const nexts = [];
91
- for (let next = [path, mapTree]; next !== undefined; next = nexts.pop()) {
92
- const [p, m] = next;
93
- const mapTreeNode = (0, index_js_4.tryUnhydratedFlexTreeNode)(m);
94
- if (mapTreeNode !== undefined) {
95
- const treeNode = index_js_4.unhydratedFlexTreeNodeToTreeNode.get(mapTreeNode);
96
- if (treeNode !== undefined) {
97
- onVisitTreeNode(p, treeNode);
98
- }
99
- }
100
- for (const [key, field] of m.fields) {
101
- for (const [i, child] of field.entries()) {
102
- nexts.push([
103
- {
104
- parent: p,
105
- parentField: key,
106
- parentIndex: i,
107
- },
108
- child,
109
- ]);
110
- }
111
- }
112
- }
113
- }
114
- function bindProxies(proxies, forest) {
115
- // Only subscribe to the event if there is at least one proxy tree to hydrate - this is not the case when inserting an empty array [].
116
- if (proxies.length > 0) {
117
- // Creating a new array emits one event per element in the array, so listen to the event once for each element
118
- let i = 0;
119
- const off = forest.events.on("afterRootFieldCreated", (fieldKey) => {
120
- // Non null asserting here because of the length check above
121
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
122
- proxies[i].rootPath.parentField = fieldKey;
123
- // Non null asserting here because of the length check above
124
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
125
- for (const { path, proxy } of proxies[i].proxyPaths) {
126
- (0, index_js_4.getKernel)(proxy).anchorProxy(forest.anchors, path);
127
- }
128
- if (++i === proxies.length) {
129
- off();
130
- }
131
- });
132
- }
133
- }
134
- // #endregion Content insertion and proxy binding
135
- //# sourceMappingURL=proxies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proxies.js","sourceRoot":"","sources":["../../src/simple-tree/proxies.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uEAAsE;AACtE,kEAA2D;AAC3D,+CAM0B;AAE1B,4DAMuC;AACvC,+CAAiE;AACjE,8CAMyB;AAEzB;;GAEG;AACH,SAAgB,mBAAmB,CAAC,KAAoB;IACvD,SAAS,gBAAgB,CACxB,SAAwD;QAExD,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC;QACvC,OAAO,IAAA,yBAAc,EAAC,YAAY,CAAC;Y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CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACpD,CAAC;YACD,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;gBAC5B,GAAG,EAAE,CAAC;YACP,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAED,iDAAiD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport {\n\tEmptyKey,\n\ttype IForestSubscription,\n\ttype MapTree,\n\ttype TreeValue,\n\ttype UpPath,\n} from \"../core/index.js\";\n\nimport {\n\tFieldKinds,\n\ttype FlexTreeField,\n\tisFlexTreeNode,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeOptionalField,\n} from \"../feature-libraries/index.js\";\nimport { type Mutable, isReadonlyArray } from \"../util/index.js\";\nimport {\n\tgetKernel,\n\ttype TreeNode,\n\tgetOrCreateNodeFromInnerNode,\n\ttryUnhydratedFlexTreeNode,\n\tunhydratedFlexTreeNodeToTreeNode,\n} from \"./core/index.js\";\n\n/**\n * Retrieve the associated {@link TreeNode} for the given field's content.\n */\nexport function getTreeNodeForField(field: FlexTreeField): TreeNode | TreeValue | undefined {\n\tfunction tryToUnboxLeaves(\n\t\tflexField: FlexTreeOptionalField | FlexTreeRequiredField,\n\t): TreeNode | TreeValue | undefined {\n\t\tconst maybeContent = flexField.content;\n\t\treturn isFlexTreeNode(maybeContent)\n\t\t\t? getOrCreateNodeFromInnerNode(maybeContent)\n\t\t\t: maybeContent;\n\t}\n\tswitch (field.schema) {\n\t\tcase FieldKinds.required.identifier: {\n\t\t\tconst typedField = field as FlexTreeRequiredField;\n\t\t\treturn tryToUnboxLeaves(typedField);\n\t\t}\n\t\tcase FieldKinds.optional.identifier: {\n\t\t\tconst typedField = field as FlexTreeOptionalField;\n\t\t\treturn tryToUnboxLeaves(typedField);\n\t\t}\n\t\tcase FieldKinds.identifier.identifier: {\n\t\t\t// Identifier fields are just value fields that hold strings\n\t\t\treturn (field as FlexTreeRequiredField).content as string;\n\t\t}\n\n\t\tdefault:\n\t\t\tfail(0xadf /* invalid field kind */);\n\t}\n}\n\n// #region Content insertion and proxy binding\n\n/** The path of a proxy, relative to the root of the content tree that the proxy belongs to */\ninterface RelativeProxyPath {\n\treadonly path: UpPath;\n\treadonly proxy: TreeNode;\n}\n\n/** All {@link RelativeProxyPath}s that are under the given root path */\ninterface RootedProxyPaths {\n\treadonly rootPath: UpPath;\n\treadonly proxyPaths: RelativeProxyPath[];\n}\n\n/**\n * Records any proxies in the given content tree and does the necessary bookkeeping to ensure they are synchronized with subsequent reads of the tree.\n * @remarks If the content tree contains any proxies, this function must be called just prior to inserting the content into the tree.\n * Specifically, no other content may be inserted into the tree between the invocation of this function and the insertion of `content`.\n * The insertion of `content` must occur or else this function will cause memory leaks.\n * @param content - the tree of content to be inserted, of which any of its object/map/array nodes might be a proxy\n * @param anchors - the {@link AnchorSet} for the tree\n * @returns The content after having all proxies replaced inline with plain javascript objects.\n * See {@link extractFactoryContent} for more details.\n */\nexport function prepareContentForHydration(\n\tcontent: MapTree | readonly MapTree[] | undefined,\n\tforest: IForestSubscription,\n): void {\n\tif (isReadonlyArray(content)) {\n\t\treturn prepareArrayContentForHydration(content, forest);\n\t}\n\n\tif (content !== undefined) {\n\t\tconst proxies: RootedProxyPaths = {\n\t\t\trootPath: { parent: undefined, parentField: EmptyKey, parentIndex: 0 },\n\t\t\tproxyPaths: [],\n\t\t};\n\n\t\twalkMapTree(content, proxies.rootPath, (p, proxy) => {\n\t\t\tproxies.proxyPaths.push({ path: p, proxy });\n\t\t});\n\n\t\tbindProxies([proxies], forest);\n\t}\n}\n\nfunction prepareArrayContentForHydration(\n\tcontent: readonly MapTree[],\n\tforest: IForestSubscription,\n): void {\n\tconst proxyPaths: RootedProxyPaths[] = [];\n\tfor (const item of content) {\n\t\tconst proxyPath: RootedProxyPaths = {\n\t\t\trootPath: {\n\t\t\t\tparent: undefined,\n\t\t\t\tparentField: EmptyKey,\n\t\t\t\tparentIndex: 0,\n\t\t\t},\n\t\t\tproxyPaths: [],\n\t\t};\n\t\tproxyPaths.push(proxyPath);\n\t\twalkMapTree(item, proxyPath.rootPath, (p, proxy) => {\n\t\t\tproxyPath.proxyPaths.push({ path: p, proxy });\n\t\t});\n\t}\n\n\tbindProxies(proxyPaths, forest);\n}\n\nfunction walkMapTree(\n\tmapTree: MapTree,\n\tpath: UpPath,\n\tonVisitTreeNode: (path: UpPath, treeNode: TreeNode) => void,\n): void {\n\tif (tryUnhydratedFlexTreeNode(mapTree)?.parentField.parent.parent !== undefined) {\n\t\tthrow new UsageError(\n\t\t\t\"Attempted to insert a node which is already under a parent. If this is desired, remove the node from its parent before inserting it elsewhere.\",\n\t\t);\n\t}\n\n\ttype Next = [path: UpPath, tree: MapTree];\n\tconst nexts: Next[] = [];\n\tfor (let next: Next | undefined = [path, mapTree]; next !== undefined; next = nexts.pop()) {\n\t\tconst [p, m] = next;\n\t\tconst mapTreeNode = tryUnhydratedFlexTreeNode(m);\n\t\tif (mapTreeNode !== undefined) {\n\t\t\tconst treeNode = unhydratedFlexTreeNodeToTreeNode.get(mapTreeNode);\n\t\t\tif (treeNode !== undefined) {\n\t\t\t\tonVisitTreeNode(p, treeNode);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, field] of m.fields) {\n\t\t\tfor (const [i, child] of field.entries()) {\n\t\t\t\tnexts.push([\n\t\t\t\t\t{\n\t\t\t\t\t\tparent: p,\n\t\t\t\t\t\tparentField: key,\n\t\t\t\t\t\tparentIndex: i,\n\t\t\t\t\t},\n\t\t\t\t\tchild,\n\t\t\t\t]);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction bindProxies(proxies: RootedProxyPaths[], forest: IForestSubscription): void {\n\t// Only subscribe to the event if there is at least one proxy tree to hydrate - this is not the case when inserting an empty array [].\n\tif (proxies.length > 0) {\n\t\t// Creating a new array emits one event per element in the array, so listen to the event once for each element\n\t\tlet i = 0;\n\t\tconst off = forest.events.on(\"afterRootFieldCreated\", (fieldKey) => {\n\t\t\t// Non null asserting here because of the length check above\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t(proxies[i]!.rootPath as Mutable<UpPath>).parentField = fieldKey;\n\t\t\t// Non null asserting here because of the length check above\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tfor (const { path, proxy } of proxies[i]!.proxyPaths) {\n\t\t\t\tgetKernel(proxy).anchorProxy(forest.anchors, path);\n\t\t\t}\n\t\t\tif (++i === proxies.length) {\n\t\t\t\toff();\n\t\t\t}\n\t\t});\n\t}\n}\n\n// #endregion Content insertion and proxy binding\n"]}
@@ -1,23 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { type IForestSubscription, type MapTree, type TreeValue } from "../core/index.js";
6
- import { type FlexTreeField } from "../feature-libraries/index.js";
7
- import { type TreeNode } from "./core/index.js";
8
- /**
9
- * Retrieve the associated {@link TreeNode} for the given field's content.
10
- */
11
- export declare function getTreeNodeForField(field: FlexTreeField): TreeNode | TreeValue | undefined;
12
- /**
13
- * Records any proxies in the given content tree and does the necessary bookkeeping to ensure they are synchronized with subsequent reads of the tree.
14
- * @remarks If the content tree contains any proxies, this function must be called just prior to inserting the content into the tree.
15
- * Specifically, no other content may be inserted into the tree between the invocation of this function and the insertion of `content`.
16
- * The insertion of `content` must occur or else this function will cause memory leaks.
17
- * @param content - the tree of content to be inserted, of which any of its object/map/array nodes might be a proxy
18
- * @param anchors - the {@link AnchorSet} for the tree
19
- * @returns The content after having all proxies replaced inline with plain javascript objects.
20
- * See {@link extractFactoryContent} for more details.
21
- */
22
- export declare function prepareContentForHydration(content: MapTree | readonly MapTree[] | undefined, forest: IForestSubscription): void;
23
- //# sourceMappingURL=proxies.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proxies.d.ts","sourceRoot":"","sources":["../../src/simple-tree/proxies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAEN,KAAK,mBAAmB,EACxB,KAAK,OAAO,EACZ,KAAK,SAAS,EAEd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEN,KAAK,aAAa,EAIlB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAEN,KAAK,QAAQ,EAIb,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CA0B1F;AAgBD;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACzC,OAAO,EAAE,OAAO,GAAG,SAAS,OAAO,EAAE,GAAG,SAAS,EACjD,MAAM,EAAE,mBAAmB,GACzB,IAAI,CAiBN"}
@@ -1,130 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { UsageError } from "@fluidframework/telemetry-utils/internal";
6
- import { fail } from "@fluidframework/core-utils/internal";
7
- import { EmptyKey, } from "../core/index.js";
8
- import { FieldKinds, isFlexTreeNode, } from "../feature-libraries/index.js";
9
- import { isReadonlyArray } from "../util/index.js";
10
- import { getKernel, getOrCreateNodeFromInnerNode, tryUnhydratedFlexTreeNode, unhydratedFlexTreeNodeToTreeNode, } from "./core/index.js";
11
- /**
12
- * Retrieve the associated {@link TreeNode} for the given field's content.
13
- */
14
- export function getTreeNodeForField(field) {
15
- function tryToUnboxLeaves(flexField) {
16
- const maybeContent = flexField.content;
17
- return isFlexTreeNode(maybeContent)
18
- ? getOrCreateNodeFromInnerNode(maybeContent)
19
- : maybeContent;
20
- }
21
- switch (field.schema) {
22
- case FieldKinds.required.identifier: {
23
- const typedField = field;
24
- return tryToUnboxLeaves(typedField);
25
- }
26
- case FieldKinds.optional.identifier: {
27
- const typedField = field;
28
- return tryToUnboxLeaves(typedField);
29
- }
30
- case FieldKinds.identifier.identifier: {
31
- // Identifier fields are just value fields that hold strings
32
- return field.content;
33
- }
34
- default:
35
- fail(0xadf /* invalid field kind */);
36
- }
37
- }
38
- /**
39
- * Records any proxies in the given content tree and does the necessary bookkeeping to ensure they are synchronized with subsequent reads of the tree.
40
- * @remarks If the content tree contains any proxies, this function must be called just prior to inserting the content into the tree.
41
- * Specifically, no other content may be inserted into the tree between the invocation of this function and the insertion of `content`.
42
- * The insertion of `content` must occur or else this function will cause memory leaks.
43
- * @param content - the tree of content to be inserted, of which any of its object/map/array nodes might be a proxy
44
- * @param anchors - the {@link AnchorSet} for the tree
45
- * @returns The content after having all proxies replaced inline with plain javascript objects.
46
- * See {@link extractFactoryContent} for more details.
47
- */
48
- export function prepareContentForHydration(content, forest) {
49
- if (isReadonlyArray(content)) {
50
- return prepareArrayContentForHydration(content, forest);
51
- }
52
- if (content !== undefined) {
53
- const proxies = {
54
- rootPath: { parent: undefined, parentField: EmptyKey, parentIndex: 0 },
55
- proxyPaths: [],
56
- };
57
- walkMapTree(content, proxies.rootPath, (p, proxy) => {
58
- proxies.proxyPaths.push({ path: p, proxy });
59
- });
60
- bindProxies([proxies], forest);
61
- }
62
- }
63
- function prepareArrayContentForHydration(content, forest) {
64
- const proxyPaths = [];
65
- for (const item of content) {
66
- const proxyPath = {
67
- rootPath: {
68
- parent: undefined,
69
- parentField: EmptyKey,
70
- parentIndex: 0,
71
- },
72
- proxyPaths: [],
73
- };
74
- proxyPaths.push(proxyPath);
75
- walkMapTree(item, proxyPath.rootPath, (p, proxy) => {
76
- proxyPath.proxyPaths.push({ path: p, proxy });
77
- });
78
- }
79
- bindProxies(proxyPaths, forest);
80
- }
81
- function walkMapTree(mapTree, path, onVisitTreeNode) {
82
- if (tryUnhydratedFlexTreeNode(mapTree)?.parentField.parent.parent !== undefined) {
83
- throw new UsageError("Attempted to insert a node which is already under a parent. If this is desired, remove the node from its parent before inserting it elsewhere.");
84
- }
85
- const nexts = [];
86
- for (let next = [path, mapTree]; next !== undefined; next = nexts.pop()) {
87
- const [p, m] = next;
88
- const mapTreeNode = tryUnhydratedFlexTreeNode(m);
89
- if (mapTreeNode !== undefined) {
90
- const treeNode = unhydratedFlexTreeNodeToTreeNode.get(mapTreeNode);
91
- if (treeNode !== undefined) {
92
- onVisitTreeNode(p, treeNode);
93
- }
94
- }
95
- for (const [key, field] of m.fields) {
96
- for (const [i, child] of field.entries()) {
97
- nexts.push([
98
- {
99
- parent: p,
100
- parentField: key,
101
- parentIndex: i,
102
- },
103
- child,
104
- ]);
105
- }
106
- }
107
- }
108
- }
109
- function bindProxies(proxies, forest) {
110
- // Only subscribe to the event if there is at least one proxy tree to hydrate - this is not the case when inserting an empty array [].
111
- if (proxies.length > 0) {
112
- // Creating a new array emits one event per element in the array, so listen to the event once for each element
113
- let i = 0;
114
- const off = forest.events.on("afterRootFieldCreated", (fieldKey) => {
115
- // Non null asserting here because of the length check above
116
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
117
- proxies[i].rootPath.parentField = fieldKey;
118
- // Non null asserting here because of the length check above
119
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
120
- for (const { path, proxy } of proxies[i].proxyPaths) {
121
- getKernel(proxy).anchorProxy(forest.anchors, path);
122
- }
123
- if (++i === proxies.length) {
124
- off();
125
- }
126
- });
127
- }
128
- }
129
- // #endregion Content insertion and proxy binding
130
- //# sourceMappingURL=proxies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proxies.js","sourceRoot":"","sources":["../../src/simple-tree/proxies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAC3D,OAAO,EACN,QAAQ,GAKR,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,UAAU,EAEV,cAA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5D,oEAAoE;YACnE,OAAO,CAAC,CAAC,CAAE,CAAC,QAA4B,CAAC,WAAW,GAAG,QAAQ,CAAC;YACjE,4DAA4D;YAC5D,oEAAoE;YACpE,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,OAAO,CAAC,CAAC,CAAE,CAAC,UAAU,EAAE,CAAC;gBACtD,SAAS,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACpD,CAAC;YACD,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;gBAC5B,GAAG,EAAE,CAAC;YACP,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAED,iDAAiD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport {\n\tEmptyKey,\n\ttype IForestSubscription,\n\ttype MapTree,\n\ttype TreeValue,\n\ttype UpPath,\n} from \"../core/index.js\";\n\nimport {\n\tFieldKinds,\n\ttype FlexTreeField,\n\tisFlexTreeNode,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeOptionalField,\n} from \"../feature-libraries/index.js\";\nimport { type Mutable, isReadonlyArray } from \"../util/index.js\";\nimport {\n\tgetKernel,\n\ttype TreeNode,\n\tgetOrCreateNodeFromInnerNode,\n\ttryUnhydratedFlexTreeNode,\n\tunhydratedFlexTreeNodeToTreeNode,\n} from \"./core/index.js\";\n\n/**\n * Retrieve the associated {@link TreeNode} for the given field's content.\n */\nexport function getTreeNodeForField(field: FlexTreeField): TreeNode | TreeValue | undefined {\n\tfunction tryToUnboxLeaves(\n\t\tflexField: FlexTreeOptionalField | FlexTreeRequiredField,\n\t): TreeNode | TreeValue | undefined {\n\t\tconst maybeContent = flexField.content;\n\t\treturn isFlexTreeNode(maybeContent)\n\t\t\t? getOrCreateNodeFromInnerNode(maybeContent)\n\t\t\t: maybeContent;\n\t}\n\tswitch (field.schema) {\n\t\tcase FieldKinds.required.identifier: {\n\t\t\tconst typedField = field as FlexTreeRequiredField;\n\t\t\treturn tryToUnboxLeaves(typedField);\n\t\t}\n\t\tcase FieldKinds.optional.identifier: {\n\t\t\tconst typedField = field as FlexTreeOptionalField;\n\t\t\treturn tryToUnboxLeaves(typedField);\n\t\t}\n\t\tcase FieldKinds.identifier.identifier: {\n\t\t\t// Identifier fields are just value fields that hold strings\n\t\t\treturn (field as FlexTreeRequiredField).content as string;\n\t\t}\n\n\t\tdefault:\n\t\t\tfail(0xadf /* invalid field kind */);\n\t}\n}\n\n// #region Content insertion and proxy binding\n\n/** The path of a proxy, relative to the root of the content tree that the proxy belongs to */\ninterface RelativeProxyPath {\n\treadonly path: UpPath;\n\treadonly proxy: TreeNode;\n}\n\n/** All {@link RelativeProxyPath}s that are under the given root path */\ninterface RootedProxyPaths {\n\treadonly rootPath: UpPath;\n\treadonly proxyPaths: RelativeProxyPath[];\n}\n\n/**\n * Records any proxies in the given content tree and does the necessary bookkeeping to ensure they are synchronized with subsequent reads of the tree.\n * @remarks If the content tree contains any proxies, this function must be called just prior to inserting the content into the tree.\n * Specifically, no other content may be inserted into the tree between the invocation of this function and the insertion of `content`.\n * The insertion of `content` must occur or else this function will cause memory leaks.\n * @param content - the tree of content to be inserted, of which any of its object/map/array nodes might be a proxy\n * @param anchors - the {@link AnchorSet} for the tree\n * @returns The content after having all proxies replaced inline with plain javascript objects.\n * See {@link extractFactoryContent} for more details.\n */\nexport function prepareContentForHydration(\n\tcontent: MapTree | readonly MapTree[] | undefined,\n\tforest: IForestSubscription,\n): void {\n\tif (isReadonlyArray(content)) {\n\t\treturn prepareArrayContentForHydration(content, forest);\n\t}\n\n\tif (content !== undefined) {\n\t\tconst proxies: RootedProxyPaths = {\n\t\t\trootPath: { parent: undefined, parentField: EmptyKey, parentIndex: 0 },\n\t\t\tproxyPaths: [],\n\t\t};\n\n\t\twalkMapTree(content, proxies.rootPath, (p, proxy) => {\n\t\t\tproxies.proxyPaths.push({ path: p, proxy });\n\t\t});\n\n\t\tbindProxies([proxies], forest);\n\t}\n}\n\nfunction prepareArrayContentForHydration(\n\tcontent: readonly MapTree[],\n\tforest: IForestSubscription,\n): void {\n\tconst proxyPaths: RootedProxyPaths[] = [];\n\tfor (const item of content) {\n\t\tconst proxyPath: RootedProxyPaths = {\n\t\t\trootPath: {\n\t\t\t\tparent: undefined,\n\t\t\t\tparentField: EmptyKey,\n\t\t\t\tparentIndex: 0,\n\t\t\t},\n\t\t\tproxyPaths: [],\n\t\t};\n\t\tproxyPaths.push(proxyPath);\n\t\twalkMapTree(item, proxyPath.rootPath, (p, proxy) => {\n\t\t\tproxyPath.proxyPaths.push({ path: p, proxy });\n\t\t});\n\t}\n\n\tbindProxies(proxyPaths, forest);\n}\n\nfunction walkMapTree(\n\tmapTree: MapTree,\n\tpath: UpPath,\n\tonVisitTreeNode: (path: UpPath, treeNode: TreeNode) => void,\n): void {\n\tif (tryUnhydratedFlexTreeNode(mapTree)?.parentField.parent.parent !== undefined) {\n\t\tthrow new UsageError(\n\t\t\t\"Attempted to insert a node which is already under a parent. If this is desired, remove the node from its parent before inserting it elsewhere.\",\n\t\t);\n\t}\n\n\ttype Next = [path: UpPath, tree: MapTree];\n\tconst nexts: Next[] = [];\n\tfor (let next: Next | undefined = [path, mapTree]; next !== undefined; next = nexts.pop()) {\n\t\tconst [p, m] = next;\n\t\tconst mapTreeNode = tryUnhydratedFlexTreeNode(m);\n\t\tif (mapTreeNode !== undefined) {\n\t\t\tconst treeNode = unhydratedFlexTreeNodeToTreeNode.get(mapTreeNode);\n\t\t\tif (treeNode !== undefined) {\n\t\t\t\tonVisitTreeNode(p, treeNode);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, field] of m.fields) {\n\t\t\tfor (const [i, child] of field.entries()) {\n\t\t\t\tnexts.push([\n\t\t\t\t\t{\n\t\t\t\t\t\tparent: p,\n\t\t\t\t\t\tparentField: key,\n\t\t\t\t\t\tparentIndex: i,\n\t\t\t\t\t},\n\t\t\t\t\tchild,\n\t\t\t\t]);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction bindProxies(proxies: RootedProxyPaths[], forest: IForestSubscription): void {\n\t// Only subscribe to the event if there is at least one proxy tree to hydrate - this is not the case when inserting an empty array [].\n\tif (proxies.length > 0) {\n\t\t// Creating a new array emits one event per element in the array, so listen to the event once for each element\n\t\tlet i = 0;\n\t\tconst off = forest.events.on(\"afterRootFieldCreated\", (fieldKey) => {\n\t\t\t// Non null asserting here because of the length check above\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t(proxies[i]!.rootPath as Mutable<UpPath>).parentField = fieldKey;\n\t\t\t// Non null asserting here because of the length check above\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tfor (const { path, proxy } of proxies[i]!.proxyPaths) {\n\t\t\t\tgetKernel(proxy).anchorProxy(forest.anchors, path);\n\t\t\t}\n\t\t\tif (++i === proxies.length) {\n\t\t\t\toff();\n\t\t\t}\n\t\t});\n\t}\n}\n\n// #endregion Content insertion and proxy binding\n"]}
@@ -1,191 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
- import { fail } from "@fluidframework/core-utils/internal";
8
- import {
9
- EmptyKey,
10
- type IForestSubscription,
11
- type MapTree,
12
- type TreeValue,
13
- type UpPath,
14
- } from "../core/index.js";
15
-
16
- import {
17
- FieldKinds,
18
- type FlexTreeField,
19
- isFlexTreeNode,
20
- type FlexTreeRequiredField,
21
- type FlexTreeOptionalField,
22
- } from "../feature-libraries/index.js";
23
- import { type Mutable, isReadonlyArray } from "../util/index.js";
24
- import {
25
- getKernel,
26
- type TreeNode,
27
- getOrCreateNodeFromInnerNode,
28
- tryUnhydratedFlexTreeNode,
29
- unhydratedFlexTreeNodeToTreeNode,
30
- } from "./core/index.js";
31
-
32
- /**
33
- * Retrieve the associated {@link TreeNode} for the given field's content.
34
- */
35
- export function getTreeNodeForField(field: FlexTreeField): TreeNode | TreeValue | undefined {
36
- function tryToUnboxLeaves(
37
- flexField: FlexTreeOptionalField | FlexTreeRequiredField,
38
- ): TreeNode | TreeValue | undefined {
39
- const maybeContent = flexField.content;
40
- return isFlexTreeNode(maybeContent)
41
- ? getOrCreateNodeFromInnerNode(maybeContent)
42
- : maybeContent;
43
- }
44
- switch (field.schema) {
45
- case FieldKinds.required.identifier: {
46
- const typedField = field as FlexTreeRequiredField;
47
- return tryToUnboxLeaves(typedField);
48
- }
49
- case FieldKinds.optional.identifier: {
50
- const typedField = field as FlexTreeOptionalField;
51
- return tryToUnboxLeaves(typedField);
52
- }
53
- case FieldKinds.identifier.identifier: {
54
- // Identifier fields are just value fields that hold strings
55
- return (field as FlexTreeRequiredField).content as string;
56
- }
57
-
58
- default:
59
- fail(0xadf /* invalid field kind */);
60
- }
61
- }
62
-
63
- // #region Content insertion and proxy binding
64
-
65
- /** The path of a proxy, relative to the root of the content tree that the proxy belongs to */
66
- interface RelativeProxyPath {
67
- readonly path: UpPath;
68
- readonly proxy: TreeNode;
69
- }
70
-
71
- /** All {@link RelativeProxyPath}s that are under the given root path */
72
- interface RootedProxyPaths {
73
- readonly rootPath: UpPath;
74
- readonly proxyPaths: RelativeProxyPath[];
75
- }
76
-
77
- /**
78
- * Records any proxies in the given content tree and does the necessary bookkeeping to ensure they are synchronized with subsequent reads of the tree.
79
- * @remarks If the content tree contains any proxies, this function must be called just prior to inserting the content into the tree.
80
- * Specifically, no other content may be inserted into the tree between the invocation of this function and the insertion of `content`.
81
- * The insertion of `content` must occur or else this function will cause memory leaks.
82
- * @param content - the tree of content to be inserted, of which any of its object/map/array nodes might be a proxy
83
- * @param anchors - the {@link AnchorSet} for the tree
84
- * @returns The content after having all proxies replaced inline with plain javascript objects.
85
- * See {@link extractFactoryContent} for more details.
86
- */
87
- export function prepareContentForHydration(
88
- content: MapTree | readonly MapTree[] | undefined,
89
- forest: IForestSubscription,
90
- ): void {
91
- if (isReadonlyArray(content)) {
92
- return prepareArrayContentForHydration(content, forest);
93
- }
94
-
95
- if (content !== undefined) {
96
- const proxies: RootedProxyPaths = {
97
- rootPath: { parent: undefined, parentField: EmptyKey, parentIndex: 0 },
98
- proxyPaths: [],
99
- };
100
-
101
- walkMapTree(content, proxies.rootPath, (p, proxy) => {
102
- proxies.proxyPaths.push({ path: p, proxy });
103
- });
104
-
105
- bindProxies([proxies], forest);
106
- }
107
- }
108
-
109
- function prepareArrayContentForHydration(
110
- content: readonly MapTree[],
111
- forest: IForestSubscription,
112
- ): void {
113
- const proxyPaths: RootedProxyPaths[] = [];
114
- for (const item of content) {
115
- const proxyPath: RootedProxyPaths = {
116
- rootPath: {
117
- parent: undefined,
118
- parentField: EmptyKey,
119
- parentIndex: 0,
120
- },
121
- proxyPaths: [],
122
- };
123
- proxyPaths.push(proxyPath);
124
- walkMapTree(item, proxyPath.rootPath, (p, proxy) => {
125
- proxyPath.proxyPaths.push({ path: p, proxy });
126
- });
127
- }
128
-
129
- bindProxies(proxyPaths, forest);
130
- }
131
-
132
- function walkMapTree(
133
- mapTree: MapTree,
134
- path: UpPath,
135
- onVisitTreeNode: (path: UpPath, treeNode: TreeNode) => void,
136
- ): void {
137
- if (tryUnhydratedFlexTreeNode(mapTree)?.parentField.parent.parent !== undefined) {
138
- throw new UsageError(
139
- "Attempted to insert a node which is already under a parent. If this is desired, remove the node from its parent before inserting it elsewhere.",
140
- );
141
- }
142
-
143
- type Next = [path: UpPath, tree: MapTree];
144
- const nexts: Next[] = [];
145
- for (let next: Next | undefined = [path, mapTree]; next !== undefined; next = nexts.pop()) {
146
- const [p, m] = next;
147
- const mapTreeNode = tryUnhydratedFlexTreeNode(m);
148
- if (mapTreeNode !== undefined) {
149
- const treeNode = unhydratedFlexTreeNodeToTreeNode.get(mapTreeNode);
150
- if (treeNode !== undefined) {
151
- onVisitTreeNode(p, treeNode);
152
- }
153
- }
154
-
155
- for (const [key, field] of m.fields) {
156
- for (const [i, child] of field.entries()) {
157
- nexts.push([
158
- {
159
- parent: p,
160
- parentField: key,
161
- parentIndex: i,
162
- },
163
- child,
164
- ]);
165
- }
166
- }
167
- }
168
- }
169
-
170
- function bindProxies(proxies: RootedProxyPaths[], forest: IForestSubscription): void {
171
- // Only subscribe to the event if there is at least one proxy tree to hydrate - this is not the case when inserting an empty array [].
172
- if (proxies.length > 0) {
173
- // Creating a new array emits one event per element in the array, so listen to the event once for each element
174
- let i = 0;
175
- const off = forest.events.on("afterRootFieldCreated", (fieldKey) => {
176
- // Non null asserting here because of the length check above
177
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
178
- (proxies[i]!.rootPath as Mutable<UpPath>).parentField = fieldKey;
179
- // Non null asserting here because of the length check above
180
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
181
- for (const { path, proxy } of proxies[i]!.proxyPaths) {
182
- getKernel(proxy).anchorProxy(forest.anchors, path);
183
- }
184
- if (++i === proxies.length) {
185
- off();
186
- }
187
- });
188
- }
189
- }
190
-
191
- // #endregion Content insertion and proxy binding