@fluidframework/tree 2.63.0-359461 → 2.63.0-359734

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 (377) hide show
  1. package/.mocharc.cjs +9 -1
  2. package/api-report/tree.alpha.api.md +93 -98
  3. package/api-report/tree.beta.api.md +37 -2
  4. package/api-report/tree.legacy.beta.api.md +37 -2
  5. package/api-report/tree.legacy.public.api.md +9 -2
  6. package/api-report/tree.public.api.md +9 -2
  7. package/dist/alpha.d.ts +11 -13
  8. package/dist/beta.d.ts +5 -0
  9. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  10. package/dist/feature-libraries/treeCursorUtils.js +17 -15
  11. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/jsonDomainSchema.d.ts +5 -5
  16. package/dist/jsonDomainSchema.js +5 -5
  17. package/dist/jsonDomainSchema.js.map +1 -1
  18. package/dist/legacy.d.ts +5 -0
  19. package/dist/packageVersion.d.ts +1 -1
  20. package/dist/packageVersion.js +1 -1
  21. package/dist/packageVersion.js.map +1 -1
  22. package/dist/public.d.ts +1 -0
  23. package/dist/serializableDomainSchema.d.ts +6 -6
  24. package/dist/serializableDomainSchema.js +5 -5
  25. package/dist/serializableDomainSchema.js.map +1 -1
  26. package/dist/shared-tree/schematizingTreeView.js +1 -1
  27. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  28. package/dist/shared-tree/treeAlpha.d.ts +20 -28
  29. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  30. package/dist/shared-tree/treeAlpha.js +4 -29
  31. package/dist/shared-tree/treeAlpha.js.map +1 -1
  32. package/dist/simple-tree/api/conciseTree.d.ts +1 -1
  33. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  34. package/dist/simple-tree/api/configuration.d.ts +0 -3
  35. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  36. package/dist/simple-tree/api/configuration.js +1 -4
  37. package/dist/simple-tree/api/configuration.js.map +1 -1
  38. package/dist/simple-tree/api/customTree.d.ts +7 -7
  39. package/dist/simple-tree/api/customTree.js +5 -5
  40. package/dist/simple-tree/api/customTree.js.map +1 -1
  41. package/dist/simple-tree/api/discrepancies.js +2 -2
  42. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  43. package/dist/simple-tree/api/index.d.ts +2 -2
  44. package/dist/simple-tree/api/index.d.ts.map +1 -1
  45. package/dist/simple-tree/api/index.js +4 -1
  46. package/dist/simple-tree/api/index.js.map +1 -1
  47. package/dist/simple-tree/api/schemaFactory.d.ts +12 -4
  48. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  49. package/dist/simple-tree/api/schemaFactory.js +3 -8
  50. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  51. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +27 -26
  52. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  53. package/dist/simple-tree/api/schemaFactoryAlpha.js +11 -0
  54. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  55. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +13 -2
  56. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  57. package/dist/simple-tree/api/schemaFactoryBeta.js +14 -0
  58. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  59. package/dist/simple-tree/api/schemaStatics.d.ts +9 -14
  60. package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
  61. package/dist/simple-tree/api/schemaStatics.js +9 -12
  62. package/dist/simple-tree/api/schemaStatics.js.map +1 -1
  63. package/dist/simple-tree/api/storedSchema.d.ts +2 -2
  64. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  65. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  66. package/dist/simple-tree/api/tree.d.ts +3 -3
  67. package/dist/simple-tree/api/tree.js.map +1 -1
  68. package/dist/simple-tree/api/treeBeta.d.ts +52 -2
  69. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  70. package/dist/simple-tree/api/treeBeta.js +36 -1
  71. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  72. package/dist/simple-tree/api/treeNodeApi.js +1 -1
  73. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  74. package/dist/simple-tree/core/allowedTypes.d.ts +120 -62
  75. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
  76. package/dist/simple-tree/core/allowedTypes.js +162 -84
  77. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  78. package/dist/simple-tree/core/context.d.ts +2 -2
  79. package/dist/simple-tree/core/context.d.ts.map +1 -1
  80. package/dist/simple-tree/core/context.js.map +1 -1
  81. package/dist/simple-tree/core/index.d.ts +2 -2
  82. package/dist/simple-tree/core/index.d.ts.map +1 -1
  83. package/dist/simple-tree/core/index.js +4 -3
  84. package/dist/simple-tree/core/index.js.map +1 -1
  85. package/dist/simple-tree/core/toStored.d.ts +3 -3
  86. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  87. package/dist/simple-tree/core/toStored.js +2 -2
  88. package/dist/simple-tree/core/toStored.js.map +1 -1
  89. package/dist/simple-tree/core/treeNode.d.ts +1 -1
  90. package/dist/simple-tree/core/treeNode.js +1 -1
  91. package/dist/simple-tree/core/treeNode.js.map +1 -1
  92. package/dist/simple-tree/core/treeNodeSchema.d.ts +3 -3
  93. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  94. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  95. package/dist/simple-tree/core/treeNodeValid.d.ts +2 -2
  96. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  97. package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
  98. package/dist/simple-tree/core/walkSchema.d.ts +3 -3
  99. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
  100. package/dist/simple-tree/core/walkSchema.js +1 -1
  101. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  102. package/dist/simple-tree/createContext.js +2 -2
  103. package/dist/simple-tree/createContext.js.map +1 -1
  104. package/dist/simple-tree/fieldSchema.d.ts +9 -32
  105. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  106. package/dist/simple-tree/fieldSchema.js +12 -20
  107. package/dist/simple-tree/fieldSchema.js.map +1 -1
  108. package/dist/simple-tree/index.d.ts +4 -4
  109. package/dist/simple-tree/index.d.ts.map +1 -1
  110. package/dist/simple-tree/index.js +6 -2
  111. package/dist/simple-tree/index.js.map +1 -1
  112. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +2 -2
  113. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  114. package/dist/simple-tree/node-kinds/array/arrayNode.js +5 -6
  115. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  116. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +3 -3
  117. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  118. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  119. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
  120. package/dist/simple-tree/node-kinds/common.js +2 -2
  121. package/dist/simple-tree/node-kinds/common.js.map +1 -1
  122. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  123. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  124. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  125. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +2 -2
  126. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  127. package/dist/simple-tree/node-kinds/map/mapNode.js +3 -3
  128. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  129. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +3 -3
  130. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  131. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  132. package/dist/simple-tree/node-kinds/object/index.d.ts +2 -2
  133. package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  134. package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
  135. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +5 -18
  136. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  137. package/dist/simple-tree/node-kinds/object/objectNode.js +5 -15
  138. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  139. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +4 -11
  140. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  141. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  142. package/dist/simple-tree/node-kinds/record/recordNode.d.ts +3 -3
  143. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  144. package/dist/simple-tree/node-kinds/record/recordNode.js +3 -3
  145. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  146. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +5 -5
  147. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  148. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  149. package/dist/simple-tree/prepareForInsertion.d.ts +5 -5
  150. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  151. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  152. package/dist/simple-tree/toStoredSchema.d.ts +8 -8
  153. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  154. package/dist/simple-tree/toStoredSchema.js +5 -5
  155. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  156. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +2 -2
  157. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  158. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  159. package/dist/simple-tree/unsafeUnknownSchema.d.ts.map +1 -1
  160. package/dist/simple-tree/unsafeUnknownSchema.js.map +1 -1
  161. package/dist/simple-tree/walkFieldSchema.js +1 -1
  162. package/dist/simple-tree/walkFieldSchema.js.map +1 -1
  163. package/dist/tableSchema.d.ts +19 -19
  164. package/dist/tableSchema.d.ts.map +1 -1
  165. package/dist/tableSchema.js +2 -2
  166. package/dist/tableSchema.js.map +1 -1
  167. package/lib/alpha.d.ts +11 -13
  168. package/lib/beta.d.ts +5 -0
  169. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  170. package/lib/feature-libraries/treeCursorUtils.js +17 -15
  171. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  172. package/lib/index.d.ts +1 -1
  173. package/lib/index.d.ts.map +1 -1
  174. package/lib/index.js.map +1 -1
  175. package/lib/jsonDomainSchema.d.ts +5 -5
  176. package/lib/jsonDomainSchema.js +5 -5
  177. package/lib/jsonDomainSchema.js.map +1 -1
  178. package/lib/legacy.d.ts +5 -0
  179. package/lib/packageVersion.d.ts +1 -1
  180. package/lib/packageVersion.js +1 -1
  181. package/lib/packageVersion.js.map +1 -1
  182. package/lib/public.d.ts +1 -0
  183. package/lib/serializableDomainSchema.d.ts +6 -6
  184. package/lib/serializableDomainSchema.js +5 -5
  185. package/lib/serializableDomainSchema.js.map +1 -1
  186. package/lib/shared-tree/schematizingTreeView.js +1 -1
  187. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  188. package/lib/shared-tree/treeAlpha.d.ts +20 -28
  189. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  190. package/lib/shared-tree/treeAlpha.js +3 -28
  191. package/lib/shared-tree/treeAlpha.js.map +1 -1
  192. package/lib/simple-tree/api/conciseTree.d.ts +1 -1
  193. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  194. package/lib/simple-tree/api/configuration.d.ts +0 -3
  195. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  196. package/lib/simple-tree/api/configuration.js +2 -5
  197. package/lib/simple-tree/api/configuration.js.map +1 -1
  198. package/lib/simple-tree/api/customTree.d.ts +7 -7
  199. package/lib/simple-tree/api/customTree.js +5 -5
  200. package/lib/simple-tree/api/customTree.js.map +1 -1
  201. package/lib/simple-tree/api/discrepancies.js +3 -3
  202. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  203. package/lib/simple-tree/api/index.d.ts +2 -2
  204. package/lib/simple-tree/api/index.d.ts.map +1 -1
  205. package/lib/simple-tree/api/index.js +1 -1
  206. package/lib/simple-tree/api/index.js.map +1 -1
  207. package/lib/simple-tree/api/schemaFactory.d.ts +12 -4
  208. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  209. package/lib/simple-tree/api/schemaFactory.js +3 -8
  210. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  211. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +27 -26
  212. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  213. package/lib/simple-tree/api/schemaFactoryAlpha.js +12 -1
  214. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  215. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +13 -2
  216. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  217. package/lib/simple-tree/api/schemaFactoryBeta.js +16 -2
  218. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  219. package/lib/simple-tree/api/schemaStatics.d.ts +9 -14
  220. package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
  221. package/lib/simple-tree/api/schemaStatics.js +9 -12
  222. package/lib/simple-tree/api/schemaStatics.js.map +1 -1
  223. package/lib/simple-tree/api/storedSchema.d.ts +2 -2
  224. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  225. package/lib/simple-tree/api/storedSchema.js +1 -1
  226. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  227. package/lib/simple-tree/api/tree.d.ts +3 -3
  228. package/lib/simple-tree/api/tree.js.map +1 -1
  229. package/lib/simple-tree/api/treeBeta.d.ts +52 -2
  230. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  231. package/lib/simple-tree/api/treeBeta.js +33 -1
  232. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  233. package/lib/simple-tree/api/treeNodeApi.js +1 -1
  234. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  235. package/lib/simple-tree/core/allowedTypes.d.ts +120 -62
  236. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
  237. package/lib/simple-tree/core/allowedTypes.js +158 -80
  238. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  239. package/lib/simple-tree/core/context.d.ts +2 -2
  240. package/lib/simple-tree/core/context.d.ts.map +1 -1
  241. package/lib/simple-tree/core/context.js.map +1 -1
  242. package/lib/simple-tree/core/index.d.ts +2 -2
  243. package/lib/simple-tree/core/index.d.ts.map +1 -1
  244. package/lib/simple-tree/core/index.js +1 -1
  245. package/lib/simple-tree/core/index.js.map +1 -1
  246. package/lib/simple-tree/core/toStored.d.ts +3 -3
  247. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  248. package/lib/simple-tree/core/toStored.js +3 -3
  249. package/lib/simple-tree/core/toStored.js.map +1 -1
  250. package/lib/simple-tree/core/treeNode.d.ts +1 -1
  251. package/lib/simple-tree/core/treeNode.js +1 -1
  252. package/lib/simple-tree/core/treeNode.js.map +1 -1
  253. package/lib/simple-tree/core/treeNodeSchema.d.ts +3 -3
  254. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  255. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  256. package/lib/simple-tree/core/treeNodeValid.d.ts +2 -2
  257. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  258. package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
  259. package/lib/simple-tree/core/walkSchema.d.ts +3 -3
  260. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
  261. package/lib/simple-tree/core/walkSchema.js +2 -2
  262. package/lib/simple-tree/core/walkSchema.js.map +1 -1
  263. package/lib/simple-tree/createContext.js +3 -3
  264. package/lib/simple-tree/createContext.js.map +1 -1
  265. package/lib/simple-tree/fieldSchema.d.ts +9 -32
  266. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  267. package/lib/simple-tree/fieldSchema.js +13 -21
  268. package/lib/simple-tree/fieldSchema.js.map +1 -1
  269. package/lib/simple-tree/index.d.ts +4 -4
  270. package/lib/simple-tree/index.d.ts.map +1 -1
  271. package/lib/simple-tree/index.js +2 -2
  272. package/lib/simple-tree/index.js.map +1 -1
  273. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +2 -2
  274. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  275. package/lib/simple-tree/node-kinds/array/arrayNode.js +6 -7
  276. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  277. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +3 -3
  278. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  279. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  280. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
  281. package/lib/simple-tree/node-kinds/common.js +3 -3
  282. package/lib/simple-tree/node-kinds/common.js.map +1 -1
  283. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  284. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  285. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  286. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +2 -2
  287. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  288. package/lib/simple-tree/node-kinds/map/mapNode.js +4 -4
  289. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  290. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +3 -3
  291. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  292. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  293. package/lib/simple-tree/node-kinds/object/index.d.ts +2 -2
  294. package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  295. package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
  296. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +5 -18
  297. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  298. package/lib/simple-tree/node-kinds/object/objectNode.js +6 -15
  299. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  300. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +4 -11
  301. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  302. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  303. package/lib/simple-tree/node-kinds/record/recordNode.d.ts +3 -3
  304. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  305. package/lib/simple-tree/node-kinds/record/recordNode.js +4 -4
  306. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  307. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +5 -5
  308. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  309. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  310. package/lib/simple-tree/prepareForInsertion.d.ts +5 -5
  311. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  312. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  313. package/lib/simple-tree/toStoredSchema.d.ts +8 -8
  314. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  315. package/lib/simple-tree/toStoredSchema.js +5 -5
  316. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  317. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +2 -2
  318. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  319. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +1 -1
  320. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  321. package/lib/simple-tree/unsafeUnknownSchema.d.ts.map +1 -1
  322. package/lib/simple-tree/unsafeUnknownSchema.js.map +1 -1
  323. package/lib/simple-tree/walkFieldSchema.js +1 -1
  324. package/lib/simple-tree/walkFieldSchema.js.map +1 -1
  325. package/lib/tableSchema.d.ts +19 -19
  326. package/lib/tableSchema.d.ts.map +1 -1
  327. package/lib/tableSchema.js +2 -2
  328. package/lib/tableSchema.js.map +1 -1
  329. package/package.json +23 -21
  330. package/src/feature-libraries/treeCursorUtils.ts +34 -19
  331. package/src/index.ts +7 -10
  332. package/src/jsonDomainSchema.ts +5 -5
  333. package/src/packageVersion.ts +1 -1
  334. package/src/serializableDomainSchema.ts +6 -6
  335. package/src/shared-tree/schematizingTreeView.ts +1 -1
  336. package/src/shared-tree/treeAlpha.ts +32 -81
  337. package/src/simple-tree/api/conciseTree.ts +1 -1
  338. package/src/simple-tree/api/configuration.ts +3 -7
  339. package/src/simple-tree/api/customTree.ts +7 -7
  340. package/src/simple-tree/api/discrepancies.ts +3 -3
  341. package/src/simple-tree/api/index.ts +10 -2
  342. package/src/simple-tree/api/schemaFactory.ts +18 -73
  343. package/src/simple-tree/api/schemaFactoryAlpha.ts +45 -12
  344. package/src/simple-tree/api/schemaFactoryBeta.ts +76 -1
  345. package/src/simple-tree/api/schemaStatics.ts +16 -61
  346. package/src/simple-tree/api/storedSchema.ts +2 -6
  347. package/src/simple-tree/api/tree.ts +3 -3
  348. package/src/simple-tree/api/treeBeta.ts +136 -3
  349. package/src/simple-tree/api/treeNodeApi.ts +1 -1
  350. package/src/simple-tree/core/allowedTypes.ts +355 -159
  351. package/src/simple-tree/core/context.ts +2 -2
  352. package/src/simple-tree/core/index.ts +10 -8
  353. package/src/simple-tree/core/toStored.ts +7 -5
  354. package/src/simple-tree/core/treeNode.ts +1 -1
  355. package/src/simple-tree/core/treeNodeSchema.ts +3 -6
  356. package/src/simple-tree/core/treeNodeValid.ts +2 -2
  357. package/src/simple-tree/core/walkSchema.ts +9 -5
  358. package/src/simple-tree/createContext.ts +3 -3
  359. package/src/simple-tree/fieldSchema.ts +24 -98
  360. package/src/simple-tree/index.ts +11 -10
  361. package/src/simple-tree/node-kinds/array/arrayNode.ts +9 -14
  362. package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +7 -8
  363. package/src/simple-tree/node-kinds/common.ts +5 -3
  364. package/src/simple-tree/node-kinds/index.ts +0 -2
  365. package/src/simple-tree/node-kinds/map/mapNode.ts +5 -13
  366. package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +7 -8
  367. package/src/simple-tree/node-kinds/object/index.ts +0 -2
  368. package/src/simple-tree/node-kinds/object/objectNode.ts +13 -51
  369. package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +5 -19
  370. package/src/simple-tree/node-kinds/record/recordNode.ts +9 -16
  371. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +7 -11
  372. package/src/simple-tree/prepareForInsertion.ts +5 -5
  373. package/src/simple-tree/toStoredSchema.ts +8 -9
  374. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +2 -6
  375. package/src/simple-tree/unsafeUnknownSchema.ts +2 -3
  376. package/src/simple-tree/walkFieldSchema.ts +1 -1
  377. package/src/tableSchema.ts +24 -37
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import { type ErasedBaseType, ErasedTypeImplementation } from "@fluidframework/core-interfaces/internal";
5
6
  import { type IsUnion, type MakeNominal } from "../../util/index.js";
