@fluidframework/tree 2.92.0 → 2.93.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 (292) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +1 -1
  3. package/api-report/tree.alpha.api.md +57 -29
  4. package/api-report/tree.beta.api.md +41 -12
  5. package/api-report/tree.legacy.beta.api.md +41 -12
  6. package/dist/api.d.ts +6 -1
  7. package/dist/api.d.ts.map +1 -1
  8. package/dist/api.js.map +1 -1
  9. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  10. package/dist/core/tree/anchorSet.js +21 -0
  11. package/dist/core/tree/anchorSet.js.map +1 -1
  12. package/dist/entrypoints/alpha.d.ts +1 -1
  13. package/dist/entrypoints/alpha.d.ts.map +1 -1
  14. package/dist/entrypoints/alpha.js +4 -4
  15. package/dist/entrypoints/alpha.js.map +1 -1
  16. package/dist/entrypoints/beta.d.ts +1 -1
  17. package/dist/entrypoints/beta.d.ts.map +1 -1
  18. package/dist/entrypoints/beta.js +3 -1
  19. package/dist/entrypoints/beta.js.map +1 -1
  20. package/dist/entrypoints/legacy.d.ts +1 -1
  21. package/dist/entrypoints/legacy.d.ts.map +1 -1
  22. package/dist/entrypoints/legacy.js +3 -1
  23. package/dist/entrypoints/legacy.js.map +1 -1
  24. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +2 -2
  25. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  26. package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -1
  27. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  28. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +13 -5
  29. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  30. package/dist/feature-libraries/chunked-forest/uniformChunk.js +22 -18
  31. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  32. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +1 -0
  33. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  34. package/dist/feature-libraries/indexing/anchorTreeIndex.js +3 -1
  35. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  36. package/dist/feature-libraries/indexing/types.d.ts +4 -3
  37. package/dist/feature-libraries/indexing/types.d.ts.map +1 -1
  38. package/dist/feature-libraries/indexing/types.js.map +1 -1
  39. package/dist/index.d.ts +1 -1
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/packageVersion.d.ts +1 -1
  43. package/dist/packageVersion.js +1 -1
  44. package/dist/packageVersion.js.map +1 -1
  45. package/dist/serializableDomainSchema.d.ts +5 -5
  46. package/dist/serializableDomainSchema.d.ts.map +1 -1
  47. package/dist/serializableDomainSchema.js.map +1 -1
  48. package/dist/shared-tree/treeAlpha.d.ts +6 -2
  49. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  50. package/dist/shared-tree/treeAlpha.js.map +1 -1
  51. package/dist/simple-tree/api/discrepancies.js +4 -1
  52. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  53. package/dist/simple-tree/api/identifierIndex.d.ts +2 -2
  54. package/dist/simple-tree/api/identifierIndex.js +1 -1
  55. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  56. package/dist/simple-tree/api/index.d.ts +2 -2
  57. package/dist/simple-tree/api/index.d.ts.map +1 -1
  58. package/dist/simple-tree/api/index.js +3 -2
  59. package/dist/simple-tree/api/index.js.map +1 -1
  60. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +31 -2
  61. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  62. package/dist/simple-tree/api/schemaFactoryAlpha.js +17 -1
  63. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  64. package/dist/simple-tree/api/simpleTreeIndex.d.ts +5 -5
  65. package/dist/simple-tree/api/simpleTreeIndex.js +1 -1
  66. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  67. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  68. package/dist/simple-tree/api/storedSchema.js +4 -1
  69. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  70. package/dist/simple-tree/api/treeAlpha.d.ts +70 -13
  71. package/dist/simple-tree/api/treeAlpha.d.ts.map +1 -1
  72. package/dist/simple-tree/api/treeAlpha.js.map +1 -1
  73. package/dist/simple-tree/api/treeChangeEvents.d.ts +1 -1
  74. package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
  75. package/dist/simple-tree/api/treeNodeApi.d.ts +60 -1
  76. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  77. package/dist/simple-tree/api/treeNodeApi.js +68 -6
  78. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  79. package/dist/simple-tree/core/toStored.d.ts +7 -0
  80. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  81. package/dist/simple-tree/core/toStored.js.map +1 -1
  82. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +17 -3
  83. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  84. package/dist/simple-tree/core/unhydratedFlexTree.js +114 -12
  85. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  86. package/dist/simple-tree/fieldSchema.d.ts +6 -1
  87. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  88. package/dist/simple-tree/fieldSchema.js +3 -0
  89. package/dist/simple-tree/fieldSchema.js.map +1 -1
  90. package/dist/simple-tree/index.d.ts +2 -2
  91. package/dist/simple-tree/index.d.ts.map +1 -1
  92. package/dist/simple-tree/index.js +4 -3
  93. package/dist/simple-tree/index.js.map +1 -1
  94. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  95. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  96. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  97. package/dist/simple-tree/node-kinds/map/index.d.ts +1 -1
  98. package/dist/simple-tree/node-kinds/map/index.d.ts.map +1 -1
  99. package/dist/simple-tree/node-kinds/map/index.js.map +1 -1
  100. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +13 -0
  101. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  102. package/dist/simple-tree/node-kinds/map/mapNode.js +6 -1
  103. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  104. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +6 -6
  105. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  106. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  107. package/dist/simple-tree/simpleSchema.d.ts +17 -0
  108. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  109. package/dist/simple-tree/simpleSchema.js.map +1 -1
  110. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  111. package/dist/simple-tree/toStoredSchema.js +23 -1
  112. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  113. package/dist/tableSchema.d.ts +4 -5
  114. package/dist/tableSchema.d.ts.map +1 -1
  115. package/dist/tableSchema.js +12 -23
  116. package/dist/tableSchema.js.map +1 -1
  117. package/dist/text/textDomain.d.ts.map +1 -1
  118. package/dist/text/textDomain.js +27 -0
  119. package/dist/text/textDomain.js.map +1 -1
  120. package/dist/text/textDomainFormatted.d.ts +4 -4
  121. package/dist/util/index.d.ts +1 -1
  122. package/dist/util/index.d.ts.map +1 -1
  123. package/dist/util/index.js +2 -3
  124. package/dist/util/index.js.map +1 -1
  125. package/dist/util/utils.d.ts +0 -1
  126. package/dist/util/utils.d.ts.map +1 -1
  127. package/dist/util/utils.js +1 -6
  128. package/dist/util/utils.js.map +1 -1
  129. package/eslint.config.mts +1 -1
  130. package/lib/api.d.ts +6 -1
  131. package/lib/api.d.ts.map +1 -1
  132. package/lib/api.js.map +1 -1
  133. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  134. package/lib/core/tree/anchorSet.js +21 -0
  135. package/lib/core/tree/anchorSet.js.map +1 -1
  136. package/lib/entrypoints/alpha.d.ts +1 -1
  137. package/lib/entrypoints/alpha.d.ts.map +1 -1
  138. package/lib/entrypoints/alpha.js +1 -1
  139. package/lib/entrypoints/alpha.js.map +1 -1
  140. package/lib/entrypoints/beta.d.ts +1 -1
  141. package/lib/entrypoints/beta.d.ts.map +1 -1
  142. package/lib/entrypoints/beta.js +1 -1
  143. package/lib/entrypoints/beta.js.map +1 -1
  144. package/lib/entrypoints/legacy.d.ts +1 -1
  145. package/lib/entrypoints/legacy.d.ts.map +1 -1
  146. package/lib/entrypoints/legacy.js +1 -1
  147. package/lib/entrypoints/legacy.js.map +1 -1
  148. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +2 -2
  149. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  150. package/lib/feature-libraries/chunked-forest/chunkTree.js +2 -1
  151. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  152. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +13 -5
  153. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  154. package/lib/feature-libraries/chunked-forest/uniformChunk.js +22 -18
  155. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  156. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +1 -0
  157. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  158. package/lib/feature-libraries/indexing/anchorTreeIndex.js +3 -1
  159. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  160. package/lib/feature-libraries/indexing/types.d.ts +4 -3
  161. package/lib/feature-libraries/indexing/types.d.ts.map +1 -1
  162. package/lib/feature-libraries/indexing/types.js.map +1 -1
  163. package/lib/index.d.ts +1 -1
  164. package/lib/index.d.ts.map +1 -1
  165. package/lib/index.js.map +1 -1
  166. package/lib/packageVersion.d.ts +1 -1
  167. package/lib/packageVersion.js +1 -1
  168. package/lib/packageVersion.js.map +1 -1
  169. package/lib/serializableDomainSchema.d.ts +5 -5
  170. package/lib/serializableDomainSchema.d.ts.map +1 -1
  171. package/lib/serializableDomainSchema.js +4 -1
  172. package/lib/serializableDomainSchema.js.map +1 -1
  173. package/lib/shared-tree/treeAlpha.d.ts +6 -2
  174. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  175. package/lib/shared-tree/treeAlpha.js.map +1 -1
  176. package/lib/simple-tree/api/discrepancies.js +4 -1
  177. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  178. package/lib/simple-tree/api/identifierIndex.d.ts +2 -2
  179. package/lib/simple-tree/api/identifierIndex.js +1 -1
  180. package/lib/simple-tree/api/identifierIndex.js.map +1 -1
  181. package/lib/simple-tree/api/index.d.ts +2 -2
  182. package/lib/simple-tree/api/index.d.ts.map +1 -1
  183. package/lib/simple-tree/api/index.js +1 -1
  184. package/lib/simple-tree/api/index.js.map +1 -1
  185. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +31 -2
  186. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  187. package/lib/simple-tree/api/schemaFactoryAlpha.js +19 -3
  188. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  189. package/lib/simple-tree/api/simpleTreeIndex.d.ts +5 -5
  190. package/lib/simple-tree/api/simpleTreeIndex.js +1 -1
  191. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  192. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  193. package/lib/simple-tree/api/storedSchema.js +4 -1
  194. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  195. package/lib/simple-tree/api/treeAlpha.d.ts +70 -13
  196. package/lib/simple-tree/api/treeAlpha.d.ts.map +1 -1
  197. package/lib/simple-tree/api/treeAlpha.js.map +1 -1
  198. package/lib/simple-tree/api/treeChangeEvents.d.ts +1 -1
  199. package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
  200. package/lib/simple-tree/api/treeNodeApi.d.ts +60 -1
  201. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  202. package/lib/simple-tree/api/treeNodeApi.js +66 -6
  203. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  204. package/lib/simple-tree/core/toStored.d.ts +7 -0
  205. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  206. package/lib/simple-tree/core/toStored.js.map +1 -1
  207. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +17 -3
  208. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  209. package/lib/simple-tree/core/unhydratedFlexTree.js +115 -13
  210. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  211. package/lib/simple-tree/fieldSchema.d.ts +6 -1
  212. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  213. package/lib/simple-tree/fieldSchema.js +3 -0
  214. package/lib/simple-tree/fieldSchema.js.map +1 -1
  215. package/lib/simple-tree/index.d.ts +2 -2
  216. package/lib/simple-tree/index.d.ts.map +1 -1
  217. package/lib/simple-tree/index.js +1 -1
  218. package/lib/simple-tree/index.js.map +1 -1
  219. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  220. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  221. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  222. package/lib/simple-tree/node-kinds/map/index.d.ts +1 -1
  223. package/lib/simple-tree/node-kinds/map/index.d.ts.map +1 -1
  224. package/lib/simple-tree/node-kinds/map/index.js.map +1 -1
  225. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +13 -0
  226. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  227. package/lib/simple-tree/node-kinds/map/mapNode.js +6 -1
  228. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  229. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +6 -6
  230. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  231. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  232. package/lib/simple-tree/simpleSchema.d.ts +17 -0
  233. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  234. package/lib/simple-tree/simpleSchema.js.map +1 -1
  235. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  236. package/lib/simple-tree/toStoredSchema.js +24 -2
  237. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  238. package/lib/tableSchema.d.ts +4 -5
  239. package/lib/tableSchema.d.ts.map +1 -1
  240. package/lib/tableSchema.js +12 -23
  241. package/lib/tableSchema.js.map +1 -1
  242. package/lib/text/textDomain.d.ts.map +1 -1
  243. package/lib/text/textDomain.js +29 -0
  244. package/lib/text/textDomain.js.map +1 -1
  245. package/lib/text/textDomainFormatted.d.ts +4 -4
  246. package/lib/tsdoc-metadata.json +1 -1
  247. package/lib/util/index.d.ts +1 -1
  248. package/lib/util/index.d.ts.map +1 -1
  249. package/lib/util/index.js +1 -1
  250. package/lib/util/index.js.map +1 -1
  251. package/lib/util/utils.d.ts +0 -1
  252. package/lib/util/utils.d.ts.map +1 -1
  253. package/lib/util/utils.js +0 -1
  254. package/lib/util/utils.js.map +1 -1
  255. package/package.json +30 -35
  256. package/src/api.ts +10 -0
  257. package/src/core/tree/anchorSet.ts +25 -0
  258. package/src/entrypoints/alpha.ts +20 -16
  259. package/src/entrypoints/beta.ts +7 -1
  260. package/src/entrypoints/legacy.ts +8 -10
  261. package/src/feature-libraries/chunked-forest/chunkTree.ts +3 -2
  262. package/src/feature-libraries/chunked-forest/uniformChunk.ts +42 -20
  263. package/src/feature-libraries/indexing/anchorTreeIndex.ts +1 -0
  264. package/src/feature-libraries/indexing/types.ts +5 -3
  265. package/src/index.ts +4 -0
  266. package/src/packageVersion.ts +1 -1
  267. package/src/serializableDomainSchema.ts +6 -0
  268. package/src/shared-tree/treeAlpha.ts +6 -2
  269. package/src/simple-tree/api/discrepancies.ts +6 -1
  270. package/src/simple-tree/api/identifierIndex.ts +2 -2
  271. package/src/simple-tree/api/index.ts +4 -0
  272. package/src/simple-tree/api/schemaFactoryAlpha.ts +67 -2
  273. package/src/simple-tree/api/simpleTreeIndex.ts +6 -6
  274. package/src/simple-tree/api/storedSchema.ts +4 -1
  275. package/src/simple-tree/api/treeAlpha.ts +75 -12
  276. package/src/simple-tree/api/treeChangeEvents.ts +1 -1
  277. package/src/simple-tree/api/treeNodeApi.ts +101 -7
  278. package/src/simple-tree/core/toStored.ts +8 -0
  279. package/src/simple-tree/core/unhydratedFlexTree.ts +134 -10
  280. package/src/simple-tree/fieldSchema.ts +10 -0
  281. package/src/simple-tree/index.ts +5 -0
  282. package/src/simple-tree/node-kinds/index.ts +1 -0
  283. package/src/simple-tree/node-kinds/map/index.ts +1 -0
  284. package/src/simple-tree/node-kinds/map/mapNode.ts +20 -3
  285. package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +6 -6
  286. package/src/simple-tree/simpleSchema.ts +20 -0
  287. package/src/simple-tree/toStoredSchema.ts +28 -1
  288. package/src/tableSchema.ts +16 -28
  289. package/src/text/textDomain.ts +68 -1
  290. package/src/util/index.ts +0 -1
  291. package/src/util/utils.ts +0 -2
  292. package/.mocharc.customBenchmarks.cjs +0 -25
