@fluidframework/tree 2.32.0 → 2.33.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 (339) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/api-report/tree.alpha.api.md +169 -192
  3. package/api-report/tree.beta.api.md +135 -164
  4. package/api-report/tree.legacy.alpha.api.md +138 -167
  5. package/api-report/tree.legacy.public.api.md +135 -164
  6. package/api-report/tree.public.api.md +135 -164
  7. package/dist/alpha.d.ts +3 -11
  8. package/dist/beta.d.ts +2 -11
  9. package/dist/core/index.d.ts +1 -1
  10. package/dist/core/index.d.ts.map +1 -1
  11. package/dist/core/index.js +1 -2
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/core/schema-stored/index.d.ts +1 -1
  14. package/dist/core/schema-stored/index.d.ts.map +1 -1
  15. package/dist/core/schema-stored/index.js +1 -2
  16. package/dist/core/schema-stored/index.js.map +1 -1
  17. package/dist/core/schema-stored/schema.d.ts +4 -11
  18. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  19. package/dist/core/schema-stored/schema.js +7 -14
  20. package/dist/core/schema-stored/schema.js.map +1 -1
  21. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  22. package/dist/core/tree/anchorSet.js +31 -24
  23. package/dist/core/tree/anchorSet.js.map +1 -1
  24. package/dist/core/tree/deltaUtil.d.ts +1 -4
  25. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  26. package/dist/core/tree/deltaUtil.js +1 -13
  27. package/dist/core/tree/deltaUtil.js.map +1 -1
  28. package/dist/core/tree/visitDelta.d.ts +6 -29
  29. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  30. package/dist/core/tree/visitDelta.js +11 -50
  31. package/dist/core/tree/visitDelta.js.map +1 -1
  32. package/dist/core/tree/visitorUtils.d.ts +12 -9
  33. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  34. package/dist/core/tree/visitorUtils.js +19 -32
  35. package/dist/core/tree/visitorUtils.js.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  37. package/dist/feature-libraries/chunked-forest/chunkedForest.js +6 -11
  38. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  39. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  40. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  42. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts +41 -5
  43. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +43 -26
  45. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +1 -1
  47. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  48. package/dist/feature-libraries/flex-tree/context.d.ts +5 -0
  49. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  50. package/dist/feature-libraries/flex-tree/context.js +4 -0
  51. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  52. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +8 -0
  53. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  54. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +8 -0
  55. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  56. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  57. package/dist/feature-libraries/indexing/anchorTreeIndex.js +15 -22
  58. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  59. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -1
  60. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js +29 -25
  61. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
  62. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  63. package/dist/feature-libraries/object-forest/objectForest.js +1 -7
  64. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  65. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  66. package/dist/feature-libraries/schema-index/codec.js +1 -1
  67. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  68. package/dist/index.d.ts +1 -1
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +3 -2
  71. package/dist/index.js.map +1 -1
  72. package/dist/internalTypes.d.ts +1 -1
  73. package/dist/internalTypes.d.ts.map +1 -1
  74. package/dist/internalTypes.js.map +1 -1
  75. package/dist/jsonDomainSchema.d.ts +6 -6
  76. package/dist/jsonDomainSchema.d.ts.map +1 -1
  77. package/dist/jsonDomainSchema.js.map +1 -1
  78. package/dist/legacy.d.ts +2 -11
  79. package/dist/packageVersion.d.ts +1 -1
  80. package/dist/packageVersion.js +1 -1
  81. package/dist/packageVersion.js.map +1 -1
  82. package/dist/public.d.ts +2 -11
  83. package/dist/serializableDomainSchema.d.ts +5 -5
  84. package/dist/shared-tree/checkoutFlexTreeView.d.ts +1 -0
  85. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  86. package/dist/shared-tree/checkoutFlexTreeView.js +4 -0
  87. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  88. package/dist/shared-tree/index.d.ts +3 -2
  89. package/dist/shared-tree/index.d.ts.map +1 -1
  90. package/dist/shared-tree/index.js +2 -2
  91. package/dist/shared-tree/index.js.map +1 -1
  92. package/dist/shared-tree/sharedTree.d.ts +4 -35
  93. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  94. package/dist/shared-tree/sharedTree.js +4 -54
  95. package/dist/shared-tree/sharedTree.js.map +1 -1
  96. package/dist/simple-tree/api/index.d.ts +2 -1
  97. package/dist/simple-tree/api/index.d.ts.map +1 -1
  98. package/dist/simple-tree/api/index.js +3 -1
  99. package/dist/simple-tree/api/index.js.map +1 -1
  100. package/dist/simple-tree/api/schemaFactory.d.ts +28 -28
  101. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  102. package/dist/simple-tree/api/schemaFactory.js +11 -11
  103. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  104. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +6 -7
  105. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  106. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  107. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +24 -5
  108. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  109. package/dist/simple-tree/api/schemaFactoryRecursive.js +14 -1
  110. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  111. package/dist/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  112. package/dist/simple-tree/api/tree.d.ts +1 -14
  113. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  114. package/dist/simple-tree/api/tree.js.map +1 -1
  115. package/dist/simple-tree/api/typesUnsafe.d.ts +237 -220
  116. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  117. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  118. package/dist/simple-tree/arrayNode.d.ts +2 -2
  119. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  120. package/dist/simple-tree/arrayNode.js.map +1 -1
  121. package/dist/simple-tree/core/treeNodeKernel.d.ts +9 -2
  122. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  123. package/dist/simple-tree/core/treeNodeKernel.js +39 -24
  124. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  125. package/dist/simple-tree/core/types.d.ts +14 -4
  126. package/dist/simple-tree/core/types.d.ts.map +1 -1
  127. package/dist/simple-tree/core/types.js +14 -4
  128. package/dist/simple-tree/core/types.js.map +1 -1
  129. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +2 -1
  130. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  131. package/dist/simple-tree/core/unhydratedFlexTree.js +3 -0
  132. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  133. package/dist/simple-tree/index.d.ts +1 -1
  134. package/dist/simple-tree/index.d.ts.map +1 -1
  135. package/dist/simple-tree/index.js +3 -2
  136. package/dist/simple-tree/index.js.map +1 -1
  137. package/dist/simple-tree/objectNode.d.ts +9 -2
  138. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  139. package/dist/simple-tree/objectNode.js +3 -0
  140. package/dist/simple-tree/objectNode.js.map +1 -1
  141. package/dist/simple-tree/schemaTypes.d.ts +10 -5
  142. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  143. package/dist/simple-tree/schemaTypes.js +5 -2
  144. package/dist/simple-tree/schemaTypes.js.map +1 -1
  145. package/dist/tableSchema.d.ts +78 -26
  146. package/dist/tableSchema.d.ts.map +1 -1
  147. package/dist/tableSchema.js +53 -24
  148. package/dist/tableSchema.js.map +1 -1
  149. package/dist/treeFactory.d.ts +6 -12
  150. package/dist/treeFactory.d.ts.map +1 -1
  151. package/dist/treeFactory.js +56 -5
  152. package/dist/treeFactory.js.map +1 -1
  153. package/lib/alpha.d.ts +3 -11
  154. package/lib/beta.d.ts +2 -11
  155. package/lib/core/index.d.ts +1 -1
  156. package/lib/core/index.d.ts.map +1 -1
  157. package/lib/core/index.js +1 -1
  158. package/lib/core/index.js.map +1 -1
  159. package/lib/core/schema-stored/index.d.ts +1 -1
  160. package/lib/core/schema-stored/index.d.ts.map +1 -1
  161. package/lib/core/schema-stored/index.js +1 -1
  162. package/lib/core/schema-stored/index.js.map +1 -1
  163. package/lib/core/schema-stored/schema.d.ts +4 -11
  164. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  165. package/lib/core/schema-stored/schema.js +6 -12
  166. package/lib/core/schema-stored/schema.js.map +1 -1
  167. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  168. package/lib/core/tree/anchorSet.js +31 -24
  169. package/lib/core/tree/anchorSet.js.map +1 -1
  170. package/lib/core/tree/deltaUtil.d.ts +1 -4
  171. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  172. package/lib/core/tree/deltaUtil.js +0 -9
  173. package/lib/core/tree/deltaUtil.js.map +1 -1
  174. package/lib/core/tree/visitDelta.d.ts +6 -29
  175. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  176. package/lib/core/tree/visitDelta.js +12 -51
  177. package/lib/core/tree/visitDelta.js.map +1 -1
  178. package/lib/core/tree/visitorUtils.d.ts +12 -9
  179. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  180. package/lib/core/tree/visitorUtils.js +19 -32
  181. package/lib/core/tree/visitorUtils.js.map +1 -1
  182. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  183. package/lib/feature-libraries/chunked-forest/chunkedForest.js +6 -11
  184. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  185. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  186. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  187. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  188. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts +41 -5
  189. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  190. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +43 -26
  191. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  192. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +1 -1
  193. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  194. package/lib/feature-libraries/flex-tree/context.d.ts +5 -0
  195. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  196. package/lib/feature-libraries/flex-tree/context.js +5 -1
  197. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  198. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +8 -0
  199. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  200. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +8 -0
  201. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  202. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  203. package/lib/feature-libraries/indexing/anchorTreeIndex.js +15 -22
  204. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  205. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -1
  206. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js +28 -24
  207. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
  208. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  209. package/lib/feature-libraries/object-forest/objectForest.js +1 -7
  210. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  211. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  212. package/lib/feature-libraries/schema-index/codec.js +2 -2
  213. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  214. package/lib/index.d.ts +1 -1
  215. package/lib/index.d.ts.map +1 -1
  216. package/lib/index.js +1 -1
  217. package/lib/index.js.map +1 -1
  218. package/lib/internalTypes.d.ts +1 -1
  219. package/lib/internalTypes.d.ts.map +1 -1
  220. package/lib/internalTypes.js.map +1 -1
  221. package/lib/jsonDomainSchema.d.ts +6 -6
  222. package/lib/jsonDomainSchema.d.ts.map +1 -1
  223. package/lib/jsonDomainSchema.js.map +1 -1
  224. package/lib/legacy.d.ts +2 -11
  225. package/lib/packageVersion.d.ts +1 -1
  226. package/lib/packageVersion.js +1 -1
  227. package/lib/packageVersion.js.map +1 -1
  228. package/lib/public.d.ts +2 -11
  229. package/lib/serializableDomainSchema.d.ts +5 -5
  230. package/lib/shared-tree/checkoutFlexTreeView.d.ts +1 -0
  231. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  232. package/lib/shared-tree/checkoutFlexTreeView.js +4 -0
  233. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  234. package/lib/shared-tree/index.d.ts +3 -2
  235. package/lib/shared-tree/index.d.ts.map +1 -1
  236. package/lib/shared-tree/index.js +1 -1
  237. package/lib/shared-tree/index.js.map +1 -1
  238. package/lib/shared-tree/sharedTree.d.ts +4 -35
  239. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  240. package/lib/shared-tree/sharedTree.js +2 -51
  241. package/lib/shared-tree/sharedTree.js.map +1 -1
  242. package/lib/simple-tree/api/index.d.ts +2 -1
  243. package/lib/simple-tree/api/index.d.ts.map +1 -1
  244. package/lib/simple-tree/api/index.js +1 -0
  245. package/lib/simple-tree/api/index.js.map +1 -1
  246. package/lib/simple-tree/api/schemaFactory.d.ts +28 -28
  247. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  248. package/lib/simple-tree/api/schemaFactory.js +11 -11
  249. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  250. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +6 -7
  251. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  252. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  253. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +24 -5
  254. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  255. package/lib/simple-tree/api/schemaFactoryRecursive.js +12 -0
  256. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  257. package/lib/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  258. package/lib/simple-tree/api/tree.d.ts +1 -14
  259. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  260. package/lib/simple-tree/api/tree.js.map +1 -1
  261. package/lib/simple-tree/api/typesUnsafe.d.ts +237 -220
  262. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  263. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  264. package/lib/simple-tree/arrayNode.d.ts +2 -2
  265. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  266. package/lib/simple-tree/arrayNode.js.map +1 -1
  267. package/lib/simple-tree/core/treeNodeKernel.d.ts +9 -2
  268. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  269. package/lib/simple-tree/core/treeNodeKernel.js +40 -25
  270. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  271. package/lib/simple-tree/core/types.d.ts +14 -4
  272. package/lib/simple-tree/core/types.d.ts.map +1 -1
  273. package/lib/simple-tree/core/types.js +14 -4
  274. package/lib/simple-tree/core/types.js.map +1 -1
  275. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +2 -1
  276. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  277. package/lib/simple-tree/core/unhydratedFlexTree.js +3 -0
  278. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  279. package/lib/simple-tree/index.d.ts +1 -1
  280. package/lib/simple-tree/index.d.ts.map +1 -1
  281. package/lib/simple-tree/index.js +1 -1
  282. package/lib/simple-tree/index.js.map +1 -1
  283. package/lib/simple-tree/objectNode.d.ts +9 -2
  284. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  285. package/lib/simple-tree/objectNode.js +4 -1
  286. package/lib/simple-tree/objectNode.js.map +1 -1
  287. package/lib/simple-tree/schemaTypes.d.ts +10 -5
  288. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  289. package/lib/simple-tree/schemaTypes.js +5 -2
  290. package/lib/simple-tree/schemaTypes.js.map +1 -1
  291. package/lib/tableSchema.d.ts +78 -26
  292. package/lib/tableSchema.d.ts.map +1 -1
  293. package/lib/tableSchema.js +53 -24
  294. package/lib/tableSchema.js.map +1 -1
  295. package/lib/treeFactory.d.ts +6 -12
  296. package/lib/treeFactory.d.ts.map +1 -1
  297. package/lib/treeFactory.js +55 -3
  298. package/lib/treeFactory.js.map +1 -1
  299. package/lib/tsdoc-metadata.json +1 -1
  300. package/package.json +22 -23
  301. package/src/core/index.ts +0 -2
  302. package/src/core/schema-stored/index.ts +0 -2
  303. package/src/core/schema-stored/schema.ts +10 -29
  304. package/src/core/tree/anchorSet.ts +32 -24
  305. package/src/core/tree/deltaUtil.ts +1 -13
  306. package/src/core/tree/visitDelta.ts +24 -81
  307. package/src/core/tree/visitorUtils.ts +43 -53
  308. package/src/feature-libraries/chunked-forest/chunkedForest.ts +7 -22
  309. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +1 -1
  310. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +45 -27
  311. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +1 -1
  312. package/src/feature-libraries/flex-tree/context.ts +11 -1
  313. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +8 -0
  314. package/src/feature-libraries/indexing/anchorTreeIndex.ts +17 -28
  315. package/src/feature-libraries/node-identifier/nodeIdentifierManager.ts +39 -38
  316. package/src/feature-libraries/object-forest/objectForest.ts +1 -18
  317. package/src/feature-libraries/schema-index/codec.ts +1 -2
  318. package/src/index.ts +3 -11
  319. package/src/internalTypes.ts +0 -19
  320. package/src/jsonDomainSchema.ts +1 -3
  321. package/src/packageVersion.ts +1 -1
  322. package/src/shared-tree/checkoutFlexTreeView.ts +6 -0
  323. package/src/shared-tree/index.ts +8 -3
  324. package/src/shared-tree/sharedTree.ts +5 -133
  325. package/src/simple-tree/api/index.ts +2 -22
  326. package/src/simple-tree/api/schemaFactory.ts +40 -54
  327. package/src/simple-tree/api/schemaFactoryAlpha.ts +9 -14
  328. package/src/simple-tree/api/schemaFactoryRecursive.ts +25 -5
  329. package/src/simple-tree/api/tree.ts +1 -14
  330. package/src/simple-tree/api/typesUnsafe.ts +359 -341
  331. package/src/simple-tree/arrayNode.ts +2 -2
  332. package/src/simple-tree/core/treeNodeKernel.ts +46 -28
  333. package/src/simple-tree/core/types.ts +14 -4
  334. package/src/simple-tree/core/unhydratedFlexTree.ts +5 -1
  335. package/src/simple-tree/index.ts +2 -22
  336. package/src/simple-tree/objectNode.ts +13 -4
  337. package/src/simple-tree/schemaTypes.ts +11 -7
  338. package/src/tableSchema.ts +190 -63
  339. package/src/treeFactory.ts +151 -8
