@fluidframework/tree 2.50.0 → 2.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (636) hide show
  1. package/.eslintrc.cjs +3 -2
  2. package/.vscode/Tree.code-workspace +14 -1
  3. package/.vscode/settings.json +16 -0
  4. package/CHANGELOG.md +51 -2
  5. package/api-report/tree.alpha.api.md +7 -7
  6. package/dist/core/schema-stored/schema.d.ts +14 -1
  7. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  8. package/dist/core/schema-stored/schema.js.map +1 -1
  9. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  10. package/dist/feature-libraries/default-schema/schemaChecker.js +3 -0
  11. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  12. package/dist/feature-libraries/flex-tree/context.d.ts +7 -2
  13. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  14. package/dist/feature-libraries/flex-tree/context.js +4 -4
  15. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  16. package/dist/feature-libraries/flex-tree/index.d.ts +1 -0
  17. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  18. package/dist/feature-libraries/flex-tree/index.js +3 -1
  19. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  20. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  21. package/dist/feature-libraries/flex-tree/lazyField.js +5 -5
  22. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  23. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +3 -1
  24. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  25. package/dist/feature-libraries/flex-tree/lazyNode.js +5 -3
  26. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  27. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  28. package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -4
  29. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  30. package/dist/feature-libraries/index.d.ts +2 -2
  31. package/dist/feature-libraries/index.d.ts.map +1 -1
  32. package/dist/feature-libraries/index.js +3 -8
  33. package/dist/feature-libraries/index.js.map +1 -1
  34. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  35. package/dist/feature-libraries/modular-schema/comparison.js +0 -3
  36. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  37. package/dist/feature-libraries/modular-schema/index.d.ts +0 -1
  38. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  39. package/dist/feature-libraries/modular-schema/index.js +1 -8
  40. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  41. package/dist/packageVersion.d.ts +1 -1
  42. package/dist/packageVersion.js +1 -1
  43. package/dist/packageVersion.js.map +1 -1
  44. package/dist/shared-tree/index.d.ts +0 -1
  45. package/dist/shared-tree/index.d.ts.map +1 -1
  46. package/dist/shared-tree/index.js +1 -3
  47. package/dist/shared-tree/index.js.map +1 -1
  48. package/dist/shared-tree/schematizeTree.d.ts +1 -1
  49. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  50. package/dist/shared-tree/schematizeTree.js +7 -10
  51. package/dist/shared-tree/schematizeTree.js.map +1 -1
  52. package/dist/shared-tree/schematizingTreeView.d.ts +11 -13
  53. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  54. package/dist/shared-tree/schematizingTreeView.js +60 -83
  55. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  56. package/dist/shared-tree/sharedTreeChangeTypes.d.ts +1 -1
  57. package/dist/shared-tree/sharedTreeChangeTypes.js.map +1 -1
  58. package/dist/shared-tree/tree.d.ts.map +1 -1
  59. package/dist/shared-tree/tree.js +4 -3
  60. package/dist/shared-tree/tree.js.map +1 -1
  61. package/dist/shared-tree/treeAlpha.d.ts +7 -1
  62. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  63. package/dist/shared-tree/treeAlpha.js.map +1 -1
  64. package/dist/shared-tree/treeCheckout.d.ts +7 -2
  65. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  66. package/dist/shared-tree/treeCheckout.js +4 -1
  67. package/dist/shared-tree/treeCheckout.js.map +1 -1
  68. package/dist/simple-tree/api/conciseTree.d.ts +1 -1
  69. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  70. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  71. package/dist/simple-tree/api/configuration.d.ts +1 -1
  72. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  73. package/dist/simple-tree/api/configuration.js +5 -5
  74. package/dist/simple-tree/api/configuration.js.map +1 -1
  75. package/dist/simple-tree/api/create.d.ts +3 -1
  76. package/dist/simple-tree/api/create.d.ts.map +1 -1
  77. package/dist/simple-tree/api/create.js +2 -0
  78. package/dist/simple-tree/api/create.js.map +1 -1
  79. package/dist/simple-tree/api/customTree.d.ts +1 -2
  80. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  81. package/dist/simple-tree/api/customTree.js.map +1 -1
  82. package/dist/simple-tree/api/getJsonSchema.d.ts +1 -1
  83. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  84. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  85. package/dist/simple-tree/api/getSimpleSchema.d.ts +1 -1
  86. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  87. package/dist/simple-tree/api/identifierIndex.d.ts +1 -1
  88. package/dist/simple-tree/api/identifierIndex.js +2 -2
  89. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  90. package/dist/simple-tree/api/index.d.ts +1 -1
  91. package/dist/simple-tree/api/index.d.ts.map +1 -1
  92. package/dist/simple-tree/api/index.js.map +1 -1
  93. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +4 -19
  94. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  95. package/dist/simple-tree/api/schemaCompatibilityTester.js +31 -82
  96. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  97. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +14 -2
  98. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  99. package/dist/simple-tree/api/schemaCreationUtilities.js +41 -4
  100. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  101. package/dist/simple-tree/api/schemaFactory.d.ts +36 -3
  102. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  103. package/dist/simple-tree/api/schemaFactory.js +18 -18
  104. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  105. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +16 -16
  106. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  107. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  108. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  109. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  110. package/dist/simple-tree/api/schemaFactoryRecursive.js +2 -2
  111. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  112. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  113. package/dist/simple-tree/api/schemaFromSimple.js +4 -4
  114. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  115. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +2 -2
  116. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  117. package/dist/simple-tree/api/simpleTreeIndex.d.ts +2 -2
  118. package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  119. package/dist/simple-tree/api/simpleTreeIndex.js +1 -1
  120. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  121. package/dist/simple-tree/api/storedSchema.d.ts +1 -1
  122. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  123. package/dist/simple-tree/api/storedSchema.js +2 -2
  124. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  125. package/dist/simple-tree/api/tree.d.ts +2 -1
  126. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  127. package/dist/simple-tree/api/tree.js.map +1 -1
  128. package/dist/simple-tree/api/treeBeta.d.ts +4 -1
  129. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  130. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  131. package/dist/simple-tree/api/treeNodeApi.d.ts +1 -2
  132. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  133. package/dist/simple-tree/api/treeNodeApi.js +3 -3
  134. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  135. package/dist/simple-tree/api/typesUnsafe.d.ts +2 -3
  136. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  137. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  138. package/dist/simple-tree/api/verboseTree.d.ts +2 -1
  139. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  140. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  141. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +1 -1
  142. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +2 -2
  143. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  144. package/dist/simple-tree/core/allowedTypes.d.ts +316 -0
  145. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -0
  146. package/dist/simple-tree/core/allowedTypes.js +173 -0
  147. package/dist/simple-tree/core/allowedTypes.js.map +1 -0
  148. package/dist/simple-tree/core/context.d.ts +3 -9
  149. package/dist/simple-tree/core/context.d.ts.map +1 -1
  150. package/dist/simple-tree/core/context.js +3 -11
  151. package/dist/simple-tree/core/context.js.map +1 -1
  152. package/dist/simple-tree/core/flexList.d.ts.map +1 -0
  153. package/dist/simple-tree/core/flexList.js.map +1 -0
  154. package/dist/simple-tree/core/getOrCreateNode.d.ts +1 -1
  155. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  156. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  157. package/dist/simple-tree/core/index.d.ts +9 -3
  158. package/dist/simple-tree/core/index.d.ts.map +1 -1
  159. package/dist/simple-tree/core/index.js +19 -3
  160. package/dist/simple-tree/core/index.js.map +1 -1
  161. package/dist/simple-tree/core/treeNodeKernel.d.ts +8 -1
  162. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  163. package/dist/simple-tree/core/treeNodeKernel.js +24 -20
  164. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  165. package/dist/simple-tree/core/treeNodeSchema.d.ts +182 -39
  166. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  167. package/dist/simple-tree/core/treeNodeSchema.js +47 -17
  168. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  169. package/{lib/simple-tree → dist/simple-tree/core}/treeNodeValid.d.ts +18 -4
  170. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -0
  171. package/dist/simple-tree/{treeNodeValid.js → core/treeNodeValid.js} +41 -11
  172. package/dist/simple-tree/core/treeNodeValid.js.map +1 -0
  173. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  174. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  175. package/dist/simple-tree/core/walkSchema.d.ts +2 -1
  176. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
  177. package/dist/simple-tree/core/walkSchema.js +6 -2
  178. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  179. package/dist/simple-tree/createContext.d.ts +6 -2
  180. package/dist/simple-tree/createContext.d.ts.map +1 -1
  181. package/dist/simple-tree/createContext.js +15 -3
  182. package/dist/simple-tree/createContext.js.map +1 -1
  183. package/dist/{feature-libraries/modular-schema → simple-tree}/discrepancies.d.ts +22 -29
  184. package/dist/simple-tree/discrepancies.d.ts.map +1 -0
  185. package/dist/simple-tree/discrepancies.js +382 -0
  186. package/dist/simple-tree/discrepancies.js.map +1 -0
  187. package/dist/simple-tree/fieldSchema.d.ts +423 -0
  188. package/dist/simple-tree/fieldSchema.d.ts.map +1 -0
  189. package/dist/simple-tree/{schemaTypes.js → fieldSchema.js} +5 -195
  190. package/dist/simple-tree/fieldSchema.js.map +1 -0
  191. package/dist/simple-tree/index.d.ts +7 -6
  192. package/dist/simple-tree/index.d.ts.map +1 -1
  193. package/dist/simple-tree/index.js +17 -11
  194. package/dist/simple-tree/index.js.map +1 -1
  195. package/dist/simple-tree/leafNodeSchema.d.ts +14 -5
  196. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  197. package/dist/simple-tree/leafNodeSchema.js +117 -2
  198. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  199. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -4
  200. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  201. package/dist/simple-tree/node-kinds/array/arrayNode.js +97 -26
  202. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  203. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +2 -2
  204. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  205. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  206. package/dist/simple-tree/node-kinds/common.d.ts +16 -0
  207. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -0
  208. package/dist/simple-tree/node-kinds/common.js +42 -0
  209. package/dist/simple-tree/node-kinds/common.js.map +1 -0
  210. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  211. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  212. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  213. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +2 -3
  214. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  215. package/dist/simple-tree/node-kinds/map/mapNode.js +64 -26
  216. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  217. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +2 -2
  218. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  219. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  220. package/dist/simple-tree/node-kinds/object/index.d.ts +2 -2
  221. package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  222. package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
  223. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +19 -5
  224. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  225. package/dist/simple-tree/node-kinds/object/objectNode.js +131 -27
  226. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  227. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +11 -4
  228. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  229. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  230. package/dist/simple-tree/node-kinds/record/recordNode.d.ts +2 -2
  231. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  232. package/dist/simple-tree/node-kinds/record/recordNode.js +41 -13
  233. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  234. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  235. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  236. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  237. package/dist/simple-tree/prepareForInsertion.d.ts +2 -2
  238. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  239. package/dist/simple-tree/prepareForInsertion.js +3 -3
  240. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  241. package/dist/simple-tree/simpleSchema.d.ts +2 -2
  242. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  243. package/dist/simple-tree/simpleSchema.js.map +1 -1
  244. package/dist/simple-tree/toStoredSchema.d.ts +1 -1
  245. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  246. package/dist/simple-tree/toStoredSchema.js +6 -7
  247. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  248. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +5 -11
  249. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  250. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +25 -395
  251. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  252. package/dist/simple-tree/unsafeUnknownSchema.d.ts +52 -0
  253. package/dist/simple-tree/unsafeUnknownSchema.d.ts.map +1 -0
  254. package/dist/simple-tree/unsafeUnknownSchema.js +13 -0
  255. package/dist/simple-tree/unsafeUnknownSchema.js.map +1 -0
  256. package/dist/simple-tree/walkFieldSchema.d.ts +1 -1
  257. package/dist/simple-tree/walkFieldSchema.js +2 -2
  258. package/dist/simple-tree/walkFieldSchema.js.map +1 -1
  259. package/dist/tableSchema.d.ts +12 -12
  260. package/dist/treeFactory.d.ts +0 -1
  261. package/dist/treeFactory.d.ts.map +1 -1
  262. package/dist/treeFactory.js +0 -1
  263. package/dist/treeFactory.js.map +1 -1
  264. package/lib/core/schema-stored/schema.d.ts +14 -1
  265. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  266. package/lib/core/schema-stored/schema.js.map +1 -1
  267. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  268. package/lib/feature-libraries/default-schema/schemaChecker.js +3 -0
  269. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  270. package/lib/feature-libraries/flex-tree/context.d.ts +7 -2
  271. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  272. package/lib/feature-libraries/flex-tree/context.js +4 -4
  273. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  274. package/lib/feature-libraries/flex-tree/index.d.ts +1 -0
  275. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  276. package/lib/feature-libraries/flex-tree/index.js +1 -0
  277. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  278. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  279. package/lib/feature-libraries/flex-tree/lazyField.js +6 -6
  280. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  281. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +3 -1
  282. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  283. package/lib/feature-libraries/flex-tree/lazyNode.js +3 -1
  284. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  285. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  286. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -2
  287. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  288. package/lib/feature-libraries/index.d.ts +2 -2
  289. package/lib/feature-libraries/index.d.ts.map +1 -1
  290. package/lib/feature-libraries/index.js +2 -2
  291. package/lib/feature-libraries/index.js.map +1 -1
  292. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  293. package/lib/feature-libraries/modular-schema/comparison.js +0 -3
  294. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  295. package/lib/feature-libraries/modular-schema/index.d.ts +0 -1
  296. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  297. package/lib/feature-libraries/modular-schema/index.js +0 -1
  298. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  299. package/lib/packageVersion.d.ts +1 -1
  300. package/lib/packageVersion.js +1 -1
  301. package/lib/packageVersion.js.map +1 -1
  302. package/lib/shared-tree/index.d.ts +0 -1
  303. package/lib/shared-tree/index.d.ts.map +1 -1
  304. package/lib/shared-tree/index.js +0 -1
  305. package/lib/shared-tree/index.js.map +1 -1
  306. package/lib/shared-tree/schematizeTree.d.ts +1 -1
  307. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  308. package/lib/shared-tree/schematizeTree.js +5 -8
  309. package/lib/shared-tree/schematizeTree.js.map +1 -1
  310. package/lib/shared-tree/schematizingTreeView.d.ts +11 -13
  311. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  312. package/lib/shared-tree/schematizingTreeView.js +61 -83
  313. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  314. package/lib/shared-tree/sharedTreeChangeTypes.d.ts +1 -1
  315. package/lib/shared-tree/sharedTreeChangeTypes.js.map +1 -1
  316. package/lib/shared-tree/tree.d.ts.map +1 -1
  317. package/lib/shared-tree/tree.js +4 -3
  318. package/lib/shared-tree/tree.js.map +1 -1
  319. package/lib/shared-tree/treeAlpha.d.ts +7 -1
  320. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  321. package/lib/shared-tree/treeAlpha.js.map +1 -1
  322. package/lib/shared-tree/treeCheckout.d.ts +7 -2
  323. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  324. package/lib/shared-tree/treeCheckout.js +5 -2
  325. package/lib/shared-tree/treeCheckout.js.map +1 -1
  326. package/lib/simple-tree/api/conciseTree.d.ts +1 -1
  327. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  328. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  329. package/lib/simple-tree/api/configuration.d.ts +1 -1
  330. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  331. package/lib/simple-tree/api/configuration.js +2 -2
  332. package/lib/simple-tree/api/configuration.js.map +1 -1
  333. package/lib/simple-tree/api/create.d.ts +3 -1
  334. package/lib/simple-tree/api/create.d.ts.map +1 -1
  335. package/lib/simple-tree/api/create.js +2 -0
  336. package/lib/simple-tree/api/create.js.map +1 -1
  337. package/lib/simple-tree/api/customTree.d.ts +1 -2
  338. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  339. package/lib/simple-tree/api/customTree.js.map +1 -1
  340. package/lib/simple-tree/api/getJsonSchema.d.ts +1 -1
  341. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  342. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  343. package/lib/simple-tree/api/getSimpleSchema.d.ts +1 -1
  344. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  345. package/lib/simple-tree/api/identifierIndex.d.ts +1 -1
  346. package/lib/simple-tree/api/identifierIndex.js +1 -1
  347. package/lib/simple-tree/api/identifierIndex.js.map +1 -1
  348. package/lib/simple-tree/api/index.d.ts +1 -1
  349. package/lib/simple-tree/api/index.d.ts.map +1 -1
  350. package/lib/simple-tree/api/index.js.map +1 -1
  351. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +4 -19
  352. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  353. package/lib/simple-tree/api/schemaCompatibilityTester.js +25 -76
  354. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  355. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +14 -2
  356. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  357. package/lib/simple-tree/api/schemaCreationUtilities.js +40 -4
  358. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  359. package/lib/simple-tree/api/schemaFactory.d.ts +36 -3
  360. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  361. package/lib/simple-tree/api/schemaFactory.js +2 -2
  362. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  363. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +16 -16
  364. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  365. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  366. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  367. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  368. package/lib/simple-tree/api/schemaFactoryRecursive.js +1 -1
  369. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  370. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  371. package/lib/simple-tree/api/schemaFromSimple.js +1 -1
  372. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  373. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +1 -1
  374. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  375. package/lib/simple-tree/api/simpleTreeIndex.d.ts +2 -2
  376. package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  377. package/lib/simple-tree/api/simpleTreeIndex.js +2 -2
  378. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  379. package/lib/simple-tree/api/storedSchema.d.ts +1 -1
  380. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  381. package/lib/simple-tree/api/storedSchema.js +2 -2
  382. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  383. package/lib/simple-tree/api/tree.d.ts +2 -1
  384. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  385. package/lib/simple-tree/api/tree.js.map +1 -1
  386. package/lib/simple-tree/api/treeBeta.d.ts +4 -1
  387. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  388. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  389. package/lib/simple-tree/api/treeNodeApi.d.ts +1 -2
  390. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  391. package/lib/simple-tree/api/treeNodeApi.js +2 -2
  392. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  393. package/lib/simple-tree/api/typesUnsafe.d.ts +2 -3
  394. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  395. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  396. package/lib/simple-tree/api/verboseTree.d.ts +2 -1
  397. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  398. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  399. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +1 -1
  400. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +1 -1
  401. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  402. package/lib/simple-tree/core/allowedTypes.d.ts +316 -0
  403. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -0
  404. package/lib/simple-tree/core/allowedTypes.js +162 -0
  405. package/lib/simple-tree/core/allowedTypes.js.map +1 -0
  406. package/lib/simple-tree/core/context.d.ts +3 -9
  407. package/lib/simple-tree/core/context.d.ts.map +1 -1
  408. package/lib/simple-tree/core/context.js +0 -8
  409. package/lib/simple-tree/core/context.js.map +1 -1
  410. package/lib/simple-tree/core/flexList.d.ts.map +1 -0
  411. package/lib/simple-tree/core/flexList.js.map +1 -0
  412. package/lib/simple-tree/core/getOrCreateNode.d.ts +1 -1
  413. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  414. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  415. package/lib/simple-tree/core/index.d.ts +9 -3
  416. package/lib/simple-tree/core/index.d.ts.map +1 -1
  417. package/lib/simple-tree/core/index.js +6 -3
  418. package/lib/simple-tree/core/index.js.map +1 -1
  419. package/lib/simple-tree/core/treeNodeKernel.d.ts +8 -1
  420. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  421. package/lib/simple-tree/core/treeNodeKernel.js +10 -6
  422. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  423. package/lib/simple-tree/core/treeNodeSchema.d.ts +182 -39
  424. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  425. package/lib/simple-tree/core/treeNodeSchema.js +44 -14
  426. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  427. package/{dist/simple-tree → lib/simple-tree/core}/treeNodeValid.d.ts +18 -4
  428. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -0
  429. package/lib/simple-tree/{treeNodeValid.js → core/treeNodeValid.js} +31 -3
  430. package/lib/simple-tree/core/treeNodeValid.js.map +1 -0
  431. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  432. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  433. package/lib/simple-tree/core/walkSchema.d.ts +2 -1
  434. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
  435. package/lib/simple-tree/core/walkSchema.js +7 -3
  436. package/lib/simple-tree/core/walkSchema.js.map +1 -1
  437. package/lib/simple-tree/createContext.d.ts +6 -2
  438. package/lib/simple-tree/createContext.d.ts.map +1 -1
  439. package/lib/simple-tree/createContext.js +13 -2
  440. package/lib/simple-tree/createContext.js.map +1 -1
  441. package/lib/{feature-libraries/modular-schema → simple-tree}/discrepancies.d.ts +22 -29
  442. package/lib/simple-tree/discrepancies.d.ts.map +1 -0
  443. package/lib/simple-tree/discrepancies.js +376 -0
  444. package/lib/simple-tree/discrepancies.js.map +1 -0
  445. package/lib/simple-tree/fieldSchema.d.ts +423 -0
  446. package/lib/simple-tree/fieldSchema.d.ts.map +1 -0
  447. package/lib/simple-tree/{schemaTypes.js → fieldSchema.js} +3 -183
  448. package/lib/simple-tree/fieldSchema.js.map +1 -0
  449. package/lib/simple-tree/index.d.ts +7 -6
  450. package/lib/simple-tree/index.d.ts.map +1 -1
  451. package/lib/simple-tree/index.js +4 -3
  452. package/lib/simple-tree/index.js.map +1 -1
  453. package/lib/simple-tree/leafNodeSchema.d.ts +14 -5
  454. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  455. package/lib/simple-tree/leafNodeSchema.js +117 -3
  456. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  457. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -4
  458. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  459. package/lib/simple-tree/node-kinds/array/arrayNode.js +86 -15
  460. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  461. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +2 -2
  462. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  463. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js +1 -1
  464. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  465. package/lib/simple-tree/node-kinds/common.d.ts +16 -0
  466. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -0
  467. package/lib/simple-tree/node-kinds/common.js +38 -0
  468. package/lib/simple-tree/node-kinds/common.js.map +1 -0
  469. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  470. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  471. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  472. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +2 -3
  473. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  474. package/lib/simple-tree/node-kinds/map/mapNode.js +51 -13
  475. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  476. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +2 -2
  477. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  478. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js +1 -1
  479. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  480. package/lib/simple-tree/node-kinds/object/index.d.ts +2 -2
  481. package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  482. package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
  483. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +19 -5
  484. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  485. package/lib/simple-tree/node-kinds/object/objectNode.js +116 -14
  486. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  487. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +11 -4
  488. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  489. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js +1 -1
  490. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  491. package/lib/simple-tree/node-kinds/record/recordNode.d.ts +2 -2
  492. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  493. package/lib/simple-tree/node-kinds/record/recordNode.js +40 -12
  494. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  495. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  496. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  497. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js +1 -1
  498. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  499. package/lib/simple-tree/prepareForInsertion.d.ts +2 -2
  500. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  501. package/lib/simple-tree/prepareForInsertion.js +2 -2
  502. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  503. package/lib/simple-tree/simpleSchema.d.ts +2 -2
  504. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  505. package/lib/simple-tree/simpleSchema.js.map +1 -1
  506. package/lib/simple-tree/toStoredSchema.d.ts +1 -1
  507. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  508. package/lib/simple-tree/toStoredSchema.js +2 -3
  509. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  510. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +5 -11
  511. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  512. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +10 -381
  513. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  514. package/lib/simple-tree/unsafeUnknownSchema.d.ts +52 -0
  515. package/lib/simple-tree/unsafeUnknownSchema.d.ts.map +1 -0
  516. package/lib/simple-tree/unsafeUnknownSchema.js +10 -0
  517. package/lib/simple-tree/unsafeUnknownSchema.js.map +1 -0
  518. package/lib/simple-tree/walkFieldSchema.d.ts +1 -1
  519. package/lib/simple-tree/walkFieldSchema.js +1 -1
  520. package/lib/simple-tree/walkFieldSchema.js.map +1 -1
  521. package/lib/tableSchema.d.ts +12 -12
  522. package/lib/treeFactory.d.ts +0 -1
  523. package/lib/treeFactory.d.ts.map +1 -1
  524. package/lib/treeFactory.js +0 -1
  525. package/lib/treeFactory.js.map +1 -1
  526. package/package.json +22 -23
  527. package/src/core/schema-stored/schema.ts +14 -1
  528. package/src/feature-libraries/default-schema/schemaChecker.ts +3 -0
  529. package/src/feature-libraries/flex-tree/context.ts +10 -5
  530. package/src/feature-libraries/flex-tree/index.ts +2 -0
  531. package/src/feature-libraries/flex-tree/lazyField.ts +10 -6
  532. package/src/feature-libraries/flex-tree/lazyNode.ts +6 -1
  533. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -2
  534. package/src/feature-libraries/index.ts +1 -15
  535. package/src/feature-libraries/modular-schema/comparison.ts +0 -4
  536. package/src/feature-libraries/modular-schema/index.ts +0 -17
  537. package/src/packageVersion.ts +1 -1
  538. package/src/shared-tree/index.ts +0 -2
  539. package/src/shared-tree/schematizeTree.ts +5 -9
  540. package/src/shared-tree/schematizingTreeView.ts +75 -113
  541. package/src/shared-tree/sharedTreeChangeTypes.ts +1 -1
  542. package/src/shared-tree/tree.ts +4 -3
  543. package/src/shared-tree/treeAlpha.ts +7 -1
  544. package/src/shared-tree/treeCheckout.ts +15 -2
  545. package/src/simple-tree/api/conciseTree.ts +1 -2
  546. package/src/simple-tree/api/configuration.ts +7 -4
  547. package/src/simple-tree/api/create.ts +3 -1
  548. package/src/simple-tree/api/customTree.ts +1 -2
  549. package/src/simple-tree/api/getJsonSchema.ts +1 -1
  550. package/src/simple-tree/api/getSimpleSchema.ts +1 -1
  551. package/src/simple-tree/api/identifierIndex.ts +1 -1
  552. package/src/simple-tree/api/index.ts +2 -0
  553. package/src/simple-tree/api/schemaCompatibilityTester.ts +38 -128
  554. package/src/simple-tree/api/schemaCreationUtilities.ts +50 -5
  555. package/src/simple-tree/api/schemaFactory.ts +45 -10
  556. package/src/simple-tree/api/schemaFactoryAlpha.ts +4 -7
  557. package/src/simple-tree/api/schemaFactoryRecursive.ts +9 -4
  558. package/src/simple-tree/api/schemaFromSimple.ts +2 -3
  559. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -1
  560. package/src/simple-tree/api/simpleTreeIndex.ts +8 -3
  561. package/src/simple-tree/api/storedSchema.ts +1 -2
  562. package/src/simple-tree/api/tree.ts +2 -2
  563. package/src/simple-tree/api/treeBeta.ts +4 -1
  564. package/src/simple-tree/api/treeNodeApi.ts +5 -8
  565. package/src/simple-tree/api/typesUnsafe.ts +5 -4
  566. package/src/simple-tree/api/verboseTree.ts +3 -6
  567. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +1 -1
  568. package/src/simple-tree/core/README.md +1 -1
  569. package/src/simple-tree/core/allowedTypes.ts +496 -0
  570. package/src/simple-tree/core/context.ts +3 -10
  571. package/src/simple-tree/core/getOrCreateNode.ts +1 -1
  572. package/src/simple-tree/core/index.ts +62 -9
  573. package/src/simple-tree/core/treeNodeKernel.ts +12 -6
  574. package/src/simple-tree/core/treeNodeSchema.ts +247 -63
  575. package/src/simple-tree/{treeNodeValid.ts → core/treeNodeValid.ts} +59 -15
  576. package/src/simple-tree/core/unhydratedFlexTree.ts +1 -1
  577. package/src/simple-tree/core/walkSchema.ts +9 -5
  578. package/src/simple-tree/createContext.ts +26 -2
  579. package/src/simple-tree/discrepancies.ts +648 -0
  580. package/src/simple-tree/fieldSchema.ts +734 -0
  581. package/src/simple-tree/index.ts +41 -31
  582. package/src/simple-tree/leafNodeSchema.ts +137 -5
  583. package/src/simple-tree/node-kinds/array/arrayNode.ts +141 -30
  584. package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +5 -7
  585. package/src/simple-tree/node-kinds/common.ts +60 -0
  586. package/src/simple-tree/node-kinds/index.ts +2 -0
  587. package/src/simple-tree/node-kinds/map/mapNode.ts +91 -33
  588. package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +5 -7
  589. package/src/simple-tree/node-kinds/object/index.ts +2 -0
  590. package/src/simple-tree/node-kinds/object/objectNode.ts +205 -25
  591. package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +22 -5
  592. package/src/simple-tree/node-kinds/record/recordNode.ts +68 -26
  593. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +6 -8
  594. package/src/simple-tree/prepareForInsertion.ts +7 -6
  595. package/src/simple-tree/simpleSchema.ts +2 -2
  596. package/src/simple-tree/toStoredSchema.ts +2 -3
  597. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +12 -494
  598. package/src/simple-tree/unsafeUnknownSchema.ts +70 -0
  599. package/src/simple-tree/walkFieldSchema.ts +1 -1
  600. package/src/treeFactory.ts +0 -1
  601. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +0 -1
  602. package/dist/feature-libraries/modular-schema/discrepancies.js +0 -361
  603. package/dist/feature-libraries/modular-schema/discrepancies.js.map +0 -1
  604. package/dist/shared-tree/checkoutFlexTreeView.d.ts +0 -58
  605. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +0 -1
  606. package/dist/shared-tree/checkoutFlexTreeView.js +0 -77
  607. package/dist/shared-tree/checkoutFlexTreeView.js.map +0 -1
  608. package/dist/simple-tree/flexList.d.ts.map +0 -1
  609. package/dist/simple-tree/flexList.js.map +0 -1
  610. package/dist/simple-tree/schemaTypes.d.ts +0 -856
  611. package/dist/simple-tree/schemaTypes.d.ts.map +0 -1
  612. package/dist/simple-tree/schemaTypes.js.map +0 -1
  613. package/dist/simple-tree/treeNodeValid.d.ts.map +0 -1
  614. package/dist/simple-tree/treeNodeValid.js.map +0 -1
  615. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +0 -1
  616. package/lib/feature-libraries/modular-schema/discrepancies.js +0 -354
  617. package/lib/feature-libraries/modular-schema/discrepancies.js.map +0 -1
  618. package/lib/shared-tree/checkoutFlexTreeView.d.ts +0 -58
  619. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +0 -1
  620. package/lib/shared-tree/checkoutFlexTreeView.js +0 -72
  621. package/lib/shared-tree/checkoutFlexTreeView.js.map +0 -1
  622. package/lib/simple-tree/flexList.d.ts.map +0 -1
  623. package/lib/simple-tree/flexList.js.map +0 -1
  624. package/lib/simple-tree/schemaTypes.d.ts +0 -856
  625. package/lib/simple-tree/schemaTypes.d.ts.map +0 -1
  626. package/lib/simple-tree/schemaTypes.js.map +0 -1
  627. package/lib/simple-tree/treeNodeValid.d.ts.map +0 -1
  628. package/lib/simple-tree/treeNodeValid.js.map +0 -1
  629. package/src/feature-libraries/modular-schema/discrepancies.ts +0 -567
  630. package/src/shared-tree/checkoutFlexTreeView.ts +0 -100
  631. package/src/simple-tree/schemaTypes.ts +0 -1420
  632. /package/dist/simple-tree/{flexList.d.ts → core/flexList.d.ts} +0 -0
  633. /package/dist/simple-tree/{flexList.js → core/flexList.js} +0 -0
  634. /package/lib/simple-tree/{flexList.d.ts → core/flexList.d.ts} +0 -0
  635. /package/lib/simple-tree/{flexList.js → core/flexList.js} +0 -0
  636. /package/src/simple-tree/{flexList.ts → core/flexList.ts} +0 -0