6
7
  import { type FlexListToUnion, type LazyItem } from "./flexList.js";
7
8
  import { type InsertableTypedNode, type NodeFromSchema, type TreeNodeSchema } from "./treeNodeSchema.js";
@@ -24,8 +25,10 @@ import { type InsertableTypedNode, type NodeFromSchema, type TreeNodeSchema } fr
24
25
  * but some of the items are known to be present unconditionally.
25
26
  * For example, typing `[typeof A] | [typeof A, typeof B]` as `[typeof A, typeof B | typeof A]` is allowed,
26
27
  * and can produce more useful {@link Input} types.
27
- * @privateRemarks
28
- * Code reading data from this should use `normalizeAllowedTypes` to ensure consistent handling, caching, nice errors etc.
28
+ *
29
+ * Due to one implementation of this being {@link AllowedTypesFull}, it is not safe to assume this is an array (as determined by `Array.isArray`).
30
+ *
31
+ * Code reading data from this should use {@link normalizeAllowedTypes} to ensure consistent handling, caching, nice errors etc.
29
32
  * @system @public
30
33
  */
31
34
  export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
@@ -33,6 +36,9 @@ export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
33
36
  * Stores annotations for an individual allowed type.
34
37
  * @remarks
35
38
  * Create using APIs on {@link SchemaFactoryAlpha}, like {@link SchemaStaticsAlpha.staged}.
