@fluidframework/tree 2.4.0-297385 → 2.4.0-299707

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 (349) hide show
  1. package/.dependency-cruiser-known-violations.json +0 -14
  2. package/api-report/tree.alpha.api.md +100 -0
  3. package/dist/alpha.d.ts +20 -1
  4. package/dist/codec/codec.d.ts +4 -4
  5. package/dist/codec/codec.js.map +1 -1
  6. package/dist/codec/noopValidator.d.ts +1 -1
  7. package/dist/codec/noopValidator.js +1 -1
  8. package/dist/codec/noopValidator.js.map +1 -1
  9. package/dist/core/tree/anchorSet.d.ts +159 -2
  10. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  11. package/dist/core/tree/anchorSet.js +54 -12
  12. package/dist/core/tree/anchorSet.js.map +1 -1
  13. package/dist/external-utilities/typeboxValidator.d.ts +1 -1
  14. package/dist/external-utilities/typeboxValidator.js +1 -1
  15. package/dist/external-utilities/typeboxValidator.js.map +1 -1
  16. package/dist/feature-libraries/flex-tree/lazyField.d.ts +4 -0
  17. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  18. package/dist/feature-libraries/flex-tree/lazyField.js +38 -6
  19. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  20. package/dist/feature-libraries/index.d.ts +0 -1
  21. package/dist/feature-libraries/index.d.ts.map +1 -1
  22. package/dist/feature-libraries/index.js +46 -49
  23. package/dist/feature-libraries/index.js.map +1 -1
  24. package/dist/feature-libraries/treeCompressionUtils.d.ts +1 -1
  25. package/dist/feature-libraries/treeCompressionUtils.js +1 -1
  26. package/dist/feature-libraries/treeCompressionUtils.js.map +1 -1
  27. package/dist/index.d.ts +6 -5
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +4 -2
  30. package/dist/index.js.map +1 -1
  31. package/dist/internalTypes.d.ts +1 -1
  32. package/dist/internalTypes.d.ts.map +1 -1
  33. package/dist/internalTypes.js.map +1 -1
  34. package/dist/packageVersion.d.ts +1 -1
  35. package/dist/packageVersion.js +1 -1
  36. package/dist/packageVersion.js.map +1 -1
  37. package/dist/shared-tree/index.d.ts +2 -1
  38. package/dist/shared-tree/index.d.ts.map +1 -1
  39. package/dist/shared-tree/index.js +5 -1
  40. package/dist/shared-tree/index.js.map +1 -1
  41. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  42. package/dist/shared-tree/schematizingTreeView.js +1 -14
  43. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  44. package/dist/shared-tree/sharedTree.d.ts +24 -9
  45. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  46. package/dist/shared-tree/sharedTree.js +20 -8
  47. package/dist/shared-tree/sharedTree.js.map +1 -1
  48. package/dist/simple-tree/api/conciseTree.d.ts +29 -0
  49. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -0
  50. package/dist/simple-tree/api/conciseTree.js +25 -0
  51. package/dist/simple-tree/api/conciseTree.js.map +1 -0
  52. package/dist/simple-tree/api/customTree.d.ts +44 -0
  53. package/dist/simple-tree/api/customTree.d.ts.map +1 -0
  54. package/dist/simple-tree/api/customTree.js +63 -0
  55. package/dist/simple-tree/api/customTree.js.map +1 -0
  56. package/dist/simple-tree/api/index.d.ts +6 -1
  57. package/dist/simple-tree/api/index.d.ts.map +1 -1
  58. package/dist/simple-tree/api/index.js +5 -1
  59. package/dist/simple-tree/api/index.js.map +1 -1
  60. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +41 -26
  61. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  62. package/dist/simple-tree/api/schemaCreationUtilities.js +43 -15
  63. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  64. package/dist/simple-tree/api/schemaFactory.d.ts +1 -2
  65. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  66. package/dist/simple-tree/api/schemaFactory.js +8 -8
  67. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  68. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +1 -2
  69. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  70. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  71. package/dist/simple-tree/api/storedSchema.d.ts +78 -0
  72. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -0
  73. package/dist/simple-tree/api/storedSchema.js +107 -0
  74. package/dist/simple-tree/api/storedSchema.js.map +1 -0
  75. package/dist/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  76. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  77. package/dist/simple-tree/api/treeNodeApi.js +5 -5
  78. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  79. package/dist/simple-tree/{typesUnsafe.d.ts → api/typesUnsafe.d.ts} +14 -5
  80. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -0
  81. package/dist/simple-tree/api/typesUnsafe.js.map +1 -0
  82. package/dist/simple-tree/api/verboseTree.d.ts +6 -20
  83. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  84. package/dist/simple-tree/api/verboseTree.js +10 -48
  85. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  86. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  87. package/dist/simple-tree/arrayNode.js +1 -2
  88. package/dist/simple-tree/arrayNode.js.map +1 -1
  89. package/dist/simple-tree/core/index.d.ts +1 -1
  90. package/dist/simple-tree/core/index.d.ts.map +1 -1
  91. package/dist/simple-tree/core/index.js +2 -1
  92. package/dist/simple-tree/core/index.js.map +1 -1
  93. package/dist/simple-tree/core/treeNodeKernel.d.ts +9 -0
  94. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  95. package/dist/simple-tree/core/treeNodeKernel.js +14 -1
  96. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  97. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  98. package/dist/simple-tree/core/unhydratedFlexTree.js +3 -1
  99. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  100. package/dist/simple-tree/flexList.d.ts.map +1 -0
  101. package/dist/simple-tree/flexList.js.map +1 -0
  102. package/dist/simple-tree/index.d.ts +3 -4
  103. package/dist/simple-tree/index.d.ts.map +1 -1
  104. package/dist/simple-tree/index.js +5 -3
  105. package/dist/simple-tree/index.js.map +1 -1
  106. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  107. package/dist/simple-tree/mapNode.js +2 -3
  108. package/dist/simple-tree/mapNode.js.map +1 -1
  109. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  110. package/dist/simple-tree/objectNode.js +3 -4
  111. package/dist/simple-tree/objectNode.js.map +1 -1
  112. package/dist/simple-tree/schemaTypes.d.ts +2 -1
  113. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  114. package/dist/simple-tree/schemaTypes.js +5 -5
  115. package/dist/simple-tree/schemaTypes.js.map +1 -1
  116. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  117. package/dist/simple-tree/toFlexSchema.js +13 -15
  118. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  119. package/dist/simple-tree/toMapTree.js +3 -3
  120. package/dist/simple-tree/toMapTree.js.map +1 -1
  121. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  122. package/dist/simple-tree/treeNodeValid.js +2 -1
  123. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  124. package/dist/treeFactory.d.ts +1 -0
  125. package/dist/treeFactory.d.ts.map +1 -1
  126. package/dist/treeFactory.js +1 -0
  127. package/dist/treeFactory.js.map +1 -1
  128. package/dist/util/utils.d.ts +10 -8
  129. package/dist/util/utils.d.ts.map +1 -1
  130. package/dist/util/utils.js.map +1 -1
  131. package/docs/main/detached-trees.md +8 -8
  132. package/lib/alpha.d.ts +20 -1
  133. package/lib/codec/codec.d.ts +4 -4
  134. package/lib/codec/codec.js.map +1 -1
  135. package/lib/codec/noopValidator.d.ts +1 -1
  136. package/lib/codec/noopValidator.js +1 -1
  137. package/lib/codec/noopValidator.js.map +1 -1
  138. package/lib/core/tree/anchorSet.d.ts +159 -2
  139. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  140. package/lib/core/tree/anchorSet.js +54 -12
  141. package/lib/core/tree/anchorSet.js.map +1 -1
  142. package/lib/external-utilities/typeboxValidator.d.ts +1 -1
  143. package/lib/external-utilities/typeboxValidator.js +1 -1
  144. package/lib/external-utilities/typeboxValidator.js.map +1 -1
  145. package/lib/feature-libraries/flex-tree/lazyField.d.ts +4 -0
  146. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  147. package/lib/feature-libraries/flex-tree/lazyField.js +36 -5
  148. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  149. package/lib/feature-libraries/index.d.ts +0 -1
  150. package/lib/feature-libraries/index.d.ts.map +1 -1
  151. package/lib/feature-libraries/index.js +0 -1
  152. package/lib/feature-libraries/index.js.map +1 -1
  153. package/lib/feature-libraries/treeCompressionUtils.d.ts +1 -1
  154. package/lib/feature-libraries/treeCompressionUtils.js +1 -1
  155. package/lib/feature-libraries/treeCompressionUtils.js.map +1 -1
  156. package/lib/index.d.ts +6 -5
  157. package/lib/index.d.ts.map +1 -1
  158. package/lib/index.js +3 -3
  159. package/lib/index.js.map +1 -1
  160. package/lib/internalTypes.d.ts +1 -1
  161. package/lib/internalTypes.d.ts.map +1 -1
  162. package/lib/internalTypes.js.map +1 -1
  163. package/lib/packageVersion.d.ts +1 -1
  164. package/lib/packageVersion.js +1 -1
  165. package/lib/packageVersion.js.map +1 -1
  166. package/lib/shared-tree/index.d.ts +2 -1
  167. package/lib/shared-tree/index.d.ts.map +1 -1
  168. package/lib/shared-tree/index.js +2 -1
  169. package/lib/shared-tree/index.js.map +1 -1
  170. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  171. package/lib/shared-tree/schematizingTreeView.js +2 -15
  172. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  173. package/lib/shared-tree/sharedTree.d.ts +24 -9
  174. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  175. package/lib/shared-tree/sharedTree.js +19 -8
  176. package/lib/shared-tree/sharedTree.js.map +1 -1
  177. package/lib/simple-tree/api/conciseTree.d.ts +29 -0
  178. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -0
  179. package/lib/simple-tree/api/conciseTree.js +21 -0
  180. package/lib/simple-tree/api/conciseTree.js.map +1 -0
  181. package/lib/simple-tree/api/customTree.d.ts +44 -0
  182. package/lib/simple-tree/api/customTree.d.ts.map +1 -0
  183. package/lib/simple-tree/api/customTree.js +59 -0
  184. package/lib/simple-tree/api/customTree.js.map +1 -0
  185. package/lib/simple-tree/api/index.d.ts +6 -1
  186. package/lib/simple-tree/api/index.d.ts.map +1 -1
  187. package/lib/simple-tree/api/index.js +1 -0
  188. package/lib/simple-tree/api/index.js.map +1 -1
  189. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +41 -26
  190. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  191. package/lib/simple-tree/api/schemaCreationUtilities.js +43 -15
  192. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  193. package/lib/simple-tree/api/schemaFactory.d.ts +1 -2
  194. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  195. package/lib/simple-tree/api/schemaFactory.js +1 -1
  196. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  197. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +1 -2
  198. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  199. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  200. package/lib/simple-tree/api/storedSchema.d.ts +78 -0
  201. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -0
  202. package/lib/simple-tree/api/storedSchema.js +101 -0
  203. package/lib/simple-tree/api/storedSchema.js.map +1 -0
  204. package/lib/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  205. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  206. package/lib/simple-tree/api/treeNodeApi.js +3 -3
  207. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  208. package/lib/simple-tree/{typesUnsafe.d.ts → api/typesUnsafe.d.ts} +14 -5
  209. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -0
  210. package/lib/simple-tree/api/typesUnsafe.js.map +1 -0
  211. package/lib/simple-tree/api/verboseTree.d.ts +6 -20
  212. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  213. package/lib/simple-tree/api/verboseTree.js +11 -49
  214. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  215. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  216. package/lib/simple-tree/arrayNode.js +1 -2
  217. package/lib/simple-tree/arrayNode.js.map +1 -1
  218. package/lib/simple-tree/core/index.d.ts +1 -1
  219. package/lib/simple-tree/core/index.d.ts.map +1 -1
  220. package/lib/simple-tree/core/index.js +1 -1
  221. package/lib/simple-tree/core/index.js.map +1 -1
  222. package/lib/simple-tree/core/treeNodeKernel.d.ts +9 -0
  223. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  224. package/lib/simple-tree/core/treeNodeKernel.js +12 -0
  225. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  226. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  227. package/lib/simple-tree/core/unhydratedFlexTree.js +3 -1
  228. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  229. package/lib/simple-tree/flexList.d.ts.map +1 -0
  230. package/lib/simple-tree/flexList.js.map +1 -0
  231. package/lib/simple-tree/index.d.ts +3 -4
  232. package/lib/simple-tree/index.d.ts.map +1 -1
  233. package/lib/simple-tree/index.js +2 -3
  234. package/lib/simple-tree/index.js.map +1 -1
  235. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  236. package/lib/simple-tree/mapNode.js +1 -2
  237. package/lib/simple-tree/mapNode.js.map +1 -1
  238. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  239. package/lib/simple-tree/objectNode.js +1 -2
  240. package/lib/simple-tree/objectNode.js.map +1 -1
  241. package/lib/simple-tree/schemaTypes.d.ts +2 -1
  242. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  243. package/lib/simple-tree/schemaTypes.js +1 -1
  244. package/lib/simple-tree/schemaTypes.js.map +1 -1
  245. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  246. package/lib/simple-tree/toFlexSchema.js +1 -3
  247. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  248. package/lib/simple-tree/toMapTree.js +3 -3
  249. package/lib/simple-tree/toMapTree.js.map +1 -1
  250. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  251. package/lib/simple-tree/treeNodeValid.js +2 -1
  252. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  253. package/lib/treeFactory.d.ts +1 -0
  254. package/lib/treeFactory.d.ts.map +1 -1
  255. package/lib/treeFactory.js +1 -0
  256. package/lib/treeFactory.js.map +1 -1
  257. package/lib/util/utils.d.ts +10 -8
  258. package/lib/util/utils.d.ts.map +1 -1
  259. package/lib/util/utils.js.map +1 -1
  260. package/package.json +26 -25
  261. package/src/codec/codec.ts +4 -4
  262. package/src/codec/noopValidator.ts +1 -1
  263. package/src/core/tree/anchorSet.ts +63 -13
  264. package/src/external-utilities/typeboxValidator.ts +1 -1
  265. package/src/feature-libraries/flex-tree/lazyField.ts +44 -7
  266. package/src/feature-libraries/index.ts +0 -10
  267. package/src/feature-libraries/treeCompressionUtils.ts +1 -1
  268. package/src/index.ts +17 -6
  269. package/src/internalTypes.ts +1 -1
  270. package/src/packageVersion.ts +1 -1
  271. package/src/shared-tree/index.ts +5 -0
  272. package/src/shared-tree/schematizingTreeView.ts +7 -16
  273. package/src/shared-tree/sharedTree.ts +52 -22
  274. package/src/simple-tree/api/conciseTree.ts +58 -0
  275. package/src/simple-tree/api/customTree.ts +119 -0
  276. package/src/simple-tree/api/index.ts +34 -1
  277. package/src/simple-tree/api/schemaCreationUtilities.ts +55 -36
  278. package/src/simple-tree/api/schemaFactory.ts +4 -6
  279. package/src/simple-tree/api/schemaFactoryRecursive.ts +1 -2
  280. package/src/simple-tree/api/storedSchema.ts +126 -0
  281. package/src/simple-tree/api/treeNodeApi.ts +3 -8
  282. package/src/simple-tree/{typesUnsafe.ts → api/typesUnsafe.ts} +15 -5
  283. package/src/simple-tree/api/verboseTree.ts +21 -76
  284. package/src/simple-tree/arrayNode.ts +1 -1
  285. package/src/simple-tree/core/index.ts +1 -0
  286. package/src/simple-tree/core/treeNodeKernel.ts +13 -0
  287. package/src/simple-tree/core/unhydratedFlexTree.ts +6 -1
  288. package/src/simple-tree/index.ts +26 -20
  289. package/src/simple-tree/mapNode.ts +1 -1
  290. package/src/simple-tree/objectNode.ts +1 -1
  291. package/src/simple-tree/schemaTypes.ts +2 -6
  292. package/src/simple-tree/toFlexSchema.ts +1 -3
  293. package/src/simple-tree/toMapTree.ts +3 -3
  294. package/src/simple-tree/treeNodeValid.ts +2 -1
  295. package/src/treeFactory.ts +1 -0
  296. package/src/util/utils.ts +10 -8
  297. package/dist/feature-libraries/flex-tree/unboxed.d.ts +0 -12
  298. package/dist/feature-libraries/flex-tree/unboxed.d.ts.map +0 -1
  299. package/dist/feature-libraries/flex-tree/unboxed.js +0 -20
  300. package/dist/feature-libraries/flex-tree/unboxed.js.map +0 -1
  301. package/dist/feature-libraries/typed-schema/flexList.d.ts.map +0 -1
  302. package/dist/feature-libraries/typed-schema/flexList.js.map +0 -1
  303. package/dist/feature-libraries/typed-schema/index.d.ts +0 -7
  304. package/dist/feature-libraries/typed-schema/index.d.ts.map +0 -1
  305. package/dist/feature-libraries/typed-schema/index.js +0 -12
  306. package/dist/feature-libraries/typed-schema/index.js.map +0 -1
  307. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -14
  308. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +0 -1
  309. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +0 -7
  310. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +0 -1
  311. package/dist/simple-tree/proxyBinding.d.ts +0 -15
  312. package/dist/simple-tree/proxyBinding.d.ts.map +0 -1
  313. package/dist/simple-tree/proxyBinding.js +0 -22
  314. package/dist/simple-tree/proxyBinding.js.map +0 -1
  315. package/dist/simple-tree/typesUnsafe.d.ts.map +0 -1
  316. package/dist/simple-tree/typesUnsafe.js.map +0 -1
  317. package/lib/feature-libraries/flex-tree/unboxed.d.ts +0 -12
  318. package/lib/feature-libraries/flex-tree/unboxed.d.ts.map +0 -1
  319. package/lib/feature-libraries/flex-tree/unboxed.js +0 -16
  320. package/lib/feature-libraries/flex-tree/unboxed.js.map +0 -1
  321. package/lib/feature-libraries/typed-schema/flexList.d.ts.map +0 -1
  322. package/lib/feature-libraries/typed-schema/flexList.js.map +0 -1
  323. package/lib/feature-libraries/typed-schema/index.d.ts +0 -7
  324. package/lib/feature-libraries/typed-schema/index.d.ts.map +0 -1
  325. package/lib/feature-libraries/typed-schema/index.js +0 -6
  326. package/lib/feature-libraries/typed-schema/index.js.map +0 -1
  327. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -14
  328. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +0 -1
  329. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +0 -6
  330. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +0 -1
  331. package/lib/simple-tree/proxyBinding.d.ts +0 -15
  332. package/lib/simple-tree/proxyBinding.d.ts.map +0 -1
  333. package/lib/simple-tree/proxyBinding.js +0 -18
  334. package/lib/simple-tree/proxyBinding.js.map +0 -1
  335. package/lib/simple-tree/typesUnsafe.d.ts.map +0 -1
  336. package/lib/simple-tree/typesUnsafe.js.map +0 -1
  337. package/src/feature-libraries/flex-tree/unboxed.ts +0 -24
  338. package/src/feature-libraries/typed-schema/README.md +0 -6
  339. package/src/feature-libraries/typed-schema/index.ts +0 -16
  340. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +0 -14
  341. package/src/simple-tree/proxyBinding.ts +0 -20
  342. /package/dist/simple-tree/{typesUnsafe.js → api/typesUnsafe.js} +0 -0
  343. /package/dist/{feature-libraries/typed-schema → simple-tree}/flexList.d.ts +0 -0
  344. /package/dist/{feature-libraries/typed-schema → simple-tree}/flexList.js +0 -0
  345. /package/lib/simple-tree/{typesUnsafe.js → api/typesUnsafe.js} +0 -0
  346. /package/lib/{feature-libraries/typed-schema → simple-tree}/flexList.d.ts +0 -0
  347. /package/lib/{feature-libraries/typed-schema → simple-tree}/flexList.js +0 -0
  348. /package/src/simple-tree/{ProxyBinding.md → core/TreeNodeBinding.md} +0 -0
  349. /package/src/{feature-libraries/typed-schema → simple-tree}/flexList.ts +0 -0