@@ -0,0 +1,316 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { type IsUnion } from "../../util/index.js";
6
+ import { type FlexListToUnion, type LazyItem } from "./flexList.js";
7
+ import { type InsertableTypedNode, type NodeFromSchema, type TreeNodeSchema } from "./treeNodeSchema.js";
8
+ /**
9
+ * Schema for types allowed in some location in a tree (like a field, map entry or array).
10
+ * @remarks
11
+ * Type constraint used in schema declaration APIs.
12
+ *
13
+ * The order of types in the array is not significant.
14
+ * Additionally, it is legal for users of this type to have the runtime and compile time order of items within this array not match.
15
+ * Therefor to ensure type safety, these arrays should not be indexed, and instead just be iterated.
16
+ *
17
+ * Ideally this restriction would be modeled in the type itself, but it is not ergonomic to do so as there is no easy (when compared to arrays)
18
+ * way to declare and manipulate unordered sets of types in TypeScript.
19
+ *
20
+ * Duplicate entries in this array are not allowed and will produce runtime errors.
21
+ * Duplicate types are allowed,
22
+ * but this must only be reflected in the type and not the runtime values.
23
+ * This duplication can be used to encode the typing when the number of items in the array is not known at compile time
24
+ * but some of the items are known to be present unconditionally.
25
+ * For example, typing `[typeof A] | [typeof A, typeof B]` as `[typeof A, typeof B | typeof A]` is allowed,
26
+ * 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.
29
+ * @system @public
30
+ */
31
+ export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
32
+ /**
33
+ * Stores annotations for an individual allowed type.
34
+ * @alpha
35
+ */
36
+ export interface AnnotatedAllowedType<T = LazyItem<TreeNodeSchema>> {
37
+ /**
38
+ * Annotations for the allowed type.
39
+ */
40
+ readonly metadata: AllowedTypeMetadata;
41
+ /**
42
+ * The allowed type the annotations apply to in a particular schema.
43
+ */
44
+ readonly type: T;
45
+ }
46
+ /**
47
+ * Stores annotations for a set of evaluated annotated allowed types.
48
+ * @alpha
49
+ */
50
+ export interface NormalizedAnnotatedAllowedTypes {
51
+ /**
52
+ * Annotations that apply to a set of allowed types.
53
+ */
54
+ readonly metadata: AllowedTypesMetadata;
55
+ /**
56
+ * All the evaluated allowed types that the annotations apply to. The types themselves are also individually annotated.
57
+ */
58
+ readonly types: readonly AnnotatedAllowedType<TreeNodeSchema>[];
59
+ }
60
+ /**
61
+ * Checks if the input is an {@link AnnotatedAllowedTypes}.
62
+ */
63
+ export declare function isAnnotatedAllowedTypes(allowedTypes: ImplicitAnnotatedAllowedTypes): allowedTypes is AnnotatedAllowedTypes;
64
+ /**
65
+ * Stores annotations for a set of allowed types.
66
+ * @alpha
67
+ */
68
+ export interface AnnotatedAllowedTypes {
69
+ /**
70
+ * Annotations that apply to a set of allowed types.
71
+ */
72
+ readonly metadata: AllowedTypesMetadata;
73
+ /**
74
+ * All the allowed types that the annotations apply to. The types themselves may also have individual annotations.
75
+ */
76
+ readonly types: readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[];
77
+ }
78
+ /**
79
+ * Annotations that apply to a set of allowed types.
80
+ * @remarks
81
+ * Additional optionals may be added to this as non-breaking changes, so implementations of it should be simple object literals with no unlisted members.
82
+ * @alpha
83
+ */
84
+ export interface AllowedTypesMetadata {
85
+ /**
86
+ * User defined metadata
87
+ */
88
+ readonly custom?: unknown;
89
+ }
90
+ /**
91
+ * Checks if the given allowed type is annotated with {@link AllowedTypeMetadata}.
92
+ */
93
+ export declare function isAnnotatedAllowedType(allowedType: AnnotatedAllowedType | LazyItem<TreeNodeSchema>): allowedType is AnnotatedAllowedType;
94
+ /**
95
+ * Annotations that apply to an individual allowed type.
96
+ * @remarks
97
+ * Additional optionals may be added to this as non-breaking changes, so implementations of it should be simple object literals with no unlisted members.
98
+ * @alpha
99
+ */
100
+ export interface AllowedTypeMetadata {
101
+ /**
102
+ * User defined metadata
103
+ */
104
+ readonly custom?: unknown;
105
+ }
106
+ /**
107
+ * Types of {@link TreeNode|TreeNodes} or {@link TreeLeafValue|TreeLeafValues} allowed at a location in a tree.
108
+ * @remarks
109
+ * Used by {@link TreeViewConfiguration} for the root and various kinds of {@link TreeNodeSchema} to specify their allowed child types.
110
+ *
111
+ * Use {@link SchemaFactory} to access leaf schema or declare new composite schema.
112
+ *
113
+ * Implicitly treats a single type as an array of one type.
114
+ *
115
+ * Arrays of schema can be used to specify multiple types are allowed, which result in unions of those types in the Tree APIs.
116
+ *
117
+ * When saved into variables, avoid type-erasing the details, as doing so loses the compile time schema awareness of APIs derived from the types.
118
+ *
119
+ * 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.
120
+ * See {@link ValidateRecursiveSchema} for details on how to structure the `ImplicitAllowedTypes` instances when constructing recursive schema.
121
+ *
122
+ * @example Explicit use with strong typing
123
+ * ```typescript
124
+ * const sf = new SchemaFactory("myScope");
125
+ * const childTypes = [sf.number, sf.string] as const satisfies ImplicitAllowedTypes;
126
+ * const config = new TreeViewConfiguration({ schema: childTypes });
127
+ * ```
128
+ *
129
+ * @example Forward reference
130
+ * ```typescript
131
+ * const sf = new SchemaFactory("myScope");
132
+ * class A extends sf.array("example", [() => B]) {}
133
+ * class B extends sf.array("Inner", sf.number) {}
134
+ * ```
135
+ * @privateRemarks
136
+ * Code reading data from this should use `normalizeAllowedTypes` to ensure consistent handling, caching, nice errors etc.
137
+ * @public
138
+ */
139
+ export type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;
140
+ /**
141
+ * Types of {@link TreeNode|TreeNodes} or {@link TreeLeafValue|TreeLeafValues} allowed at a location in a tree with
142
+ * additional metadata associated with the location they're allowed at.
143
+ * @alpha
144
+ */
145
+ export type ImplicitAnnotatedAllowedTypes = TreeNodeSchema | AnnotatedAllowedType | AnnotatedAllowedTypes | readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[];
146
+ /**
147
+ * Returns an {@link ImplicitAllowedTypes} that is equivalent to the input without annotations.
148
+ * @system @alpha
149
+ */
150
+ export type UnannotateImplicitAllowedTypes<T extends ImplicitAnnotatedAllowedTypes> = T extends AnnotatedAllowedTypes ? UnannotateAllowedTypes<T> : T extends AnnotatedAllowedType ? UnannotateAllowedType<T> : T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[] ? UnannotateAllowedTypesList<T> : T extends TreeNodeSchema ? T : never;
151
+ /**
152
+ * Removes annotations from a list of allowed types that may contain annotations.
153
+ * @system @alpha
154
+ */
155
+ export type UnannotateAllowedTypesList<T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]> = {
156
+ [I in keyof T]: UnannotateAllowedTypeOrLazyItem<T[I]>;
157
+ };
158
+ /**
159
+ * Removes annotations from an allowed type that may contain annotations.
160
+ * @system @alpha
161
+ */
162
+ export type UnannotateAllowedTypeOrLazyItem<T extends AnnotatedAllowedType | LazyItem<TreeNodeSchema>> = T extends AnnotatedAllowedType<infer X> ? X : T;
163
+ /**
164
+ * Removes all annotations from a set of allowed types.
165
+ * @system @alpha
166
+ */
167
+ export type UnannotateAllowedTypes<T extends AnnotatedAllowedTypes> = UnannotateAllowedTypesList<T["types"]>;
168
+ /**
169
+ * Removes annotations from an allowed type.
170
+ * @system @alpha
171
+ */
172
+ export type UnannotateAllowedType<T extends AnnotatedAllowedType> = T extends AnnotatedAllowedType<infer X> ? [X] : T;
173
+ /**
174
+ * Normalizes a {@link ImplicitAllowedTypes} to a set of {@link TreeNodeSchema}s, by eagerly evaluating any
175
+ * lazy schema declarations.
176
+ *
177
+ * @remarks Note: this must only be called after all required schemas have been declared, otherwise evaluation of
178
+ * recursive schemas may fail.
179
+ *
180
+ * @internal
181
+ */
182
+ export declare function normalizeAllowedTypes(types: ImplicitAllowedTypes): ReadonlySet<TreeNodeSchema>;
183
+ /**
184
+ * Normalizes an allowed type to an {@link AnnotatedAllowedType}, by adding empty annotations if they don't already exist.
185
+ */
186
+ export declare function normalizeToAnnotatedAllowedType<T extends TreeNodeSchema>(type: T | AnnotatedAllowedType<T> | AnnotatedAllowedType<LazyItem<T>>): AnnotatedAllowedType<T> | AnnotatedAllowedType<LazyItem<T>>;
187
+ /**
188
+ * Normalizes a {@link ImplicitAnnotatedAllowedTypes} to a set of {@link AnnotatedAllowedSchema}s, by eagerly evaluating any
189
+ * lazy schema declarations and adding empty metadata if it doesn't already exist.
190
+ *
191
+ * @remarks Note: this must only be called after all required schemas have been declared, otherwise evaluation of
192
+ * recursive schemas may fail.
193
+ */
194
+ export declare function normalizeAnnotatedAllowedTypes(types: ImplicitAnnotatedAllowedTypes): NormalizedAnnotatedAllowedTypes;
195
+ /**
196
+ * Converts an {@link ImplicitAnnotatedAllowedTypes} to an {@link ImplicitAllowedTypes}s, by removing
197
+ * any annotations.
198
+ * @remarks
199
+ * This does not evaluate any lazy schemas.
200
+ */
201
+ export declare function unannotateImplicitAllowedTypes<Types extends ImplicitAnnotatedAllowedTypes>(types: Types): UnannotateImplicitAllowedTypes<Types>;
202
+ /**
203
+ * Returns the schema referenced by the {@link LazyItem}.
204
+ * @remarks
205
+ * Caches results to handle {@link LazyItem}s which compute their resulting schema.
206
+ * @alpha
207
+ */
208
+ export declare function evaluateLazySchema<T extends TreeNodeSchema>(value: LazyItem<T>): T;
209
+ /**
210
+ * Indicates that the provided schema is the "most derived" version in its class hierarchy.
211
+ *
212
+ * @param oneTimeInitialize - If true this runs {@link TreeNodeValid.oneTimeInitialize} which does even more initialization and validation.
213
+ * `oneTimeInitialize` can't safely be run until all transitively referenced schema are defined, so which cases can safely use it are more limited.
214
+ * When legal for the caller to set this to true, it is preferred, but it is often not safe due to possible forward references.
215
+ * @remarks
216
+ * See {@link MostDerivedData} and {@link SchemaFactory} for details on what a "most derived" schema is and why it matters.
217
+ *
218
+ * This is a helper for invoking {@link TreeNodeValid.markMostDerived} for {@link TreeNodeSchema}.
219
+ *
220
+ * Calling this helps with error messages about invalid schema usage (See {@link SchemaFactory} for the rules, some of which this helps validate).
221
+ * Typically this should be called for each schema as early as practical to improve error reporting for invalid usages of schema
222
+ * (using two different schema derived from the same {@link SchemaFactory} produced base class).
223
+ *
224
+ * Note that construction of actual {@link TreeNode} instances or use of a schema transitively in a {@link TreeViewConfiguration} already do this,
225
+ * so any calls to this that is unconditionally after that point for the given schema is not needed.
226
+ * Instead most usages of this should be from those cases, and from miscellaneous cases where a schema is passed into an public API where theoretically someone could accidentally
227
+ * pass in a base class of a schema instead of the most derived one.
228
+ */
229
+ export declare function markSchemaMostDerived(schema: TreeNodeSchema, oneTimeInitialize?: boolean): void;
230
+ /**
231
+ * Type of tree node for a field of the given schema.
232
+ * @public
233
+ */
234
+ export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes = TreeNodeSchema> = TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
235
+ /**
236
+ * This type exists only to be linked from documentation to provide a single linkable place to document some details of
237
+ * "Input" types and how they handle schema.
238
+ *
239
+ * When a schema is used to describe data which is an input into an API, the API is [contravariant](https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)) over the schema.
240
+ * (See also, [TypeScript Variance Annotations](https://www.typescriptlang.org/docs/handbook/2/generics.html#variance-annotations)).
241
+ *
242
+ * Since these schema are expressed using TypeScript types, it is possible for the user of the API to provide non-exact values of these types which has implications that depended on the variance.
243
+ *
244
+ * Consider a field with schema type of `A | B` (where A and B are types of schema).
245
+ *
246
+ * - Reading the field behaves covariantly so {@link NodeFromSchema} of `<A | B>` is the same as `NodeFromSchema<A> | NodeFromSchema<B>`, indicating that either type of node can be read from the field.
247
+ *
248
+ * - Writing to the field behaves contravariantly. Since it is unknown if the node actually has a schema `A` or a schema `B`, the only legal values (known to be in schema regardless of which schema the underlying node has) are values which are legal for both `A & B`.
249
+ *
250
+ * Note that this is distinct from the case where the schema is `[A, B]`.
251
+ * In this case it is known that the field allows both A and B (the field can be set to an A or a B value).
252
+ * When `A | B` is used, the field might allow
253
+ * A but not B (so assigning a B value would be out of schema),
254
+ * B but not A (so assigning an A value would be out of schema)
255
+ * or both A and B.
256
+ *
257
+ * This gets more extreme when given completely unspecified schema.
258
+ * For example if a field is just provided {@link ImplicitFieldSchema}, nothing is known about the content of the field.
259
+ * This means that reading the field (via {@link TreeFieldFromImplicitField}) can give any valid tree field content,
260
+ * but there are no safe values which could be written to the field (since it is unknown what values would be out of schema) so {@link InsertableTreeFieldFromImplicitField} gives `never`.
261
+ *
262
+ * To implement this variance correctly, the computation of types for input and output have to use separate utilities
263
+ * which take very different approaches when encountering non-exact schema like unions or `ImplicitFieldSchema`.
264
+ * The utilities which behave contravariantly (as required to handle input correctly) link this documentation to indicate that this is how they behave.
265
+ *
266
+ * In addition to behaving contravariantly, these input type computation utilities often have further limitations.
267
+ * This is due to TypeScript making it difficult to implement this contravariance exactly.
268
+ * When faced with these implementation limitations these contravariant type computation utilities error on the side of producing overly strict requirements.
269
+ * For example in the above case of `A | B`, the utilities might compute an allowed insertable type as `never` even if there happens to be a common value accepted by both `A` and `B`.
270
+ * Future versions of the API can relax these requirements as the type computations are made more accurate.
271
+ *
272
+ * For a more concrete example: if {@link InsertableTreeFieldFromImplicitField} produced `never` for a schema `A | OptionalField<A>`,
273
+ * a future version could instead return a more flexible but still safe type, like `A`.
274
+ *
275
+ * More generally: try to avoid providing non-exact schema, especially for the fields of other schema.
276
+ * While these APIs attempt to handle such cases correctly, there are limitations and known bugs in this handling.
277
+ * Code using non-exact schema is much more likely to have its compilation break due to updates of this package or even TypeScript,
278
+ * and thus compilation breaks due to edge cases of non-exact schema handling, especially with recursive schema, are not considered breaking changes.
279
+ * This may change as the API become more stable.
280
+ *
281
+ * @privateRemarks
282
+ * There likely is a better way to share this documentation, but none was found at the time of writing.
283
+ *
284
+ * TODO: Once {@link InsertableField} is public, consider using it in the examples above.
285
+ * @system @public
286
+ */
287
+ export type Input<T extends never> = T;
288
+ /**
289
+ * Type of content that can be inserted into the tree for a node of the given schema.
290
+ *
291
+ * @see {@link Input}
292
+ *
293
+ * @typeparam TSchema - Schema to process.
294
+ *
295
+ * @privateRemarks
296
+ * This is a bit overly conservative, since cases like `A | [A]` give never and could give `A`.
297
+ * @public
298
+ */
299
+ export type InsertableTreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes> = [
300
+ TSchema
301
+ ] extends [TreeNodeSchema] ? InsertableTypedNode<TSchema> : [TSchema] extends [AllowedTypes] ? InsertableTreeNodeFromAllowedTypes<TSchema> : never;
302
+ /**
303
+ * Type of content that can be inserted into the tree for a node of the given schema.
304
+ *
305
+ * @see {@link Input}
306
+ *
307
+ * @typeparam TList - AllowedTypes to process
308
+ *
309
+ * @privateRemarks
310
+ * This loop is manually unrolled to allow larger unions before hitting the recursion limit in TypeScript.
311
+ * @system @public
312
+ */
313
+ export type InsertableTreeNodeFromAllowedTypes<TList extends AllowedTypes> = IsUnion<TList> extends true ? never : {
314
+ readonly [Property in keyof TList]: TList[Property] extends LazyItem<infer TSchema extends TreeNodeSchema> ? InsertableTypedNode<TSchema> : never;
315
+ }[number];
316
+ //# sourceMappingURL=allowedTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowedTypes.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/allowedTypes.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.markSchemaMostDerived = exports.evaluateLazySchema = exports.unannotateImplicitAllowedTypes = exports.normalizeAnnotatedAllowedTypes = exports.normalizeToAnnotatedAllowedType = exports.normalizeAllowedTypes = exports.isAnnotatedAllowedType = exports.isAnnotatedAllowedTypes = void 0;
8
+ const internal_1 = require("@fluidframework/telemetry-utils/internal");
9
+ const index_js_1 = require("../../util/index.js");
10
+ const flexList_js_1 = require("./flexList.js");
11
+ const treeNodeSchema_js_1 = require("./treeNodeSchema.js");
12
+ const treeNodeValid_js_1 = require("./treeNodeValid.js");
13
+ /**
14
+ * Checks if the input is an {@link AnnotatedAllowedTypes}.
15
+ */
16
+ function isAnnotatedAllowedTypes(allowedTypes) {
17
+ return (
18
+ // Class based schema, and lazy schema references report type "function": filtering them out with typeof makes narrowing based on members mostly safe
19
+ typeof allowedTypes === "object" && "metadata" in allowedTypes && "types" in allowedTypes);
20
+ }
21
+ exports.isAnnotatedAllowedTypes = isAnnotatedAllowedTypes;
22
+ /**
23
+ * Checks if the given allowed type is annotated with {@link AllowedTypeMetadata}.
24
+ */
25
+ function isAnnotatedAllowedType(allowedType) {
26
+ return "metadata" in allowedType && "type" in allowedType;
27
+ }
28
+ exports.isAnnotatedAllowedType = isAnnotatedAllowedType;
29
+ /**
30
+ * Normalizes a {@link ImplicitAllowedTypes} to a set of {@link TreeNodeSchema}s, by eagerly evaluating any
31
+ * lazy schema declarations.
32
+ *
33
+ * @remarks Note: this must only be called after all required schemas have been declared, otherwise evaluation of
34
+ * recursive schemas may fail.
35
+ *
36
+ * @internal
37
+ */
38
+ function normalizeAllowedTypes(types) {
39
+ const normalized = new Set();
40
+ if ((0, index_js_1.isReadonlyArray)(types)) {
41
+ // 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.
42
+ Object.freeze(types);
43
+ for (const lazyType of types) {
44
+ normalized.add(evaluateLazySchema(lazyType));
45
+ }
46
+ }
47
+ else {
48
+ normalized.add(evaluateLazySchema(types));
49
+ }
50
+ return normalized;
51
+ }
52
+ exports.normalizeAllowedTypes = normalizeAllowedTypes;
53
+ /**
54
+ * Normalizes an allowed type to an {@link AnnotatedAllowedType}, by adding empty annotations if they don't already exist.
55
+ */
56
+ function normalizeToAnnotatedAllowedType(type) {
57
+ return isAnnotatedAllowedType(type)
58
+ ? type
59
+ : {
60
+ metadata: {},
61
+ type,
62
+ };
63
+ }
64
+ exports.normalizeToAnnotatedAllowedType = normalizeToAnnotatedAllowedType;
65
+ /**
66
+ * Normalizes a {@link ImplicitAnnotatedAllowedTypes} to a set of {@link AnnotatedAllowedSchema}s, by eagerly evaluating any
67
+ * lazy schema declarations and adding empty metadata if it doesn't already exist.
68
+ *
69
+ * @remarks Note: this must only be called after all required schemas have been declared, otherwise evaluation of
70
+ * recursive schemas may fail.
71
+ */
72
+ function normalizeAnnotatedAllowedTypes(types) {
73
+ const typesWithoutAnnotation = isAnnotatedAllowedTypes(types) ? types.types : types;
74
+ const annotatedTypes = [];
75
+ if ((0, index_js_1.isReadonlyArray)(typesWithoutAnnotation)) {
76
+ for (const annotatedType of typesWithoutAnnotation) {
77
+ if (isAnnotatedAllowedType(annotatedType)) {
78
+ annotatedTypes.push({
79
+ type: evaluateLazySchema(annotatedType.type),
80
+ metadata: annotatedType.metadata,
81
+ });
82
+ }
83
+ else {
84
+ annotatedTypes.push({ type: evaluateLazySchema(annotatedType), metadata: {} });
85
+ }
86
+ }
87
+ }
88
+ else {
89
+ if (isAnnotatedAllowedType(typesWithoutAnnotation)) {
90
+ annotatedTypes.push({
91
+ type: evaluateLazySchema(typesWithoutAnnotation.type),
92
+ metadata: typesWithoutAnnotation.metadata,
93
+ });
94
+ }
95
+ else {
96
+ annotatedTypes.push({ type: evaluateLazySchema(typesWithoutAnnotation), metadata: {} });
97
+ }
98
+ }
99
+ return {
100
+ metadata: isAnnotatedAllowedTypes(types) ? types.metadata : {},
101
+ types: annotatedTypes,
102
+ };
103
+ }
104
+ exports.normalizeAnnotatedAllowedTypes = normalizeAnnotatedAllowedTypes;
105
+ /**
106
+ * Converts an {@link ImplicitAnnotatedAllowedTypes} to an {@link ImplicitAllowedTypes}s, by removing
107
+ * any annotations.
108
+ * @remarks
109
+ * This does not evaluate any lazy schemas.
110
+ */
111
+ function unannotateImplicitAllowedTypes(types) {
112
+ return (isAnnotatedAllowedTypes(types)
113
+ ? types.types.map((allowedType) => isAnnotatedAllowedType(allowedType) ? allowedType.type : allowedType)
114
+ : (0, index_js_1.isReadonlyArray)(types)
115
+ ? types.map((allowedType) => isAnnotatedAllowedType(allowedType) ? allowedType.type : allowedType)
116
+ : isAnnotatedAllowedType(types)
117
+ ? types.type
118
+ : types);
119
+ }
120
+ exports.unannotateImplicitAllowedTypes = unannotateImplicitAllowedTypes;
121
+ const cachedLazyItem = new WeakMap();
122
+ /**
123
+ * Returns the schema referenced by the {@link LazyItem}.
124
+ * @remarks
125
+ * Caches results to handle {@link LazyItem}s which compute their resulting schema.
126
+ * @alpha
127
+ */
128
+ function evaluateLazySchema(value) {
129
+ const evaluatedSchema = (0, flexList_js_1.isLazy)(value)
130
+ ? (0, index_js_1.getOrCreate)(cachedLazyItem, value, value)
131
+ : value;
132
+ if (evaluatedSchema === undefined) {
133
+ throw new internal_1.UsageError(`Encountered an undefined schema. This could indicate that some referenced schema has not yet been instantiated.`);
134
+ }
135
+ markSchemaMostDerived(evaluatedSchema);
136
+ return evaluatedSchema;
137
+ }
138
+ exports.evaluateLazySchema = evaluateLazySchema;
139
+ /**
140
+ * Indicates that the provided schema is the "most derived" version in its class hierarchy.
141
+ *
142
+ * @param oneTimeInitialize - If true this runs {@link TreeNodeValid.oneTimeInitialize} which does even more initialization and validation.
143
+ * `oneTimeInitialize` can't safely be run until all transitively referenced schema are defined, so which cases can safely use it are more limited.
144
+ * When legal for the caller to set this to true, it is preferred, but it is often not safe due to possible forward references.
145
+ * @remarks
146
+ * See {@link MostDerivedData} and {@link SchemaFactory} for details on what a "most derived" schema is and why it matters.
147
+ *
148
+ * This is a helper for invoking {@link TreeNodeValid.markMostDerived} for {@link TreeNodeSchema}.
149
+ *
150
+ * Calling this helps with error messages about invalid schema usage (See {@link SchemaFactory} for the rules, some of which this helps validate).
151
+ * Typically this should be called for each schema as early as practical to improve error reporting for invalid usages of schema
152
+ * (using two different schema derived from the same {@link SchemaFactory} produced base class).
153
+ *
154
+ * Note that construction of actual {@link TreeNode} instances or use of a schema transitively in a {@link TreeViewConfiguration} already do this,
155
+ * so any calls to this that is unconditionally after that point for the given schema is not needed.
156
+ * Instead most usages of this should be from those cases, and from miscellaneous cases where a schema is passed into an public API where theoretically someone could accidentally
157
+ * pass in a base class of a schema instead of the most derived one.
158
+ */
159
+ function markSchemaMostDerived(schema, oneTimeInitialize = false) {
160
+ // Leaf schema are not classes, and thus do not need to be marked as most derived.
161
+ if (schema.kind === treeNodeSchema_js_1.NodeKind.Leaf) {
162
+ return;
163
+ }
164
+ const schemaValid = (0, treeNodeValid_js_1.schemaAsTreeNodeValid)(schema);
165
+ if (oneTimeInitialize) {
166
+ schemaValid.oneTimeInitialize();
167
+ }
168
+ else {
169
+ schemaValid.markMostDerived();
170
+ }
171
+ }
172
+ exports.markSchemaMostDerived = markSchemaMostDerived;
173
+ //# sourceMappingURL=allowedTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowedTypes.js","sourceRoot":"","sources":["../../../src/simple-tree/core/allowedTypes.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { getOrCreate, isReadonlyArray, type IsUnion } from \"../../util/index.js\";\nimport { isLazy, type FlexListToUnion, type LazyItem } from \"./flexList.js\";\nimport {\n\tNodeKind,\n\ttype InsertableTypedNode,\n\ttype NodeFromSchema,\n\ttype TreeNodeSchema,\n} from \"./treeNodeSchema.js\";\nimport { schemaAsTreeNodeValid } from \"./treeNodeValid.js\";\n\n/**\n * Schema for types allowed in some location in a tree (like a field, map entry or array).\n * @remarks\n * Type constraint used in schema declaration APIs.\n *\n * The order of types in the array is not significant.\n * Additionally, it is legal for users of this type to have the runtime and compile time order of items within this array not match.\n * Therefor to ensure type safety, these arrays should not be indexed, and instead just be iterated.\n *\n * Ideally this restriction would be modeled in the type itself, but it is not ergonomic to do so as there is no easy (when compared to arrays)\n * way to declare and manipulate unordered sets of types in TypeScript.\n *\n * Duplicate entries in this array are not allowed and will produce runtime errors.\n * Duplicate types are allowed,\n * but this must only be reflected in the type and not the runtime values.\n * This duplication can be used to encode the typing when the number of items in the array is not known at compile time\n * but some of the items are known to be present unconditionally.\n * For example, typing `[typeof A] | [typeof A, typeof B]` as `[typeof A, typeof B | typeof A]` is allowed,\n * and can produce more useful {@link Input} types.\n * @privateRemarks\n * Code reading data from this should use `normalizeAllowedTypes` to ensure consistent handling, caching, nice errors etc.\n * @system @public\n */\nexport type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];\n\n/**\n * Stores annotations for an individual allowed type.\n * @alpha\n */\nexport interface AnnotatedAllowedType<T = LazyItem<TreeNodeSchema>> {\n\t/**\n\t * Annotations for the allowed type.\n\t */\n\treadonly metadata: AllowedTypeMetadata;\n\t/**\n\t * The allowed type the annotations apply to in a particular schema.\n\t */\n\treadonly type: T;\n}\n\n/**\n * Stores annotations for a set of evaluated annotated allowed types.\n * @alpha\n */\nexport interface NormalizedAnnotatedAllowedTypes {\n\t/**\n\t * Annotations that apply to a set of allowed types.\n\t */\n\treadonly metadata: AllowedTypesMetadata;\n\t/**\n\t * All the evaluated allowed types that the annotations apply to. The types themselves are also individually annotated.\n\t */\n\treadonly types: readonly AnnotatedAllowedType<TreeNodeSchema>[];\n}\n\n/**\n * Checks if the input is an {@link AnnotatedAllowedTypes}.\n */\nexport function isAnnotatedAllowedTypes(\n\tallowedTypes: ImplicitAnnotatedAllowedTypes,\n): allowedTypes is AnnotatedAllowedTypes {\n\treturn (\n\t\t// Class based schema, and lazy schema references report type \"function\": filtering them out with typeof makes narrowing based on members mostly safe\n\t\ttypeof allowedTypes === \"object\" && \"metadata\" in allowedTypes && \"types\" in allowedTypes\n\t);\n}\n\n/**\n * Stores annotations for a set of allowed types.\n * @alpha\n */\nexport interface AnnotatedAllowedTypes {\n\t/**\n\t * Annotations that apply to a set of allowed types.\n\t */\n\treadonly metadata: AllowedTypesMetadata;\n\t/**\n\t * All the allowed types that the annotations apply to. The types themselves may also have individual annotations.\n\t */\n\treadonly types: readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[];\n}\n\n/**\n * Annotations that apply to a set of allowed types.\n * @remarks\n * Additional optionals may be added to this as non-breaking changes, so implementations of it should be simple object literals with no unlisted members.\n * @alpha\n */\nexport interface AllowedTypesMetadata {\n\t/**\n\t * User defined metadata\n\t */\n\treadonly custom?: unknown;\n}\n\n/**\n * Checks if the given allowed type is annotated with {@link AllowedTypeMetadata}.\n */\nexport function isAnnotatedAllowedType(\n\tallowedType: AnnotatedAllowedType | LazyItem<TreeNodeSchema>,\n): allowedType is AnnotatedAllowedType {\n\treturn \"metadata\" in allowedType && \"type\" in allowedType;\n}\n\n/**\n * Annotations that apply to an individual allowed type.\n * @remarks\n * Additional optionals may be added to this as non-breaking changes, so implementations of it should be simple object literals with no unlisted members.\n * @alpha\n */\nexport interface AllowedTypeMetadata {\n\t/**\n\t * User defined metadata\n\t */\n\treadonly custom?: unknown;\n\n\t// TODO metadata for enablable types will be added here\n}\n\n/**\n * Types of {@link TreeNode|TreeNodes} or {@link TreeLeafValue|TreeLeafValues} allowed at a location in a tree.\n * @remarks\n * Used by {@link TreeViewConfiguration} for the root and various kinds of {@link TreeNodeSchema} to specify their allowed child types.\n *\n * Use {@link SchemaFactory} to access leaf schema or declare new composite schema.\n *\n * Implicitly treats a single type as an array of one type.\n *\n * Arrays of schema can be used to specify multiple types are allowed, which result in unions of those types in the Tree APIs.\n *\n * When saved into variables, avoid type-erasing the details, as doing so loses the compile time schema awareness of APIs derived from the types.\n *\n * 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.\n * See {@link ValidateRecursiveSchema} for details on how to structure the `ImplicitAllowedTypes` instances when constructing recursive schema.\n *\n * @example Explicit use with strong typing\n * ```typescript\n * const sf = new SchemaFactory(\"myScope\");\n * const childTypes = [sf.number, sf.string] as const satisfies ImplicitAllowedTypes;\n * const config = new TreeViewConfiguration({ schema: childTypes });\n * ```\n *\n * @example Forward reference\n * ```typescript\n * const sf = new SchemaFactory(\"myScope\");\n * class A extends sf.array(\"example\", [() => B]) {}\n * class B extends sf.array(\"Inner\", sf.number) {}\n * ```\n * @privateRemarks\n * Code reading data from this should use `normalizeAllowedTypes` to ensure consistent handling, caching, nice errors etc.\n * @public\n */\nexport type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;\n\n/**\n * Types of {@link TreeNode|TreeNodes} or {@link TreeLeafValue|TreeLeafValues} allowed at a location in a tree with\n * additional metadata associated with the location they're allowed at.\n * @alpha\n */\nexport type ImplicitAnnotatedAllowedTypes =\n\t| TreeNodeSchema\n\t| AnnotatedAllowedType\n\t| AnnotatedAllowedTypes\n\t| readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[];\n\n/**\n * Returns an {@link ImplicitAllowedTypes} that is equivalent to the input without annotations.\n * @system @alpha\n */\nexport type UnannotateImplicitAllowedTypes<T extends ImplicitAnnotatedAllowedTypes> =\n\tT extends AnnotatedAllowedTypes\n\t\t? UnannotateAllowedTypes<T>\n\t\t: T extends AnnotatedAllowedType\n\t\t\t? UnannotateAllowedType<T>\n\t\t\t: T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]\n\t\t\t\t? UnannotateAllowedTypesList<T>\n\t\t\t\t: T extends TreeNodeSchema\n\t\t\t\t\t? T\n\t\t\t\t\t: never;\n\n/**\n * Removes annotations from a list of allowed types that may contain annotations.\n * @system @alpha\n */\nexport type UnannotateAllowedTypesList<\n\tT extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[],\n> = {\n\t[I in keyof T]: UnannotateAllowedTypeOrLazyItem<T[I]>;\n};\n\n/**\n * Removes annotations from an allowed type that may contain annotations.\n * @system @alpha\n */\nexport type UnannotateAllowedTypeOrLazyItem<\n\tT extends AnnotatedAllowedType | LazyItem<TreeNodeSchema>,\n> = T extends AnnotatedAllowedType<infer X> ? X : T;\n\n/**\n * Removes all annotations from a set of allowed types.\n * @system @alpha\n */\nexport type UnannotateAllowedTypes<T extends AnnotatedAllowedTypes> =\n\tUnannotateAllowedTypesList<T[\"types\"]>;\n\n/**\n * Removes annotations from an allowed type.\n * @system @alpha\n */\nexport type UnannotateAllowedType<T extends AnnotatedAllowedType> =\n\tT extends AnnotatedAllowedType<infer X> ? [X] : T;\n\n/**\n * Normalizes a {@link ImplicitAllowedTypes} to a set of {@link TreeNodeSchema}s, by eagerly evaluating any\n * lazy schema declarations.\n *\n * @remarks Note: this must only be called after all required schemas have been declared, otherwise evaluation of\n * recursive schemas may fail.\n *\n * @internal\n */\nexport function normalizeAllowedTypes(\n\ttypes: ImplicitAllowedTypes,\n): ReadonlySet<TreeNodeSchema> {\n\tconst normalized = new Set<TreeNodeSchema>();\n\tif (isReadonlyArray(types)) {\n\t\t// 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.\n\t\tObject.freeze(types);\n\t\tfor (const lazyType of types) {\n\t\t\tnormalized.add(evaluateLazySchema(lazyType));\n\t\t}\n\t} else {\n\t\tnormalized.add(evaluateLazySchema(types));\n\t}\n\treturn normalized;\n}\n\n/**\n * Normalizes an allowed type to an {@link AnnotatedAllowedType}, by adding empty annotations if they don't already exist.\n */\nexport function normalizeToAnnotatedAllowedType<T extends TreeNodeSchema>(\n\ttype: T | AnnotatedAllowedType<T> | AnnotatedAllowedType<LazyItem<T>>,\n): AnnotatedAllowedType<T> | AnnotatedAllowedType<LazyItem<T>> {\n\treturn isAnnotatedAllowedType(type)\n\t\t? type\n\t\t: {\n\t\t\t\tmetadata: {},\n\t\t\t\ttype,\n\t\t\t};\n}\n\n/**\n * Normalizes a {@link ImplicitAnnotatedAllowedTypes} to a set of {@link AnnotatedAllowedSchema}s, by eagerly evaluating any\n * lazy schema declarations and adding empty metadata if it doesn't already exist.\n *\n * @remarks Note: this must only be called after all required schemas have been declared, otherwise evaluation of\n * recursive schemas may fail.\n */\nexport function normalizeAnnotatedAllowedTypes(\n\ttypes: ImplicitAnnotatedAllowedTypes,\n): NormalizedAnnotatedAllowedTypes {\n\tconst typesWithoutAnnotation = isAnnotatedAllowedTypes(types) ? types.types : types;\n\tconst annotatedTypes: AnnotatedAllowedType<TreeNodeSchema>[] = [];\n\tif (isReadonlyArray(typesWithoutAnnotation)) {\n\t\tfor (const annotatedType of typesWithoutAnnotation) {\n\t\t\tif (isAnnotatedAllowedType(annotatedType)) {\n\t\t\t\tannotatedTypes.push({\n\t\t\t\t\ttype: evaluateLazySchema(annotatedType.type),\n\t\t\t\t\tmetadata: annotatedType.metadata,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tannotatedTypes.push({ type: evaluateLazySchema(annotatedType), metadata: {} });\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (isAnnotatedAllowedType(typesWithoutAnnotation)) {\n\t\t\tannotatedTypes.push({\n\t\t\t\ttype: evaluateLazySchema(typesWithoutAnnotation.type),\n\t\t\t\tmetadata: typesWithoutAnnotation.metadata,\n\t\t\t});\n\t\t} else {\n\t\t\tannotatedTypes.push({ type: evaluateLazySchema(typesWithoutAnnotation), metadata: {} });\n\t\t}\n\t}\n\n\treturn {\n\t\tmetadata: isAnnotatedAllowedTypes(types) ? types.metadata : {},\n\t\ttypes: annotatedTypes,\n\t};\n}\n\n/**\n * Converts an {@link ImplicitAnnotatedAllowedTypes} to an {@link ImplicitAllowedTypes}s, by removing\n * any annotations.\n * @remarks\n * This does not evaluate any lazy schemas.\n */\nexport function unannotateImplicitAllowedTypes<Types extends ImplicitAnnotatedAllowedTypes>(\n\ttypes: Types,\n): UnannotateImplicitAllowedTypes<Types> {\n\treturn (\n\t\tisAnnotatedAllowedTypes(types)\n\t\t\t? types.types.map((allowedType) =>\n\t\t\t\t\tisAnnotatedAllowedType(allowedType) ? allowedType.type : allowedType,\n\t\t\t\t)\n\t\t\t: isReadonlyArray(types)\n\t\t\t\t? types.map((allowedType) =>\n\t\t\t\t\t\tisAnnotatedAllowedType(allowedType) ? allowedType.type : allowedType,\n\t\t\t\t\t)\n\t\t\t\t: isAnnotatedAllowedType(types)\n\t\t\t\t\t? (types.type as UnannotateImplicitAllowedTypes<Types>)\n\t\t\t\t\t: types\n\t) as UnannotateImplicitAllowedTypes<Types>;\n}\n\nconst cachedLazyItem = new WeakMap<() => unknown, unknown>();\n\n/**\n * Returns the schema referenced by the {@link LazyItem}.\n * @remarks\n * Caches results to handle {@link LazyItem}s which compute their resulting schema.\n * @alpha\n */\nexport function evaluateLazySchema<T extends TreeNodeSchema>(value: LazyItem<T>): T {\n\tconst evaluatedSchema = isLazy(value)\n\t\t? (getOrCreate(cachedLazyItem, value, value) as T)\n\t\t: value;\n\tif (evaluatedSchema === undefined) {\n\t\tthrow new UsageError(\n\t\t\t`Encountered an undefined schema. This could indicate that some referenced schema has not yet been instantiated.`,\n\t\t);\n\t}\n\tmarkSchemaMostDerived(evaluatedSchema);\n\treturn evaluatedSchema;\n}\n\n/**\n * Indicates that the provided schema is the \"most derived\" version in its class hierarchy.\n *\n * @param oneTimeInitialize - If true this runs {@link TreeNodeValid.oneTimeInitialize} which does even more initialization and validation.\n * `oneTimeInitialize` can't safely be run until all transitively referenced schema are defined, so which cases can safely use it are more limited.\n * When legal for the caller to set this to true, it is preferred, but it is often not safe due to possible forward references.\n * @remarks\n * See {@link MostDerivedData} and {@link SchemaFactory} for details on what a \"most derived\" schema is and why it matters.\n *\n * This is a helper for invoking {@link TreeNodeValid.markMostDerived} for {@link TreeNodeSchema}.\n *\n * Calling this helps with error messages about invalid schema usage (See {@link SchemaFactory} for the rules, some of which this helps validate).\n * Typically this should be called for each schema as early as practical to improve error reporting for invalid usages of schema\n * (using two different schema derived from the same {@link SchemaFactory} produced base class).\n *\n * Note that construction of actual {@link TreeNode} instances or use of a schema transitively in a {@link TreeViewConfiguration} already do this,\n * so any calls to this that is unconditionally after that point for the given schema is not needed.\n * Instead most usages of this should be from those cases, and from miscellaneous cases where a schema is passed into an public API where theoretically someone could accidentally\n * pass in a base class of a schema instead of the most derived one.\n */\nexport function markSchemaMostDerived(\n\tschema: TreeNodeSchema,\n\toneTimeInitialize = false,\n): void {\n\t// Leaf schema are not classes, and thus do not need to be marked as most derived.\n\tif (schema.kind === NodeKind.Leaf) {\n\t\treturn;\n\t}\n\n\tconst schemaValid = schemaAsTreeNodeValid(schema);\n\n\tif (oneTimeInitialize) {\n\t\tschemaValid.oneTimeInitialize();\n\t} else {\n\t\tschemaValid.markMostDerived();\n\t}\n}\n\n/**\n * Type of tree node for a field of the given schema.\n * @public\n */\nexport type TreeNodeFromImplicitAllowedTypes<\n\tTSchema extends ImplicitAllowedTypes = TreeNodeSchema,\n> = TSchema extends TreeNodeSchema\n\t? NodeFromSchema<TSchema>\n\t: TSchema extends AllowedTypes\n\t\t? NodeFromSchema<FlexListToUnion<TSchema>>\n\t\t: unknown;\n\n/**\n * This type exists only to be linked from documentation to provide a single linkable place to document some details of\n * \"Input\" types and how they handle schema.\n *\n * When a schema is used to describe data which is an input into an API, the API is [contravariant](https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)) over the schema.\n * (See also, [TypeScript Variance Annotations](https://www.typescriptlang.org/docs/handbook/2/generics.html#variance-annotations)).\n *\n * Since these schema are expressed using TypeScript types, it is possible for the user of the API to provide non-exact values of these types which has implications that depended on the variance.\n *\n * Consider a field with schema type of `A | B` (where A and B are types of schema).\n *\n * - Reading the field behaves covariantly so {@link NodeFromSchema} of `<A | B>` is the same as `NodeFromSchema<A> | NodeFromSchema<B>`, indicating that either type of node can be read from the field.\n *\n * - Writing to the field behaves contravariantly. Since it is unknown if the node actually has a schema `A` or a schema `B`, the only legal values (known to be in schema regardless of which schema the underlying node has) are values which are legal for both `A & B`.\n *\n * Note that this is distinct from the case where the schema is `[A, B]`.\n * In this case it is known that the field allows both A and B (the field can be set to an A or a B value).\n * When `A | B` is used, the field might allow\n * A but not B (so assigning a B value would be out of schema),\n * B but not A (so assigning an A value would be out of schema)\n * or both A and B.\n *\n * This gets more extreme when given completely unspecified schema.\n * For example if a field is just provided {@link ImplicitFieldSchema}, nothing is known about the content of the field.\n * This means that reading the field (via {@link TreeFieldFromImplicitField}) can give any valid tree field content,\n * but there are no safe values which could be written to the field (since it is unknown what values would be out of schema) so {@link InsertableTreeFieldFromImplicitField} gives `never`.\n *\n * To implement this variance correctly, the computation of types for input and output have to use separate utilities\n * which take very different approaches when encountering non-exact schema like unions or `ImplicitFieldSchema`.\n * The utilities which behave contravariantly (as required to handle input correctly) link this documentation to indicate that this is how they behave.\n *\n * In addition to behaving contravariantly, these input type computation utilities often have further limitations.\n * This is due to TypeScript making it difficult to implement this contravariance exactly.\n * When faced with these implementation limitations these contravariant type computation utilities error on the side of producing overly strict requirements.\n * For example in the above case of `A | B`, the utilities might compute an allowed insertable type as `never` even if there happens to be a common value accepted by both `A` and `B`.\n * Future versions of the API can relax these requirements as the type computations are made more accurate.\n *\n * For a more concrete example: if {@link InsertableTreeFieldFromImplicitField} produced `never` for a schema `A | OptionalField<A>`,\n * a future version could instead return a more flexible but still safe type, like `A`.\n *\n * More generally: try to avoid providing non-exact schema, especially for the fields of other schema.\n * While these APIs attempt to handle such cases correctly, there are limitations and known bugs in this handling.\n * Code using non-exact schema is much more likely to have its compilation break due to updates of this package or even TypeScript,\n * and thus compilation breaks due to edge cases of non-exact schema handling, especially with recursive schema, are not considered breaking changes.\n * This may change as the API become more stable.\n *\n * @privateRemarks\n * There likely is a better way to share this documentation, but none was found at the time of writing.\n *\n * TODO: Once {@link InsertableField} is public, consider using it in the examples above.\n * @system @public\n */\nexport type Input<T extends never> = T;\n\n/**\n * Type of content that can be inserted into the tree for a node of the given schema.\n *\n * @see {@link Input}\n *\n * @typeparam TSchema - Schema to process.\n *\n * @privateRemarks\n * This is a bit overly conservative, since cases like `A | [A]` give never and could give `A`.\n * @public\n */\nexport type InsertableTreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes> =\n\t[TSchema] extends [TreeNodeSchema]\n\t\t? InsertableTypedNode<TSchema>\n\t\t: [TSchema] extends [AllowedTypes]\n\t\t\t? InsertableTreeNodeFromAllowedTypes<TSchema>\n\t\t\t: never;\n\n/**\n * Type of content that can be inserted into the tree for a node of the given schema.\n *\n * @see {@link Input}\n *\n * @typeparam TList - AllowedTypes to process\n *\n * @privateRemarks\n * This loop is manually unrolled to allow larger unions before hitting the recursion limit in TypeScript.\n * @system @public\n */\nexport type InsertableTreeNodeFromAllowedTypes<TList extends AllowedTypes> =\n\tIsUnion<TList> extends true\n\t\t? never\n\t\t: {\n\t\t\t\treadonly [Property in keyof TList]: TList[Property] extends LazyItem<\n\t\t\t\t\tinfer TSchema extends TreeNodeSchema\n\t\t\t\t>\n\t\t\t\t\t? InsertableTypedNode<TSchema>\n\t\t\t\t\t: never;\n\t\t\t}[number];\n"]}
@@ -2,16 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type TreeNodeSchemaIdentifier } from "../../core/index.js";
5
+ import type { TreeNodeSchemaIdentifier } from "../../core/index.js";
6
6
  import type { FlexTreeContext, FlexTreeHydratedContext } from "../../feature-libraries/index.js";
