@fluidframework/tree 2.92.0 → 2.100.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 (366) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/INCREMENTAL_SUMMARY.md +89 -0
  3. package/README.md +7 -1
  4. package/api-report/tree.alpha.api.md +60 -29
  5. package/api-report/tree.beta.api.md +41 -12
  6. package/api-report/tree.legacy.beta.api.md +41 -12
  7. package/dist/api.d.ts +6 -1
  8. package/dist/api.d.ts.map +1 -1
  9. package/dist/api.js.map +1 -1
  10. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  11. package/dist/core/tree/anchorSet.js +21 -0
  12. package/dist/core/tree/anchorSet.js.map +1 -1
  13. package/dist/entrypoints/alpha.d.ts +1 -1
  14. package/dist/entrypoints/alpha.d.ts.map +1 -1
  15. package/dist/entrypoints/alpha.js +4 -4
  16. package/dist/entrypoints/alpha.js.map +1 -1
  17. package/dist/entrypoints/beta.d.ts +1 -1
  18. package/dist/entrypoints/beta.d.ts.map +1 -1
  19. package/dist/entrypoints/beta.js +3 -1
  20. package/dist/entrypoints/beta.js.map +1 -1
  21. package/dist/entrypoints/legacy.d.ts +1 -1
  22. package/dist/entrypoints/legacy.d.ts.map +1 -1
  23. package/dist/entrypoints/legacy.js +3 -1
  24. package/dist/entrypoints/legacy.js.map +1 -1
  25. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts +25 -1
  26. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  27. package/dist/feature-libraries/chunked-forest/basicChunk.js +71 -18
  28. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  29. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +2 -2
  30. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  31. package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -1
  32. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +1 -1
  34. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  35. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/codec/codecs.js +1 -1
  37. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  38. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  39. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  40. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  41. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  42. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +1 -2
  43. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js +0 -1
  45. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts +1 -1
  47. package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/codec/format/index.js +2 -1
  49. package/dist/feature-libraries/chunked-forest/codec/format/index.js.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts +10 -2
  51. package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/codec/format/versions.js +15 -1
  53. package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +18 -5
  55. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/uniformChunk.js +47 -19
  57. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  58. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +19 -0
  59. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  60. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +76 -22
  61. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  62. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +1 -0
  63. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  64. package/dist/feature-libraries/indexing/anchorTreeIndex.js +3 -1
  65. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  66. package/dist/feature-libraries/indexing/types.d.ts +4 -3
  67. package/dist/feature-libraries/indexing/types.d.ts.map +1 -1
  68. package/dist/feature-libraries/indexing/types.js.map +1 -1
  69. package/dist/index.d.ts +1 -1
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js.map +1 -1
  72. package/dist/packageVersion.d.ts +1 -1
  73. package/dist/packageVersion.d.ts.map +1 -1
  74. package/dist/packageVersion.js +1 -1
  75. package/dist/packageVersion.js.map +1 -1
  76. package/dist/serializableDomainSchema.d.ts +5 -5
  77. package/dist/serializableDomainSchema.d.ts.map +1 -1
  78. package/dist/serializableDomainSchema.js.map +1 -1
  79. package/dist/shared-tree/treeAlpha.d.ts +6 -2
  80. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  81. package/dist/shared-tree/treeAlpha.js.map +1 -1
  82. package/dist/shared-tree/treeCheckout.d.ts +1 -1
  83. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  84. package/dist/simple-tree/api/discrepancies.js +4 -1
  85. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  86. package/dist/simple-tree/api/identifierIndex.d.ts +2 -2
  87. package/dist/simple-tree/api/identifierIndex.js +1 -1
  88. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  89. package/dist/simple-tree/api/index.d.ts +2 -2
  90. package/dist/simple-tree/api/index.d.ts.map +1 -1
  91. package/dist/simple-tree/api/index.js +3 -2
  92. package/dist/simple-tree/api/index.js.map +1 -1
  93. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +47 -2
  94. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  95. package/dist/simple-tree/api/schemaFactoryAlpha.js +26 -1
  96. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  97. package/dist/simple-tree/api/simpleTreeIndex.d.ts +5 -5
  98. package/dist/simple-tree/api/simpleTreeIndex.js +1 -1
  99. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  100. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  101. package/dist/simple-tree/api/storedSchema.js +4 -1
  102. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  103. package/dist/simple-tree/api/treeAlpha.d.ts +70 -13
  104. package/dist/simple-tree/api/treeAlpha.d.ts.map +1 -1
  105. package/dist/simple-tree/api/treeAlpha.js.map +1 -1
  106. package/dist/simple-tree/api/treeChangeEvents.d.ts +1 -1
  107. package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
  108. package/dist/simple-tree/api/treeNodeApi.d.ts +60 -1
  109. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  110. package/dist/simple-tree/api/treeNodeApi.js +68 -6
  111. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  112. package/dist/simple-tree/core/toStored.d.ts +7 -0
  113. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  114. package/dist/simple-tree/core/toStored.js.map +1 -1
  115. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +17 -3
  116. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  117. package/dist/simple-tree/core/unhydratedFlexTree.js +114 -12
  118. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  119. package/dist/simple-tree/fieldSchema.d.ts +6 -1
  120. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  121. package/dist/simple-tree/fieldSchema.js +3 -0
  122. package/dist/simple-tree/fieldSchema.js.map +1 -1
  123. package/dist/simple-tree/index.d.ts +2 -2
  124. package/dist/simple-tree/index.d.ts.map +1 -1
  125. package/dist/simple-tree/index.js +4 -3
  126. package/dist/simple-tree/index.js.map +1 -1
  127. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  128. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  129. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  130. package/dist/simple-tree/node-kinds/map/index.d.ts +1 -1
  131. package/dist/simple-tree/node-kinds/map/index.d.ts.map +1 -1
  132. package/dist/simple-tree/node-kinds/map/index.js.map +1 -1
  133. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +13 -0
  134. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  135. package/dist/simple-tree/node-kinds/map/mapNode.js +6 -1
  136. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  137. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +6 -6
  138. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  139. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  140. package/dist/simple-tree/simpleSchema.d.ts +17 -0
  141. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  142. package/dist/simple-tree/simpleSchema.js.map +1 -1
  143. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  144. package/dist/simple-tree/toStoredSchema.js +23 -1
  145. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  146. package/dist/tableSchema.d.ts +4 -5
  147. package/dist/tableSchema.d.ts.map +1 -1
  148. package/dist/tableSchema.js +12 -23
  149. package/dist/tableSchema.js.map +1 -1
  150. package/dist/text/textDomain.d.ts.map +1 -1
  151. package/dist/text/textDomain.js +27 -0
  152. package/dist/text/textDomain.js.map +1 -1
  153. package/dist/text/textDomainFormatted.d.ts +4 -4
  154. package/dist/util/index.d.ts +1 -1
  155. package/dist/util/index.d.ts.map +1 -1
  156. package/dist/util/index.js +2 -3
  157. package/dist/util/index.js.map +1 -1
  158. package/dist/util/utils.d.ts +0 -1
  159. package/dist/util/utils.d.ts.map +1 -1
  160. package/dist/util/utils.js +1 -6
  161. package/dist/util/utils.js.map +1 -1
  162. package/docs/user-facing/isolated-declarations.md +147 -0
  163. package/eslint.config.mts +1 -1
  164. package/lib/api.d.ts +6 -1
  165. package/lib/api.d.ts.map +1 -1
  166. package/lib/api.js.map +1 -1
  167. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  168. package/lib/core/tree/anchorSet.js +21 -0
  169. package/lib/core/tree/anchorSet.js.map +1 -1
  170. package/lib/entrypoints/alpha.d.ts +1 -1
  171. package/lib/entrypoints/alpha.d.ts.map +1 -1
  172. package/lib/entrypoints/alpha.js +1 -1
  173. package/lib/entrypoints/alpha.js.map +1 -1
  174. package/lib/entrypoints/beta.d.ts +1 -1
  175. package/lib/entrypoints/beta.d.ts.map +1 -1
  176. package/lib/entrypoints/beta.js +1 -1
  177. package/lib/entrypoints/beta.js.map +1 -1
  178. package/lib/entrypoints/legacy.d.ts +1 -1
  179. package/lib/entrypoints/legacy.d.ts.map +1 -1
  180. package/lib/entrypoints/legacy.js +1 -1
  181. package/lib/entrypoints/legacy.js.map +1 -1
  182. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts +25 -1
  183. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  184. package/lib/feature-libraries/chunked-forest/basicChunk.js +72 -19
  185. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  186. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +2 -2
  187. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  188. package/lib/feature-libraries/chunked-forest/chunkTree.js +2 -1
  189. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  190. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +2 -2
  191. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  192. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  193. package/lib/feature-libraries/chunked-forest/codec/codecs.js +2 -2
  194. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  195. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  196. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  197. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +2 -2
  198. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  199. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +1 -2
  200. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
  201. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js +0 -1
  202. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
  203. package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts +1 -1
  204. package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -1
  205. package/lib/feature-libraries/chunked-forest/codec/format/index.js +1 -1
  206. package/lib/feature-libraries/chunked-forest/codec/format/index.js.map +1 -1
  207. package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts +10 -2
  208. package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -1
  209. package/lib/feature-libraries/chunked-forest/codec/format/versions.js +13 -0
  210. package/lib/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -1
  211. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +18 -5
  212. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  213. package/lib/feature-libraries/chunked-forest/uniformChunk.js +48 -20
  214. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  215. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +19 -0
  216. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  217. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +76 -22
  218. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  219. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +1 -0
  220. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  221. package/lib/feature-libraries/indexing/anchorTreeIndex.js +3 -1
  222. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  223. package/lib/feature-libraries/indexing/types.d.ts +4 -3
  224. package/lib/feature-libraries/indexing/types.d.ts.map +1 -1
  225. package/lib/feature-libraries/indexing/types.js.map +1 -1
  226. package/lib/index.d.ts +1 -1
  227. package/lib/index.d.ts.map +1 -1
  228. package/lib/index.js.map +1 -1
  229. package/lib/packageVersion.d.ts +1 -1
  230. package/lib/packageVersion.d.ts.map +1 -1
  231. package/lib/packageVersion.js +1 -1
  232. package/lib/packageVersion.js.map +1 -1
  233. package/lib/serializableDomainSchema.d.ts +5 -5
  234. package/lib/serializableDomainSchema.d.ts.map +1 -1
  235. package/lib/serializableDomainSchema.js +4 -1
  236. package/lib/serializableDomainSchema.js.map +1 -1
  237. package/lib/shared-tree/treeAlpha.d.ts +6 -2
  238. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  239. package/lib/shared-tree/treeAlpha.js.map +1 -1
  240. package/lib/shared-tree/treeCheckout.d.ts +1 -1
  241. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  242. package/lib/simple-tree/api/discrepancies.js +4 -1
  243. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  244. package/lib/simple-tree/api/identifierIndex.d.ts +2 -2
  245. package/lib/simple-tree/api/identifierIndex.js +1 -1
  246. package/lib/simple-tree/api/identifierIndex.js.map +1 -1
  247. package/lib/simple-tree/api/index.d.ts +2 -2
  248. package/lib/simple-tree/api/index.d.ts.map +1 -1
  249. package/lib/simple-tree/api/index.js +1 -1
  250. package/lib/simple-tree/api/index.js.map +1 -1
  251. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +47 -2
  252. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  253. package/lib/simple-tree/api/schemaFactoryAlpha.js +28 -3
  254. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  255. package/lib/simple-tree/api/simpleTreeIndex.d.ts +5 -5
  256. package/lib/simple-tree/api/simpleTreeIndex.js +1 -1
  257. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  258. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  259. package/lib/simple-tree/api/storedSchema.js +4 -1
  260. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  261. package/lib/simple-tree/api/treeAlpha.d.ts +70 -13
  262. package/lib/simple-tree/api/treeAlpha.d.ts.map +1 -1
  263. package/lib/simple-tree/api/treeAlpha.js.map +1 -1
  264. package/lib/simple-tree/api/treeChangeEvents.d.ts +1 -1
  265. package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
  266. package/lib/simple-tree/api/treeNodeApi.d.ts +60 -1
  267. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  268. package/lib/simple-tree/api/treeNodeApi.js +66 -6
  269. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  270. package/lib/simple-tree/core/toStored.d.ts +7 -0
  271. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  272. package/lib/simple-tree/core/toStored.js.map +1 -1
  273. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +17 -3
  274. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  275. package/lib/simple-tree/core/unhydratedFlexTree.js +115 -13
  276. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  277. package/lib/simple-tree/fieldSchema.d.ts +6 -1
  278. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  279. package/lib/simple-tree/fieldSchema.js +3 -0
  280. package/lib/simple-tree/fieldSchema.js.map +1 -1
  281. package/lib/simple-tree/index.d.ts +2 -2
  282. package/lib/simple-tree/index.d.ts.map +1 -1
  283. package/lib/simple-tree/index.js +1 -1
  284. package/lib/simple-tree/index.js.map +1 -1
  285. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  286. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  287. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  288. package/lib/simple-tree/node-kinds/map/index.d.ts +1 -1
  289. package/lib/simple-tree/node-kinds/map/index.d.ts.map +1 -1
  290. package/lib/simple-tree/node-kinds/map/index.js.map +1 -1
  291. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +13 -0
  292. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  293. package/lib/simple-tree/node-kinds/map/mapNode.js +6 -1
  294. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  295. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +6 -6
  296. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  297. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  298. package/lib/simple-tree/simpleSchema.d.ts +17 -0
  299. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  300. package/lib/simple-tree/simpleSchema.js.map +1 -1
  301. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  302. package/lib/simple-tree/toStoredSchema.js +24 -2
  303. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  304. package/lib/tableSchema.d.ts +4 -5
  305. package/lib/tableSchema.d.ts.map +1 -1
  306. package/lib/tableSchema.js +12 -23
  307. package/lib/tableSchema.js.map +1 -1
  308. package/lib/text/textDomain.d.ts.map +1 -1
  309. package/lib/text/textDomain.js +29 -0
  310. package/lib/text/textDomain.js.map +1 -1
  311. package/lib/text/textDomainFormatted.d.ts +4 -4
  312. package/lib/tsdoc-metadata.json +1 -1
  313. package/lib/util/index.d.ts +1 -1
  314. package/lib/util/index.d.ts.map +1 -1
  315. package/lib/util/index.js +1 -1
  316. package/lib/util/index.js.map +1 -1
  317. package/lib/util/utils.d.ts +0 -1
  318. package/lib/util/utils.d.ts.map +1 -1
  319. package/lib/util/utils.js +0 -1
  320. package/lib/util/utils.js.map +1 -1
  321. package/package.json +32 -37
  322. package/src/api.ts +10 -0
  323. package/src/core/tree/anchorSet.ts +25 -0
  324. package/src/entrypoints/alpha.ts +20 -16
  325. package/src/entrypoints/beta.ts +7 -1
  326. package/src/entrypoints/legacy.ts +8 -10
  327. package/src/feature-libraries/chunked-forest/basicChunk.ts +76 -20
  328. package/src/feature-libraries/chunked-forest/chunkTree.ts +3 -2
  329. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +2 -2
  330. package/src/feature-libraries/chunked-forest/codec/codecs.ts +2 -1
  331. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +3 -2
  332. package/src/feature-libraries/chunked-forest/codec/format/formatGeneric.ts +0 -1
  333. package/src/feature-libraries/chunked-forest/codec/format/index.ts +1 -0
  334. package/src/feature-libraries/chunked-forest/codec/format/versions.ts +15 -0
  335. package/src/feature-libraries/chunked-forest/uniformChunk.ts +73 -21
  336. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +116 -31
  337. package/src/feature-libraries/indexing/anchorTreeIndex.ts +1 -0
  338. package/src/feature-libraries/indexing/types.ts +5 -3
  339. package/src/index.ts +4 -0
  340. package/src/packageVersion.ts +1 -1
  341. package/src/serializableDomainSchema.ts +6 -0
  342. package/src/shared-tree/treeAlpha.ts +6 -2
  343. package/src/simple-tree/api/discrepancies.ts +6 -1
  344. package/src/simple-tree/api/identifierIndex.ts +2 -2
  345. package/src/simple-tree/api/index.ts +4 -0
  346. package/src/simple-tree/api/schemaFactoryAlpha.ts +99 -3
  347. package/src/simple-tree/api/simpleTreeIndex.ts +6 -6
  348. package/src/simple-tree/api/storedSchema.ts +4 -1
  349. package/src/simple-tree/api/treeAlpha.ts +75 -12
  350. package/src/simple-tree/api/treeChangeEvents.ts +1 -1
  351. package/src/simple-tree/api/treeNodeApi.ts +101 -7
  352. package/src/simple-tree/core/toStored.ts +8 -0
  353. package/src/simple-tree/core/unhydratedFlexTree.ts +134 -10
  354. package/src/simple-tree/fieldSchema.ts +10 -0
  355. package/src/simple-tree/index.ts +5 -0
  356. package/src/simple-tree/node-kinds/index.ts +1 -0
  357. package/src/simple-tree/node-kinds/map/index.ts +1 -0
  358. package/src/simple-tree/node-kinds/map/mapNode.ts +20 -3
  359. package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +6 -6
  360. package/src/simple-tree/simpleSchema.ts +20 -0
  361. package/src/simple-tree/toStoredSchema.ts +28 -1
  362. package/src/tableSchema.ts +16 -28
  363. package/src/text/textDomain.ts +68 -1
  364. package/src/util/index.ts +0 -1
  365. package/src/util/utils.ts +0 -2
  366. package/.mocharc.customBenchmarks.cjs +0 -25