@@ -9,29 +9,16 @@ import type {
9
9
  IFluidHandle,
10
10
  IFluidLoadable,
11
11
  } from "@fluidframework/core-interfaces/internal";
12
+ import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
12
13
  import type {
13
- IChannelAttributes,
14
- IFluidDataStoreRuntime,
15
- IChannelStorageService,
16
- } from "@fluidframework/datastore-definitions/internal";
17
- import {
18
- SharedObject,
19
- type IChannelView,
20
- type IFluidSerializer,
21
- type ISharedObject,
14
+ IChannelView,
15
+ IFluidSerializer,
22
16
  } from "@fluidframework/shared-object-base/internal";
23
17
  import {
24
18
  UsageError,
25
19
  type ITelemetryLoggerExt,
26
20
  } from "@fluidframework/telemetry-utils/internal";
27
21
  import type { IIdCompressor } from "@fluidframework/id-compressor";
28
- import type {
29
- ITelemetryContext,
30
- IExperimentalIncrementalSummaryContext,
31
- ISummaryTreeWithStats,
32
- IRuntimeMessageCollection,
33
- } from "@fluidframework/runtime-definitions/internal";
34
- import type { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
35
22
 
36
23
  import { type ICodecOptions, noopValidator } from "../codec/index.js";
37
24
  import {
@@ -103,7 +90,7 @@ import { SharedTreeChangeFamily } from "./sharedTreeChangeFamily.js";
103
90
  import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
104
91
  import type { SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
105
92
  import { type TreeCheckout, type BranchableTree, createTreeCheckout } from "./treeCheckout.js";
106
- import { Breakable, breakingClass, throwIfBroken } from "../util/index.js";
93
+ import { type Breakable, breakingClass, throwIfBroken } from "../util/index.js";
107
94
 
108
95
  /**
109
96
  * Copy of data from an {@link ITreePrivate} at some point in time.
@@ -157,13 +144,6 @@ export interface ITreePrivate extends ITreeInternal {
157
144
  readonly kernel: SharedTreeKernel;
158
145
  }
159
146
 
160
- /**
161
- * {@link ITreePrivate} extended with ISharedObject.
162
- * @remarks
163
- * This is used when integration testing this package with the Fluid runtime as it exposes the APIs the runtime consumes to manipulate the tree.
164
- */
165
- export interface ISharedTree extends ISharedObject, ITreePrivate {}
166
-
167
147
  /**
168
148
  * Has an entry for each codec which writes an explicit version into its data.
169
149
  *
@@ -206,121 +186,13 @@ function getCodecVersions(formatVersion: number): ExplicitCodecVersions {
206
186
  return versions;
207
187
  }
208
188
 
209
- /**
210
- * Shared object wrapping {@link SharedTreeKernel}.
211
- */
212
- export class SharedTree extends SharedObject implements ISharedTree {
213
- private readonly breaker: Breakable = new Breakable("Shared Tree");
214
-
215
- public readonly kernel: SharedTreeKernel;
216
-
217
- public constructor(
218
- id: string,
219
- runtime: IFluidDataStoreRuntime,
220
- attributes: IChannelAttributes,
221
- optionsParam: SharedTreeOptionsInternal,
222
- telemetryContextPrefix: string = "fluid_sharedTree_",
223
- ) {
224
- super(id, runtime, attributes, telemetryContextPrefix);
225
- if (runtime.idCompressor === undefined) {
226
- throw new UsageError("IdCompressor must be enabled to use SharedTree");
227
- }
228
- this.kernel = new SharedTreeKernel(
229
- this.breaker,
230
- this,
231
- this.serializer,
232
- (content, localOpMetadata) => this.submitLocalMessage(content, localOpMetadata),
233
- () => this.deltaManager.lastSequenceNumber,
234
- this.logger,
235
- runtime.idCompressor,
236
- optionsParam,
237
- );
238
- }
239
-
240
- public summarizeCore(
241
- serializer: IFluidSerializer,
242
- telemetryContext?: ITelemetryContext,
243
- incrementalSummaryContext?: IExperimentalIncrementalSummaryContext,
244
- ): ISummaryTreeWithStats {
245
- return this.kernel.summarizeCore(serializer, telemetryContext, incrementalSummaryContext);
246
- }
247
-
248
- protected processCore(
249
- message: ISequencedDocumentMessage,
250
- local: boolean,
251
- localOpMetadata: unknown,
252
- ): void {
253
- fail(0xb75 /* processCore should not be called on SharedTree */);
254
- }
255
-
256
- protected override processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {
257
- this.kernel.processMessagesCore(messagesCollection);
258
- }
259
-
260
- protected onDisconnect(): void {
261
- this.kernel.onDisconnect();
262
- }
263
-
264
- public exportVerbose(): VerboseTree | undefined {
265
- return this.kernel.exportVerbose();
266
- }
267
-
268
- public exportSimpleSchema(): SimpleTreeSchema {
269
- return this.kernel.exportSimpleSchema();
270
- }
271
-
272
- public contentSnapshot(): SharedTreeContentSnapshot {
273
- return this.kernel.contentSnapshot();
274
- }
275
-
276
- // For the new TreeViewAlpha API
277
- public viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(
278
- config: TreeViewConfiguration<ReadSchema<TRoot>>,
279
- ): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;
280
-
281
- // For the old TreeView API
282
- public viewWith<TRoot extends ImplicitFieldSchema>(
283
- config: TreeViewConfiguration<TRoot>,
284
- ): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;
285
-
286
- public viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(
287
- config: TreeViewConfiguration<ReadSchema<TRoot>>,
288
- ): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {
289
- return this.kernel.viewWith(config);
290
- }
291
-
292
- protected override async loadCore(services: IChannelStorageService): Promise<void> {
293
- await this.kernel.loadCore(services);
294
- }
295
-
296
- protected override didAttach(): void {
297
- this.kernel.didAttach();
298
- }
299
-
300
- protected override applyStashedOp(
301
- ...args: Parameters<
302
- SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>["applyStashedOp"]
303
- >
304
- ): void {
305
- this.kernel.applyStashedOp(...args);
306
- }
307
-
308
- protected override reSubmitCore(
309
- ...args: Parameters<
310
- SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>["reSubmitCore"]
311
- >
312
- ): void {
313
- this.kernel.reSubmitCore(...args);
314
- }
315
- }
316
-
317
189
  /**
318
190
  * SharedTreeCore, configured with a good set of indexes and field kinds which will maintain compatibility over time.
319
191
  *
320
192
  * TODO: detail compatibility requirements.
321
193
  */
322
194
  @breakingClass
323
- class SharedTreeKernel extends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange> {
195
+ export class SharedTreeKernel extends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange> {
324
196
  public readonly checkout: TreeCheckout;
325
197
  public get storedSchema(): TreeStoredSchemaRepository {
326
198
  return this.checkout.storedSchema;
@@ -31,6 +31,7 @@ export type {
31
31
  ValidateRecursiveSchema,
32
32
  FixRecursiveArraySchema,
33
33
  } from "./schemaFactoryRecursive.js";
34
+ export { allowUnused } from "./schemaFactoryRecursive.js";
34
35
  export {
35
36
  adaptEnum,
36
37
  enumFromStrings,
@@ -59,31 +60,10 @@ export { getSimpleSchema } from "./getSimpleSchema.js";
59
60
  export { ViewSchema } from "./view.js";
60
61
  export type {
61
62
  Unenforced,
62
- FieldHasDefaultUnsafe,
63
- ObjectFromSchemaRecordUnsafe,
64
- TreeObjectNodeUnsafe,
65
- TreeFieldFromImplicitFieldUnsafe,
66
- TreeNodeFromImplicitAllowedTypesUnsafe,
67
- FieldSchemaUnsafe,
68
- InsertableTreeNodeFromImplicitAllowedTypesUnsafe,
69
- TreeArrayNodeUnsafe,
70
- TreeMapNodeUnsafe,
71
- InsertableObjectFromSchemaRecordUnsafe,
72
- InsertableTreeFieldFromImplicitFieldUnsafe,
73
- InsertableTypedNodeUnsafe,
74
- NodeBuilderDataUnsafe,
75
- NodeFromSchemaUnsafe,
76
- ReadonlyMapInlined,
77
- TreeNodeSchemaClassUnsafe,
78
- TreeNodeSchemaUnsafe,
79
- AllowedTypesUnsafe,
80
- ImplicitAllowedTypesUnsafe,
81
- ImplicitFieldSchemaUnsafe,
82
- TreeNodeSchemaNonClassUnsafe,
83
- InsertableTreeNodeFromAllowedTypesUnsafe,
84
63
  FieldSchemaAlphaUnsafe,
85
64
  ArrayNodeCustomizableSchemaUnsafe,
86
65
  MapNodeCustomizableSchemaUnsafe,
66
+ System_Unsafe,
87
67
  } from "./typesUnsafe.js";
88
68
 
89
69
  export {
@@ -55,25 +55,7 @@ import {
55
55
  objectSchema,
56
56
  } from "../objectNode.js";
57
57
  import { type MapNodeInsertableData, type TreeMapNode, mapSchema } from "../mapNode.js";
58
- import type {
59
- FieldSchemaUnsafe,
60
- // Adding these unused imports makes the generated d.ts file produced by TypeScript stop breaking API-Extractor's rollup generation.
61
- // Without this import, TypeScript generates inline `import("../..")` statements in the d.ts file,
62
- // which API-Extractor leaves as is when generating the rollup, leaving them pointing at the wrong directory.
63
- // API-Extractor issue: https://github.com/microsoft/rushstack/issues/4507
64
- // eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars
65
- FieldHasDefaultUnsafe,
66
- // eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars
67
- InsertableTreeFieldFromImplicitFieldUnsafe,
68
- InsertableObjectFromSchemaRecordUnsafe,
69
- InsertableTreeNodeFromImplicitAllowedTypesUnsafe,
70
- TreeArrayNodeUnsafe,
71
- TreeMapNodeUnsafe,
72
- TreeObjectNodeUnsafe,
73
- ImplicitAllowedTypesUnsafe,
74
- ImplicitFieldSchemaUnsafe,
75
- FieldSchemaAlphaUnsafe,
76
- } from "./typesUnsafe.js";
58
+ import type { System_Unsafe, FieldSchemaAlphaUnsafe } from "./typesUnsafe.js";
77
59
  import { createFieldSchemaUnsafe } from "./schemaFactoryRecursive.js";
78
60
  import { isLazy } from "../flexList.js";
79
61
 
@@ -280,12 +262,12 @@ export interface SchemaStatics {
280
262
  * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
281
263
  */
282
264
  readonly optionalRecursive: <
283
- const T extends ImplicitAllowedTypesUnsafe,
265
+ const T extends System_Unsafe.ImplicitAllowedTypesUnsafe,
284
266
  const TCustomMetadata = unknown,
285
267
  >(
286
268
  t: T,
287
269
  props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
288
- ) => FieldSchemaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
270
+ ) => System_Unsafe.FieldSchemaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
289
271
 
290
272
  /**
291
273
  * {@link SchemaStatics.required} except tweaked to work better for recursive types.
@@ -295,12 +277,12 @@ export interface SchemaStatics {
295
277
  * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
296
278
  */
297
279
  readonly requiredRecursive: <
298
- const T extends ImplicitAllowedTypesUnsafe,
280
+ const T extends System_Unsafe.ImplicitAllowedTypesUnsafe,
299
281
  const TCustomMetadata = unknown,
300
282
  >(
301
283
  t: T,
302
284
  props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
303
- ) => FieldSchemaUnsafe<FieldKind.Required, T, TCustomMetadata>;
285
+ ) => System_Unsafe.FieldSchemaUnsafe<FieldKind.Required, T, TCustomMetadata>;
304
286
  }
305
287
 
306
288
  const defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => {
@@ -339,7 +321,7 @@ export const schemaStaticsBase = {
339
321
  },
340
322
 
341
323
  optionalRecursive: <
342
- const T extends ImplicitAllowedTypesUnsafe,
324
+ const T extends System_Unsafe.ImplicitAllowedTypesUnsafe,
343
325
  const TCustomMetadata = unknown,
344
326
  >(
345
327
  t: T,
@@ -352,7 +334,7 @@ export const schemaStaticsBase = {
352
334
  },
353
335
 
354
336
  requiredRecursive: <
355
- const T extends ImplicitAllowedTypesUnsafe,
337
+ const T extends System_Unsafe.ImplicitAllowedTypesUnsafe,
356
338
  const TCustomMetadata = unknown,
357
339
  >(
358
340
  t: T,
@@ -963,24 +945,24 @@ export class SchemaFactory<
963
945
  public static readonly requiredRecursive = schemaStaticsPublic.requiredRecursive;
964
946
 
965
947
  /**
966
- * A special field which holds a unique identifier for an object node.
948
+ * A special readonly field which holds an identifier string for an object node.
967
949
  * @remarks
968
- * The value of this field, a "node identifier", uniquely identifies a node among all other nodes in the tree.
950
+ * The value of this field, a "node identifier", is a string which identifies a node (or nodes) among all nodes in the tree.
969
951
  * Node identifiers are strings, and can therefore be used as lookup keys in maps or written to a database.
970
- * When the node is constructed, the identifier field does not need to be populated.
971
- * The SharedTree will provide an identifier for the node automatically.
972
- * An identifier provided automatically by the SharedTree has the following properties:
973
- * - It is a UUID.
952
+ * When the node is constructed, the identifier field does not need to be specified.
953
+ * When an identifier is not provided, the SharedTree will generate an identifier for the node automatically.
954
+ * The identifier generated by the SharedTree has the following properties:
955
+ *
956
+ * - It is a UUID which will not collide with other generated UUIDs.
974
957
  * - It is compressed to a space-efficient representation when stored in the document.
975
- * - A compressed form of the identifier can be accessed at runtime via the `Tree.shortId()` API.
976
- * - It will error if read (and will not be present in the object's iterable properties) before the node has been inserted into the tree.
958
+ * - A compressed form of the identifier can be accessed at runtime via the {@link TreeNodeApi.shortId|Tree.shortId()} API.
959
+ * - It will error if read (and will not be present in the object's iterable properties) before the node has been inserted into a tree.
977
960
  *
978
961
  * However, a user may alternatively supply their own string as the identifier if desired (for example, if importing identifiers from another system).
979
- * In that case, it is up to the user to ensure that the identifier is unique within the current tree - no other node should have the same identifier at the same time.
980
- * If the identifier is not unique, it may be read, but may cause libraries or features which operate over node identifiers to misbehave.
962
+ * In that case, if the user requires it to be unique, it is up to them to ensure uniqueness.
981
963
  * User-supplied identifiers may be read immediately, even before insertion into the tree.
982
964
  *
983
- * A node may have more than one identifier field (though note that this precludes the use of the `Tree.shortId()` API).
965
+ * A node may have more than one identifier field (though note that this precludes the use of the {@link TreeNodeApi.shortId|Tree.shortId()} API).
984
966
  */
985
967
  public get identifier(): FieldSchema<FieldKind.Identifier, typeof this.string> {
986
968
  const defaultIdentifierProvider: DefaultProvider = getDefaultProvider(
@@ -1008,15 +990,15 @@ export class SchemaFactory<
1008
990
  */
1009
991
  public objectRecursive<
1010
992
  const Name extends TName,
1011
- const T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>,
993
+ const T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>,
1012
994
  >(
1013
995
  name: Name,
1014
996
  t: T,
1015
997
  ): TreeNodeSchemaClass<
1016
998
  ScopedSchemaName<TScope, Name>,
1017
999
  NodeKind.Object,
1018
- TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,
1019
- object & InsertableObjectFromSchemaRecordUnsafe<T>,
1000
+ System_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,
1001
+ object & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,
1020
1002
  false,
1021
1003
  T
1022
1004
  > {
@@ -1027,8 +1009,8 @@ export class SchemaFactory<
1027
1009
  ) as unknown as TreeNodeSchemaClass<
1028
1010
  TScopedName,
1029
1011
  NodeKind.Object,
1030
- TreeObjectNodeUnsafe<T, TScopedName>,
1031
- object & InsertableObjectFromSchemaRecordUnsafe<T>,
1012
+ System_Unsafe.TreeObjectNodeUnsafe<T, TScopedName>,
1013
+ object & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,
1032
1014
  false,
1033
1015
  T
1034
1016
  >;
@@ -1042,10 +1024,10 @@ export class SchemaFactory<
1042
1024
  * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
1043
1025
  */
1044
1026
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
1045
- public arrayRecursive<const Name extends TName, const T extends ImplicitAllowedTypesUnsafe>(
1046
- name: Name,
1047
- allowedTypes: T,
1048
- ) {
1027
+ public arrayRecursive<
1028
+ const Name extends TName,
1029
+ const T extends System_Unsafe.ImplicitAllowedTypesUnsafe,
1030
+ >(name: Name, allowedTypes: T) {
1049
1031
  const RecursiveArray = this.namedArray(
1050
1032
  name,
1051
1033
  allowedTypes as T & ImplicitAllowedTypes,
@@ -1056,7 +1038,8 @@ export class SchemaFactory<
1056
1038
  return RecursiveArray as TreeNodeSchemaClass<
1057
1039
  ScopedSchemaName<TScope, Name>,
1058
1040
  NodeKind.Array,
1059
- TreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>,
1041
+ System_Unsafe.TreeArrayNodeUnsafe<T> &
1042
+ WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>,
1060
1043
  {
1061
1044
  /**
1062
1045
  * Iterator for the iterable of content for this node.
@@ -1069,7 +1052,9 @@ export class SchemaFactory<
1069
1052
  * If this workaround is kept, ideally this comment would be deduplicated with the other instance of it.
1070
1053
  * Unfortunately attempts to do this failed to avoid the compile error this was introduced to solve.
1071
1054
  */
1072
- [Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
1055
+ [Symbol.iterator](): Iterator<
1056
+ System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>
1057
+ >;
1073
1058
  },
1074
1059
  false,
1075
1060
  T,
@@ -1085,10 +1070,10 @@ export class SchemaFactory<
1085
1070
  * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
1086
1071
  */
1087
1072
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
1088
- public mapRecursive<Name extends TName, const T extends ImplicitAllowedTypesUnsafe>(
1089
- name: Name,
1090
- allowedTypes: T,
1091
- ) {
1073
+ public mapRecursive<
1074
+ Name extends TName,
1075
+ const T extends System_Unsafe.ImplicitAllowedTypesUnsafe,
1076
+ >(name: Name, allowedTypes: T) {
1092
1077
  const MapSchema = this.namedMap(
1093
1078
  name,
1094
1079
  allowedTypes as T & ImplicitAllowedTypes,
@@ -1101,7 +1086,8 @@ export class SchemaFactory<
1101
1086
  return MapSchema as TreeNodeSchemaClass<
1102
1087
  ScopedSchemaName<TScope, Name>,
1103
1088
  NodeKind.Map,
1104
- TreeMapNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,
1089
+ System_Unsafe.TreeMapNodeUnsafe<T> &
1090
+ WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,
1105
1091
  | {
1106
1092
  /**
1107
1093
  * Iterator for the iterable of content for this node.
@@ -1115,7 +1101,7 @@ export class SchemaFactory<
1115
1101
  * Unfortunately attempts to do this failed to avoid the compile error this was introduced to solve.
1116
1102
  */
1117
1103
  [Symbol.iterator](): Iterator<
1118
- [string, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>]
1104
+ [string, System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>]
1119
1105
  >;
1120
1106
  }
1121
1107
  // Ideally this would be
@@ -1123,7 +1109,7 @@ export class SchemaFactory<
1123
1109
  // but doing so breaks recursive types.
1124
1110
  // Instead we do a less nice version:
1125
1111
  | {
1126
- readonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
1112
+ readonly [P in string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
1127
1113
  },
1128
1114
  false,
1129
1115
  T,
@@ -3,16 +3,12 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import type {
7
- ScopedSchemaName,
8
- TreeObjectNodeUnsafe,
9
- InsertableObjectFromSchemaRecordUnsafe,
10
- } from "../../internalTypes.js";
11
6
  import {
12
7
  defaultSchemaFactoryObjectOptions,
13
8
  SchemaFactory,
14
9
  schemaStatics,
15
10
  type SchemaFactoryObjectOptions,
11
+ type ScopedSchemaName,
16
12
  } from "./schemaFactory.js";
17
13
  import type {
18
14
  ImplicitAllowedTypes,
@@ -23,10 +19,9 @@ import { objectSchema } from "../objectNode.js";
23
19
  import type { RestrictiveStringRecord } from "../../util/index.js";
24
20
  import type { NodeKind, TreeNodeSchemaClass } from "../core/index.js";
25
21
  import type {
26
- ImplicitAllowedTypesUnsafe,
27
- ImplicitFieldSchemaUnsafe,
28
22
  ArrayNodeCustomizableSchemaUnsafe,
29
23
  MapNodeCustomizableSchemaUnsafe,
24
+ System_Unsafe,
30
25
  } from "./typesUnsafe.js";
31
26
  import { mapSchema } from "../mapNode.js";
32
27
  import { arraySchema } from "../arrayNode.js";
@@ -97,7 +92,7 @@ export class SchemaFactoryAlpha<
97
92
  */
98
93
  public override objectRecursive<
99
94
  const Name extends TName,
100
- const T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>,
95
+ const T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>,
101
96
  const TCustomMetadata = unknown,
102
97
  >(
103
98
  name: Name,
@@ -106,8 +101,8 @@ export class SchemaFactoryAlpha<
106
101
  ): TreeNodeSchemaClass<
107
102
  ScopedSchemaName<TScope, Name>,
108
103
  NodeKind.Object,
109
- TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,
110
- object & InsertableObjectFromSchemaRecordUnsafe<T>,
104
+ System_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,
105
+ object & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,
111
106
  false,
112
107
  T,
113
108
  never,
@@ -133,8 +128,8 @@ export class SchemaFactoryAlpha<
133
128
  ) as unknown as TreeNodeSchemaClass<
134
129
  TScopedName,
135
130
  NodeKind.Object,
136
- TreeObjectNodeUnsafe<T, TScopedName>,
137
- object & InsertableObjectFromSchemaRecordUnsafe<T>,
131
+ System_Unsafe.TreeObjectNodeUnsafe<T, TScopedName>,
132
+ object & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,
138
133
  false,
139
134
  T,
140
135
  never,
@@ -205,7 +200,7 @@ export class SchemaFactoryAlpha<
205
200
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
206
201
  public override mapRecursive<
207
202
  Name extends TName,
208
- const T extends ImplicitAllowedTypesUnsafe,
203
+ const T extends System_Unsafe.ImplicitAllowedTypesUnsafe,
209
204
  const TCustomMetadata = unknown,
210
205
  >(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>) {
211
206
  return this.mapAlpha(
@@ -249,7 +244,7 @@ export class SchemaFactoryAlpha<
249
244
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
250
245
  public override arrayRecursive<
251
246
  const Name extends TName,
252
- const T extends ImplicitAllowedTypesUnsafe,
247
+ const T extends System_Unsafe.ImplicitAllowedTypesUnsafe,
253
248
  const TCustomMetadata = unknown,
254
249
  >(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>) {
255
250
  return this.arrayAlpha(
@@ -21,11 +21,11 @@ import type {
21
21
  WithType,
22
22
  TreeNode,
23
23
  } from "../core/index.js";
24
- import type { FieldSchemaAlphaUnsafe, ImplicitAllowedTypesUnsafe } from "./typesUnsafe.js";
24
+ import type { FieldSchemaAlphaUnsafe, System_Unsafe } from "./typesUnsafe.js";
25
25
 
26
26
  export function createFieldSchemaUnsafe<
27
27
  Kind extends FieldKind,
28
- Types extends ImplicitAllowedTypesUnsafe,
28
+ Types extends System_Unsafe.ImplicitAllowedTypesUnsafe,
29
29
  TCustomMetadata = unknown,
30
30
  >(
31
31
  kind: Kind,
@@ -117,21 +117,28 @@ export function createFieldSchemaUnsafe<
117
117
  * Be very careful when declaring recursive schema.
118
118
  * Due to the removed extends clauses, subtle mistakes will compile just fine but cause strange errors when the schema is used.
119
119
  *
120
- * For example if the square brackets around the allowed types are forgotten:
120
+ * For example if a reference to a schema is malformed (in this case boxed inside an object):
121
121
  *
122
122
  * ```typescript
123
- * class Test extends sf.arrayRecursive("Test", () => Test) {} // Bad
123
+ * class Test extends sf.arrayRecursive("Test", [() => ({ Test })]) {} // Bad
124
124
  * ```
125
125
  * This schema will still compile, and some (but not all) usages of it may look like they work correctly while other usages will produce generally unintelligible compile errors.
126
126
  * This issue can be partially mitigated using {@link ValidateRecursiveSchema}:
127
127
  *
128
128
  * ```typescript
129
- * class Test extends sf.arrayRecursive("Test", () => Test) {} // Bad
129
+ * class Test extends sf.arrayRecursive("Test", [() => ({ Test })]) {} // Bad
130
130
  * {
131
131
  * type _check = ValidateRecursiveSchema<typeof Test>; // Reports compile error due to invalid schema above.
132
132
  * }
133
133
  * ```
134
134
  *
135
+ * If your TypeScript configuration objects to this patten due to the unused local, you can use {@link allowUnused} to suppress the error:
136
+ *
137
+ * ```typescript
138
+ * class Test extends sf.arrayRecursive("Test", [() => ({ Test })]) {} // Bad
139
+ * allowUnused<ValidateRecursiveSchema<typeof Test>>(); // Reports compile error due to invalid schema above.
140
+ * ```
141
+ *
135
142
  * ## Object Schema
136
143
  *
137
144
  * When defining fields, if the fields is part of the recursive cycle, use the `*Recursive` {@link SchemaFactory} methods for defining the {@link FieldSchema}.
@@ -183,6 +190,19 @@ export type ValidateRecursiveSchema<
183
190
  >,
184
191
  > = true;
185
192
 
193
+ /**
194
+ * Does nothing with the provided value, but appears to use it to make unused locals warnings and errors go away.
195
+ *
196
+ * @remarks
197
+ * When TypeScript is configured with "noUnusedLocals", it will produce an error if a local variable is declared but never used.
198
+ * When you want to have this check enabled, but not follow it for a specific variable, you can pass the type or value to this function.
199
+ *
200
+ * Instead of using this, consider disabling "noUnusedLocals" in your tsconfig.json file, and enabling a similar check via a linter.
201
+ * This will allow you to still have the check, but have more control over it, for example being able to suppress it, or enable patterns like allowing unused locals with an "_" prefix.
202
+ * @alpha
203
+ */
204
+ export function allowUnused<T>(t?: T): void {}
205
+
186
206
  /**
187
207
  * Workaround for fixing errors resulting from an issue with recursive ArrayNode schema exports.
188
208
  * @remarks
@@ -77,21 +77,8 @@ export interface ViewableTree {
77
77
  * Only one schematized view may exist for a given ITree at a time.
78
78
  * If creating a second, the first must be disposed before calling `viewWith` again.
79
79
  *
80
- *
81
- * TODO: Provide a way to make a generic view schema for any document.
80
+ * @privateRemarks
82
81
  * TODO: Support adapters for handling out-of-schema data.
83
- *
84
- * Doing initialization here allows a small API that is hard to use incorrectly.
85
- * Other approaches tend to have easy-to-make mistakes.
86
- * For example, having a separate initialization function means apps can forget to call it, making an app that can only open existing documents,
87
- * or call it unconditionally leaving an app that can only create new documents.
88
- * It also would require the schema to be passed into separate places and could cause issues if they didn't match.
89
- * Since the initialization function couldn't return a typed tree, the type checking wouldn't help catch that.
90
- * Also, if an app manages to create a document, but the initialization fails to get persisted, an app that only calls the initialization function
91
- * on the create code-path (for example how a schematized factory might do it),
92
- * would leave the document in an unusable state which could not be repaired when it is reopened (by the same or other clients).
93
- * Additionally, once out of schema content adapters are properly supported (with lazy document updates),
94
- * this initialization could become just another out of schema content adapter and this initialization is no longer a special case.
95
82
  */
96
83
  viewWith<TRoot extends ImplicitFieldSchema>(
97
84
  config: TreeViewConfiguration<TRoot>,