@fluidframework/tree 2.4.0 → 2.5.0-302463

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 (241) hide show
  1. package/.vscode/settings.json +11 -1
  2. package/api-report/tree.alpha.api.md +148 -51
  3. package/api-report/tree.beta.api.md +83 -38
  4. package/api-report/tree.legacy.alpha.api.md +83 -38
  5. package/api-report/tree.legacy.public.api.md +83 -38
  6. package/api-report/tree.public.api.md +83 -38
  7. package/dist/alpha.d.ts +17 -2
  8. package/dist/beta.d.ts +6 -0
  9. package/dist/events/interop.d.ts +1 -7
  10. package/dist/events/interop.d.ts.map +1 -1
  11. package/dist/events/interop.js.map +1 -1
  12. package/dist/feature-libraries/chunked-forest/basicChunk.js +1 -1
  13. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  14. package/dist/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  15. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  16. package/dist/feature-libraries/object-forest/objectForest.js +1 -1
  17. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  18. package/dist/feature-libraries/treeCursorUtils.js +2 -2
  19. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +1 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/internalTypes.d.ts +1 -1
  25. package/dist/internalTypes.d.ts.map +1 -1
  26. package/dist/internalTypes.js.map +1 -1
  27. package/dist/legacy.d.ts +6 -0
  28. package/dist/packageVersion.d.ts +1 -1
  29. package/dist/packageVersion.d.ts.map +1 -1
  30. package/dist/packageVersion.js +1 -1
  31. package/dist/packageVersion.js.map +1 -1
  32. package/dist/public.d.ts +6 -0
  33. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  34. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  35. package/dist/shared-tree/sharedTree.d.ts +1 -1
  36. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  37. package/dist/shared-tree/sharedTree.js.map +1 -1
  38. package/dist/shared-tree/treeApi.d.ts +6 -6
  39. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  40. package/dist/shared-tree/treeApi.js.map +1 -1
  41. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  42. package/dist/shared-tree/treeCheckout.js +2 -0
  43. package/dist/shared-tree/treeCheckout.js.map +1 -1
  44. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  45. package/dist/shared-tree-core/editManager.js +12 -7
  46. package/dist/shared-tree-core/editManager.js.map +1 -1
  47. package/dist/simple-tree/api/create.d.ts +3 -3
  48. package/dist/simple-tree/api/create.d.ts.map +1 -1
  49. package/dist/simple-tree/api/create.js.map +1 -1
  50. package/dist/simple-tree/api/customTree.js +2 -2
  51. package/dist/simple-tree/api/customTree.js.map +1 -1
  52. package/dist/simple-tree/api/index.d.ts +3 -3
  53. package/dist/simple-tree/api/index.d.ts.map +1 -1
  54. package/dist/simple-tree/api/index.js +1 -2
  55. package/dist/simple-tree/api/index.js.map +1 -1
  56. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +33 -25
  57. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  58. package/dist/simple-tree/api/schemaCreationUtilities.js +31 -21
  59. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  60. package/dist/simple-tree/api/schemaFactory.d.ts +5 -1
  61. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  62. package/dist/simple-tree/api/schemaFactory.js +4 -0
  63. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  64. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +3 -3
  65. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  66. package/dist/simple-tree/api/tree.d.ts +13 -4
  67. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  68. package/dist/simple-tree/api/tree.js.map +1 -1
  69. package/dist/simple-tree/api/treeApiBeta.d.ts.map +1 -1
  70. package/dist/simple-tree/api/treeApiBeta.js.map +1 -1
  71. package/dist/simple-tree/api/typesUnsafe.d.ts +69 -17
  72. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  73. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  74. package/dist/simple-tree/arrayNode.d.ts +14 -3
  75. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  76. package/dist/simple-tree/arrayNode.js.map +1 -1
  77. package/dist/simple-tree/core/treeNodeSchema.d.ts +10 -6
  78. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  79. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  80. package/dist/simple-tree/core/withType.d.ts +3 -1
  81. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  82. package/dist/simple-tree/core/withType.js.map +1 -1
  83. package/dist/simple-tree/index.d.ts +4 -4
  84. package/dist/simple-tree/index.d.ts.map +1 -1
  85. package/dist/simple-tree/index.js +1 -2
  86. package/dist/simple-tree/index.js.map +1 -1
  87. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  88. package/dist/simple-tree/mapNode.js +3 -0
  89. package/dist/simple-tree/mapNode.js.map +1 -1
  90. package/dist/simple-tree/objectNode.d.ts +4 -2
  91. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  92. package/dist/simple-tree/objectNode.js.map +1 -1
  93. package/dist/simple-tree/schemaTypes.d.ts +168 -14
  94. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  95. package/dist/simple-tree/schemaTypes.js +6 -1
  96. package/dist/simple-tree/schemaTypes.js.map +1 -1
  97. package/dist/simple-tree/toMapTree.d.ts +4 -2
  98. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  99. package/dist/simple-tree/toMapTree.js.map +1 -1
  100. package/dist/util/index.d.ts +2 -1
  101. package/dist/util/index.d.ts.map +1 -1
  102. package/dist/util/index.js +3 -1
  103. package/dist/util/index.js.map +1 -1
  104. package/dist/util/typeUtils.d.ts +61 -0
  105. package/dist/util/typeUtils.d.ts.map +1 -1
  106. package/dist/util/typeUtils.js +27 -0
  107. package/dist/util/typeUtils.js.map +1 -1
  108. package/lib/alpha.d.ts +17 -2
  109. package/lib/beta.d.ts +6 -0
  110. package/lib/events/interop.d.ts +1 -7
  111. package/lib/events/interop.d.ts.map +1 -1
  112. package/lib/events/interop.js.map +1 -1
  113. package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -1
  114. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  115. package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  116. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  117. package/lib/feature-libraries/object-forest/objectForest.js +1 -1
  118. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  119. package/lib/feature-libraries/treeCursorUtils.js +2 -2
  120. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  121. package/lib/index.d.ts +2 -2
  122. package/lib/index.d.ts.map +1 -1
  123. package/lib/index.js +1 -1
  124. package/lib/index.js.map +1 -1
  125. package/lib/internalTypes.d.ts +1 -1
  126. package/lib/internalTypes.d.ts.map +1 -1
  127. package/lib/internalTypes.js.map +1 -1
  128. package/lib/legacy.d.ts +6 -0
  129. package/lib/packageVersion.d.ts +1 -1
  130. package/lib/packageVersion.d.ts.map +1 -1
  131. package/lib/packageVersion.js +1 -1
  132. package/lib/packageVersion.js.map +1 -1
  133. package/lib/public.d.ts +6 -0
  134. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  135. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  136. package/lib/shared-tree/sharedTree.d.ts +1 -1
  137. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  138. package/lib/shared-tree/sharedTree.js.map +1 -1
  139. package/lib/shared-tree/treeApi.d.ts +6 -6
  140. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  141. package/lib/shared-tree/treeApi.js.map +1 -1
  142. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  143. package/lib/shared-tree/treeCheckout.js +2 -0
  144. package/lib/shared-tree/treeCheckout.js.map +1 -1
  145. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  146. package/lib/shared-tree-core/editManager.js +12 -7
  147. package/lib/shared-tree-core/editManager.js.map +1 -1
  148. package/lib/simple-tree/api/create.d.ts +3 -3
  149. package/lib/simple-tree/api/create.d.ts.map +1 -1
  150. package/lib/simple-tree/api/create.js.map +1 -1
  151. package/lib/simple-tree/api/customTree.js +2 -2
  152. package/lib/simple-tree/api/customTree.js.map +1 -1
  153. package/lib/simple-tree/api/index.d.ts +3 -3
  154. package/lib/simple-tree/api/index.d.ts.map +1 -1
  155. package/lib/simple-tree/api/index.js +1 -1
  156. package/lib/simple-tree/api/index.js.map +1 -1
  157. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +33 -25
  158. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  159. package/lib/simple-tree/api/schemaCreationUtilities.js +30 -19
  160. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  161. package/lib/simple-tree/api/schemaFactory.d.ts +5 -1
  162. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  163. package/lib/simple-tree/api/schemaFactory.js +4 -0
  164. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  165. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +3 -3
  166. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  167. package/lib/simple-tree/api/tree.d.ts +13 -4
  168. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  169. package/lib/simple-tree/api/tree.js.map +1 -1
  170. package/lib/simple-tree/api/treeApiBeta.d.ts.map +1 -1
  171. package/lib/simple-tree/api/treeApiBeta.js.map +1 -1
  172. package/lib/simple-tree/api/typesUnsafe.d.ts +69 -17
  173. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  174. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  175. package/lib/simple-tree/arrayNode.d.ts +14 -3
  176. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  177. package/lib/simple-tree/arrayNode.js.map +1 -1
  178. package/lib/simple-tree/core/treeNodeSchema.d.ts +10 -6
  179. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  180. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  181. package/lib/simple-tree/core/withType.d.ts +3 -1
  182. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  183. package/lib/simple-tree/core/withType.js.map +1 -1
  184. package/lib/simple-tree/index.d.ts +4 -4
  185. package/lib/simple-tree/index.d.ts.map +1 -1
  186. package/lib/simple-tree/index.js +2 -2
  187. package/lib/simple-tree/index.js.map +1 -1
  188. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  189. package/lib/simple-tree/mapNode.js +3 -0
  190. package/lib/simple-tree/mapNode.js.map +1 -1
  191. package/lib/simple-tree/objectNode.d.ts +4 -2
  192. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  193. package/lib/simple-tree/objectNode.js.map +1 -1
  194. package/lib/simple-tree/schemaTypes.d.ts +168 -14
  195. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  196. package/lib/simple-tree/schemaTypes.js +6 -1
  197. package/lib/simple-tree/schemaTypes.js.map +1 -1
  198. package/lib/simple-tree/toMapTree.d.ts +4 -2
  199. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  200. package/lib/simple-tree/toMapTree.js.map +1 -1
  201. package/lib/util/index.d.ts +2 -1
  202. package/lib/util/index.d.ts.map +1 -1
  203. package/lib/util/index.js +1 -0
  204. package/lib/util/index.js.map +1 -1
  205. package/lib/util/typeUtils.d.ts +61 -0
  206. package/lib/util/typeUtils.d.ts.map +1 -1
  207. package/lib/util/typeUtils.js +25 -1
  208. package/lib/util/typeUtils.js.map +1 -1
  209. package/package.json +48 -32
  210. package/src/events/interop.ts +1 -12
  211. package/src/feature-libraries/chunked-forest/basicChunk.ts +1 -1
  212. package/src/feature-libraries/chunked-forest/uniformChunk.ts +1 -1
  213. package/src/feature-libraries/object-forest/objectForest.ts +1 -1
  214. package/src/feature-libraries/treeCursorUtils.ts +2 -2
  215. package/src/index.ts +16 -1
  216. package/src/internalTypes.ts +4 -0
  217. package/src/packageVersion.ts +1 -1
  218. package/src/shared-tree/schematizingTreeView.ts +6 -2
  219. package/src/shared-tree/sharedTree.ts +4 -2
  220. package/src/shared-tree/treeApi.ts +19 -9
  221. package/src/shared-tree/treeCheckout.ts +2 -0
  222. package/src/shared-tree-core/editManager.ts +16 -7
  223. package/src/simple-tree/api/create.ts +12 -7
  224. package/src/simple-tree/api/customTree.ts +2 -2
  225. package/src/simple-tree/api/index.ts +6 -1
  226. package/src/simple-tree/api/schemaCreationUtilities.ts +58 -35
  227. package/src/simple-tree/api/schemaFactory.ts +4 -0
  228. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +3 -3
  229. package/src/simple-tree/api/tree.ts +27 -4
  230. package/src/simple-tree/api/treeApiBeta.ts +6 -2
  231. package/src/simple-tree/api/typesUnsafe.ts +126 -30
  232. package/src/simple-tree/arrayNode.ts +34 -14
  233. package/src/simple-tree/core/treeNodeSchema.ts +11 -6
  234. package/src/simple-tree/core/withType.ts +10 -1
  235. package/src/simple-tree/index.ts +19 -2
  236. package/src/simple-tree/mapNode.ts +6 -3
  237. package/src/simple-tree/objectNode.ts +5 -3
  238. package/src/simple-tree/schemaTypes.ts +215 -23
  239. package/src/simple-tree/toMapTree.ts +4 -1
  240. package/src/util/index.ts +6 -0
  241. package/src/util/typeUtils.ts +87 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/tree",