@@ -2,18 +2,44 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import { type DeltaMark } from "../../core/index.js";
5
6
  import { type TreeStatus } from "../../feature-libraries/index.js";
6
7
  import { type TreeNodeSchema, type TreeNode, type TreeLeafValue, type ImplicitAllowedTypes, type TreeNodeFromImplicitAllowedTypes } from "../core/index.js";
7
8
  import type { TreeChangeEvents } from "./treeChangeEvents.js";
8
9
  /**
9
10
  * A `"retain"` op in an {@link ArrayNodeDeltaOp} sequence.
10
- * Represents elements that were not added or removed (though they may have nested changes).
11
+ * Represents elements that were neither inserted into nor removed from the array.
11
12
  * @sealed @alpha
12
13
  */
13
14
  export interface ArrayNodeRetainOp {
14
15
  readonly type: "retain";
15
16
  readonly count: number;
16
17
  }
18
+ /**
19
+ * A `"retain"` op in an {@link ArrayNodeTreeChangedDeltaOp} sequence, used in
20
+ * {@link NodeChangedDataTreeDelta} payloads delivered to
21
+ * {@link TreeChangeEventsAlpha.treeChanged} on array nodes.
22
+ *
23
+ * Extends {@link ArrayNodeRetainOp} with a {@link ArrayNodeTreeChangedRetainOp.subtreeChanged}
24
+ * flag that indicates whether any descendant of the retained element changed.
25
+ * @sealed @alpha
26
+ */
27
+ export interface ArrayNodeTreeChangedRetainOp extends ArrayNodeRetainOp {
28
+ /**
29
+ * Whether any descendant of this retained element changed.
30
+ * `true` if the element's subtree changed; `false` if nothing changed within it.
31
+ * @remarks
32
+ * Subscribe to `nodeChanged` or `treeChanged` on the element node itself for details.
33
+ */
34
+ readonly subtreeChanged: boolean;
35
+ }
36
+ /**
37
+ * A single operation in an array-node delta delivered by {@link TreeChangeEventsAlpha.treeChanged}.
38
+ * Extends {@link ArrayNodeDeltaOp}: retain ops carry a {@link ArrayNodeTreeChangedRetainOp.subtreeChanged}
39
+ * flag indicating whether any descendant of the retained element changed.
40
+ * @alpha
41
+ */
42
+ export type ArrayNodeTreeChangedDeltaOp = ArrayNodeTreeChangedRetainOp | ArrayNodeInsertOp | ArrayNodeRemoveOp;
17
43
  /**
18
44
  * An `"insert"` op in an {@link ArrayNodeDeltaOp} sequence.
19
45
  * Represents elements added to the array.
@@ -142,6 +168,39 @@ export interface TreeNodeApi {
142
168
  * {@inheritDoc TreeNodeApi}
143
169
  */
144
170
  export declare const treeNodeApi: TreeNodeApi;