@@ -3,9 +3,10 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { NodeKind, TreeNode, WithType } from "../core/index.js";
6
+ import type { TreeChangeEventsBeta } from "./treeBeta.js";
6
7
  import type { TreeChangeEvents } from "./treeChangeEvents.js";
7
- export type { ArrayNodeDeltaOp, ArrayNodeInsertOp, ArrayNodeRemoveOp, ArrayNodeRetainOp, } from "./treeNodeApi.js";
8
- import type { ArrayNodeDeltaOp } from "./treeNodeApi.js";
8
+ import type { ArrayNodeDeltaOp, ArrayNodeTreeChangedDeltaOp } from "./treeNodeApi.js";
9
+ export type { ArrayNodeDeltaOp, ArrayNodeInsertOp, ArrayNodeRemoveOp, ArrayNodeRetainOp, ArrayNodeTreeChangedDeltaOp, ArrayNodeTreeChangedRetainOp, } from "./treeNodeApi.js";
9
10
  /**
10
11
  * Data included for {@link TreeChangeEventsAlpha.nodeChanged} when the node is an object, map, or record node.
11
12
  * @sealed @alpha
@@ -21,25 +22,45 @@ export interface NodeChangedDataProperties<TNode extends TreeNode = TreeNode> {
21
22
  readonly changedProperties: ReadonlySet<TNode extends WithType<string, NodeKind.Object, infer TInfo> ? string & keyof TInfo : string>;
22
23
  }
23
24
  /**
24
- * Data included for {@link TreeChangeEventsAlpha.nodeChanged} when the node is an array node.
25
+ * Data carried by the {@link TreeChangeEventsAlpha.nodeChanged} event for array nodes.
25
26
  * @sealed @alpha
26
27
  */