3
- "version": "2.4.0",
3
+ "version": "2.5.0-302463",
4
4
  "description": "Distributed tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -89,17 +89,17 @@
89
89
  "temp-directory": "nyc/.nyc_output"
90
90
  },
91
91
  "dependencies": {
92
- "@fluid-internal/client-utils": "~2.4.0",
93
- "@fluidframework/container-runtime": "~2.4.0",
94
- "@fluidframework/core-interfaces": "~2.4.0",
95
- "@fluidframework/core-utils": "~2.4.0",
96
- "@fluidframework/datastore-definitions": "~2.4.0",
97
- "@fluidframework/driver-definitions": "~2.4.0",
98
- "@fluidframework/id-compressor": "~2.4.0",
99
- "@fluidframework/runtime-definitions": "~2.4.0",
100
- "@fluidframework/runtime-utils": "~2.4.0",
101
- "@fluidframework/shared-object-base": "~2.4.0",
102
- "@fluidframework/telemetry-utils": "~2.4.0",
92
+ "@fluid-internal/client-utils": "2.5.0-302463",
93
+ "@fluidframework/container-runtime": "2.5.0-302463",
94
+ "@fluidframework/core-interfaces": "2.5.0-302463",
95
+ "@fluidframework/core-utils": "2.5.0-302463",
96
+ "@fluidframework/datastore-definitions": "2.5.0-302463",
97
+ "@fluidframework/driver-definitions": "2.5.0-302463",
98
+ "@fluidframework/id-compressor": "2.5.0-302463",
99
+ "@fluidframework/runtime-definitions": "2.5.0-302463",
100
+ "@fluidframework/runtime-utils": "2.5.0-302463",
101
+ "@fluidframework/shared-object-base": "2.5.0-302463",
102
+ "@fluidframework/telemetry-utils": "2.5.0-302463",
103
103
  "@sinclair/typebox": "^0.32.29",
104
104
  "@tylerbu/sorted-btree-es6": "^1.8.0",
105
105
  "@ungap/structured-clone": "^1.2.0",
@@ -107,21 +107,21 @@
107
107
  },