39
+ * @privateRemarks
40
+ * Since this is sealed, users are not supposed to create instances of it directly.
41
+ * Making it extend ErasedType could enforce that.
36
42
  * @alpha
37
43
  * @sealed
38
44
  */
@@ -47,22 +53,21 @@ export interface AnnotatedAllowedType<T = LazyItem<TreeNodeSchema>> {
47
53
  readonly type: T;
48
54
  }
49
55
  /**
50
- * {@link AnnotatedAllowedTypes} but with the lazy schema references eagerly evaluated.
56
+ * {@link AllowedTypesFull} but with the lazy schema references eagerly evaluated.
51
57
  * @sealed
52
58
  * @alpha
53
59
  */
54
- export interface NormalizedAnnotatedAllowedTypes extends AnnotatedAllowedTypes<TreeNodeSchema> {
55
- }
60
+ export type AllowedTypesFullEvaluated = AllowedTypesFull<readonly AnnotatedAllowedType<TreeNodeSchema>[]>;
56
61
  /**
57
62
  * Checks if the input is an {@link AnnotatedAllowedTypes}.
58
63
  */
59
- export declare function isAnnotatedAllowedTypes(allowedTypes: ImplicitAnnotatedAllowedTypes): allowedTypes is AnnotatedAllowedTypes;
64
+ export declare function isAnnotatedAllowedTypes(allowedTypes: ImplicitAllowedTypes): allowedTypes is AllowedTypesFullInternal;
60
65
  /**
61
66
  * Stores annotations for a set of allowed types.
62
67
  * @alpha
63
68
  * @sealed
64
69
  */