171
+ /**
172
+ * Converts an array of internal {@link DeltaMark}s for a sequence field into sequential
173
+ * array delta ops suitable for inclusion in {@link NodeChangedDataDelta.delta}.
174
+ *
175
+ * Each mark in the delta describes a contiguous run of positions in the original array:
176
+ * - A mark with only `count` (no attach/detach) → `"retain"` with no subtree information
177
+ * - A mark with only `attach` → `"insert"` (new elements added)
178
+ * - A mark with only `detach` → `"remove"` (elements removed)
179
+ * - A mark with both `attach` and `detach` → `"remove"` + `"insert"`
180
+ *
181
+ * @param marks - The low-level delta marks for the array's sequence field.
182
+ *
183
+ * @privateRemarks
184
+ * The case where both `attach` and `detach` are set is unreachable today: the sequence-field
185
+ * encoder never emits such marks for array (EmptyKey) fields. It is handled defensively.
186
+ */
187
+ export declare function deltaMarksToArrayOps(marks: readonly DeltaMark[]): ArrayNodeDeltaOp[];
188
+ /**
189
+ * Converts an array of internal {@link DeltaMark}s for a sequence field into sequential
190
+ * {@link ArrayNodeTreeChangedDeltaOp}s suitable for inclusion in
191
+ * {@link NodeChangedDataTreeDelta.delta} (delivered to {@link TreeChangeEventsAlpha.treeChanged}).
192
+ *
193
+ * Same conversion rules as {@link deltaMarksToArrayOps}, but retain ops additionally carry a
194
+ * {@link ArrayNodeTreeChangedRetainOp.subtreeChanged} flag derived from whether the mark has
195
+ * a `fields` property (indicating a descendant changed).
196
+ *
197
+ * @param marks - The low-level delta marks for the array's sequence field.
198
+ *
199
+ * @privateRemarks
200
+ * The case where both `attach` and `detach` are set is unreachable today: the sequence-field
201
+ * encoder never emits such marks for array (EmptyKey) fields. It is handled defensively.
202
+ */
203
+ export declare function deltaMarksToArrayOpsForTreeChanged(marks: readonly DeltaMark[]): ArrayNodeTreeChangedDeltaOp[];
145
204
  /**
146
205
  * Returns a schema for a value if the value is a {@link TreeNode} or a {@link TreeLeafValue}.
147
206
  * Returns undefined for other values.
@@ -1 +1 @@
1
- {"version":3,"file":"treeNodeApi.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/treeNodeApi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,KAAK,UAAU,EAA2B,MAAM,kCAAkC,CAAC;AAE5F,OAAO,EAGN,KAAK,cAAc,EAEnB,KAAK,QAAQ,EAKb,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,gCAAgC,EAErC,MAAM,kBAAkB,CAAC;AAY1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,IAAI,EAAE,QAAQ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EAAE,QAAQ,GAAG,UAAU,CAAC;IAEnC;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACrD;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,WA6HzB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,GAAG,gBAAgB,EAAE,CAcpF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kCAAkC,CACjD,KAAK,EAAE,SAAS,SAAS,EAAE,GACzB,2BAA2B,EAAE,CAmB/B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,cAAc,CA2BvE;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,kBAAkB,GAC7B,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAC/B,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,YAAY,GACvB,MAAM,GAAG,SAAS,CAAC;AACtB,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,cAAc,GACzB,MAAM,GAAG,SAAS,CAAC;AA8DtB;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAgB5D;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,MAAM,GAAG,MAAM,GACxB,MAAM,GAAG,MAAM,CAyBjB"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.getPropertyKeyFromStoredKey = exports.getStoredKey = exports.getIdentifierFromNode = exports.tryGetSchema = exports.treeNodeApi = void 0;
7
+ exports.getPropertyKeyFromStoredKey = exports.getStoredKey = exports.getIdentifierFromNode = exports.tryGetSchema = exports.deltaMarksToArrayOpsForTreeChanged = exports.deltaMarksToArrayOps = exports.treeNodeApi = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const internal_2 = require("@fluidframework/runtime-utils/internal");
10
10
  const internal_3 = require("@fluidframework/telemetry-utils/internal");
@@ -59,13 +59,24 @@ exports.treeNodeApi = {
59
59
  else if ((0, index_js_5.isArrayNodeSchema)(nodeSchema)) {
60
60
  return kernel.events.on("childrenChangedAfterBatch", ({ fieldMarks }) => {
61
61
  const marks = fieldMarks.get(index_js_1.EmptyKey);
62
+ // nodeChanged fires only for shallow changes (insert, remove, move).
63
+ // Deep changes (e.g. a property of an element changed) are
64
+ // surfaced via TreeChangeEventsAlpha.treeChanged with a delta payload instead.
65
+ // When marks are undefined (marks could not be composed across multiple
66
+ // internal passes), we conservatively fire nodeChanged rather than silently
67
+ // dropping the event, even though the underlying change may have been
68
+ // purely deep. This is a known limitation of the current eventing stack.
69
+ const hasShallowChange = marks === undefined ||
70
+ marks.some((m) => m.attach !== undefined || m.detach !== undefined);
71
+ if (!hasShallowChange) {
72
+ return;
73
+ }
62
74
  // `marks` is undefined when the field was modified across multiple batches
63
75
  // within a single flush (e.g. due to an interleaved schema change) and the
64
76
  // marks could not be composed. Emit `undefined` so callers know the delta is
65
77
  // unavailable rather than receiving stale marks from only the first batch.
66
78
  // TODO: Once the eventing stack is rewritten to walk the composed delta at
67
- // flush time, `marks` will always be defined. Remove the `undefined` fallback
68
- // and simplify to: `const delta = deltaMarksToArrayOps(marks);`
79
+ // flush time, `marks` will always be defined. Remove the `undefined` fallback.
69
80
  const delta = marks === undefined ? undefined : deltaMarksToArrayOps(marks);
70
81
  listener({ delta });
71
82
  });
@@ -77,6 +88,17 @@ exports.treeNodeApi = {
77
88
  }
78
89
  }
79
90
  case "treeChanged": {
91
+ if ((0, index_js_5.isArrayNodeSchema)(kernel.schema)) {
92
+ // For array nodes, treeChanged fires via childrenChangedAfterBatch so that a
93
+ // delta payload can be provided. This covers both shallow changes
94
+ // (insert/remove/move) and deep element changes. Stable (non-alpha) listeners
95
+ // typed as () => void will silently ignore the extra argument at runtime.
96
+ return kernel.events.on("childrenChangedAfterBatch", ({ fieldMarks }) => {
97
+ const marks = fieldMarks.get(index_js_1.EmptyKey);
98
+ const delta = marks === undefined ? undefined : deltaMarksToArrayOpsForTreeChanged(marks);
99
+ listener({ delta });
100
+ });
101
+ }
80
102
  return kernel.events.on("subtreeChangedAfterBatch", () => listener({}));
81
103
  }
82
104
  default: {
@@ -106,14 +128,16 @@ exports.treeNodeApi = {
106
128
  };
107
129
  /**
108
130
  * Converts an array of internal {@link DeltaMark}s for a sequence field into sequential
109
- * array delta ops suitable for inclusion in {@link NodeChangedData.delta}.
131
+ * array delta ops suitable for inclusion in {@link NodeChangedDataDelta.delta}.
110
132
  *
111
133
  * Each mark in the delta describes a contiguous run of positions in the original array:
112
- * - A mark with only `count` (no attach/detach) → `"retain"` (elements unchanged at this level)
134
+ * - A mark with only `count` (no attach/detach) → `"retain"` with no subtree information
113
135
  * - A mark with only `attach` → `"insert"` (new elements added)
114
136
  * - A mark with only `detach` → `"remove"` (elements removed)
115
137
  * - A mark with both `attach` and `detach` → `"remove"` + `"insert"`
116
138
  *
139
+ * @param marks - The low-level delta marks for the array's sequence field.
140
+ *
117
141
  * @privateRemarks
118
142
  * The case where both `attach` and `detach` are set is unreachable today: the sequence-field
119
143
  * encoder never emits such marks for array (EmptyKey) fields. It is handled defensively.
@@ -128,12 +152,50 @@ function deltaMarksToArrayOps(marks) {
128
152
  ops.push({ type: "insert", count: mark.count });
129
153
  }
130
154
  else if (mark.detach === undefined) {
131
- // Neither attach nor detach: elements retained (may have nested changes in mark.fields).
155
+ // Retain: elements were not added or removed.
132
156
  ops.push({ type: "retain", count: mark.count });
133
157
  }
134
158
  }
135
159
  return ops;
136
160
  }
161
+ exports.deltaMarksToArrayOps = deltaMarksToArrayOps;
162
+ /**
163
+ * Converts an array of internal {@link DeltaMark}s for a sequence field into sequential
164
+ * {@link ArrayNodeTreeChangedDeltaOp}s suitable for inclusion in
165
+ * {@link NodeChangedDataTreeDelta.delta} (delivered to {@link TreeChangeEventsAlpha.treeChanged}).
166
+ *
167
+ * Same conversion rules as {@link deltaMarksToArrayOps}, but retain ops additionally carry a
168
+ * {@link ArrayNodeTreeChangedRetainOp.subtreeChanged} flag derived from whether the mark has
169
+ * a `fields` property (indicating a descendant changed).
170
+ *
171
+ * @param marks - The low-level delta marks for the array's sequence field.
172
+ *
173
+ * @privateRemarks
174
+ * The case where both `attach` and `detach` are set is unreachable today: the sequence-field
175
+ * encoder never emits such marks for array (EmptyKey) fields. It is handled defensively.
176
+ */
177
+ function deltaMarksToArrayOpsForTreeChanged(marks) {
178
+ const ops = [];
179
+ for (const mark of marks) {
180
+ if (mark.detach !== undefined) {
181
+ ops.push({ type: "remove", count: mark.count });
182
+ }
183
+ if (mark.attach !== undefined) {
184
+ ops.push({ type: "insert", count: mark.count });
185
+ }
186
+ else if (mark.detach === undefined) {
187
+ // Retain: elements were not added or removed (but may have deep changes).
188
+ // When `fields` is set, `count` is guaranteed to be 1 (DeltaMark invariant).
189
+ ops.push({
190
+ type: "retain",
191
+ count: mark.count,
192
+ subtreeChanged: mark.fields !== undefined,
193
+ });
194
+ }
195
+ }
196
+ return ops;
197
+ }
198
+ exports.deltaMarksToArrayOpsForTreeChanged = deltaMarksToArrayOpsForTreeChanged;
137
199
  /**
138
200
  * Returns a schema for a value if the value is a {@link TreeNode} or a {@link TreeLeafValue}.
139
201
  * Returns undefined for other values.
@@ -1 +1 @@
1
- {"version":3,"file":"treeNodeApi.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeNodeApi.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAAyF;AACzF,qEAAuE;AACvE,uEAAsE;AAEtE,k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W,CAAC,KAAK,KAAK,CAAC,EAAE,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAC5F,OAAO,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC;AAC/B,CAAC;AAhBD,oCAgBC;AAED;;GAEG;AACH,SAAgB,2BAA2B,CAC1C,MAAsB,EACtB,SAA0B;IAE1B,iHAAiH;IACjH,gFAAgF;IAChF,IAAI,MAAM,CAAC,IAAI,KAAK,mBAAQ,CAAC,MAAM,EAAE,CAAC;QACrC,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,IAA2C,CAAC;IAElE,cAAc;IACd,iEAAiE;IACjE,uGAAuG;IACvG,6IAA6I;IAC7I,iEAAiE;IACjE,KAAK,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACjE,IAAI,WAAW,YAAY,4BAAW,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,KAAK,SAAS,EAAE,CAAC;YAChF,OAAO,WAAW,CAAC;QACpB,CAAC;IACF,CAAC;IAED,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE,CAAC;QACrC,IAAA,eAAI,EAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC;AA5BD,kEA4BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Off } from \"@fluidframework/core-interfaces\";\nimport { assert, oob, fail, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EmptyKey, rootFieldKey, type DeltaMark } from \"../../core/index.js\";\nimport { type TreeStatus, isTreeValue, FieldKinds } from \"../../feature-libraries/index.js\";\nimport { extractFromOpaque } from \"../../util/index.js\";\nimport {\n\tgetKernel,\n\tisTreeNode,\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype TreeNode,\n\ttryGetTreeNodeSchema,\n\tgetOrCreateNodeFromInnerNode,\n\ttypeSchemaSymbol,\n\tgetInnerNode,\n\ttype TreeLeafValue,\n\ttype ImplicitAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tnormalizeAllowedTypes,\n} from \"../core/index.js\";\nimport { type ImplicitFieldSchema, FieldSchema } from \"../fieldSchema.js\";\nimport { tryGetTreeNodeForField } from \"../getTreeNodeForField.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isArrayNodeSchema, isObjectNodeSchema } from \"../node-kinds/index.js\";\n\nimport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\n\n/**\n * A `\"retain\"` op in an {@link ArrayNodeDeltaOp} sequence.\n * Represents elements that were not added or removed (though they may have nested changes).\n * @sealed @alpha\n */\nexport interface ArrayNodeRetainOp {\n\treadonly type: \"retain\";\n\treadonly count: number;\n}\n\n/**\n * An `\"insert\"` op in an {@link ArrayNodeDeltaOp} sequence.\n * Represents elements added to the array.\n * Read the new element values from the current tree at the positions described by this op.\n * @sealed @alpha\n */\nexport interface ArrayNodeInsertOp {\n\treadonly type: \"insert\";\n\treadonly count: number;\n}\n\n/**\n * A `\"remove\"` op in an {@link ArrayNodeDeltaOp} sequence.\n * Represents elements removed from the array.\n * @sealed @alpha\n */\nexport interface ArrayNodeRemoveOp {\n\treadonly type: \"remove\";\n\treadonly count: number;\n}\n\n/**\n * A single operation in an array node change delta. Used to efficiently sync an external\n * representation of an array (e.g. a text editor or virtual list) with tree changes without\n * needing to snapshot the old state or diff the entire array. Each op describes a contiguous run\n * of positions in the array before the change. For inserts, read the new element values from the\n * current tree at those positions.\n *\n * @remarks\n * There is no dedicated `\"move\"` op. Moves are represented as `\"remove\"` + `\"insert\"`.\n * When an element is moved within the same array it appears\n * as a `\"remove\"` at the source position followed by an `\"insert\"` at the destination position.\n * When an element is moved across two different arrays, the source array's delta contains a\n * `\"remove\"` and the destination array's delta contains an `\"insert\"` — they cannot be\n * correlated without additional bookkeeping on the caller's side.\n *\n * @sealed @alpha\n */\nexport type ArrayNodeDeltaOp = ArrayNodeRetainOp | ArrayNodeInsertOp | ArrayNodeRemoveOp;\n\n/**\n * Provides various functions for analyzing {@link TreeNode}s.\n *\n * @remarks\n * With the exception of {@link TreeNodeApi.status}, these functions should not be called with nodes that have\n * been {@link TreeStatus.Deleted | deleted}.\n * To verify whether or not a node already has been deleted, use the {@link TreeNodeApi.status} function.\n *\n * This type should only be used via the public {@link (Tree:variable)} export.\n *\n * @privateRemarks\n * Due to limitations of API-Extractor link resolution, this type can't be moved into internalTypes but should be considered just an implementation detail of the `Tree` export.\n *\n * Inlining the typing of this interface onto the `Tree` object provides slightly different .d.ts generation,\n * which avoids typescript expanding the type of TreeNodeSchema and thus encountering\n * https://github.com/microsoft/rushstack/issues/1958.\n * @sealed @public\n */\nexport interface TreeNodeApi {\n\t/**\n\t * The schema information for this node.\n\t */\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema;\n\n\t/**\n\t * Narrow the type of the given value if it satisfies the given schema.\n\t * @example\n\t * ```ts\n\t * if (node.is(myNode, Point)) {\n\t * const y = myNode.y; // `myNode` is now known to satisfy the `Point` schema and therefore has a `y` coordinate.\n\t * }\n\t * ```\n\t */\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema>;\n\n\t/**\n\t * Return the node under which this node resides in the tree (or undefined if this is a root node of the tree).\n\t *\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been {@link TreeStatus.Deleted | deleted}.\n\t *\n\t * @see {@link (TreeAlpha:interface).child}\n\t * @see {@link (TreeAlpha:interface).children}\n\t */\n\tparent(node: TreeNode): TreeNode | undefined;\n\n\t/**\n\t * The key of the given node under its parent.\n\t *\n\t * @remarks\n\t * If `node` is an element in a {@link (TreeArrayNode:interface)}, this returns the index of `node` in the array node (a `number`).\n\t * Otherwise, this returns the key of the field that it is under (a `string`).\n\t *\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been {@link TreeStatus.Deleted | deleted}.\n\t */\n\tkey(node: TreeNode): string | number;\n\n\t/**\n\t * Register an event listener on the given node.\n\t * @param node - The node whose events should be subscribed to.\n\t * @param eventName - Which event to subscribe to.\n\t * @param listener - The callback to trigger for the event. The tree can be read during the callback, but it is invalid to modify the tree during this callback.\n\t * @returns A callback function which will deregister the event.\n\t * This callback should be called only once.\n\t * @remarks\n\t * The returned unsubscribe function should be called any time the need for the `listener` callback ends before the node is {@link TreeStatus.Deleted | deleted} (Not just {@link TreeStatus.Removed | removed}).\n\t * Doing so removes the overhead of tracking and triggering the event, and also avoids leaking any memory retained by the callback.\n\t */\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): () => void;\n\n\t/**\n\t * Returns the {@link TreeStatus} of the given node.\n\t */\n\tstatus(node: TreeNode): TreeStatus;\n\n\t/**\n\t * Returns the {@link SchemaFactory.identifier | identifier} of the given node in the most compressed form possible.\n\t * @remarks\n\t * If the node is {@link Unhydrated | hydrated} and its identifier is a valid UUID that was automatically generated by the SharedTree it is part of (or something else using the same {@link @fluidframework/id-compressor#IIdCompressor}), then this will return a process-unique integer corresponding to that identifier.\n\t * This is useful for performance-sensitive scenarios involving many nodes with identifiers that need to be compactly retained in memory or used for efficient lookup.\n\t * Note that automatically generated identifiers that were accessed before the node was hydrated will return the generated UUID, not the process-unique integer.\n\t *\n\t * If the node's identifier is any other user-provided string, then this will return that string.\n\t *\n\t * If the node has no identifier (that is, it has no {@link SchemaFactory.identifier | identifier} field), then this returns `undefined`.\n\t *\n\t * If the node has more than one identifier, then this will throw an error.\n\t *\n\t * The returned integer should not be serialized or preserved outside of the current process.\n\t * Its lifetime is that of the current in-memory instance of the FF container for this client, and it is not guaranteed to be unique or stable outside of that context.\n\t * The same node's identifier may, for example, be different across multiple sessions for the same client and document, or different across two clients in the same session.\n\t */\n\tshortId(node: TreeNode): number | string | undefined;\n}\n\n/**\n * {@inheritDoc TreeNodeApi}\n */\nexport const treeNodeApi: TreeNodeApi = {\n\tparent(node: TreeNode): TreeNode | undefined {\n\t\tconst editNode = getInnerNode(node).parentField.parent.parent;\n\t\tif (editNode === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst output = getOrCreateNodeFromInnerNode(editNode);\n\t\tassert(\n\t\t\t!isTreeValue(output),\n\t\t\t0x87f /* Parent can't be a leaf, so it should be a node not a value */,\n\t\t);\n\t\treturn output;\n\t},\n\tkey(node: TreeNode): string | number {\n\t\t// If the parent is undefined, then this node is under the root field,\n\t\t// so we know its key is the special root one.\n\t\tconst parent = treeNodeApi.parent(node);\n\t\tif (parent === undefined) {\n\t\t\treturn rootFieldKey;\n\t\t}\n\n\t\t// The flex-domain strictly operates in terms of \"stored keys\".\n\t\t// To find the associated developer-facing \"property key\", we need to look up the field associated with\n\t\t// the stored key from the flex-domain, and get property key its simple-domain counterpart was created with.\n\t\tconst storedKey = getStoredKey(node);\n\t\tconst parentSchema = treeNodeApi.schema(parent);\n\t\tconst propertyKey = getPropertyKeyFromStoredKey(parentSchema, storedKey);\n\t\treturn propertyKey;\n\t},\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): Off {\n\t\tconst kernel = getKernel(node);\n\t\tswitch (eventName) {\n\t\t\tcase \"nodeChanged\": {\n\t\t\t\tconst nodeSchema = kernel.schema;\n\t\t\t\tif (isObjectNodeSchema(nodeSchema)) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tconst changedProperties = new Set(\n\t\t\t\t\t\t\tArray.from(\n\t\t\t\t\t\t\t\tchangedFields,\n\t\t\t\t\t\t\t\t(field) =>\n\t\t\t\t\t\t\t\t\tnodeSchema.storedKeyToPropertyKey.get(field) ??\n\t\t\t\t\t\t\t\t\tfail(0xb36 /* Could not find stored key in schema. */),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlistener({ changedProperties });\n\t\t\t\t\t});\n\t\t\t\t} else if (isArrayNodeSchema(nodeSchema)) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ fieldMarks }) => {\n\t\t\t\t\t\tconst marks = fieldMarks.get(EmptyKey);\n\t\t\t\t\t\t// `marks` is undefined when the field was modified across multiple batches\n\t\t\t\t\t\t// within a single flush (e.g. due to an interleaved schema change) and the\n\t\t\t\t\t\t// marks could not be composed. Emit `undefined` so callers know the delta is\n\t\t\t\t\t\t// unavailable rather than receiving stale marks from only the first batch.\n\t\t\t\t\t\t// TODO: Once the eventing stack is rewritten to walk the composed delta at\n\t\t\t\t\t\t// flush time, `marks` will always be defined. Remove the `undefined` fallback\n\t\t\t\t\t\t// and simplify to: `const delta = deltaMarksToArrayOps(marks);`\n\t\t\t\t\t\tconst delta = marks === undefined ? undefined : deltaMarksToArrayOps(marks);\n\t\t\t\t\t\tlistener({ delta });\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tlistener({ changedProperties: changedFields });\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase \"treeChanged\": {\n\t\t\t\treturn kernel.events.on(\"subtreeChangedAfterBatch\", () => listener({}));\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new UsageError(`No event named ${JSON.stringify(eventName)}.`);\n\t\t\t}\n\t\t}\n\t},\n\tstatus(node: TreeNode): TreeStatus {\n\t\treturn getKernel(node).getStatus();\n\t},\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema> {\n\t\t// This \"is\" utility would return false if the provided schema is a base type of the actual schema.\n\t\t// This could be confusing, and that case can only be hit when violating the rule that there is a single most derived schema that gets used (See documentation on TreeNodeSchemaClass).\n\t\t// Therefore this uses markSchemaMostDerived to ensure an informative usage error is thrown in the case where a base type is used.\n\n\t\tconst actualSchema = tryGetSchema(value);\n\t\tif (actualSchema === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\treturn normalizeAllowedTypes(schema).evaluateSet().has(actualSchema);\n\t},\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema {\n\t\treturn tryGetSchema(node) ?? fail(0xb37 /* Not a tree node */);\n\t},\n\tshortId(node: TreeNode): number | string | undefined {\n\t\treturn getIdentifierFromNode(node, \"preferCompressed\");\n\t},\n};\n\n/**\n * Converts an array of internal {@link DeltaMark}s for a sequence field into sequential\n * array delta ops suitable for inclusion in {@link NodeChangedData.delta}.\n *\n * Each mark in the delta describes a contiguous run of positions in the original array:\n * - A mark with only `count` (no attach/detach) → `\"retain\"` (elements unchanged at this level)\n * - A mark with only `attach` → `\"insert\"` (new elements added)\n * - A mark with only `detach` → `\"remove\"` (elements removed)\n * - A mark with both `attach` and `detach` → `\"remove\"` + `\"insert\"`\n *\n * @privateRemarks\n * The case where both `attach` and `detach` are set is unreachable today: the sequence-field\n * encoder never emits such marks for array (EmptyKey) fields. It is handled defensively.\n */\nfunction deltaMarksToArrayOps(marks: readonly DeltaMark[]): ArrayNodeDeltaOp[] {\n\tconst ops: ArrayNodeDeltaOp[] = [];\n\tfor (const mark of marks) {\n\t\tif (mark.detach !== undefined) {\n\t\t\tops.push({ type: \"remove\", count: mark.count });\n\t\t}\n\t\tif (mark.attach !== undefined) {\n\t\t\tops.push({ type: \"insert\", count: mark.count });\n\t\t} else if (mark.detach === undefined) {\n\t\t\t// Neither attach nor detach: elements retained (may have nested changes in mark.fields).\n\t\t\tops.push({ type: \"retain\", count: mark.count });\n\t\t}\n\t}\n\treturn ops;\n}\n\n/**\n * Returns a schema for a value if the value is a {@link TreeNode} or a {@link TreeLeafValue}.\n * Returns undefined for other values.\n */\nexport function tryGetSchema(value: unknown): undefined | TreeNodeSchema {\n\tswitch (typeof value) {\n\t\tcase \"string\": {\n\t\t\treturn stringSchema;\n\t\t}\n\t\tcase \"number\": {\n\t\t\treturn numberSchema;\n\t\t}\n\t\tcase \"boolean\": {\n\t\t\treturn booleanSchema;\n\t\t}\n\t\tcase \"object\": {\n\t\t\tif (isTreeNode(value)) {\n\t\t\t\t// TODO: This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.\n\t\t\t\treturn tryGetTreeNodeSchema(value);\n\t\t\t}\n\t\t\tif (value === null) {\n\t\t\t\treturn nullSchema;\n\t\t\t}\n\t\t\tif (isFluidHandle(value)) {\n\t\t\t\treturn handleSchema;\n\t\t\t}\n\t\t}\n\t\tdefault: {\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n\n/**\n * Gets the identifier from a node.\n *\n * @param node - {@link TreeNode} where you want to extract the identifier from.\n * @param compression - string value to determine what type of identifier you want to retrieve.\n *\n * @remarks\n * If the node does not contain an identifier field, it returns undefined.\n *\n * If `compression` is set to `compressed`:\n *\n * - If the node contains a compressible identifier known by the id compressor, the compressed identifier is returned.\n *\n * - If the node contains an identifier, but is not compressible or unknown by the id compressor, `undefined` is returned.\n *\n * If `compression` is set to `preferCompressed`:\n *\n * - If the node contains a compressible identifier known by the id compressor, the compressed identifier is returned.\n *\n * - If the node contains an identifier, but is not compressible or unknown by the id compressor, the uncompressed identifier is returned.\n *\n * If `compression` is set to `uncompressed`:\n * - If the node contains an identifier field, the uncompressed identifier is returned.\n */\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"preferCompressed\",\n): number | string | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"compressed\",\n): number | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"uncompressed\",\n): string | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"preferCompressed\" | \"compressed\" | \"uncompressed\",\n): number | string | undefined {\n\tconst schema = node[typeSchemaSymbol];\n\tif (!isObjectNodeSchema(schema)) {\n\t\treturn undefined;\n\t}\n\n\tconst flexNode = getInnerNode(node);\n\tconst identifierFieldKeys = schema.identifierFieldKeys;\n\n\tswitch (identifierFieldKeys.length) {\n\t\tcase 0: {\n\t\t\treturn undefined;\n\t\t}\n\t\tcase 1: {\n\t\t\tconst key = identifierFieldKeys[0] ?? oob();\n\t\t\tconst identifierField = flexNode.tryGetField(key);\n\t\t\tassert(identifierField !== undefined, 0xbb5 /* missing identifier field */);\n\t\t\tconst identifierValue = tryGetTreeNodeForField(identifierField);\n\t\t\tassert(typeof identifierValue === \"string\", 0xbb6 /* identifier not a string */);\n\n\t\t\tconst context = flexNode.context;\n\t\t\tswitch (compression) {\n\t\t\t\tcase \"preferCompressed\": {\n\t\t\t\t\tif (context.isHydrated()) {\n\t\t\t\t\t\tconst localNodeKey =\n\t\t\t\t\t\t\tcontext.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);\n\t\t\t\t\t\treturn localNodeKey === undefined\n\t\t\t\t\t\t\t? identifierValue\n\t\t\t\t\t\t\t: extractFromOpaque(localNodeKey);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn identifierValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"compressed\": {\n\t\t\t\t\tif (context.isHydrated()) {\n\t\t\t\t\t\tconst localNodeKey =\n\t\t\t\t\t\t\tcontext.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);\n\t\t\t\t\t\treturn localNodeKey === undefined ? undefined : extractFromOpaque(localNodeKey);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"uncompressed\": {\n\t\t\t\t\treturn identifierValue;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(compression);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdefault: {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"The node has more than one identifier. Retrieve identifiers individually via their fields instead.\",\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Gets the stored key with which the provided node is associated in the parent.\n */\nexport function getStoredKey(node: TreeNode): string | number {\n\t// Note: the flex domain strictly works with \"stored keys\", and knows nothing about the developer-facing\n\t// \"property keys\".\n\tconst parentField = getInnerNode(node).parentField;\n\tif (parentField.parent.schema === FieldKinds.sequence.identifier) {\n\t\t// The parent of `node` is an array node\n\t\tassert(\n\t\t\tparentField.parent.key === EmptyKey,\n\t\t\t0xa28 /* When using index as key, field should use EmptyKey */,\n\t\t);\n\t\treturn parentField.index;\n\t}\n\n\t// The parent of `node` is an object, a map, or undefined. If undefined, then `node` is a root/detached node.\n\tassert(parentField.index === 0, 0xa29 /* When using field key as key, index should be 0 */);\n\treturn parentField.parent.key;\n}\n\n/**\n * Given a node schema, gets the property key corresponding with the provided {@link FieldProps.key | stored key}.\n */\nexport function getPropertyKeyFromStoredKey(\n\tschema: TreeNodeSchema,\n\tstoredKey: string | number,\n): string | number {\n\t// Only object nodes have the concept of a \"stored key\", differentiated from the developer-facing \"property key\".\n\t// For any other kind of node, the stored key and the property key are the same.\n\tif (schema.kind !== NodeKind.Object) {\n\t\treturn storedKey;\n\t}\n\n\tconst fields = schema.info as Record<string, ImplicitFieldSchema>;\n\n\t// Invariants:\n\t// - The set of all property keys under an object must be unique.\n\t// - The set of all stored keys (including those implicitly created from property keys) must be unique.\n\t// To find the property key associated with the provided stored key, first check for any stored key matches (which are optionally populated).\n\t// If we don't find any, then search for a matching property key.\n\tfor (const [propertyKey, fieldSchema] of Object.entries(fields)) {\n\t\tif (fieldSchema instanceof FieldSchema && fieldSchema.props?.key === storedKey) {\n\t\t\treturn propertyKey;\n\t\t}\n\t}\n\n\tif (fields[storedKey] === undefined) {\n\t\tfail(0xb38 /* Existing stored key should always map to a property key */);\n\t}\n\n\treturn storedKey;\n}\n"]}
1
+ {"version":3,"file":"treeNodeApi.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeNodeApi.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAAyF;AACzF,qEAAuE;AACvE,uEAAsE;AAEtE,kDAA6E;AAC7E,+DAA4F;AAC5F,kDAAwD;AACxD,+CAc0B;AAC1B,sDAA0E;AAC1E,sEAAmE;AACnE,4DAM8B;AAC9B,qDAA+E;AAyL/E;;GAEG;AACU,QAAA,WAAW,GAAgB;IACvC,MAAM,CAAC,IAAc;QACpB,MAAM,QAAQ,GAAG,IAAA,uBAAY,EAAC,IAAI,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;QAC9D,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,MAAM,MAAM,GAAG,IAAA,uCAA4B,EAAC,QAAQ,CAAC,CAAC;QACtD,IAAA,iBAAM,EACL,CAAC,IAAA,sBAAW,EAAC,MAAM,CAAC,EACpB,KAAK,CAAC,gEAAgE,CACtE,CAAC;QACF,OAAO,MAAM,CAAC;IACf,CAAC;IACD,GAAG,CAAC,IAAc;QACjB,sEAAsE;QACtE,8CAA8C;QAC9C,MAAM,MAAM,GAAG,mBAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,uBAAY,CAAC;QACrB,CAAC;QAED,+DAA+D;QAC/D,uGAAuG;QACvG,4GAA4G;QAC5G,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,YAAY,GAAG,mBAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC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IACjE,KAAK,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACjE,IAAI,WAAW,YAAY,4BAAW,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,KAAK,SAAS,EAAE,CAAC;YAChF,OAAO,WAAW,CAAC;QACpB,CAAC;IACF,CAAC;IAED,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE,CAAC;QACrC,IAAA,eAAI,EAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC;AA5BD,kEA4BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Off } from \"@fluidframework/core-interfaces\";\nimport { assert, oob, fail, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EmptyKey, rootFieldKey, type DeltaMark } from \"../../core/index.js\";\nimport { type TreeStatus, isTreeValue, FieldKinds } from \"../../feature-libraries/index.js\";\nimport { extractFromOpaque } from \"../../util/index.js\";\nimport {\n\tgetKernel,\n\tisTreeNode,\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype TreeNode,\n\ttryGetTreeNodeSchema,\n\tgetOrCreateNodeFromInnerNode,\n\ttypeSchemaSymbol,\n\tgetInnerNode,\n\ttype TreeLeafValue,\n\ttype ImplicitAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tnormalizeAllowedTypes,\n} from \"../core/index.js\";\nimport { type ImplicitFieldSchema, FieldSchema } from \"../fieldSchema.js\";\nimport { tryGetTreeNodeForField } from \"../getTreeNodeForField.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isArrayNodeSchema, isObjectNodeSchema } from \"../node-kinds/index.js\";\n\nimport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\n\n/**\n * A `\"retain\"` op in an {@link ArrayNodeDeltaOp} sequence.\n * Represents elements that were neither inserted into nor removed from the array.\n * @sealed @alpha\n */\nexport interface ArrayNodeRetainOp {\n\treadonly type: \"retain\";\n\treadonly count: number;\n}\n\n/**\n * A `\"retain\"` op in an {@link ArrayNodeTreeChangedDeltaOp} sequence, used in\n * {@link NodeChangedDataTreeDelta} payloads delivered to\n * {@link TreeChangeEventsAlpha.treeChanged} on array nodes.\n *\n * Extends {@link ArrayNodeRetainOp} with a {@link ArrayNodeTreeChangedRetainOp.subtreeChanged}\n * flag that indicates whether any descendant of the retained element changed.\n * @sealed @alpha\n */\nexport interface ArrayNodeTreeChangedRetainOp extends ArrayNodeRetainOp {\n\t/**\n\t * Whether any descendant of this retained element changed.\n\t * `true` if the element's subtree changed; `false` if nothing changed within it.\n\t * @remarks\n\t * Subscribe to `nodeChanged` or `treeChanged` on the element node itself for details.\n\t */\n\treadonly subtreeChanged: boolean;\n}\n\n/**\n * A single operation in an array-node delta delivered by {@link TreeChangeEventsAlpha.treeChanged}.\n * Extends {@link ArrayNodeDeltaOp}: retain ops carry a {@link ArrayNodeTreeChangedRetainOp.subtreeChanged}\n * flag indicating whether any descendant of the retained element changed.\n * @alpha\n */\nexport type ArrayNodeTreeChangedDeltaOp =\n\t| ArrayNodeTreeChangedRetainOp\n\t| ArrayNodeInsertOp\n\t| ArrayNodeRemoveOp;\n\n/**\n * An `\"insert\"` op in an {@link ArrayNodeDeltaOp} sequence.\n * Represents elements added to the array.\n * Read the new element values from the current tree at the positions described by this op.\n * @sealed @alpha\n */\nexport interface ArrayNodeInsertOp {\n\treadonly type: \"insert\";\n\treadonly count: number;\n}\n\n/**\n * A `\"remove\"` op in an {@link ArrayNodeDeltaOp} sequence.\n * Represents elements removed from the array.\n * @sealed @alpha\n */\nexport interface ArrayNodeRemoveOp {\n\treadonly type: \"remove\";\n\treadonly count: number;\n}\n\n/**\n * A single operation in an array node change delta. Used to efficiently sync an external\n * representation of an array (e.g. a text editor or virtual list) with tree changes without\n * needing to snapshot the old state or diff the entire array. Each op describes a contiguous run\n * of positions in the array before the change. For inserts, read the new element values from the\n * current tree at those positions.\n *\n * @remarks\n * There is no dedicated `\"move\"` op. Moves are represented as `\"remove\"` + `\"insert\"`.\n * When an element is moved within the same array it appears\n * as a `\"remove\"` at the source position followed by an `\"insert\"` at the destination position.\n * When an element is moved across two different arrays, the source array's delta contains a\n * `\"remove\"` and the destination array's delta contains an `\"insert\"` — they cannot be\n * correlated without additional bookkeeping on the caller's side.\n *\n * @sealed @alpha\n */\nexport type ArrayNodeDeltaOp = ArrayNodeRetainOp | ArrayNodeInsertOp | ArrayNodeRemoveOp;\n\n/**\n * Provides various functions for analyzing {@link TreeNode}s.\n *\n * @remarks\n * With the exception of {@link TreeNodeApi.status}, these functions should not be called with nodes that have\n * been {@link TreeStatus.Deleted | deleted}.\n * To verify whether or not a node already has been deleted, use the {@link TreeNodeApi.status} function.\n *\n * This type should only be used via the public {@link (Tree:variable)} export.\n *\n * @privateRemarks\n * Due to limitations of API-Extractor link resolution, this type can't be moved into internalTypes but should be considered just an implementation detail of the `Tree` export.\n *\n * Inlining the typing of this interface onto the `Tree` object provides slightly different .d.ts generation,\n * which avoids typescript expanding the type of TreeNodeSchema and thus encountering\n * https://github.com/microsoft/rushstack/issues/1958.\n * @sealed @public\n */\nexport interface TreeNodeApi {\n\t/**\n\t * The schema information for this node.\n\t */\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema;\n\n\t/**\n\t * Narrow the type of the given value if it satisfies the given schema.\n\t * @example\n\t * ```ts\n\t * if (node.is(myNode, Point)) {\n\t * const y = myNode.y; // `myNode` is now known to satisfy the `Point` schema and therefore has a `y` coordinate.\n\t * }\n\t * ```\n\t */\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema>;\n\n\t/**\n\t * Return the node under which this node resides in the tree (or undefined if this is a root node of the tree).\n\t *\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been {@link TreeStatus.Deleted | deleted}.\n\t *\n\t * @see {@link (TreeAlpha:interface).child}\n\t * @see {@link (TreeAlpha:interface).children}\n\t */\n\tparent(node: TreeNode): TreeNode | undefined;\n\n\t/**\n\t * The key of the given node under its parent.\n\t *\n\t * @remarks\n\t * If `node` is an element in a {@link (TreeArrayNode:interface)}, this returns the index of `node` in the array node (a `number`).\n\t * Otherwise, this returns the key of the field that it is under (a `string`).\n\t *\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been {@link TreeStatus.Deleted | deleted}.\n\t */\n\tkey(node: TreeNode): string | number;\n\n\t/**\n\t * Register an event listener on the given node.\n\t * @param node - The node whose events should be subscribed to.\n\t * @param eventName - Which event to subscribe to.\n\t * @param listener - The callback to trigger for the event. The tree can be read during the callback, but it is invalid to modify the tree during this callback.\n\t * @returns A callback function which will deregister the event.\n\t * This callback should be called only once.\n\t * @remarks\n\t * The returned unsubscribe function should be called any time the need for the `listener` callback ends before the node is {@link TreeStatus.Deleted | deleted} (Not just {@link TreeStatus.Removed | removed}).\n\t * Doing so removes the overhead of tracking and triggering the event, and also avoids leaking any memory retained by the callback.\n\t */\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): () => void;\n\n\t/**\n\t * Returns the {@link TreeStatus} of the given node.\n\t */\n\tstatus(node: TreeNode): TreeStatus;\n\n\t/**\n\t * Returns the {@link SchemaFactory.identifier | identifier} of the given node in the most compressed form possible.\n\t * @remarks\n\t * If the node is {@link Unhydrated | hydrated} and its identifier is a valid UUID that was automatically generated by the SharedTree it is part of (or something else using the same {@link @fluidframework/id-compressor#IIdCompressor}), then this will return a process-unique integer corresponding to that identifier.\n\t * This is useful for performance-sensitive scenarios involving many nodes with identifiers that need to be compactly retained in memory or used for efficient lookup.\n\t * Note that automatically generated identifiers that were accessed before the node was hydrated will return the generated UUID, not the process-unique integer.\n\t *\n\t * If the node's identifier is any other user-provided string, then this will return that string.\n\t *\n\t * If the node has no identifier (that is, it has no {@link SchemaFactory.identifier | identifier} field), then this returns `undefined`.\n\t *\n\t * If the node has more than one identifier, then this will throw an error.\n\t *\n\t * The returned integer should not be serialized or preserved outside of the current process.\n\t * Its lifetime is that of the current in-memory instance of the FF container for this client, and it is not guaranteed to be unique or stable outside of that context.\n\t * The same node's identifier may, for example, be different across multiple sessions for the same client and document, or different across two clients in the same session.\n\t */\n\tshortId(node: TreeNode): number | string | undefined;\n}\n\n/**\n * {@inheritDoc TreeNodeApi}\n */\nexport const treeNodeApi: TreeNodeApi = {\n\tparent(node: TreeNode): TreeNode | undefined {\n\t\tconst editNode = getInnerNode(node).parentField.parent.parent;\n\t\tif (editNode === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst output = getOrCreateNodeFromInnerNode(editNode);\n\t\tassert(\n\t\t\t!isTreeValue(output),\n\t\t\t0x87f /* Parent can't be a leaf, so it should be a node not a value */,\n\t\t);\n\t\treturn output;\n\t},\n\tkey(node: TreeNode): string | number {\n\t\t// If the parent is undefined, then this node is under the root field,\n\t\t// so we know its key is the special root one.\n\t\tconst parent = treeNodeApi.parent(node);\n\t\tif (parent === undefined) {\n\t\t\treturn rootFieldKey;\n\t\t}\n\n\t\t// The flex-domain strictly operates in terms of \"stored keys\".\n\t\t// To find the associated developer-facing \"property key\", we need to look up the field associated with\n\t\t// the stored key from the flex-domain, and get property key its simple-domain counterpart was created with.\n\t\tconst storedKey = getStoredKey(node);\n\t\tconst parentSchema = treeNodeApi.schema(parent);\n\t\tconst propertyKey = getPropertyKeyFromStoredKey(parentSchema, storedKey);\n\t\treturn propertyKey;\n\t},\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): Off {\n\t\tconst kernel = getKernel(node);\n\t\tswitch (eventName) {\n\t\t\tcase \"nodeChanged\": {\n\t\t\t\tconst nodeSchema = kernel.schema;\n\t\t\t\tif (isObjectNodeSchema(nodeSchema)) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tconst changedProperties = new Set(\n\t\t\t\t\t\t\tArray.from(\n\t\t\t\t\t\t\t\tchangedFields,\n\t\t\t\t\t\t\t\t(field) =>\n\t\t\t\t\t\t\t\t\tnodeSchema.storedKeyToPropertyKey.get(field) ??\n\t\t\t\t\t\t\t\t\tfail(0xb36 /* Could not find stored key in schema. */),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlistener({ changedProperties });\n\t\t\t\t\t});\n\t\t\t\t} else if (isArrayNodeSchema(nodeSchema)) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ fieldMarks }) => {\n\t\t\t\t\t\tconst marks = fieldMarks.get(EmptyKey);\n\t\t\t\t\t\t// nodeChanged fires only for shallow changes (insert, remove, move).\n\t\t\t\t\t\t// Deep changes (e.g. a property of an element changed) are\n\t\t\t\t\t\t// surfaced via TreeChangeEventsAlpha.treeChanged with a delta payload instead.\n\t\t\t\t\t\t// When marks are undefined (marks could not be composed across multiple\n\t\t\t\t\t\t// internal passes), we conservatively fire nodeChanged rather than silently\n\t\t\t\t\t\t// dropping the event, even though the underlying change may have been\n\t\t\t\t\t\t// purely deep. This is a known limitation of the current eventing stack.\n\t\t\t\t\t\tconst hasShallowChange =\n\t\t\t\t\t\t\tmarks === undefined ||\n\t\t\t\t\t\t\tmarks.some((m) => m.attach !== undefined || m.detach !== undefined);\n\t\t\t\t\t\tif (!hasShallowChange) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// `marks` is undefined when the field was modified across multiple batches\n\t\t\t\t\t\t// within a single flush (e.g. due to an interleaved schema change) and the\n\t\t\t\t\t\t// marks could not be composed. Emit `undefined` so callers know the delta is\n\t\t\t\t\t\t// unavailable rather than receiving stale marks from only the first batch.\n\t\t\t\t\t\t// TODO: Once the eventing stack is rewritten to walk the composed delta at\n\t\t\t\t\t\t// flush time, `marks` will always be defined. Remove the `undefined` fallback.\n\t\t\t\t\t\tconst delta = marks === undefined ? undefined : deltaMarksToArrayOps(marks);\n\t\t\t\t\t\tlistener({ delta });\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tlistener({ changedProperties: changedFields });\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase \"treeChanged\": {\n\t\t\t\tif (isArrayNodeSchema(kernel.schema)) {\n\t\t\t\t\t// For array nodes, treeChanged fires via childrenChangedAfterBatch so that a\n\t\t\t\t\t// delta payload can be provided. This covers both shallow changes\n\t\t\t\t\t// (insert/remove/move) and deep element changes. Stable (non-alpha) listeners\n\t\t\t\t\t// typed as () => void will silently ignore the extra argument at runtime.\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ fieldMarks }) => {\n\t\t\t\t\t\tconst marks = fieldMarks.get(EmptyKey);\n\t\t\t\t\t\tconst delta =\n\t\t\t\t\t\t\tmarks === undefined ? undefined : deltaMarksToArrayOpsForTreeChanged(marks);\n\t\t\t\t\t\t(listener as (data: { readonly delta: typeof delta }) => void)({ delta });\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn kernel.events.on(\"subtreeChangedAfterBatch\", () => listener({}));\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new UsageError(`No event named ${JSON.stringify(eventName)}.`);\n\t\t\t}\n\t\t}\n\t},\n\tstatus(node: TreeNode): TreeStatus {\n\t\treturn getKernel(node).getStatus();\n\t},\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema> {\n\t\t// This \"is\" utility would return false if the provided schema is a base type of the actual schema.\n\t\t// This could be confusing, and that case can only be hit when violating the rule that there is a single most derived schema that gets used (See documentation on TreeNodeSchemaClass).\n\t\t// Therefore this uses markSchemaMostDerived to ensure an informative usage error is thrown in the case where a base type is used.\n\n\t\tconst actualSchema = tryGetSchema(value);\n\t\tif (actualSchema === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\treturn normalizeAllowedTypes(schema).evaluateSet().has(actualSchema);\n\t},\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema {\n\t\treturn tryGetSchema(node) ?? fail(0xb37 /* Not a tree node */);\n\t},\n\tshortId(node: TreeNode): number | string | undefined {\n\t\treturn getIdentifierFromNode(node, \"preferCompressed\");\n\t},\n};\n\n/**\n * Converts an array of internal {@link DeltaMark}s for a sequence field into sequential\n * array delta ops suitable for inclusion in {@link NodeChangedDataDelta.delta}.\n *\n * Each mark in the delta describes a contiguous run of positions in the original array:\n * - A mark with only `count` (no attach/detach) → `\"retain\"` with no subtree information\n * - A mark with only `attach` → `\"insert\"` (new elements added)\n * - A mark with only `detach` → `\"remove\"` (elements removed)\n * - A mark with both `attach` and `detach` → `\"remove\"` + `\"insert\"`\n *\n * @param marks - The low-level delta marks for the array's sequence field.\n *\n * @privateRemarks\n * The case where both `attach` and `detach` are set is unreachable today: the sequence-field\n * encoder never emits such marks for array (EmptyKey) fields. It is handled defensively.\n */\nexport function deltaMarksToArrayOps(marks: readonly DeltaMark[]): ArrayNodeDeltaOp[] {\n\tconst ops: ArrayNodeDeltaOp[] = [];\n\tfor (const mark of marks) {\n\t\tif (mark.detach !== undefined) {\n\t\t\tops.push({ type: \"remove\", count: mark.count });\n\t\t}\n\t\tif (mark.attach !== undefined) {\n\t\t\tops.push({ type: \"insert\", count: mark.count });\n\t\t} else if (mark.detach === undefined) {\n\t\t\t// Retain: elements were not added or removed.\n\t\t\tops.push({ type: \"retain\", count: mark.count });\n\t\t}\n\t}\n\treturn ops;\n}\n\n/**\n * Converts an array of internal {@link DeltaMark}s for a sequence field into sequential\n * {@link ArrayNodeTreeChangedDeltaOp}s suitable for inclusion in\n * {@link NodeChangedDataTreeDelta.delta} (delivered to {@link TreeChangeEventsAlpha.treeChanged}).\n *\n * Same conversion rules as {@link deltaMarksToArrayOps}, but retain ops additionally carry a\n * {@link ArrayNodeTreeChangedRetainOp.subtreeChanged} flag derived from whether the mark has\n * a `fields` property (indicating a descendant changed).\n *\n * @param marks - The low-level delta marks for the array's sequence field.\n *\n * @privateRemarks\n * The case where both `attach` and `detach` are set is unreachable today: the sequence-field\n * encoder never emits such marks for array (EmptyKey) fields. It is handled defensively.\n */\nexport function deltaMarksToArrayOpsForTreeChanged(\n\tmarks: readonly DeltaMark[],\n): ArrayNodeTreeChangedDeltaOp[] {\n\tconst ops: ArrayNodeTreeChangedDeltaOp[] = [];\n\tfor (const mark of marks) {\n\t\tif (mark.detach !== undefined) {\n\t\t\tops.push({ type: \"remove\", count: mark.count });\n\t\t}\n\t\tif (mark.attach !== undefined) {\n\t\t\tops.push({ type: \"insert\", count: mark.count });\n\t\t} else if (mark.detach === undefined) {\n\t\t\t// Retain: elements were not added or removed (but may have deep changes).\n\t\t\t// When `fields` is set, `count` is guaranteed to be 1 (DeltaMark invariant).\n\t\t\tops.push({\n\t\t\t\ttype: \"retain\",\n\t\t\t\tcount: mark.count,\n\t\t\t\tsubtreeChanged: mark.fields !== undefined,\n\t\t\t});\n\t\t}\n\t}\n\treturn ops;\n}\n\n/**\n * Returns a schema for a value if the value is a {@link TreeNode} or a {@link TreeLeafValue}.\n * Returns undefined for other values.\n */\nexport function tryGetSchema(value: unknown): undefined | TreeNodeSchema {\n\tswitch (typeof value) {\n\t\tcase \"string\": {\n\t\t\treturn stringSchema;\n\t\t}\n\t\tcase \"number\": {\n\t\t\treturn numberSchema;\n\t\t}\n\t\tcase \"boolean\": {\n\t\t\treturn booleanSchema;\n\t\t}\n\t\tcase \"object\": {\n\t\t\tif (isTreeNode(value)) {\n\t\t\t\t// TODO: This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.\n\t\t\t\treturn tryGetTreeNodeSchema(value);\n\t\t\t}\n\t\t\tif (value === null) {\n\t\t\t\treturn nullSchema;\n\t\t\t}\n\t\t\tif (isFluidHandle(value)) {\n\t\t\t\treturn handleSchema;\n\t\t\t}\n\t\t}\n\t\tdefault: {\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n\n/**\n * Gets the identifier from a node.\n *\n * @param node - {@link TreeNode} where you want to extract the identifier from.\n * @param compression - string value to determine what type of identifier you want to retrieve.\n *\n * @remarks\n * If the node does not contain an identifier field, it returns undefined.\n *\n * If `compression` is set to `compressed`:\n *\n * - If the node contains a compressible identifier known by the id compressor, the compressed identifier is returned.\n *\n * - If the node contains an identifier, but is not compressible or unknown by the id compressor, `undefined` is returned.\n *\n * If `compression` is set to `preferCompressed`:\n *\n * - If the node contains a compressible identifier known by the id compressor, the compressed identifier is returned.\n *\n * - If the node contains an identifier, but is not compressible or unknown by the id compressor, the uncompressed identifier is returned.\n *\n * If `compression` is set to `uncompressed`:\n * - If the node contains an identifier field, the uncompressed identifier is returned.\n */\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"preferCompressed\",\n): number | string | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"compressed\",\n): number | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"uncompressed\",\n): string | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"preferCompressed\" | \"compressed\" | \"uncompressed\",\n): number | string | undefined {\n\tconst schema = node[typeSchemaSymbol];\n\tif (!isObjectNodeSchema(schema)) {\n\t\treturn undefined;\n\t}\n\n\tconst flexNode = getInnerNode(node);\n\tconst identifierFieldKeys = schema.identifierFieldKeys;\n\n\tswitch (identifierFieldKeys.length) {\n\t\tcase 0: {\n\t\t\treturn undefined;\n\t\t}\n\t\tcase 1: {\n\t\t\tconst key = identifierFieldKeys[0] ?? oob();\n\t\t\tconst identifierField = flexNode.tryGetField(key);\n\t\t\tassert(identifierField !== undefined, 0xbb5 /* missing identifier field */);\n\t\t\tconst identifierValue = tryGetTreeNodeForField(identifierField);\n\t\t\tassert(typeof identifierValue === \"string\", 0xbb6 /* identifier not a string */);\n\n\t\t\tconst context = flexNode.context;\n\t\t\tswitch (compression) {\n\t\t\t\tcase \"preferCompressed\": {\n\t\t\t\t\tif (context.isHydrated()) {\n\t\t\t\t\t\tconst localNodeKey =\n\t\t\t\t\t\t\tcontext.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);\n\t\t\t\t\t\treturn localNodeKey === undefined\n\t\t\t\t\t\t\t? identifierValue\n\t\t\t\t\t\t\t: extractFromOpaque(localNodeKey);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn identifierValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"compressed\": {\n\t\t\t\t\tif (context.isHydrated()) {\n\t\t\t\t\t\tconst localNodeKey =\n\t\t\t\t\t\t\tcontext.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);\n\t\t\t\t\t\treturn localNodeKey === undefined ? undefined : extractFromOpaque(localNodeKey);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"uncompressed\": {\n\t\t\t\t\treturn identifierValue;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(compression);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdefault: {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"The node has more than one identifier. Retrieve identifiers individually via their fields instead.\",\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Gets the stored key with which the provided node is associated in the parent.\n */\nexport function getStoredKey(node: TreeNode): string | number {\n\t// Note: the flex domain strictly works with \"stored keys\", and knows nothing about the developer-facing\n\t// \"property keys\".\n\tconst parentField = getInnerNode(node).parentField;\n\tif (parentField.parent.schema === FieldKinds.sequence.identifier) {\n\t\t// The parent of `node` is an array node\n\t\tassert(\n\t\t\tparentField.parent.key === EmptyKey,\n\t\t\t0xa28 /* When using index as key, field should use EmptyKey */,\n\t\t);\n\t\treturn parentField.index;\n\t}\n\n\t// The parent of `node` is an object, a map, or undefined. If undefined, then `node` is a root/detached node.\n\tassert(parentField.index === 0, 0xa29 /* When using field key as key, index should be 0 */);\n\treturn parentField.parent.key;\n}\n\n/**\n * Given a node schema, gets the property key corresponding with the provided {@link FieldProps.key | stored key}.\n */\nexport function getPropertyKeyFromStoredKey(\n\tschema: TreeNodeSchema,\n\tstoredKey: string | number,\n): string | number {\n\t// Only object nodes have the concept of a \"stored key\", differentiated from the developer-facing \"property key\".\n\t// For any other kind of node, the stored key and the property key are the same.\n\tif (schema.kind !== NodeKind.Object) {\n\t\treturn storedKey;\n\t}\n\n\tconst fields = schema.info as Record<string, ImplicitFieldSchema>;\n\n\t// Invariants:\n\t// - The set of all property keys under an object must be unique.\n\t// - The set of all stored keys (including those implicitly created from property keys) must be unique.\n\t// To find the property key associated with the provided stored key, first check for any stored key matches (which are optionally populated).\n\t// If we don't find any, then search for a matching property key.\n\tfor (const [propertyKey, fieldSchema] of Object.entries(fields)) {\n\t\tif (fieldSchema instanceof FieldSchema && fieldSchema.props?.key === storedKey) {\n\t\t\treturn propertyKey;\n\t\t}\n\t}\n\n\tif (fields[storedKey] === undefined) {\n\t\tfail(0xb38 /* Existing stored key should always map to a property key */);\n\t}\n\n\treturn storedKey;\n}\n"]}
@@ -13,6 +13,13 @@ export interface StoredFromViewSchemaGenerationOptions {
13
13
  * Due to caching, the behavior of this function must be pure.
14
14
  */
15
15
  includeStaged(upgrade: SchemaUpgrade): boolean;
16
+ /**
17
+ * Determines whether to treat a {@link SchemaFactoryAlpha.stagedOptional | staged optional} field as optional
18
+ * (rather than required) in the resulting stored schema.
19
+ * @remarks
20
+ * Due to caching, the behavior of this function must be pure.
21
+ */
22
+ includeStagedOptional(upgrade: SchemaUpgrade): boolean;
16
23
  }