108
108
  "devDependencies": {
109
109
  "@arethetypeswrong/cli": "^0.16.4",
110
- "@biomejs/biome": "~1.8.3",
111
- "@fluid-internal/mocha-test-setup": "~2.4.0",
112
- "@fluid-private/stochastic-test-utils": "~2.4.0",
113
- "@fluid-private/test-dds-utils": "~2.4.0",
114
- "@fluid-private/test-drivers": "~2.4.0",
110
+ "@biomejs/biome": "~1.9.3",
111
+ "@fluid-internal/mocha-test-setup": "2.5.0-302463",
112
+ "@fluid-private/stochastic-test-utils": "2.5.0-302463",
113
+ "@fluid-private/test-dds-utils": "2.5.0-302463",
114
+ "@fluid-private/test-drivers": "2.5.0-302463",
115
115
  "@fluid-tools/benchmark": "^0.50.0",
116
- "@fluid-tools/build-cli": "^0.48.0",
116
+ "@fluid-tools/build-cli": "^0.49.0",
117
117
  "@fluidframework/build-common": "^2.0.3",
118
- "@fluidframework/build-tools": "^0.48.0",
119
- "@fluidframework/container-definitions": "~2.4.0",
120
- "@fluidframework/container-loader": "~2.4.0",
118
+ "@fluidframework/build-tools": "^0.49.0",
119
+ "@fluidframework/container-definitions": "2.5.0-302463",
120
+ "@fluidframework/container-loader": "2.5.0-302463",
121
121
  "@fluidframework/eslint-config-fluid": "^5.4.0",
122
- "@fluidframework/test-runtime-utils": "~2.4.0",
123
- "@fluidframework/test-utils": "~2.4.0",
124
- "@fluidframework/tree-previous": "npm:@fluidframework/tree@~2.3.0",
122
+ "@fluidframework/test-runtime-utils": "2.5.0-302463",
123
+ "@fluidframework/test-utils": "2.5.0-302463",
124
+ "@fluidframework/tree-previous": "npm:@fluidframework/tree@~2.4.0",
125
125
  "@microsoft/api-extractor": "7.47.8",
126
126
  "@types/diff": "^3.5.1",
127
127
  "@types/easy-table": "^0.0.32",
@@ -164,22 +164,38 @@
164
164
  },