@@ -0,0 +1,126 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import type { ICodecOptions } from "../../codec/index.js";
7
+ import { Compatibility, type TreeStoredSchema } from "../../core/index.js";
8
+ import {
9
+ defaultSchemaPolicy,
10
+ encodeTreeSchema,
11
+ makeSchemaCodec,
12
+ } from "../../feature-libraries/index.js";
13
+ // eslint-disable-next-line import/no-internal-modules
14
+ import type { Format } from "../../feature-libraries/schema-index/index.js";
15
+ import type { JsonCompatible } from "../../util/index.js";
16
+ import type { ImplicitFieldSchema } from "../schemaTypes.js";
17
+ import { toStoredSchema } from "../toFlexSchema.js";
18
+ import type { SchemaCompatibilityStatus } from "./tree.js";
19
+ import { ViewSchema } from "./view.js";
20
+
21
+ /**
22
+ * Dumps the "persisted" schema subset of the provided `schema` into a deterministic JSON-compatible, semi-human-readable, but unspecified format.
23
+ *
24
+ * @remarks
25
+ * This can be used to help inspect schema for debugging, and to save a snapshot of schema to help detect and review changes to an applications schema.
26
+ *
27
+ * This format may change across major versions of this package: such changes are considered breaking.
28
+ * Beyond that, no compatibility guarantee is provided for this format: it should never be relied upon to load data, it should only be used for comparing outputs from this function.
29
+ *
30
+ * This only includes the "persisted" subset of schema information, which means the portion which gets included in documents.
31
+ * It thus uses "persisted" keys, see {@link FieldProps.key}.
32
+ *
33
+ * If two schema have identical "persisted" schema, then they are considered {@link SchemaCompatibilityStatus.isEquivalent|equivalent}.
34
+ *
35
+ * See also {@link comparePersistedSchema}.
36
+ *
37
+ * @example
38
+ * An application could use this API to generate a `schema.json` file when it first releases,
39
+ * then test that the schema is sill compatible with documents from that version with a test like :
40
+ * ```typescript
41
+ * assert.deepEqual(extractPersistedSchema(MySchema), require("./schema.json"));
42
+ * ```
43
+ *
44
+ * @privateRemarks
45
+ * This currently uses the schema summary format, but that could be changed to something more human readable (particularly if the encoded format becomes less human readable).
46
+ * This intentionally does not leak the format types in the API.
47
+ *
48
+ * Public API surface uses "persisted" terminology while internally we use "stored".
49
+ * @alpha
50
+ */
51
+ export function extractPersistedSchema(schema: ImplicitFieldSchema): JsonCompatible {
52
+ const stored = toStoredSchema(schema);
53
+ return encodeTreeSchema(stored);
54
+ }
55
+
56
+ /**
57
+ * Compares two schema extracted using {@link extractPersistedSchema}.
58
+ * Reports the same compatibility that {@link TreeView.compatibility} would report if
59
+ * opening a document that used the `persisted` schema and provided `view` to {@link ViewableTree.viewWith}.
60
+ *
61
+ * @param persisted - Schema persisted for a document. Typically persisted alongside the data and assumed to describe that data.
62
+ * @param view - Schema which would be used to view persisted content. Use {@link extractPersistedSchema} to convert the view schema into this format.
63
+ * @param options - {@link ICodecOptions} used when parsing the provided schema.
64
+ * @param canInitialize - Passed through to the return value unchanged and otherwise unused.
65
+ * @returns The {@link SchemaCompatibilityStatus} a {@link TreeView} would report for this combination of schema.
66
+ *
67
+ * @remarks
68
+ * This uses the persisted formats for schema, meaning it only includes data which impacts compatibility.
69
+ * It also uses the persisted format so that this API can be used in tests to compare against saved schema from previous versions of the application.
70
+ *
71
+ * @example
72
+ * An application could use {@link extractPersistedSchema} to generate a `schema.json` file for various versions of the app,
73
+ * then test that documents using those schema can be upgraded to work with the current schema using a test like:
74
+ * ```typescript
75
+ * assert(
76
+ * comparePersistedSchema(
77
+ * require("./schema.json"),
78
+ * extractPersistedSchema(MySchema),
79
+ * { jsonValidator: typeboxValidator },
80
+ * false,
81
+ * ).canUpgrade,
82
+ * );
83
+ * ```
84
+ * @alpha
85
+ */
86
+ export function comparePersistedSchema(
87
+ persisted: JsonCompatible,
88
+ view: JsonCompatible,
89
+ options: ICodecOptions,
90
+ canInitialize: boolean,
91
+ ): SchemaCompatibilityStatus {
92
+ const schemaCodec = makeSchemaCodec(options);
93
+ const stored = schemaCodec.decode(persisted as Format);
94
+ const viewParsed = schemaCodec.decode(view as Format);
95
+ const viewSchema = new ViewSchema(defaultSchemaPolicy, {}, viewParsed);
96
+ return comparePersistedSchemaInternal(stored, viewSchema, canInitialize);
97
+ }
98
+
99
+ /**
100
+ * Compute compatibility for viewing a document with `stored` schema using `viewSchema`.
101
+ * `canInitialize` is passed through to the return value unchanged and otherwise unused.
102
+ */
103
+ export function comparePersistedSchemaInternal(
104
+ stored: TreeStoredSchema,
105
+ viewSchema: ViewSchema,
106
+ canInitialize: boolean,
107
+ ): SchemaCompatibilityStatus {
108
+ const result = viewSchema.checkCompatibility(stored);
109
+
110
+ // TODO: AB#8121: Weaken this check to support viewing under additional circumstances.
111
+ // In the near term, this should support viewing documents with additional optional fields in their schema on object types.
112
+ // Longer-term (as demand arises), we could also add APIs to constructing view schema to allow for more flexibility
113
+ // (e.g. out-of-schema content handlers could allow support for viewing docs which have extra allowed types in a particular field)
114
+ const canView =
115
+ result.write === Compatibility.Compatible && result.read === Compatibility.Compatible;
116
+ const canUpgrade = result.read === Compatibility.Compatible;
117
+ const isEquivalent = canView && canUpgrade;
118
+ const compatibility: SchemaCompatibilityStatus = {
119
+ canView,
120
+ canUpgrade,
121
+ isEquivalent,
122
+ canInitialize,
123
+ };
124
+
125
+ return compatibility;
126
+ }
@@ -6,15 +6,8 @@
6
6
  import { assert, oob } from "@fluidframework/core-utils/internal";