27
28
  export interface NodeChangedDataDelta {
28
29
  /**
29
30
  * The sequential operations describing what changed in the array node.
30
31
  * @remarks
31
- * The value may be `undefined` in two cases:
32
- * - The node was created locally and has not yet been inserted into a document tree (a known
33
- * temporary limitation, tracked in AB#63261).
34
- * - The document was updated in a way that required multiple internal change passes in a single
35
- * operation (for example, a data change combined with a schema upgrade).
32
+ * The value may be `undefined` when the document was updated in a way that required multiple
33
+ * internal change passes in a single operation (for example, a data change combined with a
34
+ * schema upgrade).
36
35
  *
37
36
  * See {@link ArrayNodeDeltaOp} for op semantics.
38
37
  */
39
38
  readonly delta: readonly ArrayNodeDeltaOp[] | undefined;
40
39
  }
41
40
  /**
42
- * The data passed to {@link TreeChangeEventsAlpha.nodeChanged}.
41
+ * Data carried by the {@link TreeChangeEventsAlpha.treeChanged} event for array nodes.
42
+ * @remarks
43
+ * Extends {@link NodeChangedDataDelta}: the retain ops in the delta additionally carry a
44
+ * {@link ArrayNodeTreeChangedRetainOp.subtreeChanged} flag indicating whether any descendant
45
+ * of the retained element changed.
46
+ * @sealed @alpha
47
+ */
48
+ export interface NodeChangedDataTreeDelta {
49
+ /**
50
+ * The sequential operations describing what changed in the array node,
51
+ * including subtree-change information on retain ops.
52
+ * @remarks
53
+ * The value may be `undefined` when the document was updated in a way that required multiple
54
+ * internal change passes in a single operation (for example, a data change combined with a
55
+ * schema upgrade).
56
+ *
57
+ * See {@link ArrayNodeTreeChangedDeltaOp} for op semantics.
58
+ */
59
+ readonly delta: readonly ArrayNodeTreeChangedDeltaOp[] | undefined;
60
+ }
61
+ /**
62
+ * The data passed to {@link TreeChangeEventsAlpha.nodeChanged} and, for array nodes,
63
+ * to {@link TreeChangeEventsAlpha.treeChanged}.
43
64
  * @remarks
44
65
  * - For array nodes: {@link NodeChangedDataDelta} (includes a {@link NodeChangedDataDelta.delta | delta} payload).
45
66
  * - For object, map, and record nodes: {@link NodeChangedDataProperties} (includes {@link NodeChangedDataProperties.changedProperties | changedProperties}).
@@ -48,22 +69,58 @@ export interface NodeChangedDataDelta {
48
69
  */