165
165
  "typeValidation": {
166
166
  "broken": {
167
- "TypeAlias_MapNodeInsertableData": {
168
- "backCompat": false
167
+ "TypeAlias_InsertableTreeFieldFromImplicitField": {
168
+ "backCompat": false,
169
+ "forwardCompat": false
169
170
  },
170
- "Interface_InternalTypes_TreeNodeSchemaNonClass": {
171
+ "Interface_TreeArrayNode": {
171
172
  "backCompat": false
172
173
  },
173
- "Interface_FieldSchemaUnsafe": {
174
+ "TypeAlias_InsertableTreeNodeFromImplicitAllowedTypes": {
175
+ "backCompat": false,
174
176
  "forwardCompat": false
175
177
  },
176
- "Interface_ITreeViewConfiguration": {
177
- "forwardCompat": false
178
+ "TypeAlias_NodeFromSchema": {
179
+ "backCompat": false
180
+ },
181
+ "TypeAlias_TreeFieldFromImplicitField": {
182
+ "backCompat": false
183
+ },
184
+ "TypeAlias_TreeNodeFromImplicitAllowedTypes": {
185
+ "backCompat": false
186
+ },
187
+ "TypeAlias_InternalTypes_ApplyKind": {
188
+ "forwardCompat": false,
189
+ "backCompat": false
190
+ },
191
+ "TypeAlias_InternalTypes_InsertableObjectFromSchemaRecord": {
192
+ "forwardCompat": false,
193
+ "backCompat": false
178
194
  },
179
- "TypeAlias_ImplicitFieldSchema": {
195
+ "TypeAlias_InsertableTreeFieldFromImplicitFieldUnsafe": {
180
196
  "forwardCompat": false
181
197
  },
182
- "TypeAlias_ImplicitAllowedTypes": {
198
+ "TypeAlias_InternalTypes_InsertableTreeFieldFromImplicitFieldUnsafe": {
183
199
  "forwardCompat": false
184
200
  }
185
201
  },
@@ -5,21 +5,10 @@
5
5
 
6
6
  import type { IEvent } from "@fluidframework/core-interfaces";
7
7
  import type { Listeners } from "./listeners.js";
8
+ import type { UnionToIntersection } from "../util/index.js";
8
9
 
9
10
  // TODO: this file is currently unused. Use it or remove it.
10
11
 
11
- /**
12
- * Convert a union of types to an intersection of those types. Useful for `TransformEvents`.
13
- * @privateRemarks
14
- * First an always true extends clause is used (T extends T) to distribute T into to a union of types contravariant over each member of the T union.
15
- * Then the constraint on the type parameter in this new context is inferred, giving the intersection.
16
- */
17
- export type UnionToIntersection<T> = (T extends T ? (k: T) => unknown : never) extends (
18
- k: infer U,
19
- ) => unknown
20
- ? U
21
- : never;
22
-
23
12
  /**
24
13
  * Converts a {@link Listeners} type (i.e. the event registry for a {@link Listenable}) into a type consumable
25
14
  * by an IEventProvider from `@fluidframework/core-interfaces`.
@@ -253,7 +253,7 @@ export class BasicChunkCursor extends SynchronousCursor implements ChunkedCursor
253
253
  return {
254
254
  field:
255
255
  this.indexStack.length === 1
256
- ? prefix?.rootFieldOverride ?? this.getFieldKey()
256
+ ? (prefix?.rootFieldOverride ?? this.getFieldKey())
257
257
  : this.getFieldKey(),
258
258
  parent: this.getOffsetPath(1, prefix),
259
259
  };
@@ -533,7 +533,7 @@ class Cursor extends SynchronousCursor implements ChunkedCursor {
533
533
  this.indexOfField =
534
534
  fieldInfo === undefined
535
535
  ? fieldMap.size
536
- : fieldInfo.indexOfParentField ?? fail("children should have parents");
536
+ : (fieldInfo.indexOfParentField ?? fail("children should have parents"));
537
537
  this.fieldKey = key;
538
538
  this.mode = CursorLocationType.Fields;
539
539
  }
@@ -140,7 +140,7 @@ export class ObjectForest implements IEditableForest {
140
140
  );
141
141
  if (this.currentCursors.size > 1) {
142
142
  const unexpectedSources = [...this.currentCursors].flatMap((c) =>
143
- c === cursor ? [] : c.source ?? null,
143
+ c === cursor ? [] : (c.source ?? null),
144
144
  );
145
145
 
146
146
  throw new Error(
@@ -194,7 +194,7 @@ class StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNo
194
194
  return {
195
195
  field:
196
196
  this.indexStack.length === 1
197
- ? prefix?.rootFieldOverride ?? this.getFieldKey()
197
+ ? (prefix?.rootFieldOverride ?? this.getFieldKey())
198
198
  : this.getFieldKey(),
199
199
  parent: this.getOffsetPath(1, prefix),
200
200
  };
@@ -427,7 +427,7 @@ export function prefixFieldPath(
427
427
  return path;
428
428
  }
429
429
  return {
430
- field: path.parent === undefined ? prefix.rootFieldOverride ?? path.field : path.field,
430
+ field: path.parent === undefined ? (prefix.rootFieldOverride ?? path.field) : path.field,
431
431
  parent: prefixPath(prefix, path.parent),
432
432
  };
433
433
  }
package/src/index.ts CHANGED
@@ -114,6 +114,8 @@ export {
114
114
  type InsertableObjectFromSchemaRecordUnsafe,
115
115
  type InsertableTreeFieldFromImplicitFieldUnsafe,
116
116
  type FieldSchemaUnsafe,
117
+ type TreeNodeSchemaClassUnsafe,
118
+ type InsertableTreeNodeFromAllowedTypesUnsafe,
117
119
  // System types (not in Internal types for various reasons, like doc links or cannot be named errors).
118
120
  type typeSchemaSymbol,
119
121
  type TreeNodeSchemaNonClass,
@@ -124,7 +126,13 @@ export {
124
126
  adaptEnum,
125
127
  enumFromStrings,
126
128
  singletonSchema,
127
- typedObjectValues,
129
+ type UnsafeUnknownSchema,
130
+ type TreeViewAlpha,
131
+ type InsertableField,
132
+ type Insertable,
133
+ type InsertableContent,
134
+ type FactoryContent,
135
+ type FactoryContentObject,
128
136
  // test recursive schema for checking that d.ts files handles schema correctly
129
137
  test_RecursiveObject,
130
138
  test_RecursiveObject_base,
@@ -151,6 +159,9 @@ export {
151
159
  getJsonSchema,
152
160
  type LazyItem,
153
161
  type Unenforced,
162
+ type ReadonlyArrayNode,
163
+ type InsertableTreeNodeFromAllowedTypes,
164
+ type Input,
154
165
  } from "./simple-tree/index.js";
155
166
  export {
156
167
  SharedTree,
@@ -171,6 +182,10 @@ export {
171
182
  type RestrictiveReadonlyRecord,
172
183
  type RestrictiveStringRecord,
173
184
  type MakeNominal,
185
+ type IsUnion,
186
+ type UnionToIntersection,
187
+ type UnionToTuple,
188
+ type PopUnion,
174
189
  } from "./util/index.js";
175
190
 
176
191
  import * as InternalTypes from "./internalTypes.js";
@@ -10,6 +10,7 @@
10
10
  export type { _InlineTrick, FlattenKeys } from "./util/index.js";
11
11
  export type {
12
12
  ApplyKind,
13
+ ApplyKindInput,
13
14
  NodeBuilderData,
14
15
  FieldHasDefault,
15
16
  TreeArrayNodeBase,
@@ -33,6 +34,9 @@ export type {
33
34
  NodeBuilderDataUnsafe,
34
35
  NodeFromSchemaUnsafe,
35
36
  ReadonlyMapInlined,
37
+ TreeNodeSchemaUnsafe,
38
+ AllowedTypesUnsafe,
39
+ TreeNodeSchemaNonClassUnsafe,
36
40
  } from "./simple-tree/index.js";
37
41
  export type { FlexList, FlexListToUnion, ExtractItemType } from "./simple-tree/index.js";
38
42
 
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/tree";
9
- export const pkgVersion = "2.4.0";
9
+ export const pkgVersion = "2.5.0-302463";
@@ -144,7 +144,7 @@ export class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitField
144
144
 
145
145
  this.runSchemaEdit(() => {
146
146
  const mapTree = mapTreeFromNodeData(
147
- content as InsertableContent,
147
+ content as InsertableContent | undefined,
148
148
  this.rootFieldSchema,
149
149
  this.nodeKeyManager,
150
150
  {
@@ -359,7 +359,11 @@ export class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitField
359
359
  );
360
360
  }
361
361
  const view = this.getView();
362
- setField(view.context.root, this.rootFieldSchema, newRoot as InsertableContent);
362
+ setField(
363
+ view.context.root,
364
+ this.rootFieldSchema,
365
+ newRoot as InsertableContent | undefined,
366
+ );
363
367
  }
364
368
  }
365
369
 
@@ -353,8 +353,10 @@ export function getBranch(tree: ITree): TreeBranch;
353
353
  * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.
354
354
  * @alpha
355
355
  */
356
- export function getBranch(view: TreeView<ImplicitFieldSchema>): TreeBranch;
357
- export function getBranch(treeOrView: ITree | TreeView<ImplicitFieldSchema>): TreeBranch {
356
+ export function getBranch<T extends ImplicitFieldSchema>(view: TreeView<T>): TreeBranch;
357
+ export function getBranch<T extends ImplicitFieldSchema>(
358
+ treeOrView: ITree | TreeView<T>,
359
+ ): TreeBranch {
358
360
  assert(
359
361
  treeOrView instanceof SharedTree || treeOrView instanceof SchematizingSimpleTreeView,
360
362
  0xa48 /* Unsupported implementation */,
@@ -78,7 +78,10 @@ export interface RunTransaction {
78
78
  * If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.
79
79
  * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
80
80
  */
81
- <TView extends TreeView<ImplicitFieldSchema>, TResult>(
81
+ // TODO: TreeView is invariant over the schema, so to accept any view, `any` is the only real option unless a non generic (or covariant) base type for view is introduced (which is planned).
82
+ // This use of any is actually type safe as it is only used as a constraint, and the actual strongly typed view (TView) is passed to the callback.
83
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
84
+ <TView extends TreeView<any>, TResult>(
82
85
  tree: TView,
83
86
  transaction: (root: TView["root"]) => TResult,
84
87
  ): TResult;
@@ -123,7 +126,9 @@ export interface RunTransaction {
123
126
  * If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.
124
127
  * If the transaction is rolled back (whether by an error or by returning the {@link RunTransaction.rollback} | rollback value), a corresponding change event will also be emitted for the rollback.
125
128
  */
126
- <TView extends TreeView<ImplicitFieldSchema>, TResult>(
129
+ // See comment on previous overload about use of any here.
130
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
131
+ <TView extends TreeView<any>, TResult>(
127
132
  tree: TView,
128
133
  transaction: (root: TView["root"]) => TResult | typeof rollback,
129
134
  ): TResult | typeof rollback;
@@ -161,10 +166,9 @@ export interface RunTransaction {
161
166
  * If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.
162
167
  * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
163
168
  */
164
- <TView extends TreeView<ImplicitFieldSchema>>(
165
- tree: TView,
166
- transaction: (root: TView["root"]) => void,
167
- ): void;
169
+ // See comment on previous overload about use of any here.
170
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
171
+ <TView extends TreeView<any>>(tree: TView, transaction: (root: TView["root"]) => void): void;
168
172
  /**
169
173
  * Apply one or more edits to the tree as a single atomic unit.
170
174
  * @param node - The node that will be passed to `transaction`.
@@ -211,7 +215,9 @@ export interface RunTransaction {
211
215
  * If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.
212
216
  * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
213
217
  */
214
- <TView extends TreeView<ImplicitFieldSchema>, TResult>(
218
+ // See comment on previous overload about use of any here.
219
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
220
+ <TView extends TreeView<any>, TResult>(
215
221
  tree: TView,
216
222
  transaction: (root: TView["root"]) => TResult,
217
223
  preconditions?: readonly TransactionConstraint[],
@@ -264,7 +270,9 @@ export interface RunTransaction {
264
270
  * If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.
265
271
  * If the transaction is rolled back (whether by an error or by returning the {@link RunTransaction.rollback} | rollback value), a corresponding change event will also be emitted for the rollback.
266
272
  */
267
- <TView extends TreeView<ImplicitFieldSchema>, TResult>(
273
+ // See comment on previous overload about use of any here.
274
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
275
+ <TView extends TreeView<any>, TResult>(
268
276
  tree: TView,
269
277
  transaction: (root: TView["root"]) => TResult | typeof rollback,
270
278
  preconditions?: readonly TransactionConstraint[],
@@ -313,7 +321,9 @@ export interface RunTransaction {
313
321
  * If the transaction function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.
314
322
  * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
315
323
  */
316
- <TView extends TreeView<ImplicitFieldSchema>>(
324
+ // See comment on previous overload about use of any here.
325
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
326
+ <TView extends TreeView<any>>(
317
327
  tree: TView,
318
328
  transaction: (root: TView["root"]) => void,
319
329
  preconditions?: readonly TransactionConstraint[],
@@ -516,6 +516,8 @@ export class TreeCheckout implements ITreeCheckoutFork {
516
516
  event.type === "append" ||
517
517
  (event.type === "replace" && getChangeReplaceType(event) === "transactionCommit")
518
518
  ) {
519
+ // TODO:#20949: When the SharedTree is detached, these commits will already have been garbage collected.
520
+ // Figure out a way to generate revertibles before the commits are garbage collected.
519
521
  for (const commit of event.newCommits) {
520
522
  const kind = event.type === "append" ? event.kind : CommitKind.Default;
521
523
  const { change, revision } = commit;
@@ -53,6 +53,14 @@ const minimumPossibleSequenceId: SequenceId = {
53
53
  sequenceNumber: minimumPossibleSequenceNumber,
54
54
  };
55
55
 
56
+ /**
57
+ * A special revision tag for the initial {@link EditManager.trunkBase} commit.
58
+ * @remarks This tag is used to supply the _initial_ trunk base with a known revision.
59
+ * The trunk base may advance over time, after which point the trunk base will have a different revision.
60
+ * When {@link EditManager.getSummaryData | serializing} and deserializing, peer branches that include the trunk base commit in their history will always use this tag.
61
+ */
62
+ const rootRevision = "root" as const satisfies RevisionTag;
63
+
56
64
  /**
57
65
  * Max number of telemetry log call that may be aggregated before being sent.
58
66
  */
@@ -152,7 +160,7 @@ export class EditManager<
152
160
  logger?: ITelemetryLoggerExt,
153
161
  ) {
154
162
  this.trunkBase = {
155
- revision: "root",
163
+ revision: rootRevision,
156
164
  change: changeFamily.rebaser.compose([]),
157
165
  };
158
166
  this.sequenceMap.set(minimumPossibleSequenceId, this.trunkBase);
@@ -363,11 +371,6 @@ export class EditManager<
363
371
  newTrunkBase,
364
372
  this.trunkBase,
365
373
  ).map((c) => c.revision);
366
- // Copying the revision of the old trunk base into the new trunk base means we don't need to write out the original
367
- // revision to summaries. All clients agree that the trunk base always has the same hardcoded revision.
368
- newTrunkBase.revision = this.trunkBase.revision;
369
- // Overwriting the change is not strictly necessary, but done here for consistency (so all trunk bases are deeply equal).
370
- newTrunkBase.change = this.trunkBase.change;
371
374
  // Dropping the parent field removes (transitively) all references to the evicted commits so they can be garbage collected.
372
375
  delete newTrunkBase.parent;
373
376
  this.trunkBase = newTrunkBase;
@@ -442,6 +445,7 @@ export class EditManager<
442
445
 
443
446
  const trunk = getPathFromBase(this.trunk.getHead(), oldestCommitInCollabWindow).map(
444
447
  (c) => {
448
+ assert(c !== this.trunkBase, "Serialized trunk should not include the trunk base");
445
449
  const metadata =
446
450
  this.trunkMetadata.get(c.revision) ?? fail("Expected metadata for trunk commit");
447
451
  const commit: SequencedCommit<TChangeset> = {
@@ -464,11 +468,16 @@ export class EditManager<
464
468
  findCommonAncestor([branch.getHead(), branchPath], this.trunk.getHead()) ??
465
469
  fail("Expected branch to be based on trunk");
466
470
 
471
+ const base = ancestor === this.trunkBase ? rootRevision : ancestor.revision;
467
472
  return [
468
473
  sessionId,
469
474
  {
470
- base: ancestor.revision,
475
+ base,
471
476
  commits: branchPath.map((c) => {
477
+ assert(
478
+ c !== this.trunkBase,
479
+ "Serialized branch should not include the trunk base",
480
+ );
472
481
  const commit: Commit<TChangeset> = {
473
482
  change: c.change,
474
483
  revision: c.revision,
@@ -10,10 +10,11 @@ import type { ITreeCursorSynchronous, SchemaAndPolicy } from "../../core/index.j
10
10
  import type {
11
11
  TreeLeafValue,
12
12
  ImplicitFieldSchema,
13
- InsertableTreeFieldFromImplicitField,
14
13
  TreeFieldFromImplicitField,
15
14
  FieldSchema,
16
15
  FieldKind,
16
+ UnsafeUnknownSchema,
17
+ InsertableField,
17
18
  } from "../schemaTypes.js";
18
19
  import {
19
20
  getOrCreateNodeFromInnerNode,
@@ -29,7 +30,7 @@ import {
29
30
  } from "../../feature-libraries/index.js";
30
31
  import { isFieldInSchema } from "../../feature-libraries/index.js";
31
32
  import { toStoredSchema } from "../toFlexSchema.js";
32
- import { inSchemaOrThrow, mapTreeFromNodeData, type InsertableContent } from "../toMapTree.js";
33
+ import { inSchemaOrThrow, mapTreeFromNodeData } from "../toMapTree.js";
33
34
  import {
34
35
  applySchemaToParserOptions,
35
36
  cursorFromVerbose,
@@ -55,7 +56,7 @@ import { getUnhydratedContext } from "../createContext.js";
55
56
  */
56
57
  export function createFromInsertable<TSchema extends ImplicitFieldSchema>(
57
58
  schema: TSchema,
58
- data: InsertableTreeFieldFromImplicitField<TSchema>,
59
+ data: InsertableField<TSchema>,
59
60
  context?: NodeKeyManager | undefined,
60
61
  ): Unhydrated<TreeFieldFromImplicitField<TSchema>> {
61
62
  const cursor = cursorFromInsertable(schema, data, context);
@@ -72,9 +73,13 @@ export function createFromInsertable<TSchema extends ImplicitFieldSchema>(
72
73
  * this is the same as invoking its constructor except that an unhydrated node can also be provided and the returned value is a cursor.
73
74
  * When `undefined` is provided (for an optional field), `undefined` is returned.
74
75
  */
75
- export function cursorFromInsertable<TSchema extends ImplicitFieldSchema>(
76
- schema: TSchema,
77
- data: InsertableTreeFieldFromImplicitField<TSchema>,
76
+ export function cursorFromInsertable<
77
+ TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,
78
+ >(
79
+ schema: UnsafeUnknownSchema extends TSchema
80
+ ? ImplicitFieldSchema
81
+ : TSchema & ImplicitFieldSchema,
82
+ data: InsertableField<TSchema>,
78
83
  context?: NodeKeyManager | undefined,
79
84
  ):
80
85
  | ITreeCursorSynchronous
@@ -87,7 +92,7 @@ export function cursorFromInsertable<TSchema extends ImplicitFieldSchema>(
87
92
  };
88
93
 
89
94
  const mapTree = mapTreeFromNodeData(
90
- data as InsertableContent | undefined,
95
+ data as InsertableField<UnsafeUnknownSchema>,
91
96
  schema,
92
97
  context,
93
98
  schemaValidationPolicy,
@@ -102,8 +102,8 @@ export function customFromCursorInner<TChild, THandle>(
102
102
  const storedKey = reader.getFieldKey();
103
103
  const key =
104
104
  isObjectNodeSchema(nodeSchema) && !options.useStoredKeys
105
- ? nodeSchema.storedKeyToPropertyKey.get(storedKey) ??
106
- fail("missing property key")
105
+ ? (nodeSchema.storedKeyToPropertyKey.get(storedKey) ??
106
+ fail("missing property key"))
107
107
  : storedKey;
108
108
  // Length is checked above.
109
109
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -12,6 +12,7 @@ export {
12
12
  type ITreeViewConfiguration,
13
13
  type SchemaCompatibilityStatus,
14
14
  type ITreeConfigurationOptions,
15
+ type TreeViewAlpha,
15
16
  } from "./tree.js";
16
17
  export { SchemaFactory, type ScopedSchemaName } from "./schemaFactory.js";
17
18
  export type {
@@ -22,7 +23,6 @@ export {
22
23
  adaptEnum,
23
24
  enumFromStrings,
24
25
  singletonSchema,
25
- typedObjectValues,
26
26
  } from "./schemaCreationUtilities.js";
27
27
  export { treeNodeApi, type TreeNodeApi } from "./treeNodeApi.js";
28
28
  export { createFromInsertable, cursorFromInsertable } from "./create.js";
@@ -62,6 +62,11 @@ export type {
62
62
  NodeBuilderDataUnsafe,
63
63
  NodeFromSchemaUnsafe,
64
64
  ReadonlyMapInlined,
65
+ TreeNodeSchemaClassUnsafe,
66
+ TreeNodeSchemaUnsafe,
67
+ AllowedTypesUnsafe,
68
+ TreeNodeSchemaNonClassUnsafe,
69
+ InsertableTreeNodeFromAllowedTypesUnsafe,
65
70
  } from "./typesUnsafe.js";
66
71
 
67
72
  export type {