7
7
 
8
8
  import { EmptyKey, rootFieldKey } from "../../core/index.js";
9
- import {
10
- type LazyItem,
11
- type TreeStatus,
12
- isLazy,
13
- isTreeValue,
14
- FieldKinds,
15
- } from "../../feature-libraries/index.js";
9
+ import { type TreeStatus, isTreeValue, FieldKinds } from "../../feature-libraries/index.js";
16
10
  import { fail, extractFromOpaque, isReadonlyArray } from "../../util/index.js";
17
- import { getOrCreateInnerNode } from "../proxyBinding.js";
18
11
  import {
19
12
  type TreeLeafValue,
20
13
  type ImplicitFieldSchema,
@@ -43,8 +36,10 @@ import {
43
36
  getOrCreateNodeFromInnerNode,
44
37
  UnhydratedFlexTreeNode,
45
38
  typeSchemaSymbol,
39
+ getOrCreateInnerNode,
46
40
  } from "../core/index.js";
47
41
  import { isObjectNodeSchema } from "../objectNodeTypes.js";
42
+ import { isLazy, type LazyItem } from "../flexList.js";
48
43
 
49
44
  /**
50
45
  * Provides various functions for analyzing {@link TreeNode}s.
@@ -3,8 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import type { FlexListToUnion, Unenforced } from "../feature-libraries/index.js";
7
- import type { RestrictiveStringRecord, _InlineTrick } from "../util/index.js";
6
+ import type { RestrictiveStringRecord, _InlineTrick } from "../../util/index.js";
8
7
 
9
8
  import type {
10
9
  AllowedTypes,
@@ -15,15 +14,16 @@ import type {
15
14
  ImplicitFieldSchema,
16
15
  NodeFromSchema,
17
16
  TreeNodeFromImplicitAllowedTypes,
18
- } from "./schemaTypes.js";
17
+ } from "../schemaTypes.js";
19
18
  import type {
20
19
  NodeKind,
21
20
  TreeNodeSchema,
22
21
  WithType,
23
22
  TreeNode,
24
23
  Unhydrated,
25
- } from "./core/index.js";
26
- import type { TreeArrayNodeBase, TreeArrayNode } from "./arrayNode.js";
24
+ } from "../core/index.js";
25
+ import type { TreeArrayNodeBase, TreeArrayNode } from "../arrayNode.js";
26
+ import type { FlexListToUnion } from "../flexList.js";
27
27
 
28
28
  /*
29
29
  * TODO:
@@ -37,6 +37,16 @@ import type { TreeArrayNodeBase, TreeArrayNode } from "./arrayNode.js";
37
37
  */
38
38
  /* eslint-disable @typescript-eslint/no-explicit-any */
39
39
 
40
+ /**
41
+ * A placeholder to use in {@link https://www.typescriptlang.org/docs/handbook/2/generics.html#generic-constraints | extends constraints} when using the real type breaks compilation of some recursive types due to {@link https://github.com/microsoft/TypeScript/issues/55758 | a design limitation of TypeScript}.
42
+ *
43
+ * These extends constraints only serve as documentation:
44
+ * to avoid breaking compilation, this type has to not actually enforce anything, and thus is just `unknown`.
45
+ * Therefore the type safety is the responsibility of the user of the API.
46
+ * @public
47
+ */
48
+ export type Unenforced<_DesiredExtendsConstraint> = unknown;
49
+
40
50
  /**
41
51
  * {@link Unenforced} version of `ObjectFromSchemaRecord`.
42
52
  * @remarks
@@ -10,10 +10,7 @@ import { assert } from "@fluidframework/core-utils/internal";
10
10
  import {
11
11
  aboveRootPlaceholder,
12
12
  EmptyKey,
13
- forEachField,
14
- inCursorField,
15
13
  keyAsDetachedField,
16
- mapCursorField,
17
14
  type FieldKey,
18
15
  type ITreeCursor,
19
16
  type ITreeCursorSynchronous,
@@ -40,16 +37,22 @@ import {
40
37
  stringSchema,
41
38
  } from "../leafNodeSchema.js";
42
39
  import { isObjectNodeSchema } from "../objectNodeTypes.js";
43
- import { walkFieldSchema } from "../walkFieldSchema.js";
40
+ import {
41
+ customFromCursorInner,
42
+ type CustomTreeNode,
43
+ type CustomTreeValue,
44
+ type EncodeOptions,
45
+ } from "./customTree.js";
44
46
  import { getUnhydratedContext } from "../createContext.js";
45
47
 
46
48
  /**
47
- * Verbose encoding of a {@link TreeNode} or {@link TreeValue}.
49
+ * Verbose encoding of a {@link TreeNode} or {@link TreeLeafValue}.
48
50
  * @remarks
49
51
  * This is verbose meaning that every {@link TreeNode} is a {@link VerboseTreeNode}.
50
52
  * Any IFluidHandle values have been replaced by `THandle`.
51
53
  * @privateRemarks
52
- * This can store all possible simple trees, but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.
54
+ * This can store all possible simple trees,
55
+ * but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.
53
56
  */
54
57
  export type VerboseTree<THandle = IFluidHandle> =
55
58
  | VerboseTreeNode<THandle>
@@ -77,7 +80,8 @@ export type VerboseTree<THandle = IFluidHandle> =
77
80
  * This format allows for all simple-tree compatible trees to be represented.
78
81
  *
79
82
  * Unlike `JsonableTree`, leaf nodes are not boxed into node objects, and instead have their schema inferred from the value.
80
- * Additionally, sequence fields can only occur on a node that has a single sequence field (with the empty key) replicating the behavior of simple-tree ArrayNodes.
83
+ * Additionally, sequence fields can only occur on a node that has a single sequence field (with the empty key)
84
+ * replicating the behavior of simple-tree ArrayNodes.
81
85
  */
82
86
  export interface VerboseTreeNode<THandle = IFluidHandle> {
83
87
  /**
@@ -144,24 +148,6 @@ export interface SchemalessParseOptions<TCustom> {
144
148
  };
145
149
  }
146
150
 
147
- /**
148
- * Options for how to interpret a `VerboseTree<TCustom>` without relying on schema.
149
- */
150
- export interface EncodeOptions<TCustom> {
151
- /**
152
- * Fixup custom input formats.
153
- * @remarks
154
- * See note on {@link ParseOptions.valueConverter}.
155
- */
156
- valueConverter(data: IFluidHandle): TCustom;
157
- /**
158
- * If true, interpret the input keys of object nodes as stored keys.
159
- * If false, interpret them as property keys.
160
- * @defaultValue false.
161
- */
162
- readonly useStoredKeys?: boolean;
163
- }
164
-
165
151
  /**
166
152
  * Use info from `schema` to convert `options` to {@link SchemalessParseOptions}.
167
153
  */
@@ -345,12 +331,7 @@ export function verboseFromCursor<TCustom>(
345
331
  ...options,
346
332
  };
347
333
 
348
- const schemaMap = new Map<string, TreeNodeSchema>();
349
- walkFieldSchema(rootSchema, {
350
- node(schema) {
351
- schemaMap.set(schema.identifier, schema);
352
- },
353
- });
334
+ const schemaMap = getUnhydratedContext(rootSchema).schema;
354
335
 
355
336
  return verboseFromCursorInner(reader, config, schemaMap);
356
337
  }
@@ -360,50 +341,14 @@ function verboseFromCursorInner<TCustom>(
360
341
  options: Required<EncodeOptions<TCustom>>,
361
342
  schema: ReadonlyMap<string, TreeNodeSchema>,
362
343
  ): VerboseTree<TCustom> {
363
- const type = reader.type;
364
- const nodeSchema = schema.get(type) ?? fail("missing schema for type in cursor");
365
-
366
- switch (type) {
367
- case numberSchema.identifier:
368
- case booleanSchema.identifier:
369
- case nullSchema.identifier:
370
- case stringSchema.identifier:
371
- assert(reader.value !== undefined, 0xa14 /* out of schema: missing value */);
372
- assert(!isFluidHandle(reader.value), 0xa15 /* out of schema: unexpected FluidHandle */);
373
- return reader.value;
374
- case handleSchema.identifier:
375
- assert(reader.value !== undefined, 0xa16 /* out of schema: missing value */);
376
- assert(isFluidHandle(reader.value), 0xa17 /* out of schema: unexpected FluidHandle */);
377
- return options.valueConverter(reader.value);
378
- default: {
379
- assert(reader.value === undefined, 0xa18 /* out of schema: unexpected value */);
380
- if (nodeSchema.kind === NodeKind.Array) {
381
- const fields = inCursorField(reader, EmptyKey, () =>
382
- mapCursorField(reader, () => verboseFromCursorInner(reader, options, schema)),
383
- );
384
- return { type, fields };
385
- } else {
386
- const fields: Record<string, VerboseTree<TCustom>> = {};
387
- forEachField(reader, () => {
388
- const children = mapCursorField(reader, () =>
389
- verboseFromCursorInner(reader, options, schema),
390
- );
391
- if (children.length === 1) {
392
- const storedKey = reader.getFieldKey();
393
- const key =
394
- isObjectNodeSchema(nodeSchema) && !options.useStoredKeys
395
- ? nodeSchema.storedKeyToPropertyKey.get(storedKey) ??
396
- fail("missing property key")
397
- : storedKey;
398
- // Length is checked above.
399
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
400
- fields[key] = children[0]!;
401
- } else {
402
- assert(children.length === 0, 0xa19 /* invalid children number */);
403
- }
404
- });
405
- return { type, fields };
406
- }
407
- }
344
+ const fields = customFromCursorInner(reader, options, schema, verboseFromCursorInner);
345
+ const nodeSchema = schema.get(reader.type) ?? fail("missing schema for type in cursor");
346
+ if (nodeSchema.kind === NodeKind.Leaf) {
347
+ return fields as CustomTreeValue<TCustom>;
408
348
  }
349
+
350
+ return {
351
+ type: reader.type,
352
+ fields: fields as CustomTreeNode<TCustom>,
353
+ };
409
354
  }
@@ -14,7 +14,6 @@ import {
14
14
  isFlexTreeNode,
15
15
  } from "../feature-libraries/index.js";
16
16
  import { prepareContentForHydration } from "./proxies.js";
17
- import { getOrCreateInnerNode } from "./proxyBinding.js";
18
17
  import {
19
18
  normalizeAllowedTypes,
20
19
  type ImplicitAllowedTypes,
@@ -34,6 +33,7 @@ import {
34
33
  getOrCreateNodeFromInnerNode,
35
34
  type TreeNodeSchemaBoth,
36
35
  getSimpleNodeSchemaFromInnerNode,
36
+ getOrCreateInnerNode,
37
37
  } from "./core/index.js";
38
38
  import { type InsertableContent, mapTreeFromNodeData } from "./toMapTree.js";
39
39
  import { fail } from "../util/index.js";
@@ -11,6 +11,7 @@ export {
11
11
  type InnerNode,
12
12
  tryDisposeTreeNode,
13
13
  tryGetTreeNodeFromMapNode,
14
+ getOrCreateInnerNode,
14
15
  } from "./treeNodeKernel.js";
15
16
  export { type WithType, typeNameSymbol, typeSchemaSymbol } from "./withType.js";
16
17
  export {
@@ -430,3 +430,16 @@ export function getTreeNodeSchemaFromHydratedFlexNode(flexNode: FlexTreeNode): T
430
430
 
431
431
  return context.schema.get(flexNode.schema) ?? fail("Missing schema");
432
432
  }
433
+
434
+ /**
435
+ * Retrieves the flex node associated with the given target via {@link setInnerNode}.
436
+ * @remarks
437
+ * For {@link Unhydrated} nodes, this returns the MapTreeNode.
438
+ *
439
+ * For hydrated nodes it returns a FlexTreeNode backed by the forest.
440
+ * Note that for "marinated" nodes, this FlexTreeNode exists and returns it: it does not return the MapTreeNode which is the current InnerNode.
441
+ */
442
+ export function getOrCreateInnerNode(treeNode: TreeNode, allowFreed = false): InnerNode {
443
+ const kernel = getKernel(treeNode);
444
+ return kernel.getOrCreateInnerNode(allowFreed);
445
+ }
@@ -442,7 +442,12 @@ class EagerMapTreeRequiredField
442
442
  implements FlexTreeRequiredField
443
443
  {
444
444
  public override get content(): FlexTreeUnknownUnboxed {
445
- return super.content ?? fail("Expected EagerMapTree required field to have a value");
445
+ // This cannot use ?? since null is a legal value here.
446
+ assert(
447
+ super.content !== undefined,
448
+ "Expected EagerMapTree required field to have a value",
449
+ );
450
+ return super.content;
446
451
  }
447
452
  }
448
453
 
@@ -22,6 +22,7 @@ export {
22
22
  tryDisposeTreeNode,
23
23
  HydratedContext,
24
24
  SimpleContextSlot,
25
+ getOrCreateInnerNode,
25
26
  } from "./core/index.js";
26
27
  export {
27
28
  type ITree,
@@ -40,7 +41,6 @@ export {
40
41
  enumFromStrings,
41
42
  singletonSchema,
42
43
  typedObjectValues,
43
- type EmptyObject,
44
44
  test_RecursiveObject,
45
45
  test_RecursiveObject_base,
46
46
  test_RecursiveObjectPojoMode,
@@ -67,7 +67,31 @@ export {
67
67
  type JsonLeafSchemaType,
68
68
  getJsonSchema,
69
69
  getSimpleSchema,
70
+ type VerboseTreeNode,
71
+ type EncodeOptions,
72
+ type ParseOptions,
73
+ type VerboseTree,
74
+ extractPersistedSchema,
75
+ comparePersistedSchema,
76
+ type ConciseTree,
77
+ comparePersistedSchemaInternal,
70
78
  ViewSchema,
79
+ type Unenforced,
80
+ type FieldHasDefaultUnsafe,
81
+ type ObjectFromSchemaRecordUnsafe,
82
+ type TreeObjectNodeUnsafe,
83
+ type TreeFieldFromImplicitFieldUnsafe,
84
+ type TreeNodeFromImplicitAllowedTypesUnsafe,
85
+ type FieldSchemaUnsafe,
86
+ type InsertableTreeNodeFromImplicitAllowedTypesUnsafe,
87
+ type TreeArrayNodeUnsafe,
88
+ type TreeMapNodeUnsafe,
89
+ type InsertableObjectFromSchemaRecordUnsafe,
90
+ type InsertableTreeFieldFromImplicitFieldUnsafe,
91
+ type InsertableTypedNodeUnsafe,
92
+ type NodeBuilderDataUnsafe,
93
+ type NodeFromSchemaUnsafe,
94
+ type ReadonlyMapInlined,
71
95
  } from "./api/index.js";
72
96
  export {
73
97
  type NodeFromSchema,
@@ -90,29 +114,10 @@ export {
90
114
  type ApplyKind,
91
115
  type FieldSchemaMetadata,
92
116
  } from "./schemaTypes.js";
93
- export { getOrCreateInnerNode } from "./proxyBinding.js";
94
- export type {
95
- FieldHasDefaultUnsafe,
96
- ObjectFromSchemaRecordUnsafe,
97
- TreeObjectNodeUnsafe,
98
- TreeFieldFromImplicitFieldUnsafe,
99
- TreeNodeFromImplicitAllowedTypesUnsafe,
100
- FieldSchemaUnsafe,
101
- InsertableTreeNodeFromImplicitAllowedTypesUnsafe,
102
- TreeArrayNodeUnsafe,
103
- TreeMapNodeUnsafe,
104
- InsertableObjectFromSchemaRecordUnsafe,
105
- InsertableTreeFieldFromImplicitFieldUnsafe,
106
- InsertableTypedNodeUnsafe,
107
- NodeBuilderDataUnsafe,
108
- NodeFromSchemaUnsafe,
109
- ReadonlyMapInlined,
110
- } from "./typesUnsafe.js";
111
117
  export {
112
118
  getTreeNodeForField,
113
119
  prepareContentForHydration,
114
120
  } from "./proxies.js";
115
-
116
121
  export {
117
122
  TreeArrayNode,
118
123
  IterableTreeArrayContent,
@@ -135,3 +140,4 @@ export {
135
140
  handleSchema,
136
141
  nullSchema,
137
142
  } from "./leafNodeSchema.js";
143
+ export type { LazyItem, FlexList, FlexListToUnion, ExtractItemType } from "./flexList.js";
@@ -11,7 +11,6 @@ import {
11
11
  getSchemaAndPolicy,
12
12
  } from "../feature-libraries/index.js";
13
13
  import { getTreeNodeForField, prepareContentForHydration } from "./proxies.js";
14
- import { getOrCreateInnerNode } from "./proxyBinding.js";
15
14
  import {
16
15
  createFieldSchema,
17
16
  FieldKind,
@@ -33,6 +32,7 @@ import {
33
32
  typeSchemaSymbol,
34
33
  type Context,
35
34
  UnhydratedFlexTreeNode,
35
+ getOrCreateInnerNode,
36
36
  } from "./core/index.js";
37
37
  import {
38
38
  mapTreeFromNodeData,
@@ -16,7 +16,6 @@ import {
16
16
  getSchemaAndPolicy,
17
17
  } from "../feature-libraries/index.js";
18
18
  import { getTreeNodeForField, prepareContentForHydration } from "./proxies.js";
19
- import { getOrCreateInnerNode } from "./proxyBinding.js";
20
19
  import {
21
20
  type ImplicitFieldSchema,
22
21
  getStoredKey,
@@ -39,6 +38,7 @@ import {
39
38
  type TreeNode,
40
39
  type Context,
41
40
  UnhydratedFlexTreeNode,
41
+ getOrCreateInnerNode,
42
42
  } from "./core/index.js";
43
43
  import { mapTreeFromNodeData, type InsertableContent } from "./toMapTree.js";
44
44
  import { type RestrictiveStringRecord, fail, type FlattenKeys } from "../util/index.js";
@@ -7,12 +7,7 @@ import type { ErasedType, IFluidHandle } from "@fluidframework/core-interfaces";
7
7
  import { Lazy } from "@fluidframework/core-utils/internal";
8
8
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
9
9
 
10
- import {
11
- type LazyItem,
12
- type NodeKeyManager,
13
- isLazy,
14
- type FlexListToUnion,
15
- } from "../feature-libraries/index.js";
10
+ import type { NodeKeyManager } from "../feature-libraries/index.js";
16
11
  import { type MakeNominal, brand, isReadonlyArray } from "../util/index.js";
17
12
  import type {
18
13
  Unhydrated,
@@ -22,6 +17,7 @@ import type {
22
17
  } from "./core/index.js";
23
18
  import type { FieldKey } from "../core/index.js";
24
19
  import type { InsertableContent } from "./toMapTree.js";
20
+ import { isLazy, type FlexListToUnion, type LazyItem } from "./flexList.js";
25
21
 
26
22
  /**
27
23
  * Returns true if the given schema is a {@link TreeNodeSchemaClass}, or otherwise false if it is a {@link TreeNodeSchemaNonClass}.
@@ -20,9 +20,6 @@ import {
20
20
  type TreeTypeSet,
21
21
  } from "../core/index.js";
22
22
  import { FieldKinds, type FlexFieldKind } from "../feature-libraries/index.js";
23
- // TODO: once flex schema is gone, this code can move into simple-tree
24
- // eslint-disable-next-line import/no-internal-modules
25
- import { normalizeFlexListEager } from "../feature-libraries/typed-schema/index.js";
26
23
  import { brand, fail, isReadonlyArray } from "../util/index.js";
27
24
  import { NodeKind, type TreeNodeSchema } from "./core/index.js";
28
25
  import {
@@ -34,6 +31,7 @@ import {
34
31
  import { walkFieldSchema } from "./walkFieldSchema.js";
35
32
  import { LeafNodeSchema } from "./leafNodeSchema.js";
36
33
  import { isObjectNodeSchema } from "./objectNodeTypes.js";
34
+ import { normalizeFlexListEager } from "./flexList.js";
37
35
 
38
36
  /**
39
37
  * Converts a {@link ImplicitFieldSchema} into a {@link TreeStoredSchema}.
@@ -262,14 +262,14 @@ function mapValueWithFallbacks(
262
262
  // Our serialized data format does not support -0.
263
263
  // Map such input to +0.
264
264
  return 0;
265
- } else if (Number.isNaN(value) || !Number.isFinite(value)) {
265
+ } else if (!Number.isFinite(value)) {
266
266
  // Our serialized data format does not support NaN nor +/-∞.
267
267
  // If the schema supports `null`, fall back to that. Otherwise, throw.
268
268
  // This is intended to match JSON's behavior for such values.
269
269
  if (allowedTypes.has(nullSchema)) {
270
270
  return null;
271
271
  } else {
272
- throw new TypeError(`Received unsupported numeric value: ${value}.`);
272
+ throw new UsageError(`Received unsupported numeric value: ${value}.`);
273
273
  }
274
274
  } else {
275
275
  return value;
@@ -287,7 +287,7 @@ function mapValueWithFallbacks(
287
287
  }
288
288
  }
289
289
  default:
290
- throw new TypeError(`Received unsupported leaf value: ${value}.`);
290
+ throw new UsageError(`Received unsupported leaf value: ${value}.`);
291
291
  }
292
292
  }
293
293
 
@@ -18,11 +18,12 @@ import {
18
18
  type Context,
19
19
  type UnhydratedFlexTreeNode,
20
20
  } from "./core/index.js";
21
- import { type FlexTreeNode, isFlexTreeNode, markEager } from "../feature-libraries/index.js";
21
+ import { type FlexTreeNode, isFlexTreeNode } from "../feature-libraries/index.js";
22
22
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
23
23
  import { fail } from "../util/index.js";
24
24
 
25
25
  import { getSimpleNodeSchemaFromInnerNode } from "./core/index.js";
26
+ import { markEager } from "./flexList.js";
26
27
 
27
28
  /**
28
29
  * Class which all {@link TreeNode}s must extend.
@@ -81,6 +81,7 @@ export const SharedTree = configuredSharedTree({});
81
81
  * });
82
82
  * ```
83
83
  * @privateRemarks
84
+ * This should be legacy, but has to be internal due to limitations of API tagging preventing it from being both alpha and alpha+legacy.
84
85
  * TODO:
85
86
  * Expose Ajv validator for better error message quality somehow.
86
87
  * Maybe as part of a test utils or dev-tool package?
package/src/util/utils.ts CHANGED
@@ -219,9 +219,10 @@ export function count(iterable: Iterable<unknown>): number {
219
219
 
220
220
  /**
221
221
  * Use for Json compatible data.
222
- *
223
- * Note that this does not robustly forbid non json comparable data via type checking,
222
+ * @remarks
223
+ * This does not robustly forbid non json comparable data via type checking,
224
224
  * but instead mostly restricts access to it.
225
+ * @alpha
225
226
  */
226
227
  export type JsonCompatible =
227
228
  | string
@@ -234,16 +235,17 @@ export type JsonCompatible =
234
235
 
235
236
  /**
236
237
  * Use for Json object compatible data.
237
- *
238
- * Note that this does not robustly forbid non json comparable data via type checking,
238
+ * @remarks
239
+ * This does not robustly forbid non json comparable data via type checking,
239
240
  * but instead mostly restricts access to it.
241
+ * @alpha
240
242
  */
241
243
  export type JsonCompatibleObject = { [P in string]?: JsonCompatible };
242
244
 
243
245
  /**
244
246
  * Use for readonly view of Json compatible data.
245
- *
246
- * Note that this does not robustly forbid non json comparable data via type checking,
247
+ * @remarks
248
+ * This does not robustly forbid non json comparable data via type checking,
247
249
  * but instead mostly restricts access to it.
248
250
  */
249
251
  export type JsonCompatibleReadOnly =
@@ -257,8 +259,8 @@ export type JsonCompatibleReadOnly =
257
259
 
258
260
  /**
259
261
  * Use for readonly view of Json compatible data.
260
- *
261
- * Note that this does not robustly forbid non json comparable data via type checking,
262
+ * @remarks
263
+ * This does not robustly forbid non json comparable data via type checking,
262
264
  * but instead mostly restricts access to it.
263
265
  */
264
266
  export type JsonCompatibleReadOnlyObject = { readonly [P in string]?: JsonCompatibleReadOnly };
@@ -1,12 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { ITreeSubscriptionCursor } from "../../core/index.js";
6
- import type { Context } from "./context.js";
7
- import type { FlexTreeUnknownUnboxed } from "./flexTreeTypes.js";
8
- /**
9
- * Returns the flex tree node, of the value if it has one.
10
- */
11
- export declare function unboxedFlexNode(context: Context, cursor: ITreeSubscriptionCursor): FlexTreeUnknownUnboxed;
12
- //# sourceMappingURL=unboxed.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unboxed.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGjE;;GAEG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,uBAAuB,GAC7B,sBAAsB,CAMxB"}