49
70
  export type NodeChangedDataAlpha<TNode extends TreeNode = TreeNode> = TNode extends WithType<string, NodeKind.Array> ? NodeChangedDataDelta : TNode extends WithType<string, NodeKind.Map | NodeKind.Object | NodeKind.Record> ? NodeChangedDataProperties<TNode> : NodeChangedDataProperties<TNode> | NodeChangedDataDelta;
50
71
  /**
51
- * Extension of {@link TreeChangeEvents} with a richer `nodeChanged` event.
72
+ * Extension of {@link TreeChangeEvents} with a richer `nodeChanged` event and a
73
+ * delta-carrying `treeChanged` event for array nodes.
52
74
  * @remarks
53
75
  * Provides a `nodeChanged` event that includes a delta payload for array nodes and
54
76
  * requires `changedProperties` for object, map, and record nodes.
77
+ * Also provides a `treeChanged` event that, for array nodes, carries a {@link NodeChangedDataDelta}
78
+ * payload describing both shallow and deep changes.
79
+ * For non-array nodes, the `treeChanged` signature is the same as the base event.
80
+ *
55
81
  * Use via `TreeAlpha.on`.
56
82
  * @sealed @alpha
57
83
  */
58
84
  export interface TreeChangeEventsAlpha<TNode extends TreeNode = TreeNode> extends TreeChangeEvents {
59
85
  /**
60
- * Like `TreeChangeEventsBeta.nodeChanged`, but for array nodes the event data includes
61
- * a {@link NodeChangedDataDelta.delta | delta} payload describing the changes as a sequence
62
- * of {@link ArrayNodeDeltaOp} values.
86
+ * Emitted when a shallow change occurs on this node, i.e., when the node's direct children change.
63
87
  *
64
88
  * @remarks
89
+ * For array nodes: the event data includes a {@link NodeChangedDataDelta.delta | delta} payload
90
+ * as a sequence of {@link ArrayNodeDeltaOp} values. Does not fire for deep changes (e.g. a
91
+ * property of an array element changed without any shallow array change). Subscribe to
92
+ * {@link TreeChangeEventsAlpha.treeChanged} on the array to receive a delta for those cases as well.
93
+ *
94
+ * For object, map, and record nodes: the event data includes
95
+ * {@link NodeChangedDataProperties.changedProperties | changedProperties}.
96
+ * @privateRemarks
65
97
  * This defines a property which is a function instead of using the method syntax to avoid function bi-variance issues with the input data to the callback.
66
98
  */
67
99
  nodeChanged: (data: NodeChangedDataAlpha<TNode>) => void;
100
+ /**
101
+ * Emitted when something in the subtree rooted at this node changes.
102
+ *
103
+ * @remarks
104
+ * For array nodes: emitted when any change occurred within the array, including both
105
+ * shallow changes (insert, remove, move) and deep changes (e.g. a property of an element
106
+ * changed). The event data carries a {@link NodeChangedDataTreeDelta.delta | delta} payload
107
+ * describing what changed. The delta uses {@link ArrayNodeTreeChangedRetainOp.subtreeChanged}
108
+ * to flag elements that have deep changes, without describing the details of those deep changes.
109
+ * To inspect deep changes, subscribe to `nodeChanged` or `treeChanged` on the individual
110
+ * element nodes.
111
+ *
112
+ * When this array is nested inside another array, the outer array's `treeChanged` still
113
+ * fires with a delta, but that delta only shows `subtreeChanged: true` for the element
114
+ * position containing this inner array — it does not include the inner array's detailed
115
+ * insert/remove/retain ops. To receive those detailed ops, subscribe to `treeChanged`
116
+ * directly on the inner array.
117
+ * Ancestor non-array nodes still receive the base (no-payload) `treeChanged` via normal
118
+ * subtree propagation.
119
+ *
120
+ * For non-array nodes: same as the base {@link TreeChangeEvents.treeChanged}.
121
+ * @privateRemarks
122
+ * This defines a property which is a function instead of using the method syntax to avoid function bi-variance issues with the input data to the callback.
123
+ */
124
+ treeChanged: TNode extends WithType<string, NodeKind.Array> ? (data: NodeChangedDataTreeDelta) => void : TreeChangeEventsBeta<TNode>["treeChanged"];
68
125
  }