65
- export interface AnnotatedAllowedTypes<T = LazyItem<TreeNodeSchema>> {
70
+ export interface AnnotatedAllowedTypes<T = readonly AnnotatedAllowedType[]> extends ErasedBaseType<"tree.AnnotatedAllowedTypes"> {
66
71
  /**
67
72
  * Annotations that apply to a set of allowed types.
68
73
  */
@@ -70,7 +75,79 @@ export interface AnnotatedAllowedTypes<T = LazyItem<TreeNodeSchema>> {
70
75
  /**
71
76
  * All the allowed types that the annotations apply to. The types themselves may also have individual annotations.
72
77
  */
73
- readonly types: readonly AnnotatedAllowedType<T>[];
78
+ readonly types: T;
79
+ /**
80
+ * Get this {@link AnnotatedAllowedTypes} but with any lazy schema references eagerly evaluated.
81
+ * @remarks
82
+ * See {@link evaluateLazySchema} the implications of evaluating lazy schema references.
83
+ */
84
+ evaluate(): AllowedTypesFullEvaluated;
85
+ /**
86
+ * Get the allowed types as a set with any lazy schema references eagerly evaluated.
87
+ * @remarks
88
+ * See {@link evaluateLazySchema} the implications of evaluating lazy schema references.
89
+ */
90
+ evaluateSet(): ReadonlySet<TreeNodeSchema>;
91
+ /**
92
+ * Get the allowed types as a set of identifiers with any lazy schema references eagerly evaluated.
93
+ * @remarks
94
+ * See {@link evaluateLazySchema} the implications of evaluating lazy schema references.
95
+ *
96
+ * It is recommend to work in terms of {@link TreeNodeSchema}
97
+ * rather than identifiers where possible since its more type safe and it is possible that two schema with the same identifier exist.
98
+ */
99
+ evaluateIdentifiers(): ReadonlySet<string>;
100
+ }
101
+ /**
102
+ * Stores annotations for a set of allowed types.
103
+ * @remarks
104
+ * Most expressive form of AllowedTypes which any of the implicit types can be normalized to.
105
+ * @alpha
106
+ * @sealed
107
+ */
108
+ export type AllowedTypesFull<T extends readonly AnnotatedAllowedType[] = readonly AnnotatedAllowedType[]> = AnnotatedAllowedTypes<T> & UnannotateAllowedTypesList<T>;
109
+ /**
110
+ * Creates an {@link AllowedTypesFull} type from a mixed array of annotated and unannotated allowed types.
111
+ * @alpha
112
+ * @sealed
113
+ */
114
+ export type AllowedTypesFullFromMixed<T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]> = UnannotateAllowedTypesList<T> & AnnotatedAllowedTypes<AnnotateAllowedTypesList<T>>;
115
+ /**
116
+ * The same as the built-in InstanceType, but works on classes with private constructors.
117
+ * @privateRemarks
118
+ * This is based on the trick in {@link https://stackoverflow.com/a/74657881}.
119
+ */
120
+ type InstanceTypeRelaxed<TClass> = InstanceType<(new () => never) & TClass>;
121
+ /**
122
+ * {@link AllowedTypesFull} but with internal types.
123
+ */
124
+ export type AllowedTypesFullInternal<T extends readonly AnnotatedAllowedType[] = readonly AnnotatedAllowedType[]> = AnnotatedAllowedTypesInternal<T> & UnannotateAllowedTypesList<T>;
125
+ type AllowedTypesFullInternalEvaluated = AllowedTypesFullInternal<readonly AnnotatedAllowedType<TreeNodeSchema>[]>;
126
+ /**
127
+ * The implementation of {@link AnnotatedAllowedTypes}. Also implements {@link AllowedTypesFull}.
128
+ * @remarks
129
+ * Due to TypeScript limitations, this class cannot directly state it implements {@link AllowedTypesFull}.
130
+ * As a workaround for that, the static `create` method returns the intersection type.
131
+ */
132
+ export declare class AnnotatedAllowedTypesInternal<T extends readonly AnnotatedAllowedType[] = readonly AnnotatedAllowedType[]> extends ErasedTypeImplementation<AnnotatedAllowedTypes<T>> implements AnnotatedAllowedTypes<T> {
133
+ readonly types: T;
134
+ readonly metadata: AllowedTypesMetadata;
135
+ readonly unannotatedTypes: UnannotateAllowedTypesList<T>;
136
+ /**
137
+ * True if and only if there is at least one lazy schema reference in the types arrays.
138
+ */
139
+ private readonly isLazy;
140
+ private readonly lazyEvaluate;
141
+ private constructor();
142
+ evaluate(): AllowedTypesFullInternalEvaluated;
143
+ evaluateSet(): ReadonlySet<TreeNodeSchema>;
144
+ evaluateIdentifiers(): ReadonlySet<string>;
145
+ static [Symbol.hasInstance]<TThis extends (abstract new (...args: unknown[]) => object) | typeof AnnotatedAllowedTypesInternal>(this: TThis, value: ErasedBaseType | InstanceTypeRelaxed<TThis> | ImplicitAllowedTypes): value is InstanceTypeRelaxed<TThis> & AnnotatedAllowedTypesInternal & AllowedTypesFull;
146
+ static narrow<TThis extends (abstract new (...args: unknown[]) => object) | typeof AnnotatedAllowedTypesInternal>(this: TThis, value: ErasedBaseType | InstanceTypeRelaxed<TThis> | ImplicitAllowedTypes): asserts value is InstanceTypeRelaxed<TThis> & AnnotatedAllowedTypesInternal & AllowedTypesFull;
147
+ private static proxy;
148
+ static create<const T extends readonly AnnotatedAllowedType[]>(types: T, metadata?: AllowedTypesMetadata): AnnotatedAllowedTypesInternal<T> & AllowedTypesFull<T>;
149
+ static createUnannotated<const T extends AllowedTypes>(types: T, metadata?: AllowedTypesMetadata): AnnotatedAllowedTypesInternal & T;
150
+ static createMixed<const T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]>(types: T, metadata?: AllowedTypesMetadata): AllowedTypesFullFromMixed<T>;
74
151
  }