17
24
  /**
18
25
  * Marker type indicating that the input schema is already a stored schema.
@@ -1 +1 @@
1
- {"version":3,"file":"toStored.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/toStored.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,qCAAqC;IACrD;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;CAC/C;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,eAAyB,CAAC;AACnD,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,SAAS,eAAsB,CAAC;AAC7C,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,6BAA6B,GACtC,qCAAqC,GACrC,YAAY,CAAC;AAEhB;;;;;;GAMG;AACH,MAAM,MAAM,iCAAiC,GAC1C,qCAAqC,GACrC,YAAY,GACZ,SAAS,CAAC"}
1
+ {"version":3,"file":"toStored.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/toStored.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,qCAAqC;IACrD;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;IAE/C;;;;;OAKG;IACH,qBAAqB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;CACvD;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,eAAyB,CAAC;AACnD,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,SAAS,eAAsB,CAAC;AAC7C,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,6BAA6B,GACtC,qCAAqC,GACrC,YAAY,CAAC;AAEhB;;;;;;GAMG;AACH,MAAM,MAAM,iCAAiC,GAC1C,qCAAqC,GACrC,YAAY,GACZ,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"toStored.js","sourceRoot":"","sources":["../../../src/simple-tree/core/toStored.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAgBH;;GAEG;AACU,QAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAGnD;;;;GAIG;AACU,QAAA,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SchemaUpgrade } from \"./allowedTypes.js\";\n\n/**\n * Options for transforming a view simple-schema to a stored simple-schema (See {@link TreeStoredSchema}).\n */\nexport interface StoredFromViewSchemaGenerationOptions {\n\t/**\n\t * Determines whether to include {@link SchemaStaticsBeta.staged | staged} allowed types in the resulting stored schema.\n\t * @remarks\n\t * Due to caching, the behavior of this function must be pure.\n\t */\n\tincludeStaged(upgrade: SchemaUpgrade): boolean;\n}\n\n/**\n * Marker type indicating that the input schema is already a stored schema.\n */\nexport const ExpectStored = Symbol(\"ExpectStored\");\nexport type ExpectStored = typeof ExpectStored;\n\n/**\n * Marker type indicating that the input schema should not be transformed: data accessible from the simple schema API surface should be copied as is.\n * @remarks\n * The only real use-cases for this are deep-copying simple schema, and copying objects that implement more than just simple schema (such as {@link TreeSchema}) into simple object without extra prototypes and properties.\n */\nexport const Unchanged = Symbol(\"Unchanged\");\nexport type Unchanged = typeof Unchanged;\n\n/**\n * Subset of {@link SimpleSchemaTransformationOptions} for when the output is a known to be a stored schema.\n */\nexport type StoredSchemaGenerationOptions =\n\t| StoredFromViewSchemaGenerationOptions\n\t| ExpectStored;\n\n/**\n * Options for transforming a schema.\n * @remarks\n * See also {@link generateSchemaFromSimpleSchema} for a different schema transformation.\n * Note that if we want to make `generateSchemaFromSimpleSchema` consume view simple-schema, and use these transformation APIs to generate that view simple-schema from a stored simple-schema,\n * we will need to add a \"ToView\" option here.\n */\nexport type SimpleSchemaTransformationOptions =\n\t| StoredFromViewSchemaGenerationOptions\n\t| ExpectStored\n\t| Unchanged;\n"]}
1
+ {"version":3,"file":"toStored.js","sourceRoot":"","sources":["../../../src/simple-tree/core/toStored.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAwBH;;GAEG;AACU,QAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAGnD;;;;GAIG;AACU,QAAA,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SchemaUpgrade } from \"./allowedTypes.js\";\n\n/**\n * Options for transforming a view simple-schema to a stored simple-schema (See {@link TreeStoredSchema}).\n */\nexport interface StoredFromViewSchemaGenerationOptions {\n\t/**\n\t * Determines whether to include {@link SchemaStaticsBeta.staged | staged} allowed types in the resulting stored schema.\n\t * @remarks\n\t * Due to caching, the behavior of this function must be pure.\n\t */\n\tincludeStaged(upgrade: SchemaUpgrade): boolean;\n\n\t/**\n\t * Determines whether to treat a {@link SchemaFactoryAlpha.stagedOptional | staged optional} field as optional\n\t * (rather than required) in the resulting stored schema.\n\t * @remarks\n\t * Due to caching, the behavior of this function must be pure.\n\t */\n\tincludeStagedOptional(upgrade: SchemaUpgrade): boolean;\n}\n\n/**\n * Marker type indicating that the input schema is already a stored schema.\n */\nexport const ExpectStored = Symbol(\"ExpectStored\");\nexport type ExpectStored = typeof ExpectStored;\n\n/**\n * Marker type indicating that the input schema should not be transformed: data accessible from the simple schema API surface should be copied as is.\n * @remarks\n * The only real use-cases for this are deep-copying simple schema, and copying objects that implement more than just simple schema (such as {@link TreeSchema}) into simple object without extra prototypes and properties.\n */\nexport const Unchanged = Symbol(\"Unchanged\");\nexport type Unchanged = typeof Unchanged;\n\n/**\n * Subset of {@link SimpleSchemaTransformationOptions} for when the output is a known to be a stored schema.\n */\nexport type StoredSchemaGenerationOptions =\n\t| StoredFromViewSchemaGenerationOptions\n\t| ExpectStored;\n\n/**\n * Options for transforming a schema.\n * @remarks\n * See also {@link generateSchemaFromSimpleSchema} for a different schema transformation.\n * Note that if we want to make `generateSchemaFromSimpleSchema` consume view simple-schema, and use these transformation APIs to generate that view simple-schema from a stored simple-schema,\n * we will need to add a \"ToView\" option here.\n */\nexport type SimpleSchemaTransformationOptions =\n\t| StoredFromViewSchemaGenerationOptions\n\t| ExpectStored\n\t| Unchanged;\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { HasListeners, Listenable } from "@fluidframework/core-interfaces/internal";
6
- import { type AnchorEvents, type FieldKey, type FieldKindIdentifier, type ITreeCursorSynchronous, type NodeData, type NormalizedFieldUpPath, type SchemaPolicy, type TreeNodeSchemaIdentifier, type TreeNodeStoredSchema, type TreeStoredSchema, type TreeValue, type Value } from "../../core/index.js";
6
+ import { type AnchorEvents, type DeltaMark, type FieldKey, type FieldKindIdentifier, type ITreeCursorSynchronous, type NodeData, type NormalizedFieldUpPath, type SchemaPolicy, type TreeNodeSchemaIdentifier, type TreeNodeStoredSchema, type TreeStoredSchema, type TreeValue, type Value } from "../../core/index.js";
7
7
  import { type FlexTreeContext, FlexTreeEntityKind, type FlexTreeField, type FlexTreeNode, type FlexTreeOptionalField, type FlexTreeSequenceField, type FlexTreeTypedField, type FlexTreeUnknownUnboxed, flexTreeMarker, type FlexTreeHydratedContext, type FlexFieldKind, type FlexibleNodeContent, type FlexTreeHydratedContextMinimal, type FlexibleFieldContent, type MapTreeFieldViewGeneric, type MapTreeNodeViewGeneric, type HydratedFlexTreeNode, type MinimalFieldMap } from "../../feature-libraries/index.js";
8
8
  import type { ContextualFieldProvider } from "../fieldSchema.js";
9
9
  import type { Context } from "./context.js";
@@ -106,7 +106,15 @@ export declare class UnhydratedFlexTreeNode implements FlexTreeNode, MapTreeNode
106
106
  getBoxed(key: string): UnhydratedFlexTreeField;
107
107
  keys(): IterableIterator<FieldKey>;
108
108
  get value(): Value;
109
- emitChangedEvent(key: FieldKey): void;
109
+ /**
110
+ * Emit a `childrenChangedAfterBatch` event for this node, then propagate deep-change
111
+ * signals to ancestor array nodes and subtree-changed signals up the entire ancestor chain.
112
+ * @param key - The field key that changed.
113
+ * @param marks - Optional delta marks describing the change to the field. When provided, they
114
+ * are included in the `fieldMarks` payload so that array-node listeners can build a delta.
115
+ * When omitted (e.g. for non-sequence fields), `fieldMarks` is empty.
116
+ */
117
+ emitChangedEvent(key: FieldKey, marks?: readonly DeltaMark[]): void;
110
118
  }
111
119
  /**
112
120
  * Implementation of `FlexTreeContext`.
@@ -175,7 +183,13 @@ export declare class UnhydratedFlexTreeField implements FlexTreeField, MapTreeFi
175
183
  * @remarks All edits to the field (i.e. mutations of the field's MapTrees) should be directed through this function.
176
184
  * This function ensures that the parent MapTree has no empty fields (which is an invariant of `MapTree`) after the mutation.
177
185
  */
178
- protected edit(edit: (mapTrees: UnhydratedFlexTreeNode[]) => void | UnhydratedFlexTreeNode[]): void;
186
+ protected edit(edit: (mapTrees: UnhydratedFlexTreeNode[]) => void | UnhydratedFlexTreeNode[],
187
+ /**
188
+ * Delta marks describing this edit, forwarded to {@link UnhydratedFlexTreeNode.emitChangedEvent}.
189
+ * Sequence-field subclasses pass pre-computed marks so that array-node listeners receive a
190
+ * meaningful delta; other field kinds omit this parameter.
191
+ */
192
+ marks?: readonly DeltaMark[]): void;
179
193
  getFieldPath(): NormalizedFieldUpPath;
180
194
  /** Unboxes leaf nodes to their values */
181
195
  protected unboxed(index: number): TreeValue | U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