7
- import type { NormalizedAnnotatedAllowedTypes, TreeNodeSchema } from "./treeNodeSchema.js";
8
- /**
9
- * Creating multiple simple tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.
10
- * This slot is used to detect if one already exists and error if creating a second.
11
- * @remarks
12
- * See also {@link ContextSlot} in which the flex-tree context is stored.
13
- */
14
- export declare const SimpleContextSlot: import("../../core/index.js").AnchorSlot<HydratedContext>;
7
+ import type { NormalizedAnnotatedAllowedTypes } from "./allowedTypes.js";
8
+ import type { TreeNodeSchema } from "./treeNodeSchema.js";
15
9
  /**
16
10
  * Additional information about a collection of {@link TreeNode}s.
17
11
  * @remarks
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAc,KAAK,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EACX,eAAe,EACf,uBAAuB,EACvB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,KAAK,EAAE,+BAA+B,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG3F;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,2DAAgC,CAAC;AAE/D;;;;;;;;;;;;GAYG;AACH,qBAAa,OAAO;aAmBF,WAAW,EAAE,eAAe;IAlB7C;;;;;;;;OAQG;IACH,SAAgB,MAAM,EAAE,WAAW,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC;IAE9E;;;;OAIG;gBAEF,UAAU,EAAE,+BAA+B,EAC3B,WAAW,EAAE,eAAe;CAU7C;AAED;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,OAAO;aAGjB,WAAW,EAAE,uBAAuB;gBAD7D,UAAU,EAAE,+BAA+B,EAClB,WAAW,EAAE,uBAAuB;CAI9D"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,KAAK,EACX,eAAe,EACf,uBAAuB,EACvB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;;;;;;;;;;;GAYG;AACH,qBAAa,OAAO;aAmBF,WAAW,EAAE,eAAe;IAlB7C;;;;;;;;OAQG;IACH,SAAgB,MAAM,EAAE,WAAW,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC;IAE9E;;;;OAIG;gBAEF,UAAU,EAAE,+BAA+B,EAC3B,WAAW,EAAE,eAAe;CAU7C;AAED;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,OAAO;aAGjB,WAAW,EAAE,uBAAuB;gBAD7D,UAAU,EAAE,+BAA+B,EAClB,WAAW,EAAE,uBAAuB;CAI9D"}
@@ -4,17 +4,9 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.HydratedContext = exports.Context = exports.SimpleContextSlot = void 0;
8
- const index_js_1 = require("../../core/index.js");
9
- const index_js_2 = require("../../util/index.js");
7
+ exports.HydratedContext = exports.Context = void 0;
8
+ const index_js_1 = require("../../util/index.js");
10
9
  const walkSchema_js_1 = require("./walkSchema.js");
11
- /**
12
- * Creating multiple simple tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.
13
- * This slot is used to detect if one already exists and error if creating a second.
14
- * @remarks
15
- * See also {@link ContextSlot} in which the flex-tree context is stored.
16
- */
17
- exports.SimpleContextSlot = (0, index_js_1.anchorSlot)();
18
10
  /**
19
11
  * Additional information about a collection of {@link TreeNode}s.
20
12
  * @remarks
@@ -39,7 +31,7 @@ class Context {
39
31
  const schema = new Map();
40
32
  (0, walkSchema_js_1.walkAllowedTypes)(rootSchema, {
41
33
  node(nodeSchema) {
42
- schema.set((0, index_js_2.brand)(nodeSchema.identifier), nodeSchema);
34
+ schema.set((0, index_js_1.brand)(nodeSchema.identifier), nodeSchema);
43
35
  },
44
36
  });
45
37
  this.schema = schema;
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/simple-tree/core/context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kDAAgF;AAKhF,kDAA4C;AAG5C,mDAAmD;AAEnD;;;;;GAKG;AACU,QAAA,iBAAiB,GAAG,IAAA,qBAAU,GAAmB,CAAC;AAE/D;;;;;;;;;;;;GAYG;AACH,MAAa,OAAO;IAYnB;;;;OAIG;IACH,YACC,UAA2C,EAC3B,WAA4B;QAA5B,gBAAW,GAAX,WAAW,CAAiB;QAE5C,MAAM,MAAM,GAAkD,IAAI,GAAG,EAAE,CAAC;QACxE,IAAA,gCAAgB,EAAC,UAAU,EAAE;YAC5B,IAAI,CAAC,UAAU;gBACd,MAAM,CAAC,GAAG,CAAC,IAAA,gBAAK,EAAC,UAAU,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC;YACtD,CAAC;SACD,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;CACD;AA7BD,0BA6BC;AAED;;;GAGG;AACH,MAAa,eAAgB,SAAQ,OAAO;IAC3C,YACC,UAA2C,EAClB,WAAoC;QAE7D,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAFN,gBAAW,GAAX,WAAW,CAAyB;IAG9D,CAAC;CACD;AAPD,0CAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { anchorSlot, type TreeNodeSchemaIdentifier } from \"../../core/index.js\";\nimport type {\n\tFlexTreeContext,\n\tFlexTreeHydratedContext,\n} from \"../../feature-libraries/index.js\";\nimport { brand } from \"../../util/index.js\";\n\nimport type { NormalizedAnnotatedAllowedTypes, TreeNodeSchema } from \"./treeNodeSchema.js\";\nimport { walkAllowedTypes } from \"./walkSchema.js\";\n\n/**\n * Creating multiple simple tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.\n * This slot is used to detect if one already exists and error if creating a second.\n * @remarks\n * See also {@link ContextSlot} in which the flex-tree context is stored.\n */\nexport const SimpleContextSlot = anchorSlot<HydratedContext>();\n\n/**\n * Additional information about a collection of {@link TreeNode}s.\n * @remarks\n * Each TreeNode provides a way to navigate to a context for it with additional information.\n *\n * For unhydrated nodes, this information is rather limited since the node doesn't know what tree it might get inserted into (if any),\n * and thus is limited to information derived about that particular unhydrated tree and its schema.\n *\n * Hydrated nodes have more contextual information, and thus can provide a single {@link HydratedContext} for all nodes in the document which can have additional information.\n *\n * @privateRemarks\n * This design is the same as {@link FlexTreeContext} with its base type and {@link FlexTreeHydratedContext} extending it.\n */\nexport class Context {\n\t/**\n\t * All schema which could transitively be used under the associated node.\n\t * @remarks\n\t * While generally {@link TreeNodeSchema} are referenced as objects and thus do not need to be looked up by identifier,\n\t * there are a few cases (mainly constructing new TreeNodes from existing tree data) where such a lookup is useful.\n\t * Having this map in the context addresses this use-case.\n\t * @privateRemarks\n\t * This design mirrors how {@link FlexTreeSchema} are accessed off the {@link FlexTreeContext}, making the migration away from them simpler.\n\t */\n\tpublic readonly schema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeSchema>;\n\n\t/**\n\t * Builds the context.\n\t * @remarks\n\t * Since this walks the schema, it must not be invoked during schema declaration or schema forward references could fail to be resolved.\n\t */\n\tpublic constructor(\n\t\trootSchema: NormalizedAnnotatedAllowedTypes,\n\t\tpublic readonly flexContext: FlexTreeContext,\n\t) {\n\t\tconst schema: Map<TreeNodeSchemaIdentifier, TreeNodeSchema> = new Map();\n\t\twalkAllowedTypes(rootSchema, {\n\t\t\tnode(nodeSchema) {\n\t\t\t\tschema.set(brand(nodeSchema.identifier), nodeSchema);\n\t\t\t},\n\t\t});\n\t\tthis.schema = schema;\n\t}\n}\n\n/**\n * Extends {@link Context} with additional information from the view and/or tree which becomes known when a {@link TreeNode} is hydrated,\n * associating it with the containing {@link TreeView}.\n */\nexport class HydratedContext extends Context {\n\tpublic constructor(\n\t\trootSchema: NormalizedAnnotatedAllowedTypes,\n\t\tpublic override readonly flexContext: FlexTreeHydratedContext,\n\t) {\n\t\tsuper(rootSchema, flexContext);\n\t}\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/simple-tree/core/context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,kDAA4C;AAI5C,mDAAmD;AAEnD;;;;;;;;;;;;GAYG;AACH,MAAa,OAAO;IAYnB;;;;OAIG;IACH,YACC,UAA2C,EAC3B,WAA4B;QAA5B,gBAAW,GAAX,WAAW,CAAiB;QAE5C,MAAM,MAAM,GAAkD,IAAI,GAAG,EAAE,CAAC;QACxE,IAAA,gCAAgB,EAAC,UAAU,EAAE;YAC5B,IAAI,CAAC,UAAU;gBACd,MAAM,CAAC,GAAG,CAAC,IAAA,gBAAK,EAAC,UAAU,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC;YACtD,CAAC;SACD,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;CACD;AA7BD,0BA6BC;AAED;;;GAGG;AACH,MAAa,eAAgB,SAAQ,OAAO;IAC3C,YACC,UAA2C,EAClB,WAAoC;QAE7D,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAFN,gBAAW,GAAX,WAAW,CAAyB;IAG9D,CAAC;CACD;AAPD,0CAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TreeNodeSchemaIdentifier } from \"../../core/index.js\";\nimport type {\n\tFlexTreeContext,\n\tFlexTreeHydratedContext,\n} from \"../../feature-libraries/index.js\";\nimport { brand } from \"../../util/index.js\";\nimport type { NormalizedAnnotatedAllowedTypes } from \"./allowedTypes.js\";\n\nimport type { TreeNodeSchema } from \"./treeNodeSchema.js\";\nimport { walkAllowedTypes } from \"./walkSchema.js\";\n\n/**\n * Additional information about a collection of {@link TreeNode}s.\n * @remarks\n * Each TreeNode provides a way to navigate to a context for it with additional information.\n *\n * For unhydrated nodes, this information is rather limited since the node doesn't know what tree it might get inserted into (if any),\n * and thus is limited to information derived about that particular unhydrated tree and its schema.\n *\n * Hydrated nodes have more contextual information, and thus can provide a single {@link HydratedContext} for all nodes in the document which can have additional information.\n *\n * @privateRemarks\n * This design is the same as {@link FlexTreeContext} with its base type and {@link FlexTreeHydratedContext} extending it.\n */\nexport class Context {\n\t/**\n\t * All schema which could transitively be used under the associated node.\n\t * @remarks\n\t * While generally {@link TreeNodeSchema} are referenced as objects and thus do not need to be looked up by identifier,\n\t * there are a few cases (mainly constructing new TreeNodes from existing tree data) where such a lookup is useful.\n\t * Having this map in the context addresses this use-case.\n\t * @privateRemarks\n\t * This design mirrors how {@link FlexTreeSchema} are accessed off the {@link FlexTreeContext}, making the migration away from them simpler.\n\t */\n\tpublic readonly schema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeSchema>;\n\n\t/**\n\t * Builds the context.\n\t * @remarks\n\t * Since this walks the schema, it must not be invoked during schema declaration or schema forward references could fail to be resolved.\n\t */\n\tpublic constructor(\n\t\trootSchema: NormalizedAnnotatedAllowedTypes,\n\t\tpublic readonly flexContext: FlexTreeContext,\n\t) {\n\t\tconst schema: Map<TreeNodeSchemaIdentifier, TreeNodeSchema> = new Map();\n\t\twalkAllowedTypes(rootSchema, {\n\t\t\tnode(nodeSchema) {\n\t\t\t\tschema.set(brand(nodeSchema.identifier), nodeSchema);\n\t\t\t},\n\t\t});\n\t\tthis.schema = schema;\n\t}\n}\n\n/**\n * Extends {@link Context} with additional information from the view and/or tree which becomes known when a {@link TreeNode} is hydrated,\n * associating it with the containing {@link TreeView}.\n */\nexport class HydratedContext extends Context {\n\tpublic constructor(\n\t\trootSchema: NormalizedAnnotatedAllowedTypes,\n\t\tpublic override readonly flexContext: FlexTreeHydratedContext,\n\t) {\n\t\tsuper(rootSchema, flexContext);\n\t}\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flexList.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/flexList.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,gFAAgF;AAChF,wBAAgB,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,MAAM,IAAI,CAErE;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CASpC;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,CAAC,IAAI,GAAG,OAAO,IAAI,SAAS,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;AAEjE;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,CAAC,IAAI,GAAG,OAAO,IAAI,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;AAE3D;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,IAAI,SAAS,QAAQ,IAAI,IAAI,SAAS,MAAM,MAAM,MAAM,GACjF,MAAM,GACN,IAAI,CAAC;AAER;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,QAAQ,IAAI,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC"}