75
152
  /**
76
153
  * Annotations that apply to a set of allowed types.
@@ -140,6 +217,8 @@ export declare class SchemaUpgrade {
140
217
  * When referring to types that are declared after the definition of the `ImplicitAllowedTypes`, the schema can be wrapped in a lambda to allow the forward reference.
141
218
  * See {@link ValidateRecursiveSchema} for details on how to structure the `ImplicitAllowedTypes` instances when constructing recursive schema.
142
219
  *
220
+ * Code reading data from this should use {@link normalizeAllowedTypes} to ensure consistent handling, caching, nice errors etc.
221
+ *
143
222
  * @example Explicit use with strong typing
144
223
  * ```typescript
145
224
  * const sf = new SchemaFactory("myScope");
@@ -153,80 +232,44 @@ export declare class SchemaUpgrade {
153
232
  * class A extends sf.array("example", [() => B]) {}
154
233
  * class B extends sf.array("Inner", sf.number) {}
155
234
  * ```
156
- * @privateRemarks
157
- * Code reading data from this should use `normalizeAllowedTypes` to ensure consistent handling, caching, nice errors etc.
158
235
  * @public
159
236
  */
160
237
  export type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;
161
- /**
162
- * Types of {@link TreeNode|TreeNodes} or {@link TreeLeafValue|TreeLeafValues} allowed at a location in a tree with
163
- * additional metadata associated with the location they're allowed at.
164
- * @alpha
165
- * @input
166
- */
167
- export type ImplicitAnnotatedAllowedTypes = TreeNodeSchema | AnnotatedAllowedType | AnnotatedAllowedTypes | readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[];
168
- /**
169
- * Returns an {@link ImplicitAllowedTypes} that is equivalent to the input without annotations.
170
- * @system @alpha
171
- */
172
- export type UnannotateImplicitAllowedTypes<T extends ImplicitAnnotatedAllowedTypes> = T extends AnnotatedAllowedTypes ? UnannotateAllowedTypes<T> : T extends AnnotatedAllowedType ? UnannotateAllowedTypesList<[T]> : T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[] ? UnannotateAllowedTypesList<T> : T extends TreeNodeSchema ? T : ImplicitAllowedTypes;
173
238
  /**
174
239
  * Removes annotations from a list of allowed types that may contain annotations.
175
240
  * @system @alpha
176
241
  */
177
242
  export type UnannotateAllowedTypesList<T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]> = {
178
- [I in keyof T]: UnannotateAllowedType<T[I]>;
243
+ [I in keyof T]: T[I] extends AnnotatedAllowedType<infer X> ? X : T[I];
179
244
  };
180
245
  /**
181
- * Removes all annotations from a set of allowed types.
182
- * @system @alpha
183
- */
184
- export type UnannotateAllowedTypes<T extends AnnotatedAllowedTypes> = UnannotateAllowedTypesList<T["types"]>;
185
- /**
186
- * Removes annotations from an allowed type.
187
- * @remarks
188
- * If the input could be lazy
189
- * (is a LazyItem or AnnotatedAllowedType<LazyItem> instead of just a TreeNodeSchema | AnnotatedAllowedType<TreeNodeSchema>)
190
- * then the output of this will be a LazyItem and thus is not valid as an ImplicitAllowedTypes without wrapping it in an array.
191
- * This can however be used on items within an AllowedTypes array.
246
+ * Add annotations to a list of allowed types that may or may not contain annotations.
192
247
  * @system @alpha
193
248
  */
194
- export type UnannotateAllowedType<T extends AnnotatedAllowedType | LazyItem<TreeNodeSchema>> = T extends AnnotatedAllowedType<infer X> ? X : T;
249
+ export type AnnotateAllowedTypesList<T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]> = {
250
+ [I in keyof T]: T[I] extends AnnotatedAllowedType<unknown> ? T[I] : AnnotatedAllowedType<T[I]>;
251
+ };
195
252
  /**
196
- * Normalizes a {@link ImplicitAllowedTypes} to a set of {@link TreeNodeSchema}s, by eagerly evaluating any
197
- * lazy schema declarations.
198
- *
199
- * @remarks Note: this must only be called after all required schemas have been declared, otherwise evaluation of
200
- * recursive schemas may fail.
201
- *
202
- * @internal
253
+ * Normalizes an {@link ImplicitAllowedTypes} to an {@link AllowedTypesFull}.
254
+ * @alpha
203
255
  */
204
- export declare function normalizeAllowedTypes(types: ImplicitAnnotatedAllowedTypes): ReadonlySet<TreeNodeSchema>;
256
+ export declare function normalizeAllowedTypes(types: ImplicitAllowedTypes): AllowedTypesFull;
205
257
  /**
206
258
  * Normalizes an allowed type to an {@link AnnotatedAllowedType}, by adding empty annotations if they don't already exist.
207
259
  */
208
260
  export declare function normalizeToAnnotatedAllowedType<T extends LazyItem<TreeNodeSchema>>(type: T | AnnotatedAllowedType<T>): AnnotatedAllowedType<T>;