69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EAAE,SAAS,2BAA2B,EAAE,GAAG,SAAS,CAAC;CACnE;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,CAAC,KAAK,SAAS,QAAQ,GAAG,QAAQ,IACjE,KAAK,SAAS,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,GAC3C,oBAAoB,GACpB,KAAK,SAAS,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,GAAG,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAC/E,yBAAyB,CAAC,KAAK,CAAC,GAChC,yBAAyB,CAAC,KAAK,CAAC,GAAG,oBAAoB,CAAC;AAE7D;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,qBAAqB,CAAC,KAAK,SAAS,QAAQ,GAAG,QAAQ,CACvE,SAAQ,gBAAgB;IACxB;;;;;;;;;;;;;OAaG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;IAEzD;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,WAAW,EAAE,KAAK,SAAS,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,GACxD,CAAC,IAAI,EAAE,wBAAwB,KAAK,IAAI,GACxC,oBAAoB,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,CAAC;CAC9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"treeAlpha.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeAlpha.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { NodeKind, TreeNode, WithType } from \"../core/index.js\";\n\nimport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\nexport type {\n\tArrayNodeDeltaOp,\n\tArrayNodeInsertOp,\n\tArrayNodeRemoveOp,\n\tArrayNodeRetainOp,\n} from \"./treeNodeApi.js\";\nimport type { ArrayNodeDeltaOp } from \"./treeNodeApi.js\";\n\n/**\n * Data included for {@link TreeChangeEventsAlpha.nodeChanged} when the node is an object, map, or record node.\n * @sealed @alpha\n */\nexport interface NodeChangedDataProperties<TNode extends TreeNode = TreeNode> {\n\t/**\n\t * Lists all the properties which changed on the node.\n\t * @remarks\n\t * This only includes changes to the node itself (which would trigger {@link TreeChangeEvents.nodeChanged}).\n\t *\n\t * The set should never be empty, since `nodeChanged` will only be triggered when there is a change, and for the supported node types, the only things that can change are properties.\n\t */\n\treadonly changedProperties: ReadonlySet<\n\t\t// For Object nodes, strongly type with the property names from the schema:\n\t\tTNode extends WithType<string, NodeKind.Object, infer TInfo>\n\t\t\t? string & keyof TInfo\n\t\t\t: string\n\t>;\n}\n\n/**\n * Data included for {@link TreeChangeEventsAlpha.nodeChanged} when the node is an array node.\n * @sealed @alpha\n */\nexport interface NodeChangedDataDelta {\n\t/**\n\t * The sequential operations describing what changed in the array node.\n\t * @remarks\n\t * The value may be `undefined` in two cases:\n\t * - The node was created locally and has not yet been inserted into a document tree (a known\n\t * temporary limitation, tracked in AB#63261).\n\t * - The document was updated in a way that required multiple internal change passes in a single\n\t * operation (for example, a data change combined with a schema upgrade).\n\t *\n\t * See {@link ArrayNodeDeltaOp} for op semantics.\n\t */\n\treadonly delta: readonly ArrayNodeDeltaOp[] | undefined;\n}\n\n/**\n * The data passed to {@link TreeChangeEventsAlpha.nodeChanged}.\n * @remarks\n * - For array nodes: {@link NodeChangedDataDelta} (includes a {@link NodeChangedDataDelta.delta | delta} payload).\n * - For object, map, and record nodes: {@link NodeChangedDataProperties} (includes {@link NodeChangedDataProperties.changedProperties | changedProperties}).\n * - For a generic/unknown node type: the union of both.\n * @alpha\n */\nexport type NodeChangedDataAlpha<TNode extends TreeNode = TreeNode> =\n\tTNode extends WithType<string, NodeKind.Array>\n\t\t? NodeChangedDataDelta\n\t\t: TNode extends WithType<string, NodeKind.Map | NodeKind.Object | NodeKind.Record>\n\t\t\t? NodeChangedDataProperties<TNode>\n\t\t\t: NodeChangedDataProperties<TNode> | NodeChangedDataDelta;\n\n/**\n * Extension of {@link TreeChangeEvents} with a richer `nodeChanged` event.\n * @remarks\n * Provides a `nodeChanged` event that includes a delta payload for array nodes and\n * requires `changedProperties` for object, map, and record nodes.\n * Use via `TreeAlpha.on`.\n * @sealed @alpha\n */\nexport interface TreeChangeEventsAlpha<TNode extends TreeNode = TreeNode>\n\textends TreeChangeEvents {\n\t/**\n\t * Like `TreeChangeEventsBeta.nodeChanged`, but for array nodes the event data includes\n\t * a {@link NodeChangedDataDelta.delta | delta} payload describing the changes as a sequence\n\t * of {@link ArrayNodeDeltaOp} values.\n\t *\n\t * @remarks\n\t * This defines a property which is a function instead of using the method syntax to avoid function bi-variance issues with the input data to the callback.\n\t */\n\tnodeChanged: (data: NodeChangedDataAlpha<TNode>) => void;\n}\n"]}
1
+ {"version":3,"file":"treeAlpha.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeAlpha.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { NodeKind, TreeNode, WithType } from \"../core/index.js\";\n\nimport type { TreeChangeEventsBeta } from \"./treeBeta.js\";\nimport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\nimport type { ArrayNodeDeltaOp, ArrayNodeTreeChangedDeltaOp } from \"./treeNodeApi.js\";\nexport type {\n\tArrayNodeDeltaOp,\n\tArrayNodeInsertOp,\n\tArrayNodeRemoveOp,\n\tArrayNodeRetainOp,\n\tArrayNodeTreeChangedDeltaOp,\n\tArrayNodeTreeChangedRetainOp,\n} from \"./treeNodeApi.js\";\n\n/**\n * Data included for {@link TreeChangeEventsAlpha.nodeChanged} when the node is an object, map, or record node.\n * @sealed @alpha\n */\nexport interface NodeChangedDataProperties<TNode extends TreeNode = TreeNode> {\n\t/**\n\t * Lists all the properties which changed on the node.\n\t * @remarks\n\t * This only includes changes to the node itself (which would trigger {@link TreeChangeEvents.nodeChanged}).\n\t *\n\t * The set should never be empty, since `nodeChanged` will only be triggered when there is a change, and for the supported node types, the only things that can change are properties.\n\t */\n\treadonly changedProperties: ReadonlySet<\n\t\t// For Object nodes, strongly type with the property names from the schema:\n\t\tTNode extends WithType<string, NodeKind.Object, infer TInfo>\n\t\t\t? string & keyof TInfo\n\t\t\t: string\n\t>;\n}\n\n/**\n * Data carried by the {@link TreeChangeEventsAlpha.nodeChanged} event for array nodes.\n * @sealed @alpha\n */\nexport interface NodeChangedDataDelta {\n\t/**\n\t * The sequential operations describing what changed in the array node.\n\t * @remarks\n\t * The value may be `undefined` when the document was updated in a way that required multiple\n\t * internal change passes in a single operation (for example, a data change combined with a\n\t * schema upgrade).\n\t *\n\t * See {@link ArrayNodeDeltaOp} for op semantics.\n\t */\n\treadonly delta: readonly ArrayNodeDeltaOp[] | undefined;\n}\n\n/**\n * Data carried by the {@link TreeChangeEventsAlpha.treeChanged} event for array nodes.\n * @remarks\n * Extends {@link NodeChangedDataDelta}: the retain ops in the delta additionally carry a\n * {@link ArrayNodeTreeChangedRetainOp.subtreeChanged} flag indicating whether any descendant\n * of the retained element changed.\n * @sealed @alpha\n */\nexport interface NodeChangedDataTreeDelta {\n\t/**\n\t * The sequential operations describing what changed in the array node,\n\t * including subtree-change information on retain ops.\n\t * @remarks\n\t * The value may be `undefined` when the document was updated in a way that required multiple\n\t * internal change passes in a single operation (for example, a data change combined with a\n\t * schema upgrade).\n\t *\n\t * See {@link ArrayNodeTreeChangedDeltaOp} for op semantics.\n\t */\n\treadonly delta: readonly ArrayNodeTreeChangedDeltaOp[] | undefined;\n}\n\n/**\n * The data passed to {@link TreeChangeEventsAlpha.nodeChanged} and, for array nodes,\n * to {@link TreeChangeEventsAlpha.treeChanged}.\n * @remarks\n * - For array nodes: {@link NodeChangedDataDelta} (includes a {@link NodeChangedDataDelta.delta | delta} payload).\n * - For object, map, and record nodes: {@link NodeChangedDataProperties} (includes {@link NodeChangedDataProperties.changedProperties | changedProperties}).\n * - For a generic/unknown node type: the union of both.\n * @alpha\n */\nexport type NodeChangedDataAlpha<TNode extends TreeNode = TreeNode> =\n\tTNode extends WithType<string, NodeKind.Array>\n\t\t? NodeChangedDataDelta\n\t\t: TNode extends WithType<string, NodeKind.Map | NodeKind.Object | NodeKind.Record>\n\t\t\t? NodeChangedDataProperties<TNode>\n\t\t\t: NodeChangedDataProperties<TNode> | NodeChangedDataDelta;\n\n/**\n * Extension of {@link TreeChangeEvents} with a richer `nodeChanged` event and a\n * delta-carrying `treeChanged` event for array nodes.\n * @remarks\n * Provides a `nodeChanged` event that includes a delta payload for array nodes and\n * requires `changedProperties` for object, map, and record nodes.\n * Also provides a `treeChanged` event that, for array nodes, carries a {@link NodeChangedDataDelta}\n * payload describing both shallow and deep changes.\n * For non-array nodes, the `treeChanged` signature is the same as the base event.\n *\n * Use via `TreeAlpha.on`.\n * @sealed @alpha\n */\nexport interface TreeChangeEventsAlpha<TNode extends TreeNode = TreeNode>\n\textends TreeChangeEvents {\n\t/**\n\t * Emitted when a shallow change occurs on this node, i.e., when the node's direct children change.\n\t *\n\t * @remarks\n\t * For array nodes: the event data includes a {@link NodeChangedDataDelta.delta | delta} payload\n\t * as a sequence of {@link ArrayNodeDeltaOp} values. Does not fire for deep changes (e.g. a\n\t * property of an array element changed without any shallow array change). Subscribe to\n\t * {@link TreeChangeEventsAlpha.treeChanged} on the array to receive a delta for those cases as well.\n\t *\n\t * For object, map, and record nodes: the event data includes\n\t * {@link NodeChangedDataProperties.changedProperties | changedProperties}.\n\t * @privateRemarks\n\t * This defines a property which is a function instead of using the method syntax to avoid function bi-variance issues with the input data to the callback.\n\t */\n\tnodeChanged: (data: NodeChangedDataAlpha<TNode>) => void;\n\n\t/**\n\t * Emitted when something in the subtree rooted at this node changes.\n\t *\n\t * @remarks\n\t * For array nodes: emitted when any change occurred within the array, including both\n\t * shallow changes (insert, remove, move) and deep changes (e.g. a property of an element\n\t * changed). The event data carries a {@link NodeChangedDataTreeDelta.delta | delta} payload\n\t * describing what changed. The delta uses {@link ArrayNodeTreeChangedRetainOp.subtreeChanged}\n\t * to flag elements that have deep changes, without describing the details of those deep changes.\n\t * To inspect deep changes, subscribe to `nodeChanged` or `treeChanged` on the individual\n\t * element nodes.\n\t *\n\t * When this array is nested inside another array, the outer array's `treeChanged` still\n\t * fires with a delta, but that delta only shows `subtreeChanged: true` for the element\n\t * position containing this inner array — it does not include the inner array's detailed\n\t * insert/remove/retain ops. To receive those detailed ops, subscribe to `treeChanged`\n\t * directly on the inner array.\n\t * Ancestor non-array nodes still receive the base (no-payload) `treeChanged` via normal\n\t * subtree propagation.\n\t *\n\t * For non-array nodes: same as the base {@link TreeChangeEvents.treeChanged}.\n\t * @privateRemarks\n\t * This defines a property which is a function instead of using the method syntax to avoid function bi-variance issues with the input data to the callback.\n\t */\n\ttreeChanged: TNode extends WithType<string, NodeKind.Array>\n\t\t? (data: NodeChangedDataTreeDelta) => void\n\t\t: TreeChangeEventsBeta<TNode>[\"treeChanged\"];\n}\n"]}
@@ -35,7 +35,7 @@ export interface TreeChangeEvents {
35
35
  *
36
36
  * - Object nodes define a change as being when the value of one of its properties changes (i.e., the property's value is set, including when set to `undefined`).
37
37
  *
38
- * - Array nodes define a change as when an element is added, removed, moved or replaced.
38
+ * - Array nodes define a change as when an element is added, removed, moved, or replaced.
39
39
  *
40
40
  * - Map nodes define a change as when an entry is added, updated, or removed.
41
41
  *
@@ -1 +1 @@
1
- {"version":3,"file":"treeChangeEvents.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeChangeEvents.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A collection of events that can be emitted by a {@link TreeNode}.\n *\n * @remarks\n * Access these events via the {@link (Tree:variable)}'s {@link TreeNodeApi.on} method.\n *\n * @privateRemarks\n * TODO: add a way to subscribe to a specific field (for nodeChanged and treeChanged).\n * Probably have object node and map node specific APIs for this.\n *\n * TODO: ensure that subscription API for fields aligns with API for subscribing to the root.\n *\n * TODO: add more wider area (avoid needing tons of nodeChanged registration) events for use-cases other than treeChanged.\n * Some ideas:\n *\n * - treeChanged, but with some subtrees/fields/paths excluded\n * - helper to batch several nodeChanged calls to a treeChanged scope\n * - parent change (ex: registration on the parent field for a specific index: maybe allow it for a range. Ex: node event takes optional field and optional index range?)\n * - new content inserted into subtree. Either provide event for this and/or enough info to treeChanged to find and search the new sub-trees.\n * Add separate (non event related) API to efficiently scan tree for given set of types (using low level cursor and schema based filtering)\n * to allow efficiently searching for new content (and initial content) of a given type.\n *\n * @sealed @public\n */\nexport interface TreeChangeEvents {\n\t/**\n\t * Emitted by a node if any changes affected the node.\n\t *\n\t * This event is emitted after all the changes in a batch have been applied to the whole tree.\n\t * This means that a handler for this event will be able to read the updated state of the tree.\n\t *\n\t * - Object nodes define a change as being when the value of one of its properties changes (i.e., the property's value is set, including when set to `undefined`).\n\t *\n\t * - Array nodes define a change as when an element is added, removed, moved or replaced.\n\t *\n\t * - Map nodes define a change as when an entry is added, updated, or removed.\n\t *\n\t * @param unstable - Future versions of this API (such as the one in beta on TreeBeta) may use this argument to provide additional data to the event.\n\t * users of this event should ensure that they do not provide a listener callback which has an optional parameter in this position, since unexpected data might get provided to it.\n\t * This parameter exists to capture this fact in the type system.\n\t * Using an inline lambda expression as the listener callback is a good pattern to avoid cases like this were arguments are added from breaking due to optional arguments.\n\t *\n\t * @remarks\n\t * This event is not emitted when:\n\t *\n\t * - Properties of a child node change. Notably, updates to an array node or a map node (like adding or removing\n\t * elements/entries) will emit this event on the array/map node itself, but not on the node that contains the\n\t * array/map node as one of its properties.\n\t *\n\t * - The node is moved to a different location in the tree or removed from the tree.\n\t * In this case the event is emitted on the _parent_ node, not the node itself.\n\t *\n\t * For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in\n\t * the client that made the original edit.\n\t *\n\t * When the event is emitted, the tree is guaranteed to be in-schema.\n\t *\n\t * @privateRemarks\n\t * This event occurs whenever the apparent contents of the node instance change, regardless of what caused the change.\n\t * For example, it will fire when the local client reassigns a child, when part of a remote edit is applied to the\n\t * node, or when the node has to be updated due to resolution of a merge conflict\n\t * (for example a previously applied local change might be undone, then reapplied differently or not at all).\n\t *\n\t * TODO: define and document event ordering (ex: bottom up, with nodeChanged before treeChange on each level).\n\t */\n\tnodeChanged(unstable?: unknown): void;\n\n\t/**\n\t * Emitted by a node if something changed anywhere in the subtree rooted at it.\n\t *\n\t * This event is emitted after all the changes in a batch have been applied to the whole tree.\n\t * This means that a handler for this event will be able to read the updated state of the tree.\n\t *\n\t * @remarks\n\t * This event is not emitted when the node itself is moved to a different location in the tree or removed from the tree.\n\t * In that case it is emitted on the _parent_ node, not the node itself.\n\t *\n\t * The node itself is part of the subtree, so this event will be emitted even if the only changes are to the properties\n\t * of the node itself.\n\t *\n\t * For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in\n\t * the client that made the original edit.\n\t *\n\t * When it is emitted, the tree is guaranteed to be in-schema.\n\t */\n\ttreeChanged(): void;\n}\n"]}
1
+ {"version":3,"file":"treeChangeEvents.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeChangeEvents.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A collection of events that can be emitted by a {@link TreeNode}.\n *\n * @remarks\n * Access these events via the {@link (Tree:variable)}'s {@link TreeNodeApi.on} method.\n *\n * @privateRemarks\n * TODO: add a way to subscribe to a specific field (for nodeChanged and treeChanged).\n * Probably have object node and map node specific APIs for this.\n *\n * TODO: ensure that subscription API for fields aligns with API for subscribing to the root.\n *\n * TODO: add more wider area (avoid needing tons of nodeChanged registration) events for use-cases other than treeChanged.\n * Some ideas:\n *\n * - treeChanged, but with some subtrees/fields/paths excluded\n * - helper to batch several nodeChanged calls to a treeChanged scope\n * - parent change (ex: registration on the parent field for a specific index: maybe allow it for a range. Ex: node event takes optional field and optional index range?)\n * - new content inserted into subtree. Either provide event for this and/or enough info to treeChanged to find and search the new sub-trees.\n * Add separate (non event related) API to efficiently scan tree for given set of types (using low level cursor and schema based filtering)\n * to allow efficiently searching for new content (and initial content) of a given type.\n *\n * @sealed @public\n */\nexport interface TreeChangeEvents {\n\t/**\n\t * Emitted by a node if any changes affected the node.\n\t *\n\t * This event is emitted after all the changes in a batch have been applied to the whole tree.\n\t * This means that a handler for this event will be able to read the updated state of the tree.\n\t *\n\t * - Object nodes define a change as being when the value of one of its properties changes (i.e., the property's value is set, including when set to `undefined`).\n\t *\n\t * - Array nodes define a change as when an element is added, removed, moved, or replaced.\n\t *\n\t * - Map nodes define a change as when an entry is added, updated, or removed.\n\t *\n\t * @param unstable - Future versions of this API (such as the one in beta on TreeBeta) may use this argument to provide additional data to the event.\n\t * users of this event should ensure that they do not provide a listener callback which has an optional parameter in this position, since unexpected data might get provided to it.\n\t * This parameter exists to capture this fact in the type system.\n\t * Using an inline lambda expression as the listener callback is a good pattern to avoid cases like this were arguments are added from breaking due to optional arguments.\n\t *\n\t * @remarks\n\t * This event is not emitted when:\n\t *\n\t * - Properties of a child node change. Notably, updates to an array node or a map node (like adding or removing\n\t * elements/entries) will emit this event on the array/map node itself, but not on the node that contains the\n\t * array/map node as one of its properties.\n\t *\n\t * - The node is moved to a different location in the tree or removed from the tree.\n\t * In this case the event is emitted on the _parent_ node, not the node itself.\n\t *\n\t * For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in\n\t * the client that made the original edit.\n\t *\n\t * When the event is emitted, the tree is guaranteed to be in-schema.\n\t *\n\t * @privateRemarks\n\t * This event occurs whenever the apparent contents of the node instance change, regardless of what caused the change.\n\t * For example, it will fire when the local client reassigns a child, when part of a remote edit is applied to the\n\t * node, or when the node has to be updated due to resolution of a merge conflict\n\t * (for example a previously applied local change might be undone, then reapplied differently or not at all).\n\t *\n\t * TODO: define and document event ordering (ex: bottom up, with nodeChanged before treeChange on each level).\n\t */\n\tnodeChanged(unstable?: unknown): void;\n\n\t/**\n\t * Emitted by a node if something changed anywhere in the subtree rooted at it.\n\t *\n\t * This event is emitted after all the changes in a batch have been applied to the whole tree.\n\t * This means that a handler for this event will be able to read the updated state of the tree.\n\t *\n\t * @remarks\n\t * This event is not emitted when the node itself is moved to a different location in the tree or removed from the tree.\n\t * In that case it is emitted on the _parent_ node, not the node itself.\n\t *\n\t * The node itself is part of the subtree, so this event will be emitted even if the only changes are to the properties\n\t * of the node itself.\n\t *\n\t * For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in\n\t * the client that made the original edit.\n\t *\n\t * When it is emitted, the tree is guaranteed to be in-schema.\n\t */\n\ttreeChanged(): void;\n}\n"]}
@@ -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,QA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I,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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AAW,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,CA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E;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,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