209
261
  /**
210
- * Normalizes a {@link ImplicitAnnotatedAllowedTypes} to a set of {@link AnnotatedAllowedSchema}s, by eagerly evaluating any
262
+ * Normalizes allowed types to an {@link AllowedTypesFullInternal}.
263
+ */
264
+ export declare function normalizeAllowedTypesInternal(type: ImplicitAllowedTypes): AllowedTypesFullInternal;
265
+ /**
266
+ * Normalizes an {@link ImplicitAllowedTypes} to an {@link AllowedTypesFullInternalEvaluated} by eagerly evaluating any
211
267
  * lazy schema declarations and adding empty metadata if it doesn't already exist.
212
268
  *
213
269
  * @remarks Note: this must only be called after all required schemas have been declared, otherwise evaluation of
214
270
  * recursive schemas may fail.
215
271
  */
216
- export declare function normalizeAnnotatedAllowedTypes(types: ImplicitAnnotatedAllowedTypes): NormalizedAnnotatedAllowedTypes;
217
- /**
218
- * Converts an {@link ImplicitAnnotatedAllowedTypes} to an {@link ImplicitAllowedTypes}s, by removing
219
- * any annotations.
220
- * @remarks
221
- * This does not evaluate any lazy schemas.
222
- */
223
- export declare function unannotateImplicitAllowedTypes<Types extends ImplicitAnnotatedAllowedTypes>(types: Types): UnannotateImplicitAllowedTypes<Types>;
224
- /**
225
- * Converts an {@link AnnotatedAllowedType} to an {@link LazyItem} by removing any annotations.
226
- * @remarks
227
- * This does not evaluate any lazy schemas.
228
- */
229
- export declare function unannotateAllowedType<Type extends AnnotatedAllowedType | LazyItem<TreeNodeSchema>>(allowedType: Type): UnannotateAllowedType<Type>;
272
+ export declare function normalizeAndEvaluateAnnotatedAllowedTypes(types: ImplicitAllowedTypes): AllowedTypesFullInternalEvaluated;
230
273
  /**
231
274
  * Returns the schema referenced by the {@link LazyItem}.
232
275
  * @remarks
@@ -237,7 +280,7 @@ export declare function evaluateLazySchema<T extends TreeNodeSchema>(value: Lazy
237
280
  /**
238
281
  * Throws a UsageError if the provided schema is undefined, most likely due to being used before it was initialized.
239
282
  */
240
- export declare function checkForUninitializedSchema(schema: ImplicitAnnotatedAllowedTypes | LazyItem<TreeNodeSchema> | AnnotatedAllowedType): void;
283
+ export declare function checkForUninitializedSchema(schema: ImplicitAllowedTypes | LazyItem<TreeNodeSchema> | AnnotatedAllowedType): void;
241
284
  /**
242
285
  * Indicates that the provided schema is the "most derived" version in its class hierarchy.
243
286
  *
@@ -339,10 +382,25 @@ export type InsertableTreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitA
339
382
  * @typeparam TList - AllowedTypes to process
340
383
  *
341
384
  * @privateRemarks
342
- * This loop is manually unrolled to allow larger unions before hitting the recursion limit in TypeScript.
385
+ * This loop is non-recursive to allow larger unions before hitting the recursion limit in TypeScript.
343
386
  * @system @public
344
387
  */
345
388
  export type InsertableTreeNodeFromAllowedTypes<TList extends AllowedTypes> = IsUnion<TList> extends true ? never : {
346
- readonly [Property in keyof TList]: TList[Property] extends LazyItem<infer TSchema extends TreeNodeSchema> ? InsertableTypedNode<TSchema> : never;
347
- }[number];
389
+ readonly [Property in keyof TList]: [TList[Property]] extends [
390
+ LazyItem<infer TSchema extends TreeNodeSchema>
391
+ ] ? InsertableTypedNode<TSchema> : never;
392
+ }[NumberKeys<TList>];
393
+ /**
394
+ * Extracts the keys of `T` which are numbers.
395
+ * @remarks
396
+ * The keys are extracted as strings which can be used to index `T`.
397
+ *
398
+ * This handles cases like `{ x: 4 } & [5, 6]` returning `"0"` and `"1"`.
399
+ * Such cases are difficult to handle since `keyof` includes `number` in such cases, but the type can not be indexed by `number`.
400
+ * @system @public
401
+ */
402
+ export type NumberKeys<T, Transformed = {
403
+ readonly [Property in keyof T as number extends Property ? never : Property]: Property;
404
+ }> = Transformed[`${number}` & keyof Transformed];
405
+ export {};
348
406
  //# sourceMappingURL=allowedTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"allowedTypes.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/allowedTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAGN,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAU,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAEN,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AAG7B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC;IACjE;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC;;OA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AC,CAAC;AAExB;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,CACrB,CAAC,EACD,WAAW,GAAG;IACb,QAAQ,EAAE,QAAQ,IAAI,MAAM,CAAC,IAAI,MAAM,SAAS,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ;CACtF,IACE,WAAW,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,WAAW,CAAC,CAAC"}
@@ -4,8 +4,10 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.markSchemaMostDerived = exports.checkForUninitializedSchema = exports.evaluateLazySchema = exports.unannotateAllowedType = exports.unannotateImplicitAllowedTypes = exports.normalizeAnnotatedAllowedTypes = exports.normalizeToAnnotatedAllowedType = exports.normalizeAllowedTypes = exports.SchemaUpgrade = exports.createSchemaUpgrade = exports.isAnnotatedAllowedType = exports.isAnnotatedAllowedTypes = void 0;
7
+ exports.markSchemaMostDerived = exports.checkForUninitializedSchema = exports.evaluateLazySchema = exports.normalizeAndEvaluateAnnotatedAllowedTypes = exports.normalizeAllowedTypesInternal = exports.normalizeToAnnotatedAllowedType = exports.normalizeAllowedTypes = exports.SchemaUpgrade = exports.createSchemaUpgrade = exports.isAnnotatedAllowedType = exports.AnnotatedAllowedTypesInternal = exports.isAnnotatedAllowedTypes = void 0;
8
8
  const internal_1 = require("@fluidframework/telemetry-utils/internal");
9
+ const internal_2 = require("@fluidframework/core-utils/internal");
10
+ const internal_3 = require("@fluidframework/core-interfaces/internal");
9
11
  const index_js_1 = require("../../util/index.js");
10
12
  const flexList_js_1 = require("./flexList.js");
11
13
  const treeNodeSchema_js_1 = require("./treeNodeSchema.js");
@@ -15,11 +17,135 @@ const treeNodeValid_js_1 = require("./treeNodeValid.js");
15
17
  */
16
18
  function isAnnotatedAllowedTypes(allowedTypes) {
17
19
  checkForUninitializedSchema(allowedTypes);
18
- return (
19
- // Class based schema, and lazy schema references report type "function": filtering them out with typeof makes narrowing based on members mostly safe
20
- typeof allowedTypes === "object" && "metadata" in allowedTypes && "types" in allowedTypes);
20
+ return allowedTypes instanceof AnnotatedAllowedTypesInternal;
21
21
  }
22
22
  exports.isAnnotatedAllowedTypes = isAnnotatedAllowedTypes;
23
+ /**
24
+ * The implementation of {@link AnnotatedAllowedTypes}. Also implements {@link AllowedTypesFull}.
25
+ * @remarks
26
+ * Due to TypeScript limitations, this class cannot directly state it implements {@link AllowedTypesFull}.
27
+ * As a workaround for that, the static `create` method returns the intersection type.
28
+ */
29
+ class AnnotatedAllowedTypesInternal extends internal_3.ErasedTypeImplementation {
30
+ constructor(types, metadata = {}) {
31
+ super();
32
+ this.types = types;
33
+ this.metadata = metadata;
34
+ this.unannotatedTypes = types.map((type) => type.type);
35
+ // Since the array has been copied, mutations to it will not be handled correctly so freeze it.
36
+ // Support for such mutations could be added at a later date by making more things lazy.
37
+ Object.freeze(this.types);
38
+ Object.freeze(this.unannotatedTypes);
39
+ this.isLazy = false;
40
+ for (const type of this.unannotatedTypes) {
41
+ if ((0, flexList_js_1.isLazy)(type)) {
42
+ this.isLazy = true;
43
+ }
44
+ else {
45
+ markSchemaMostDerived(type);
46
+ }
47
+ }
48
+ const proxy = AnnotatedAllowedTypesInternal.proxy(this);
49
+ this.lazyEvaluate = new internal_2.Lazy(() => {
50
+ const annotated = this.isLazy
51
+ ? AnnotatedAllowedTypesInternal.create(this.types.map((type) => ({
52
+ ...type,
53
+ type: evaluateLazySchema(type.type),
54
+ })), this.metadata)
55
+ : proxy;
56
+ return {
57
+ annotated,
58
+ set: new Set(annotated.unannotatedTypes),
59
+ identifiers: new Set(annotated.unannotatedTypes.map((t) => t.identifier)),
60
+ };
61
+ });
62
+ return proxy;
63
+ }
64
+ evaluate() {
65
+ return this.lazyEvaluate.value.annotated;
66
+ }
67
+ evaluateSet() {
68
+ return this.lazyEvaluate.value.set;
69
+ }
70
+ evaluateIdentifiers() {
71
+ return this.lazyEvaluate.value.identifiers;
72
+ }
73
+ static [Symbol.hasInstance](value) {
74
+ return Object.prototype.isPrototypeOf.call(this.prototype, value);
75
+ }
76
+ static narrow(value) {
77
+ if (!Object.prototype.isPrototypeOf.call(this.prototype, value)) {
78
+ throw new TypeError("Invalid AnnotatedAllowedTypes instance");
79
+ }
80
+ }
81
+ static proxy(result) {
82
+ const proxy = new Proxy(result, {
83
+ set: () => {
84
+ throw new internal_1.UsageError("AnnotatedAllowedTypes is immutable");
85
+ },
86
+ get: (target, property, receiver) => {
87
+ // Hide common array editing methods.
88
+ if (property === "push" || property === "pop") {
89
+ return undefined;
90
+ }
91
+ // Forward array lookup and array methods to the unannotated types array.
92
+ if (property in target.unannotatedTypes) {
93
+ return Reflect.get(target.unannotatedTypes, property);
94
+ }
95
+ // Forward anything else to target.
96
+ return Reflect.get(target, property);
97
+ },
98
+ has: (target, property) => {
99
+ if (property in target.unannotatedTypes) {
100
+ return true;
101
+ }
102
+ // Forward anything else to target.
103
+ return property in target;
104
+ },
105
+ ownKeys: (target) => {
106
+ const targetKeys = Reflect.ownKeys(target);
107
+ const unannotatedTypesKeys = Reflect.ownKeys(target.unannotatedTypes);
108
+ return [...unannotatedTypesKeys, ...targetKeys];
109
+ },
110
+ getOwnPropertyDescriptor: (target, property) => {
111
+ if (Object.prototype.hasOwnProperty.call(target.unannotatedTypes, property)) {
112
+ const inner = Object.getOwnPropertyDescriptor(target.unannotatedTypes, property);
113
+ return {
114
+ ...inner,
115
+ // Since these properties are not on the target, make them non-configurable to confirm with proxy invariants.
116
+ configurable: true,
117
+ writable: false,
118
+ };
119
+ }
120
+ else {
121
+ const inner = Object.getOwnPropertyDescriptor(target, property);
122
+ return {
123
+ ...inner,
124
+ writable: false,
125
+ // Allow only array entries to be enumerable.
126
+ enumerable: false,
127
+ };
128
+ }
129
+ },
130
+ });
131
+ return proxy;
132
+ }
133
+ static create(types, metadata = {}) {
134
+ const result = new AnnotatedAllowedTypesInternal(types, metadata);
135
+ return result;
136
+ }
137
+ static createUnannotated(types, metadata = {}) {
138
+ const annotatedTypes = types.map(normalizeToAnnotatedAllowedType);
139
+ const result = AnnotatedAllowedTypesInternal.create(annotatedTypes, metadata);
140
+ return result;
141
+ }
142
+ static createMixed(types, metadata = {}) {
143
+ const annotatedTypes = types.map(normalizeToAnnotatedAllowedType);
144
+ const result = AnnotatedAllowedTypesInternal.create(annotatedTypes, metadata);
145
+ return result;
146
+ }
147
+ }
148
+ exports.AnnotatedAllowedTypesInternal = AnnotatedAllowedTypesInternal;
23
149
  /**
24
150
  * Checks if the given allowed type is annotated with {@link AllowedTypeMetadata}.
25
151
  */
@@ -47,29 +173,11 @@ exports.SchemaUpgrade = SchemaUpgrade;
47
173
  exports.createSchemaUpgrade = () => new SchemaUpgrade();
48
174
  })();
49
175
  /**
50
- * Normalizes a {@link ImplicitAllowedTypes} to a set of {@link TreeNodeSchema}s, by eagerly evaluating any
51
- * lazy schema declarations.
52
- *
53
- * @remarks Note: this must only be called after all required schemas have been declared, otherwise evaluation of
54
- * recursive schemas may fail.
55
- *
56
- * @internal
176
+ * Normalizes an {@link ImplicitAllowedTypes} to an {@link AllowedTypesFull}.
177
+ * @alpha
57
178
  */
58
179
  function normalizeAllowedTypes(types) {
59
- // remove annotations before normalizing
60
- const unannotated = unannotateImplicitAllowedTypes(types);
61
- const normalized = new Set();
62
- if ((0, index_js_1.isReadonlyArray)(unannotated)) {
63
- // Types array must not be modified after it is normalized since that would result in the user of the normalized data having wrong (out of date) content.
64
- Object.freeze(unannotated);
65
- for (const lazyType of unannotated) {
66
- normalized.add(evaluateLazySchema(lazyType));
67
- }
68
- }
69
- else {
70
- normalized.add(evaluateLazySchema(unannotated));
71
- }
72
- return normalized;
180
+ return normalizeAllowedTypesInternal(types);
73
181
  }
74
182
  exports.normalizeAllowedTypes = normalizeAllowedTypes;
75
183
  /**
@@ -85,72 +193,42 @@ function normalizeToAnnotatedAllowedType(type) {
85
193
  }
86
194
  exports.normalizeToAnnotatedAllowedType = normalizeToAnnotatedAllowedType;
87
195
  /**
88
- * Normalizes a {@link ImplicitAnnotatedAllowedTypes} to a set of {@link AnnotatedAllowedSchema}s, by eagerly evaluating any
89
- * lazy schema declarations and adding empty metadata if it doesn't already exist.
90
- *
91
- * @remarks Note: this must only be called after all required schemas have been declared, otherwise evaluation of
92
- * recursive schemas may fail.
196
+ * See note inside {@link normalizeAllowedTypesInternal}.
93
197
  */
94
- function normalizeAnnotatedAllowedTypes(types) {
95
- const typesWithoutAnnotation = isAnnotatedAllowedTypes(types) ? types.types : types;
96
- const annotatedTypes = [];
97
- if ((0, index_js_1.isReadonlyArray)(typesWithoutAnnotation)) {
98
- for (const annotatedType of typesWithoutAnnotation) {
99
- if (isAnnotatedAllowedType(annotatedType)) {
100
- annotatedTypes.push({
101
- type: evaluateLazySchema(annotatedType.type),
102
- metadata: annotatedType.metadata,
103
- });
104
- }
105
- else {
106
- annotatedTypes.push({ type: evaluateLazySchema(annotatedType), metadata: {} });
107
- }
108
- }
109
- }
110
- else {
111
- if (isAnnotatedAllowedType(typesWithoutAnnotation)) {
112
- annotatedTypes.push({
113
- type: evaluateLazySchema(typesWithoutAnnotation.type),
114
- metadata: typesWithoutAnnotation.metadata,
115
- });
116
- }
117
- else {
118
- annotatedTypes.push({ type: evaluateLazySchema(typesWithoutAnnotation), metadata: {} });
119
- }
120
- }
121
- return {
122
- metadata: isAnnotatedAllowedTypes(types) ? types.metadata : {},
123
- types: annotatedTypes,
124
- };
125
- }
126
- exports.normalizeAnnotatedAllowedTypes = normalizeAnnotatedAllowedTypes;
198
+ const cachedNormalize = new WeakMap();
127
199
  /**
128
- * Converts an {@link ImplicitAnnotatedAllowedTypes} to an {@link ImplicitAllowedTypes}s, by removing
129
- * any annotations.
130
- * @remarks
131
- * This does not evaluate any lazy schemas.
200
+ * Normalizes allowed types to an {@link AllowedTypesFullInternal}.
132
201
  */
133
- function unannotateImplicitAllowedTypes(types) {
134
- return (isAnnotatedAllowedTypes(types)
135
- ? types.types.map(unannotateAllowedType)
136
- : (0, index_js_1.isReadonlyArray)(types)
137
- ? types.map(unannotateAllowedType)
138
- : isAnnotatedAllowedType(types)
139
- ? types.type
140
- : types);
202
+ function normalizeAllowedTypesInternal(type) {
203
+ if (isAnnotatedAllowedTypes(type)) {
204
+ return type;
205
+ }
206
+ // This caching accomplishes two things:
207
+ // 1. It avoids redundant computations for the same input.
208
+ // 2. It provides a stable object identity for the output in case the input is normalized twice and other systems (such as unhydrated contexts) are cached based on the object identity of the output.
209
+ // It is this second case which is the more important since creating the AnnotatedAllowedTypesInternal is rather cheap.
210
+ // Adding this cache improved the performance of the "large recursive union" test (which mostly just constructs a TreeConfiguration) by ~5 times.
211
+ // This cache is strictly a performance optimization: it is not required for correctness.
212
+ return (0, index_js_1.getOrCreate)(cachedNormalize, type, () => {
213
+ // Due to more specific internal type, the above does not narrow sufficiently, so more narrowing is needed.
214
+ // It is possible this will give a false error if a TreeNodeSchema which matches this check is used.
215
+ (0, internal_2.assert)(!("types" in type && "metadata" in type), "invalid AnnotatedAllowedTypes");
216
+ const annotatedTypes = ((0, index_js_1.isReadonlyArray)(type) ? type : [type]).map(normalizeToAnnotatedAllowedType);
217
+ return AnnotatedAllowedTypesInternal.create(annotatedTypes);
218
+ });
141
219
  }
142
- exports.unannotateImplicitAllowedTypes = unannotateImplicitAllowedTypes;
220
+ exports.normalizeAllowedTypesInternal = normalizeAllowedTypesInternal;
143
221
  /**
144
- * Converts an {@link AnnotatedAllowedType} to an {@link LazyItem} by removing any annotations.
145
- * @remarks
146
- * This does not evaluate any lazy schemas.
222
+ * Normalizes an {@link ImplicitAllowedTypes} to an {@link AllowedTypesFullInternalEvaluated} by eagerly evaluating any
223
+ * lazy schema declarations and adding empty metadata if it doesn't already exist.
224
+ *
225
+ * @remarks Note: this must only be called after all required schemas have been declared, otherwise evaluation of
226
+ * recursive schemas may fail.
147
227
  */
148
- function unannotateAllowedType(allowedType) {
149
- return isAnnotatedAllowedType(allowedType)
150
- ? allowedType.type
151
- : allowedType;
228
+ function normalizeAndEvaluateAnnotatedAllowedTypes(types) {
229
+ return normalizeAllowedTypesInternal(types).evaluate();
152
230
  }
153
- exports.unannotateAllowedType = unannotateAllowedType;
231
+ exports.normalizeAndEvaluateAnnotatedAllowedTypes = normalizeAndEvaluateAnnotatedAllowedTypes;
154
232
  const cachedLazyItem = new WeakMap();
155
233
  /**
156
234
  * Returns the schema referenced by the {@link LazyItem}.