@fluidframework/tree 2.71.0 → 2.72.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 (603) hide show
  1. package/CHANGELOG.md +26 -40
  2. package/api-report/tree.alpha.api.md +27 -18
  3. package/api-report/tree.beta.api.md +42 -0
  4. package/api-report/tree.legacy.beta.api.md +42 -0
  5. package/dist/alpha.d.ts +9 -7
  6. package/dist/api.js +1 -1
  7. package/dist/api.js.map +1 -1
  8. package/dist/beta.d.ts +7 -0
  9. package/dist/codec/codec.d.ts +16 -1
  10. package/dist/codec/codec.d.ts.map +1 -1
  11. package/dist/codec/codec.js +16 -3
  12. package/dist/codec/codec.js.map +1 -1
  13. package/dist/core/index.d.ts +1 -1
  14. package/dist/core/index.d.ts.map +1 -1
  15. package/dist/core/index.js +2 -2
  16. package/dist/core/index.js.map +1 -1
  17. package/dist/core/schema-stored/index.d.ts +1 -1
  18. package/dist/core/schema-stored/index.d.ts.map +1 -1
  19. package/dist/core/schema-stored/index.js +2 -2
  20. package/dist/core/schema-stored/index.js.map +1 -1
  21. package/dist/core/schema-stored/schema.d.ts +6 -6
  22. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  23. package/dist/core/schema-stored/schema.js +6 -7
  24. package/dist/core/schema-stored/schema.js.map +1 -1
  25. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +2 -1
  26. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  27. package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  28. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts +1 -1
  29. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  30. package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -2
  31. package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  32. package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  33. package/dist/core/tree/detachedFieldIndexCodecV2.js +3 -1
  34. package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  35. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +2 -3
  36. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  37. package/dist/core/tree/detachedFieldIndexCodecs.js +29 -8
  38. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  39. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +10 -1
  40. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  41. package/dist/core/tree/detachedFieldIndexFormatCommon.js +8 -1
  42. package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  43. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts +2 -2
  44. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
  45. package/dist/core/tree/detachedFieldIndexFormatV1.js +3 -3
  46. package/dist/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
  47. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
  48. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  49. package/dist/core/tree/detachedFieldIndexFormatV2.js +3 -3
  50. package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  51. package/dist/core/tree/index.d.ts +2 -1
  52. package/dist/core/tree/index.d.ts.map +1 -1
  53. package/dist/core/tree/index.js.map +1 -1
  54. package/dist/external-utilities/typeboxValidator.js +1 -1
  55. package/dist/external-utilities/typeboxValidator.js.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -10
  57. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/codec/codecs.js +12 -8
  59. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  62. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +8 -3
  63. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/format.js +9 -4
  65. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  67. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/codec/index.js +1 -2
  69. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  71. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +1 -1
  72. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  73. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  74. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  75. package/dist/feature-libraries/chunked-forest/index.js +1 -2
  76. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  77. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -9
  78. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  79. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +3 -21
  80. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  81. package/dist/feature-libraries/forest-summary/codec.d.ts +4 -5
  82. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  83. package/dist/feature-libraries/forest-summary/codec.js +15 -4
  84. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  85. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  86. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  87. package/dist/feature-libraries/forest-summary/format.d.ts +8 -1
  88. package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
  89. package/dist/feature-libraries/forest-summary/format.js +8 -3
  90. package/dist/feature-libraries/forest-summary/format.js.map +1 -1
  91. package/dist/feature-libraries/forest-summary/index.d.ts +2 -1
  92. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  93. package/dist/feature-libraries/forest-summary/index.js +3 -1
  94. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  95. package/dist/feature-libraries/index.d.ts +3 -3
  96. package/dist/feature-libraries/index.d.ts.map +1 -1
  97. package/dist/feature-libraries/index.js +2 -2
  98. package/dist/feature-libraries/index.js.map +1 -1
  99. package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
  100. package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
  101. package/dist/feature-libraries/schema-edits/index.js.map +1 -1
  102. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -7
  103. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  104. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +5 -4
  105. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  106. package/dist/feature-libraries/schema-index/codec.d.ts +10 -10
  107. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  108. package/dist/feature-libraries/schema-index/codec.js +22 -18
  109. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  110. package/dist/feature-libraries/schema-index/formatV1.d.ts +2 -2
  111. package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  112. package/dist/feature-libraries/schema-index/formatV1.js +1 -1
  113. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
  114. package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -2
  115. package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  116. package/dist/feature-libraries/schema-index/formatV2.js +1 -1
  117. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
  118. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
  119. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  120. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  121. package/dist/index.d.ts +1 -1
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.js +3 -1
  124. package/dist/index.js.map +1 -1
  125. package/dist/legacy.d.ts +7 -0
  126. package/dist/packageVersion.d.ts +1 -1
  127. package/dist/packageVersion.js +1 -1
  128. package/dist/packageVersion.js.map +1 -1
  129. package/dist/shared-tree/independentView.d.ts +1 -1
  130. package/dist/shared-tree/independentView.d.ts.map +1 -1
  131. package/dist/shared-tree/independentView.js +22 -15
  132. package/dist/shared-tree/independentView.js.map +1 -1
  133. package/dist/shared-tree/sharedTree.d.ts +12 -16
  134. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  135. package/dist/shared-tree/sharedTree.js +87 -127
  136. package/dist/shared-tree/sharedTree.js.map +1 -1
  137. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +7 -6
  138. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  139. package/dist/shared-tree/sharedTreeChangeCodecs.js +12 -11
  140. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  141. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  142. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  143. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  144. package/dist/shared-tree/treeAlpha.d.ts +1 -1
  145. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  146. package/dist/shared-tree/treeAlpha.js +4 -2
  147. package/dist/shared-tree/treeAlpha.js.map +1 -1
  148. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  149. package/dist/shared-tree/treeCheckout.js +1 -3
  150. package/dist/shared-tree/treeCheckout.js.map +1 -1
  151. package/dist/shared-tree-core/editManagerCodecs.d.ts +19 -6
  152. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  153. package/dist/shared-tree-core/editManagerCodecs.js +35 -17
  154. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  155. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +37 -0
  156. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  157. package/dist/shared-tree-core/editManagerFormatCommons.js +43 -1
  158. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  159. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  160. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  161. package/dist/shared-tree-core/editManagerFormatV1toV4.js +4 -4
  162. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  163. package/dist/shared-tree-core/editManagerFormatV5.d.ts +2 -2
  164. package/dist/shared-tree-core/editManagerFormatV5.d.ts.map +1 -1
  165. package/dist/shared-tree-core/editManagerFormatV5.js +1 -1
  166. package/dist/shared-tree-core/editManagerFormatV5.js.map +1 -1
  167. package/dist/shared-tree-core/index.d.ts +5 -3
  168. package/dist/shared-tree-core/index.d.ts.map +1 -1
  169. package/dist/shared-tree-core/index.js +11 -3
  170. package/dist/shared-tree-core/index.js.map +1 -1
  171. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -1
  172. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  173. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  174. package/dist/shared-tree-core/messageCodecV5.d.ts +2 -1
  175. package/dist/shared-tree-core/messageCodecV5.d.ts.map +1 -1
  176. package/dist/shared-tree-core/messageCodecV5.js.map +1 -1
  177. package/dist/shared-tree-core/messageCodecs.d.ts +19 -6
  178. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  179. package/dist/shared-tree-core/messageCodecs.js +38 -21
  180. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  181. package/dist/shared-tree-core/messageFormat.d.ts +50 -0
  182. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -0
  183. package/dist/shared-tree-core/messageFormat.js +51 -0
  184. package/dist/shared-tree-core/messageFormat.js.map +1 -0
  185. package/dist/shared-tree-core/sharedTreeCore.d.ts +8 -8
  186. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  187. package/dist/shared-tree-core/sharedTreeCore.js +3 -3
  188. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  189. package/dist/simple-tree/api/discrepancies.d.ts +2 -2
  190. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  191. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  192. package/dist/simple-tree/api/incrementalAllowedTypes.js +1 -1
  193. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  194. package/dist/simple-tree/api/index.d.ts +3 -2
  195. package/dist/simple-tree/api/index.d.ts.map +1 -1
  196. package/dist/simple-tree/api/index.js +4 -1
  197. package/dist/simple-tree/api/index.js.map +1 -1
  198. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +2 -98
  199. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  200. package/dist/simple-tree/api/schemaFactoryAlpha.js +1 -52
  201. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  202. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +98 -2
  203. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  204. package/dist/simple-tree/api/schemaFactoryBeta.js +61 -7
  205. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  206. package/dist/simple-tree/api/schemaFromSimple.js +6 -3
  207. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  208. package/dist/simple-tree/api/simpleSchemaCodec.d.ts +28 -0
  209. package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -0
  210. package/dist/simple-tree/api/simpleSchemaCodec.js +292 -0
  211. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -0
  212. package/dist/simple-tree/api/storedSchema.d.ts +2 -2
  213. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  214. package/dist/simple-tree/api/storedSchema.js +8 -6
  215. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  216. package/dist/simple-tree/api/tree.d.ts +2 -2
  217. package/dist/simple-tree/api/tree.js.map +1 -1
  218. package/dist/simple-tree/api/typesUnsafe.d.ts +6 -6
  219. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  220. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +18 -3
  221. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  222. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +78 -35
  223. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  224. package/dist/simple-tree/core/allowedTypes.d.ts +3 -3
  225. package/dist/simple-tree/core/allowedTypes.js +1 -1
  226. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  227. package/dist/simple-tree/core/treeNode.js +1 -1
  228. package/dist/simple-tree/core/treeNode.js.map +1 -1
  229. package/dist/simple-tree/index.d.ts +2 -1
  230. package/dist/simple-tree/index.d.ts.map +1 -1
  231. package/dist/simple-tree/index.js +4 -0
  232. package/dist/simple-tree/index.js.map +1 -1
  233. package/dist/simple-tree/node-kinds/array/arrayNode.js +1 -1
  234. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  235. package/dist/simple-tree/node-kinds/map/mapNode.js +1 -1
  236. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  237. package/dist/simple-tree/node-kinds/object/objectNode.js +2 -2
  238. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  239. package/dist/simple-tree/node-kinds/record/recordNode.js +2 -2
  240. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  241. package/dist/simple-tree/simpleSchema.d.ts +11 -3
  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/simpleSchemaFormatV1.d.ts +249 -0
  245. package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -0
  246. package/dist/simple-tree/simpleSchemaFormatV1.js +115 -0
  247. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -0
  248. package/dist/tableSchema.d.ts.map +1 -1
  249. package/dist/tableSchema.js +1 -1
  250. package/dist/tableSchema.js.map +1 -1
  251. package/dist/treeFactory.d.ts +3 -1
  252. package/dist/treeFactory.d.ts.map +1 -1
  253. package/dist/treeFactory.js +26 -2
  254. package/dist/treeFactory.js.map +1 -1
  255. package/dist/util/brand.d.ts +31 -2
  256. package/dist/util/brand.d.ts.map +1 -1
  257. package/dist/util/brand.js +28 -2
  258. package/dist/util/brand.js.map +1 -1
  259. package/dist/util/brandedMap.d.ts +3 -1
  260. package/dist/util/brandedMap.d.ts.map +1 -1
  261. package/dist/util/brandedMap.js.map +1 -1
  262. package/dist/util/index.d.ts +1 -1
  263. package/dist/util/index.d.ts.map +1 -1
  264. package/dist/util/index.js +3 -2
  265. package/dist/util/index.js.map +1 -1
  266. package/lib/alpha.d.ts +9 -7
  267. package/lib/api.js +2 -2
  268. package/lib/api.js.map +1 -1
  269. package/lib/beta.d.ts +7 -0
  270. package/lib/codec/codec.d.ts +16 -1
  271. package/lib/codec/codec.d.ts.map +1 -1
  272. package/lib/codec/codec.js +16 -3
  273. package/lib/codec/codec.js.map +1 -1
  274. package/lib/core/index.d.ts +1 -1
  275. package/lib/core/index.d.ts.map +1 -1
  276. package/lib/core/index.js +1 -1
  277. package/lib/core/index.js.map +1 -1
  278. package/lib/core/schema-stored/index.d.ts +1 -1
  279. package/lib/core/schema-stored/index.d.ts.map +1 -1
  280. package/lib/core/schema-stored/index.js +1 -1
  281. package/lib/core/schema-stored/index.js.map +1 -1
  282. package/lib/core/schema-stored/schema.d.ts +6 -6
  283. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  284. package/lib/core/schema-stored/schema.js +6 -7
  285. package/lib/core/schema-stored/schema.js.map +1 -1
  286. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +2 -1
  287. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  288. package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  289. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts +1 -1
  290. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  291. package/lib/core/tree/detachedFieldIndexCodecV1.js +3 -2
  292. package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  293. package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  294. package/lib/core/tree/detachedFieldIndexCodecV2.js +4 -2
  295. package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  296. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +2 -3
  297. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  298. package/lib/core/tree/detachedFieldIndexCodecs.js +29 -8
  299. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  300. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +10 -1
  301. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  302. package/lib/core/tree/detachedFieldIndexFormatCommon.js +7 -0
  303. package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  304. package/lib/core/tree/detachedFieldIndexFormatV1.d.ts +2 -2
  305. package/lib/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
  306. package/lib/core/tree/detachedFieldIndexFormatV1.js +3 -3
  307. package/lib/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
  308. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
  309. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  310. package/lib/core/tree/detachedFieldIndexFormatV2.js +3 -3
  311. package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  312. package/lib/core/tree/index.d.ts +2 -1
  313. package/lib/core/tree/index.d.ts.map +1 -1
  314. package/lib/core/tree/index.js +1 -1
  315. package/lib/core/tree/index.js.map +1 -1
  316. package/lib/external-utilities/typeboxValidator.js +1 -1
  317. package/lib/external-utilities/typeboxValidator.js.map +1 -1
  318. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -10
  319. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  320. package/lib/feature-libraries/chunked-forest/codec/codecs.js +13 -8
  321. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  322. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +2 -2
  323. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  324. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +8 -3
  325. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  326. package/lib/feature-libraries/chunked-forest/codec/format.js +8 -3
  327. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  328. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  329. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  330. package/lib/feature-libraries/chunked-forest/codec/index.js +2 -2
  331. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  332. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  333. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +2 -2
  334. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  335. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  336. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  337. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  338. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  339. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -9
  340. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  341. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +2 -20
  342. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  343. package/lib/feature-libraries/forest-summary/codec.d.ts +4 -5
  344. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  345. package/lib/feature-libraries/forest-summary/codec.js +16 -5
  346. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  347. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  348. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  349. package/lib/feature-libraries/forest-summary/format.d.ts +8 -1
  350. package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
  351. package/lib/feature-libraries/forest-summary/format.js +7 -2
  352. package/lib/feature-libraries/forest-summary/format.js.map +1 -1
  353. package/lib/feature-libraries/forest-summary/index.d.ts +2 -1
  354. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  355. package/lib/feature-libraries/forest-summary/index.js +1 -0
  356. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  357. package/lib/feature-libraries/index.d.ts +3 -3
  358. package/lib/feature-libraries/index.d.ts.map +1 -1
  359. package/lib/feature-libraries/index.js +2 -2
  360. package/lib/feature-libraries/index.js.map +1 -1
  361. package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
  362. package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
  363. package/lib/feature-libraries/schema-edits/index.js.map +1 -1
  364. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -7
  365. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  366. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +6 -5
  367. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  368. package/lib/feature-libraries/schema-index/codec.d.ts +10 -10
  369. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  370. package/lib/feature-libraries/schema-index/codec.js +24 -20
  371. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  372. package/lib/feature-libraries/schema-index/formatV1.d.ts +2 -2
  373. package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  374. package/lib/feature-libraries/schema-index/formatV1.js +2 -2
  375. package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
  376. package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -2
  377. package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  378. package/lib/feature-libraries/schema-index/formatV2.js +2 -2
  379. package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
  380. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
  381. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  382. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  383. package/lib/index.d.ts +1 -1
  384. package/lib/index.d.ts.map +1 -1
  385. package/lib/index.js +1 -1
  386. package/lib/index.js.map +1 -1
  387. package/lib/legacy.d.ts +7 -0
  388. package/lib/packageVersion.d.ts +1 -1
  389. package/lib/packageVersion.js +1 -1
  390. package/lib/packageVersion.js.map +1 -1
  391. package/lib/shared-tree/independentView.d.ts +1 -1
  392. package/lib/shared-tree/independentView.d.ts.map +1 -1
  393. package/lib/shared-tree/independentView.js +11 -4
  394. package/lib/shared-tree/independentView.js.map +1 -1
  395. package/lib/shared-tree/sharedTree.d.ts +12 -16
  396. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  397. package/lib/shared-tree/sharedTree.js +90 -130
  398. package/lib/shared-tree/sharedTree.js.map +1 -1
  399. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +7 -6
  400. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  401. package/lib/shared-tree/sharedTreeChangeCodecs.js +7 -6
  402. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  403. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  404. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  405. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  406. package/lib/shared-tree/treeAlpha.d.ts +1 -1
  407. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  408. package/lib/shared-tree/treeAlpha.js +5 -3
  409. package/lib/shared-tree/treeAlpha.js.map +1 -1
  410. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  411. package/lib/shared-tree/treeCheckout.js +1 -3
  412. package/lib/shared-tree/treeCheckout.js.map +1 -1
  413. package/lib/shared-tree-core/editManagerCodecs.d.ts +19 -6
  414. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  415. package/lib/shared-tree-core/editManagerCodecs.js +32 -16
  416. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  417. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +37 -0
  418. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  419. package/lib/shared-tree-core/editManagerFormatCommons.js +42 -0
  420. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  421. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  422. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  423. package/lib/shared-tree-core/editManagerFormatV1toV4.js +5 -5
  424. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  425. package/lib/shared-tree-core/editManagerFormatV5.d.ts +2 -2
  426. package/lib/shared-tree-core/editManagerFormatV5.d.ts.map +1 -1
  427. package/lib/shared-tree-core/editManagerFormatV5.js +2 -2
  428. package/lib/shared-tree-core/editManagerFormatV5.js.map +1 -1
  429. package/lib/shared-tree-core/index.d.ts +5 -3
  430. package/lib/shared-tree-core/index.d.ts.map +1 -1
  431. package/lib/shared-tree-core/index.js +4 -2
  432. package/lib/shared-tree-core/index.js.map +1 -1
  433. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -1
  434. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  435. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  436. package/lib/shared-tree-core/messageCodecV5.d.ts +2 -1
  437. package/lib/shared-tree-core/messageCodecV5.d.ts.map +1 -1
  438. package/lib/shared-tree-core/messageCodecV5.js.map +1 -1
  439. package/lib/shared-tree-core/messageCodecs.d.ts +19 -6
  440. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  441. package/lib/shared-tree-core/messageCodecs.js +35 -20
  442. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  443. package/lib/shared-tree-core/messageFormat.d.ts +50 -0
  444. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -0
  445. package/lib/shared-tree-core/messageFormat.js +48 -0
  446. package/lib/shared-tree-core/messageFormat.js.map +1 -0
  447. package/lib/shared-tree-core/sharedTreeCore.d.ts +8 -8
  448. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  449. package/lib/shared-tree-core/sharedTreeCore.js +3 -3
  450. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  451. package/lib/simple-tree/api/discrepancies.d.ts +2 -2
  452. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  453. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  454. package/lib/simple-tree/api/incrementalAllowedTypes.js +1 -1
  455. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  456. package/lib/simple-tree/api/index.d.ts +3 -2
  457. package/lib/simple-tree/api/index.d.ts.map +1 -1
  458. package/lib/simple-tree/api/index.js +1 -0
  459. package/lib/simple-tree/api/index.js.map +1 -1
  460. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +2 -98
  461. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  462. package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -52
  463. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  464. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +98 -2
  465. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  466. package/lib/simple-tree/api/schemaFactoryBeta.js +58 -4
  467. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  468. package/lib/simple-tree/api/schemaFromSimple.js +6 -3
  469. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  470. package/lib/simple-tree/api/simpleSchemaCodec.d.ts +28 -0
  471. package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -0
  472. package/lib/simple-tree/api/simpleSchemaCodec.js +264 -0
  473. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -0
  474. package/lib/simple-tree/api/storedSchema.d.ts +2 -2
  475. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  476. package/lib/simple-tree/api/storedSchema.js +5 -3
  477. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  478. package/lib/simple-tree/api/tree.d.ts +2 -2
  479. package/lib/simple-tree/api/tree.js.map +1 -1
  480. package/lib/simple-tree/api/typesUnsafe.d.ts +6 -6
  481. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  482. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +18 -3
  483. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  484. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +75 -34
  485. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  486. package/lib/simple-tree/core/allowedTypes.d.ts +3 -3
  487. package/lib/simple-tree/core/allowedTypes.js +1 -1
  488. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  489. package/lib/simple-tree/core/treeNode.js +1 -1
  490. package/lib/simple-tree/core/treeNode.js.map +1 -1
  491. package/lib/simple-tree/index.d.ts +2 -1
  492. package/lib/simple-tree/index.d.ts.map +1 -1
  493. package/lib/simple-tree/index.js +1 -0
  494. package/lib/simple-tree/index.js.map +1 -1
  495. package/lib/simple-tree/node-kinds/array/arrayNode.js +2 -2
  496. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  497. package/lib/simple-tree/node-kinds/map/mapNode.js +2 -2
  498. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  499. package/lib/simple-tree/node-kinds/object/objectNode.js +3 -3
  500. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  501. package/lib/simple-tree/node-kinds/record/recordNode.js +3 -3
  502. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  503. package/lib/simple-tree/simpleSchema.d.ts +11 -3
  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/simpleSchemaFormatV1.d.ts +249 -0
  507. package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -0
  508. package/lib/simple-tree/simpleSchemaFormatV1.js +112 -0
  509. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -0
  510. package/lib/tableSchema.d.ts.map +1 -1
  511. package/lib/tableSchema.js +1 -1
  512. package/lib/tableSchema.js.map +1 -1
  513. package/lib/treeFactory.d.ts +3 -1
  514. package/lib/treeFactory.d.ts.map +1 -1
  515. package/lib/treeFactory.js +23 -1
  516. package/lib/treeFactory.js.map +1 -1
  517. package/lib/util/brand.d.ts +31 -2
  518. package/lib/util/brand.d.ts.map +1 -1
  519. package/lib/util/brand.js +26 -1
  520. package/lib/util/brand.js.map +1 -1
  521. package/lib/util/brandedMap.d.ts +3 -1
  522. package/lib/util/brandedMap.d.ts.map +1 -1
  523. package/lib/util/brandedMap.js.map +1 -1
  524. package/lib/util/index.d.ts +1 -1
  525. package/lib/util/index.d.ts.map +1 -1
  526. package/lib/util/index.js +1 -1
  527. package/lib/util/index.js.map +1 -1
  528. package/package.json +24 -24
  529. package/src/api.ts +2 -2
  530. package/src/codec/codec.ts +17 -3
  531. package/src/core/index.ts +1 -2
  532. package/src/core/schema-stored/index.ts +1 -2
  533. package/src/core/schema-stored/schema.ts +10 -7
  534. package/src/core/tree/detachedFieldIndexCodecCommon.ts +2 -1
  535. package/src/core/tree/detachedFieldIndexCodecV1.ts +4 -2
  536. package/src/core/tree/detachedFieldIndexCodecV2.ts +4 -6
  537. package/src/core/tree/detachedFieldIndexCodecs.ts +33 -11
  538. package/src/core/tree/detachedFieldIndexFormatCommon.ts +17 -2
  539. package/src/core/tree/detachedFieldIndexFormatV1.ts +6 -4
  540. package/src/core/tree/detachedFieldIndexFormatV2.ts +6 -4
  541. package/src/core/tree/index.ts +2 -4
  542. package/src/external-utilities/typeboxValidator.ts +1 -1
  543. package/src/feature-libraries/chunked-forest/codec/codecs.ts +18 -13
  544. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +2 -2
  545. package/src/feature-libraries/chunked-forest/codec/format.ts +15 -4
  546. package/src/feature-libraries/chunked-forest/codec/index.ts +4 -2
  547. package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +2 -2
  548. package/src/feature-libraries/chunked-forest/index.ts +0 -1
  549. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +2 -29
  550. package/src/feature-libraries/forest-summary/codec.ts +24 -9
  551. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -1
  552. package/src/feature-libraries/forest-summary/format.ts +12 -2
  553. package/src/feature-libraries/forest-summary/index.ts +2 -1
  554. package/src/feature-libraries/index.ts +1 -2
  555. package/src/feature-libraries/schema-edits/index.ts +0 -1
  556. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +16 -16
  557. package/src/feature-libraries/schema-index/codec.ts +34 -22
  558. package/src/feature-libraries/schema-index/formatV1.ts +2 -2
  559. package/src/feature-libraries/schema-index/formatV2.ts +2 -2
  560. package/src/feature-libraries/schema-index/schemaSummarizer.ts +2 -1
  561. package/src/index.ts +3 -1
  562. package/src/packageVersion.ts +1 -1
  563. package/src/shared-tree/independentView.ts +16 -5
  564. package/src/shared-tree/sharedTree.ts +112 -172
  565. package/src/shared-tree/sharedTreeChangeCodecs.ts +15 -9
  566. package/src/shared-tree/sharedTreeChangeFamily.ts +2 -2
  567. package/src/shared-tree/treeAlpha.ts +6 -5
  568. package/src/shared-tree/treeCheckout.ts +1 -3
  569. package/src/shared-tree-core/editManagerCodecs.ts +56 -19
  570. package/src/shared-tree-core/editManagerFormatCommons.ts +47 -0
  571. package/src/shared-tree-core/editManagerFormatV1toV4.ts +10 -5
  572. package/src/shared-tree-core/editManagerFormatV5.ts +3 -3
  573. package/src/shared-tree-core/index.ts +11 -5
  574. package/src/shared-tree-core/messageCodecV1ToV4.ts +6 -1
  575. package/src/shared-tree-core/messageCodecV5.ts +2 -1
  576. package/src/shared-tree-core/messageCodecs.ts +60 -26
  577. package/src/shared-tree-core/messageFormat.ts +56 -0
  578. package/src/shared-tree-core/sharedTreeCore.ts +11 -13
  579. package/src/simple-tree/api/discrepancies.ts +2 -2
  580. package/src/simple-tree/api/incrementalAllowedTypes.ts +1 -1
  581. package/src/simple-tree/api/index.ts +6 -2
  582. package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -168
  583. package/src/simple-tree/api/schemaFactoryBeta.ts +180 -14
  584. package/src/simple-tree/api/schemaFromSimple.ts +6 -3
  585. package/src/simple-tree/api/simpleSchemaCodec.ts +360 -0
  586. package/src/simple-tree/api/storedSchema.ts +8 -5
  587. package/src/simple-tree/api/tree.ts +2 -2
  588. package/src/simple-tree/api/typesUnsafe.ts +6 -6
  589. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +80 -47
  590. package/src/simple-tree/core/allowedTypes.ts +3 -3
  591. package/src/simple-tree/core/treeNode.ts +2 -2
  592. package/src/simple-tree/index.ts +5 -1
  593. package/src/simple-tree/node-kinds/array/arrayNode.ts +2 -2
  594. package/src/simple-tree/node-kinds/map/mapNode.ts +2 -2
  595. package/src/simple-tree/node-kinds/object/objectNode.ts +3 -3
  596. package/src/simple-tree/node-kinds/record/recordNode.ts +3 -3
  597. package/src/simple-tree/simpleSchema.ts +12 -3
  598. package/src/simple-tree/simpleSchemaFormatV1.ts +179 -0
  599. package/src/tableSchema.ts +5 -2
  600. package/src/treeFactory.ts +33 -1
  601. package/src/util/brand.ts +40 -2
  602. package/src/util/brandedMap.ts +3 -1
  603. package/src/util/index.ts +1 -0
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.toSimpleTreeSchema = void 0;
7
+ exports.copySimpleTreeSchemaWithoutMetadata = exports.copySimpleNodeSchema = exports.toSimpleTreeSchema = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const fieldSchema_js_1 = require("../fieldSchema.js");
10
10
  const index_js_1 = require("../core/index.js");
@@ -16,7 +16,6 @@ const leafNodeSchema_js_1 = require("../leafNodeSchema.js");
16
16
  *
17
17
  * @param schema - The schema to convert
18
18
  * @param copySchemaObjects - If true, TreeNodeSchema and FieldSchema are copied into plain JavaScript objects. Either way, custom metadata is referenced and not copied.
19
- * @param isViewSchema - If true (default), properties used by view schema but not part of stored schema (for example, `isStaged` on allowed types) are preserved in the output.
20
19
  *
21
20
  * @remarks
22
21
  * Given that the Schema types used in {@link ImplicitFieldSchema} already implement the {@link SimpleNodeSchema} interfaces, there are limited use-cases for this function.
@@ -28,7 +27,7 @@ const leafNodeSchema_js_1 = require("../leafNodeSchema.js");
28
27
  * TODO: once SimpleTreeSchema is stable, {@link TreeViewConfiguration} could implement {@link SimpleTreeSchema} directly.
29
28
  * That would provide the non-copying alternative that could expose the value type of the definitions map as {@link TreeNodeSchema}.
30
29
  */
31
- function toSimpleTreeSchema(schema, copySchemaObjects, isViewSchema = true) {
30
+ function toSimpleTreeSchema(schema, copySchemaObjects) {
32
31
  const normalizedSchema = (0, fieldSchema_js_1.normalizeFieldSchema)(schema);
33
32
  const definitions = new Map();
34
33
  (0, walkFieldSchema_js_1.walkFieldSchema)(normalizedSchema, {
@@ -39,16 +38,14 @@ function toSimpleTreeSchema(schema, copySchemaObjects, isViewSchema = true) {
39
38
  nodeSchema instanceof leafNodeSchema_js_1.LeafNodeSchema ||
40
39
  nodeSchema instanceof index_js_2.ObjectNodeSchema ||
41
40
  nodeSchema instanceof index_js_2.RecordNodeSchema, 0xb60 /* Invalid schema */);
42
- const outSchema = copySchemaObjects
43
- ? copySimpleNodeSchema(nodeSchema, isViewSchema)
44
- : nodeSchema;
41
+ const outSchema = copySchemaObjects ? copySimpleNodeSchema(nodeSchema) : nodeSchema;
45
42
  definitions.set(nodeSchema.identifier, outSchema);
46
43
  },
47
44
  });
48
45
  return {
49
46
  root: copySchemaObjects
50
47
  ? ({
51
- simpleAllowedTypes: normalizeSimpleAllowedTypes(normalizedSchema.simpleAllowedTypes, isViewSchema),
48
+ simpleAllowedTypes: normalizedSchema.simpleAllowedTypes,
52
49
  kind: normalizedSchema.kind,
53
50
  metadata: normalizedSchema.metadata,
54
51
  persistedMetadata: normalizedSchema.persistedMetadata,
@@ -58,30 +55,12 @@ function toSimpleTreeSchema(schema, copySchemaObjects, isViewSchema = true) {
58
55
  };
59
56
  }
60
57
  exports.toSimpleTreeSchema = toSimpleTreeSchema;
61
- /**
62
- * Normalizes the {@link SimpleAllowedTypeAttributes} by either preserving or omitting view-specific schema properties.
63
- * @param simpleAllowedTypes - The simple allowed types to normalize.
64
- * @param isViewSchema - If true, properties used by view schema but not part of stored schema (for example, `isStaged` on allowed types) are preserved in the output.
65
- * @returns The normalized simple allowed types.
66
- */
67
- function normalizeSimpleAllowedTypes(simpleAllowedTypes, isViewSchema) {
68
- if (isViewSchema) {
69
- return simpleAllowedTypes;
70
- }
71
- else {
72
- const normalized = new Map();
73
- for (const [identifier, attributes] of simpleAllowedTypes.entries()) {
74
- normalized.set(identifier, { ...attributes, isStaged: undefined });
75
- }
76
- return normalized;
77
- }
78
- }
79
58
  /**
80
59
  * Copies a {@link SimpleNodeSchema} into a new plain JavaScript object.
81
60
  *
82
61
  * @remarks Caches the result on the input schema for future calls.
83
62
  */
84
- function copySimpleNodeSchema(schema, isViewSchema) {
63
+ function copySimpleNodeSchema(schema) {
85
64
  const kind = schema.kind;
86
65
  switch (kind) {
87
66
  case index_js_1.NodeKind.Leaf:
@@ -89,13 +68,14 @@ function copySimpleNodeSchema(schema, isViewSchema) {
89
68
  case index_js_1.NodeKind.Array:
90
69
  case index_js_1.NodeKind.Map:
91
70
  case index_js_1.NodeKind.Record:
92
- return copySimpleSchemaWithAllowedTypes(schema, isViewSchema);
71
+ return copySimpleSchemaWithAllowedTypes(schema);
93
72
  case index_js_1.NodeKind.Object:
94
- return copySimpleObjectSchema(schema, isViewSchema);
73
+ return copySimpleObjectSchema(schema);
95
74
  default:
96
75
  (0, internal_1.unreachableCase)(kind);
97
76
  }
98
77
  }
78
+ exports.copySimpleNodeSchema = copySimpleNodeSchema;
99
79
  function copySimpleLeafSchema(schema) {
100
80
  return {
101
81
  kind: index_js_1.NodeKind.Leaf,
@@ -104,31 +84,94 @@ function copySimpleLeafSchema(schema) {
104
84
  persistedMetadata: schema.persistedMetadata,
105
85
  };
106
86
  }
107
- function copySimpleSchemaWithAllowedTypes(schema, isViewSchema) {
87
+ function copySimpleSchemaWithAllowedTypes(schema) {
108
88
  return {
109
89
  kind: schema.kind,
110
- simpleAllowedTypes: normalizeSimpleAllowedTypes(schema.simpleAllowedTypes, isViewSchema),
90
+ simpleAllowedTypes: schema.simpleAllowedTypes,
111
91
  metadata: schema.metadata,
112
92
  persistedMetadata: schema.persistedMetadata,
113
93
  };
114
94
  }
115
- function copySimpleObjectSchema(schema, isViewSchema) {
95
+ function copySimpleObjectSchema(schema) {
116
96
  const fields = new Map();
117
97
  for (const [propertyKey, field] of schema.fields) {
118
98
  // field already is a SimpleObjectFieldSchema, but copy the subset of the properties needed by this interface to get a clean simple object.
119
- fields.set(propertyKey, {
99
+ const simpleField = {
120
100
  kind: field.kind,
121
- simpleAllowedTypes: normalizeSimpleAllowedTypes(field.simpleAllowedTypes, isViewSchema),
101
+ simpleAllowedTypes: field.simpleAllowedTypes,
122
102
  metadata: field.metadata,
123
103
  persistedMetadata: field.persistedMetadata,
124
104
  storedKey: field.storedKey,
125
- });
105
+ };
106
+ fields.set(propertyKey, simpleField);
126
107
  }
127
- return {
108
+ const simpleObject = {
128
109
  kind: index_js_1.NodeKind.Object,
129
110
  fields,
130
111
  metadata: schema.metadata,
131
112
  persistedMetadata: schema.persistedMetadata,
113
+ allowUnknownOptionalFields: schema.allowUnknownOptionalFields,
114
+ };
115
+ return simpleObject;
116
+ }
117
+ /**
118
+ * Creates a copy of a SimpleTreeSchema without metadata fields. This is useful for comparing deserialized view schemas with in-memory schemas.
119
+ * metadata and persistedMetadata are not relevant for schema compatibility checks and are not serialized by the Simple Schema serializer.
120
+ * @see {@link simpleSchemaSerializer.ts} for the serialization logic.
121
+ *
122
+ * @param schema - The SimpleTreeSchema to remove fields from.
123
+ * @param fieldsToRemove - An object specifying which fields to remove.
124
+ * @returns A new SimpleTreeSchema without the specified fields.
125
+ */
126
+ function copySimpleTreeSchemaWithoutMetadata(schema) {
127
+ const definitions = new Map();
128
+ for (const [identifier, nodeSchema] of schema.definitions.entries()) {
129
+ const kind = nodeSchema.kind;
130
+ switch (kind) {
131
+ case index_js_1.NodeKind.Array:
132
+ case index_js_1.NodeKind.Map:
133
+ case index_js_1.NodeKind.Record:
134
+ case index_js_1.NodeKind.Leaf: {
135
+ const outputNodeSchema = {
136
+ ...nodeSchema,
137
+ metadata: {},
138
+ persistedMetadata: undefined,
139
+ };
140
+ definitions.set(identifier, outputNodeSchema);
141
+ break;
142
+ }
143
+ case index_js_1.NodeKind.Object: {
144
+ const outputFields = new Map();
145
+ for (const [propertyKey, fieldSchema] of nodeSchema.fields.entries()) {
146
+ const outputField = {
147
+ ...fieldSchema,
148
+ metadata: {},
149
+ persistedMetadata: undefined,
150
+ };
151
+ outputFields.set(propertyKey, outputField);
152
+ }
153
+ const outputNodeSchema = {
154
+ ...nodeSchema,
155
+ metadata: {},
156
+ persistedMetadata: undefined,
157
+ fields: outputFields,
158
+ };
159
+ definitions.set(identifier, outputNodeSchema);
160
+ break;
161
+ }
162
+ default:
163
+ (0, internal_1.unreachableCase)(kind);
164
+ }
165
+ }
166
+ return {
167
+ root: {
168
+ kind: schema.root.kind,
169
+ simpleAllowedTypes: schema.root.simpleAllowedTypes,
170
+ metadata: {},
171
+ persistedMetadata: undefined,
172
+ },
173
+ definitions,
132
174
  };
133
175
  }
176
+ exports.copySimpleTreeSchemaWithoutMetadata = copySimpleTreeSchemaWithoutMetadata;
134
177
  //# sourceMappingURL=viewSchemaToSimpleSchema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"viewSchemaToSimpleSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/viewSchemaToSimpleSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAC9E,sDAAmF;AAanF,+CAA4C;AAC5C,qDAKgC;AAChC,8DAAwD;AACxD,4DAAsD;AAEtD;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,kBAAkB,CACjC,MAA2B,EAC3B,iBAA0B,EAC1B,eAAwB,IAAI;IAE5B,MAAM,gBAAgB,GAAG,IAAA,qCAAoB,EAAC,MAAM,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,IAAI,GAAG,EAA4B,CAAC;IACxD,IAAA,oCAAe,EAAC,gBAAgB,EAAE;QACjC,IAAI,EAAE,CAAC,UAAU,EAAE,EAAE;YACpB,iJAAiJ;YACjJ,IAAA,iBAAM,EACL,UAAU,YAAY,0BAAe;gBACpC,UAAU,YAAY,wBAAa;gBACnC,UAAU,YAAY,kCAAc;gBACpC,UAAU,YAAY,2BAAgB;gBACtC,UAAU,YAAY,2BAAgB,EACvC,KAAK,CAAC,oBAAoB,CAC1B,CAAC;YACF,MAAM,SAAS,GAAG,iBAAiB;gBAClC,CAAC,CAAC,oBAAoB,CAAC,UAAU,EAAE,YAAY,CAAC;gBAChD,CAAC,CAAC,UAAU,CAAC;YACd,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QACnD,CAAC;KACD,CAAC,CAAC;IAEH,OAAO;QACN,IAAI,EAAE,iBAAiB;YACtB,CAAC,CAAC,CAAC;gB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oft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { normalizeFieldSchema, type ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport type {\n\tSimpleAllowedTypeAttributes,\n\tSimpleArrayNodeSchema,\n\tSimpleFieldSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleNodeSchema,\n\tSimpleObjectFieldSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleRecordNodeSchema,\n\tSimpleTreeSchema,\n} from \"../simpleSchema.js\";\nimport { NodeKind } from \"../core/index.js\";\nimport {\n\tArrayNodeSchema,\n\tMapNodeSchema,\n\tObjectNodeSchema,\n\tRecordNodeSchema,\n} from \"../node-kinds/index.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport { LeafNodeSchema } from \"../leafNodeSchema.js\";\n\n/**\n * Converts an {@link ImplicitFieldSchema} to a \"simple\" schema representation.\n *\n * @param schema - The schema to convert\n * @param copySchemaObjects - If true, TreeNodeSchema and FieldSchema are copied into plain JavaScript objects. Either way, custom metadata is referenced and not copied.\n * @param isViewSchema - If true (default), properties used by view schema but not part of stored schema (for example, `isStaged` on allowed types) are preserved in the output.\n *\n * @remarks\n * Given that the Schema types used in {@link ImplicitFieldSchema} already implement the {@link SimpleNodeSchema} interfaces, there are limited use-cases for this function.\n * One possible use-case is converting schema to a more serialization friendly format.\n * This format however is not JSON compatible due to use of Maps and Sets,\n * but it it does not rely on cyclic object references for handling recursive schema and instead uses the `definitions` map.\n *\n * @privateRemarks\n * TODO: once SimpleTreeSchema is stable, {@link TreeViewConfiguration} could implement {@link SimpleTreeSchema} directly.\n * That would provide the non-copying alternative that could expose the value type of the definitions map as {@link TreeNodeSchema}.\n */\nexport function toSimpleTreeSchema(\n\tschema: ImplicitFieldSchema,\n\tcopySchemaObjects: boolean,\n\tisViewSchema: boolean = true,\n): SimpleTreeSchema {\n\tconst normalizedSchema = normalizeFieldSchema(schema);\n\tconst definitions = new Map<string, SimpleNodeSchema>();\n\twalkFieldSchema(normalizedSchema, {\n\t\tnode: (nodeSchema) => {\n\t\t\t// The set of node kinds is extensible, but the typing of SimpleNodeSchema is not, so we need to check that the schema is one of the known kinds.\n\t\t\tassert(\n\t\t\t\tnodeSchema instanceof ArrayNodeSchema ||\n\t\t\t\t\tnodeSchema instanceof MapNodeSchema ||\n\t\t\t\t\tnodeSchema instanceof LeafNodeSchema ||\n\t\t\t\t\tnodeSchema instanceof ObjectNodeSchema ||\n\t\t\t\t\tnodeSchema instanceof RecordNodeSchema,\n\t\t\t\t0xb60 /* Invalid schema */,\n\t\t\t);\n\t\t\tconst outSchema = copySchemaObjects\n\t\t\t\t? copySimpleNodeSchema(nodeSchema, isViewSchema)\n\t\t\t\t: nodeSchema;\n\t\t\tdefinitions.set(nodeSchema.identifier, outSchema);\n\t\t},\n\t});\n\n\treturn {\n\t\troot: copySchemaObjects\n\t\t\t? ({\n\t\t\t\t\tsimpleAllowedTypes: normalizeSimpleAllowedTypes(\n\t\t\t\t\t\tnormalizedSchema.simpleAllowedTypes,\n\t\t\t\t\t\tisViewSchema,\n\t\t\t\t\t),\n\t\t\t\t\tkind: normalizedSchema.kind,\n\t\t\t\t\tmetadata: normalizedSchema.metadata,\n\t\t\t\t\tpersistedMetadata: normalizedSchema.persistedMetadata,\n\t\t\t\t} satisfies SimpleFieldSchema)\n\t\t\t: normalizedSchema,\n\t\tdefinitions,\n\t};\n}\n\n/**\n * Normalizes the {@link SimpleAllowedTypeAttributes} by either preserving or omitting view-specific schema properties.\n * @param simpleAllowedTypes - The simple allowed types to normalize.\n * @param isViewSchema - If true, properties used by view schema but not part of stored schema (for example, `isStaged` on allowed types) are preserved in the output.\n * @returns The normalized simple allowed types.\n */\nfunction normalizeSimpleAllowedTypes(\n\tsimpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes>,\n\tisViewSchema: boolean,\n): ReadonlyMap<string, SimpleAllowedTypeAttributes> {\n\tif (isViewSchema) {\n\t\treturn simpleAllowedTypes;\n\t} else {\n\t\tconst normalized = new Map<string, SimpleAllowedTypeAttributes>();\n\t\tfor (const [identifier, attributes] of simpleAllowedTypes.entries()) {\n\t\t\tnormalized.set(identifier, { ...attributes, isStaged: undefined });\n\t\t}\n\t\treturn normalized;\n\t}\n}\n\n/**\n * Copies a {@link SimpleNodeSchema} into a new plain JavaScript object.\n *\n * @remarks Caches the result on the input schema for future calls.\n */\nfunction copySimpleNodeSchema(\n\tschema: SimpleNodeSchema,\n\tisViewSchema: boolean,\n): SimpleNodeSchema {\n\tconst kind = schema.kind;\n\tswitch (kind) {\n\t\tcase NodeKind.Leaf:\n\t\t\treturn copySimpleLeafSchema(schema);\n\t\tcase NodeKind.Array:\n\t\tcase NodeKind.Map:\n\t\tcase NodeKind.Record:\n\t\t\treturn copySimpleSchemaWithAllowedTypes(schema, isViewSchema);\n\t\tcase NodeKind.Object:\n\t\t\treturn copySimpleObjectSchema(schema, isViewSchema);\n\t\tdefault:\n\t\t\tunreachableCase(kind);\n\t}\n}\n\nfunction copySimpleLeafSchema(schema: SimpleLeafNodeSchema): SimpleLeafNodeSchema {\n\treturn {\n\t\tkind: NodeKind.Leaf,\n\t\tleafKind: schema.leafKind,\n\t\tmetadata: schema.metadata,\n\t\tpersistedMetadata: schema.persistedMetadata,\n\t};\n}\n\nfunction copySimpleSchemaWithAllowedTypes(\n\tschema: SimpleMapNodeSchema | SimpleArrayNodeSchema | SimpleRecordNodeSchema,\n\tisViewSchema: boolean,\n): SimpleMapNodeSchema | SimpleArrayNodeSchema | SimpleRecordNodeSchema {\n\treturn {\n\t\tkind: schema.kind,\n\t\tsimpleAllowedTypes: normalizeSimpleAllowedTypes(schema.simpleAllowedTypes, isViewSchema),\n\t\tmetadata: schema.metadata,\n\t\tpersistedMetadata: schema.persistedMetadata,\n\t};\n}\n\nfunction copySimpleObjectSchema(\n\tschema: SimpleObjectNodeSchema,\n\tisViewSchema: boolean,\n): SimpleObjectNodeSchema {\n\tconst fields: Map<string, SimpleObjectFieldSchema> = new Map();\n\tfor (const [propertyKey, field] of schema.fields) {\n\t\t// field already is a SimpleObjectFieldSchema, but copy the subset of the properties needed by this interface to get a clean simple object.\n\t\tfields.set(propertyKey, {\n\t\t\tkind: field.kind,\n\t\t\tsimpleAllowedTypes: normalizeSimpleAllowedTypes(field.simpleAllowedTypes, isViewSchema),\n\t\t\tmetadata: field.metadata,\n\t\t\tpersistedMetadata: field.persistedMetadata,\n\t\t\tstoredKey: field.storedKey,\n\t\t});\n\t}\n\n\treturn {\n\t\tkind: NodeKind.Object,\n\t\tfields,\n\t\tmetadata: schema.metadata,\n\t\tpersistedMetadata: schema.persistedMetadata,\n\t};\n}\n"]}
1
+ {"version":3,"file":"viewSchemaToSimpleSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/viewSchemaToSimpleSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAC9E,sDAAmF;AAYnF,+CAA4C;AAC5C,qDAKgC;AAChC,8DAAwD;AACxD,4DAAsD;AAEtD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,kBAAkB,CACjC,MAA2B,EAC3B,iBAA0B;IAE1B,MAAM,gBAAgB,GAAG,IAAA,qCAAoB,EAAC,MAAM,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,IAAI,GAAG,EAA4B,CAAC;IACxD,IAAA,oCAAe,EAAC,gBAAgB,EAAE;QACjC,IAAI,EAAE,CAAC,UAAU,EAAE,EAAE;YACpB,iJAAiJ;YACjJ,IAAA,iBAAM,EACL,UAAU,YAAY,0BAAe;gBACpC,UAAU,YAAY,wBAAa;gBACnC,UAAU,YAAY,kCAAc;gBACpC,UAAU,YAAY,2BAAgB;gBACtC,UAAU,YAAY,2BAAgB,EACvC,KAAK,CAAC,oBAAoB,CAC1B,CAAC;YACF,MAAM,SAAS,GAAG,iBAAiB,CAAC,CAAC,CAAC,oBAAoB,CAAC,UA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,WAAW;KACX,CAAC;AACH,CAAC;AArDD,kFAqDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { normalizeFieldSchema, type ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport type {\n\tSimpleArrayNodeSchema,\n\tSimpleFieldSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleNodeSchema,\n\tSimpleObjectFieldSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleRecordNodeSchema,\n\tSimpleTreeSchema,\n} from \"../simpleSchema.js\";\nimport { NodeKind } from \"../core/index.js\";\nimport {\n\tArrayNodeSchema,\n\tMapNodeSchema,\n\tObjectNodeSchema,\n\tRecordNodeSchema,\n} from \"../node-kinds/index.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport { LeafNodeSchema } from \"../leafNodeSchema.js\";\n\n/**\n * Converts an {@link ImplicitFieldSchema} to a \"simple\" schema representation.\n *\n * @param schema - The schema to convert\n * @param copySchemaObjects - If true, TreeNodeSchema and FieldSchema are copied into plain JavaScript objects. Either way, custom metadata is referenced and not copied.\n *\n * @remarks\n * Given that the Schema types used in {@link ImplicitFieldSchema} already implement the {@link SimpleNodeSchema} interfaces, there are limited use-cases for this function.\n * One possible use-case is converting schema to a more serialization friendly format.\n * This format however is not JSON compatible due to use of Maps and Sets,\n * but it it does not rely on cyclic object references for handling recursive schema and instead uses the `definitions` map.\n *\n * @privateRemarks\n * TODO: once SimpleTreeSchema is stable, {@link TreeViewConfiguration} could implement {@link SimpleTreeSchema} directly.\n * That would provide the non-copying alternative that could expose the value type of the definitions map as {@link TreeNodeSchema}.\n */\nexport function toSimpleTreeSchema(\n\tschema: ImplicitFieldSchema,\n\tcopySchemaObjects: boolean,\n): SimpleTreeSchema {\n\tconst normalizedSchema = normalizeFieldSchema(schema);\n\tconst definitions = new Map<string, SimpleNodeSchema>();\n\twalkFieldSchema(normalizedSchema, {\n\t\tnode: (nodeSchema) => {\n\t\t\t// The set of node kinds is extensible, but the typing of SimpleNodeSchema is not, so we need to check that the schema is one of the known kinds.\n\t\t\tassert(\n\t\t\t\tnodeSchema instanceof ArrayNodeSchema ||\n\t\t\t\t\tnodeSchema instanceof MapNodeSchema ||\n\t\t\t\t\tnodeSchema instanceof LeafNodeSchema ||\n\t\t\t\t\tnodeSchema instanceof ObjectNodeSchema ||\n\t\t\t\t\tnodeSchema instanceof RecordNodeSchema,\n\t\t\t\t0xb60 /* Invalid schema */,\n\t\t\t);\n\t\t\tconst outSchema = copySchemaObjects ? copySimpleNodeSchema(nodeSchema) : nodeSchema;\n\t\t\tdefinitions.set(nodeSchema.identifier, outSchema);\n\t\t},\n\t});\n\n\treturn {\n\t\troot: copySchemaObjects\n\t\t\t? ({\n\t\t\t\t\tsimpleAllowedTypes: normalizedSchema.simpleAllowedTypes,\n\t\t\t\t\tkind: normalizedSchema.kind,\n\t\t\t\t\tmetadata: normalizedSchema.metadata,\n\t\t\t\t\tpersistedMetadata: normalizedSchema.persistedMetadata,\n\t\t\t\t} satisfies SimpleFieldSchema)\n\t\t\t: normalizedSchema,\n\t\tdefinitions,\n\t};\n}\n\n/**\n * Copies a {@link SimpleNodeSchema} into a new plain JavaScript object.\n *\n * @remarks Caches the result on the input schema for future calls.\n */\nexport function copySimpleNodeSchema(schema: SimpleNodeSchema): SimpleNodeSchema {\n\tconst kind = schema.kind;\n\tswitch (kind) {\n\t\tcase NodeKind.Leaf:\n\t\t\treturn copySimpleLeafSchema(schema);\n\t\tcase NodeKind.Array:\n\t\tcase NodeKind.Map:\n\t\tcase NodeKind.Record:\n\t\t\treturn copySimpleSchemaWithAllowedTypes(schema);\n\t\tcase NodeKind.Object:\n\t\t\treturn copySimpleObjectSchema(schema);\n\t\tdefault:\n\t\t\tunreachableCase(kind);\n\t}\n}\n\nfunction copySimpleLeafSchema(schema: SimpleLeafNodeSchema): SimpleLeafNodeSchema {\n\treturn {\n\t\tkind: NodeKind.Leaf,\n\t\tleafKind: schema.leafKind,\n\t\tmetadata: schema.metadata,\n\t\tpersistedMetadata: schema.persistedMetadata,\n\t};\n}\n\nfunction copySimpleSchemaWithAllowedTypes(\n\tschema: SimpleMapNodeSchema | SimpleArrayNodeSchema | SimpleRecordNodeSchema,\n): SimpleMapNodeSchema | SimpleArrayNodeSchema | SimpleRecordNodeSchema {\n\treturn {\n\t\tkind: schema.kind,\n\t\tsimpleAllowedTypes: schema.simpleAllowedTypes,\n\t\tmetadata: schema.metadata,\n\t\tpersistedMetadata: schema.persistedMetadata,\n\t};\n}\n\nfunction copySimpleObjectSchema(schema: SimpleObjectNodeSchema): SimpleObjectNodeSchema {\n\tconst fields: Map<string, SimpleObjectFieldSchema> = new Map();\n\tfor (const [propertyKey, field] of schema.fields) {\n\t\t// field already is a SimpleObjectFieldSchema, but copy the subset of the properties needed by this interface to get a clean simple object.\n\t\tconst simpleField = {\n\t\t\tkind: field.kind,\n\t\t\tsimpleAllowedTypes: field.simpleAllowedTypes,\n\t\t\tmetadata: field.metadata,\n\t\t\tpersistedMetadata: field.persistedMetadata,\n\t\t\tstoredKey: field.storedKey,\n\t\t};\n\n\t\tfields.set(propertyKey, simpleField);\n\t}\n\n\tconst simpleObject = {\n\t\tkind: NodeKind.Object,\n\t\tfields,\n\t\tmetadata: schema.metadata,\n\t\tpersistedMetadata: schema.persistedMetadata,\n\t\tallowUnknownOptionalFields: schema.allowUnknownOptionalFields,\n\t} satisfies SimpleObjectNodeSchema;\n\n\treturn simpleObject;\n}\n\n/**\n * Creates a copy of a SimpleTreeSchema without metadata fields. This is useful for comparing deserialized view schemas with in-memory schemas.\n * metadata and persistedMetadata are not relevant for schema compatibility checks and are not serialized by the Simple Schema serializer.\n * @see {@link simpleSchemaSerializer.ts} for the serialization logic.\n *\n * @param schema - The SimpleTreeSchema to remove fields from.\n * @param fieldsToRemove - An object specifying which fields to remove.\n * @returns A new SimpleTreeSchema without the specified fields.\n */\nexport function copySimpleTreeSchemaWithoutMetadata(\n\tschema: SimpleTreeSchema,\n): SimpleTreeSchema {\n\tconst definitions = new Map<string, SimpleNodeSchema>();\n\n\tfor (const [identifier, nodeSchema] of schema.definitions.entries()) {\n\t\tconst kind = nodeSchema.kind;\n\t\tswitch (kind) {\n\t\t\tcase NodeKind.Array:\n\t\t\tcase NodeKind.Map:\n\t\t\tcase NodeKind.Record:\n\t\t\tcase NodeKind.Leaf: {\n\t\t\t\tconst outputNodeSchema = {\n\t\t\t\t\t...nodeSchema,\n\t\t\t\t\tmetadata: {},\n\t\t\t\t\tpersistedMetadata: undefined,\n\t\t\t\t};\n\t\t\t\tdefinitions.set(identifier, outputNodeSchema);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Object: {\n\t\t\t\tconst outputFields = new Map<string, SimpleObjectFieldSchema>();\n\t\t\t\tfor (const [propertyKey, fieldSchema] of nodeSchema.fields.entries()) {\n\t\t\t\t\tconst outputField: SimpleObjectFieldSchema = {\n\t\t\t\t\t\t...fieldSchema,\n\t\t\t\t\t\tmetadata: {},\n\t\t\t\t\t\tpersistedMetadata: undefined,\n\t\t\t\t\t};\n\t\t\t\t\toutputFields.set(propertyKey, outputField);\n\t\t\t\t}\n\t\t\t\tconst outputNodeSchema = {\n\t\t\t\t\t...nodeSchema,\n\t\t\t\t\tmetadata: {},\n\t\t\t\t\tpersistedMetadata: undefined,\n\t\t\t\t\tfields: outputFields,\n\t\t\t\t};\n\t\t\t\tdefinitions.set(identifier, outputNodeSchema);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(kind);\n\t\t}\n\t}\n\n\treturn {\n\t\troot: {\n\t\t\tkind: schema.root.kind,\n\t\t\tsimpleAllowedTypes: schema.root.simpleAllowedTypes,\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: undefined,\n\t\t},\n\t\tdefinitions,\n\t};\n}\n"]}
@@ -36,7 +36,7 @@ export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
36
36
  /**
37
37
  * Stores annotations for an individual allowed type.
38
38
  * @remarks
39
- * Create using APIs on {@link SchemaFactoryAlpha}, like {@link SchemaStaticsAlpha.staged}.
39
+ * Create using APIs on {@link SchemaStaticsBeta}, like {@link SchemaStaticsBeta.staged}.
40
40
  * @privateRemarks
41
41
  * Since this is sealed, users are not supposed to create instances of it directly.
42
42
  * Making it extend ErasedType could enforce that.
@@ -187,7 +187,7 @@ export interface AllowedTypeMetadata {
187
187
  */
188
188
  readonly custom?: unknown;
189
189
  /**
190
- * If defined, indicates that an allowed type is {@link SchemaStaticsAlpha.staged | staged}.
190
+ * If defined, indicates that an allowed type is {@link SchemaStaticsBeta.staged | staged}.
191
191
  */
192
192
  readonly stagedSchemaUpgrade?: SchemaUpgrade;
193
193
  }
@@ -198,7 +198,7 @@ export declare let createSchemaUpgrade: () => SchemaUpgrade;
198
198
  /**
199
199
  * Unique token used to upgrade schemas and determine if a particular upgrade has been completed.
200
200
  * @remarks
201
- * Create using {@link SchemaStaticsAlpha.staged}.
201
+ * Create using {@link SchemaStaticsBeta.staged}.
202
202
  * @privateRemarks
203
203
  * TODO:#38722 implement runtime schema upgrades.
204
204
  * Until then, the class purely behaves mostly as a placeholder.
@@ -172,7 +172,7 @@ exports.isAnnotatedAllowedType = isAnnotatedAllowedType;
172
172
  /**
173
173
  * Unique token used to upgrade schemas and determine if a particular upgrade has been completed.
174
174
  * @remarks
175
- * Create using {@link SchemaStaticsAlpha.staged}.
175
+ * Create using {@link SchemaStaticsBeta.staged}.
176
176
  * @privateRemarks
177
177
  * TODO:#38722 implement runtime schema upgrades.
178
178
  * Until then, the class purely behaves mostly as a placeholder.
@@ -1 +1 @@
1
- {"version":3,"file":"allowedTypes.js","sourceRoot":"","sources":["../../../src/simple-tree/core/allowedTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uEAAsE;AACtE,kEAA2D;AAE3D,uEAGkD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I,qBAAU,CACnB,6PAA6P,CAC7P,CAAC;IACH,CAAC;AACF,CAAC;AARD,kEAQC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,qBAAqB,CACpC,MAAsB,EACtB,iBAAiB,GAAG,KAAK;IAEzB,kFAAkF;IAClF,IAAI,MAAM,CAAC,IAAI,KAAK,4BAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,OAAO;IACR,CAAC;IAED,MAAM,WAAW,GAAG,IAAA,wCAAqB,EAAC,MAAM,CAAC,CAAC;IAElD,IAAI,iBAAiB,EAAE,CAAC;QACvB,WAAW,CAAC,iBAAiB,EAAE,CAAC;IACjC,CAAC;SAAM,CAAC;QACP,WAAW,CAAC,eAAe,EAAE,CAAC;IAC/B,CAAC;AACF,CAAC;AAhBD,sDAgBC","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\";\nimport { Lazy } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype ErasedBaseType,\n\tErasedTypeImplementation,\n} from \"@fluidframework/core-interfaces/internal\";\n\nimport {\n\tgetOrCreate,\n\tisReadonlyArray,\n\ttype IsUnion,\n\ttype MakeNominal,\n} 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\";\nimport type { SimpleAllowedTypeAttributes } from \"../simpleSchema.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 *\n * Due to one implementation of this being {@link AllowedTypesFull}, it is not safe to assume this is an array (as determined by `Array.isArray`).\n *\n * Code reading data from this should use {@link 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 * @remarks\n * Create using APIs on {@link SchemaFactoryAlpha}, like {@link SchemaStaticsAlpha.staged}.\n * @privateRemarks\n * Since this is sealed, users are not supposed to create instances of it directly.\n * Making it extend ErasedType could enforce that.\n * @beta\n * @sealed\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 * {@link AllowedTypesFull} but with the lazy schema references eagerly evaluated.\n * @sealed\n * @beta\n */\nexport type AllowedTypesFullEvaluated = AllowedTypesFull<\n\treadonly AnnotatedAllowedType<TreeNodeSchema>[]\n>;\n\n/**\n * Checks if the input is an {@link AnnotatedAllowedTypes}.\n */\nexport function isAnnotatedAllowedTypes(\n\tallowedTypes: ImplicitAllowedTypes,\n): allowedTypes is AllowedTypesFullInternal {\n\tcheckForUninitializedSchema(allowedTypes);\n\treturn allowedTypes instanceof AnnotatedAllowedTypesInternal;\n}\n\n/**\n * Stores annotations for a set of allowed types.\n * @beta\n * @sealed\n */\nexport interface AnnotatedAllowedTypes<T = readonly AnnotatedAllowedType[]>\n\textends ErasedBaseType<\"tree.AnnotatedAllowedTypes\"> {\n\t/**\n\t * Annotations that apply to a set of allowed types.\n\t */\n\treadonly metadata: AllowedTypesMetadata;\n\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: T;\n\n\t/**\n\t * Get this {@link AnnotatedAllowedTypes} but with any lazy schema references eagerly evaluated.\n\t * @remarks\n\t * See {@link evaluateLazySchema} the implications of evaluating lazy schema references.\n\t */\n\tevaluate(): AllowedTypesFullEvaluated;\n\n\t/**\n\t * Get the allowed types as a set with any lazy schema references eagerly evaluated.\n\t * @remarks\n\t * See {@link evaluateLazySchema} the implications of evaluating lazy schema references.\n\t */\n\tevaluateSet(): ReadonlySet<TreeNodeSchema>;\n\n\t/**\n\t * Get the allowed types as a set of identifiers with any lazy schema references eagerly evaluated.\n\t * @remarks\n\t * See {@link evaluateLazySchema} the implications of evaluating lazy schema references.\n\t *\n\t * It is recommend to work in terms of {@link TreeNodeSchema}\n\t * rather than identifiers where possible since its more type safe and it is possible that two schema with the same identifier exist.\n\t */\n\tevaluateIdentifiers(): ReadonlySet<string>;\n}\n\n/**\n * Stores annotations for a set of allowed types.\n * @remarks\n * Most expressive form of AllowedTypes which any of the implicit types can be normalized to.\n * @beta\n * @sealed\n */\nexport type AllowedTypesFull<\n\tT extends readonly AnnotatedAllowedType[] = readonly AnnotatedAllowedType[],\n> = AnnotatedAllowedTypes<T> & UnannotateAllowedTypesList<T>;\n\n/**\n * Creates an {@link AllowedTypesFull} type from a mixed array of annotated and unannotated allowed types.\n * @system @sealed @beta\n */\nexport type AllowedTypesFullFromMixed<\n\tT extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[],\n> = UnannotateAllowedTypesList<T> & AnnotatedAllowedTypes<AnnotateAllowedTypesList<T>>;\n\n/**\n * The same as the built-in InstanceType, but works on classes with private constructors.\n * @privateRemarks\n * This is based on the trick in {@link https://stackoverflow.com/a/74657881}.\n */\ntype InstanceTypeRelaxed<TClass> = InstanceType<(new () => never) & TClass>;\n\n/**\n * {@link AllowedTypesFull} but with internal types.\n */\nexport type AllowedTypesFullInternal<\n\tT extends readonly AnnotatedAllowedType[] = readonly AnnotatedAllowedType[],\n> = AnnotatedAllowedTypesInternal<T> & UnannotateAllowedTypesList<T>;\n\ntype AllowedTypesFullInternalEvaluated = AllowedTypesFullInternal<\n\treadonly AnnotatedAllowedType<TreeNodeSchema>[]\n>;\n\n/**\n * The implementation of {@link AnnotatedAllowedTypes}. Also implements {@link AllowedTypesFull}.\n * @remarks\n * Due to TypeScript limitations, this class cannot directly state it implements {@link AllowedTypesFull}.\n * As a workaround for that, the static `create` method returns the intersection type.\n */\nexport class AnnotatedAllowedTypesInternal<\n\t\tT extends readonly AnnotatedAllowedType[] = readonly AnnotatedAllowedType[],\n\t>\n\textends ErasedTypeImplementation<AnnotatedAllowedTypes<T>>\n\timplements AnnotatedAllowedTypes<T>\n{\n\tpublic readonly unannotatedTypes: UnannotateAllowedTypesList<T>;\n\n\t/**\n\t * True if and only if there is at least one lazy schema reference in the types arrays.\n\t */\n\tprivate readonly isLazy: boolean;\n\n\tprivate readonly lazyEvaluate: Lazy<{\n\t\treadonly annotated: AllowedTypesFullInternalEvaluated;\n\t\treadonly set: ReadonlySet<TreeNodeSchema>;\n\t\treadonly identifiers: ReadonlySet<string>;\n\t}>;\n\n\tprivate constructor(\n\t\tpublic readonly types: T,\n\t\tpublic readonly metadata: AllowedTypesMetadata = {},\n\t) {\n\t\tsuper();\n\t\tthis.unannotatedTypes = types.map((type) => type.type) as typeof this.unannotatedTypes;\n\n\t\t// Since the array has been copied, mutations to it will not be handled correctly so freeze it.\n\t\t// Support for such mutations could be added at a later date by making more things lazy.\n\t\tObject.freeze(this.types);\n\t\tObject.freeze(this.unannotatedTypes);\n\n\t\tthis.isLazy = false;\n\t\tfor (const type of this.unannotatedTypes) {\n\t\t\tif (isLazy(type)) {\n\t\t\t\tthis.isLazy = true;\n\t\t\t} else {\n\t\t\t\tmarkSchemaMostDerived(type);\n\t\t\t}\n\t\t}\n\n\t\tconst proxy = AnnotatedAllowedTypesInternal.proxy(this);\n\n\t\tthis.lazyEvaluate = new Lazy(() => {\n\t\t\tconst annotated = this.isLazy\n\t\t\t\t? AnnotatedAllowedTypesInternal.create(\n\t\t\t\t\t\tthis.types.map((type) => ({\n\t\t\t\t\t\t\t...type,\n\t\t\t\t\t\t\ttype: evaluateLazySchema(type.type),\n\t\t\t\t\t\t})),\n\t\t\t\t\t\tthis.metadata,\n\t\t\t\t\t)\n\t\t\t\t: (proxy as AllowedTypesFullInternalEvaluated);\n\t\t\treturn {\n\t\t\t\tannotated,\n\t\t\t\tset: new Set(annotated.unannotatedTypes),\n\t\t\t\tidentifiers: new Set(annotated.unannotatedTypes.map((t) => t.identifier)),\n\t\t\t};\n\t\t});\n\n\t\treturn proxy;\n\t}\n\n\tpublic evaluate(): AllowedTypesFullInternalEvaluated {\n\t\treturn this.lazyEvaluate.value.annotated;\n\t}\n\n\tpublic evaluateSet(): ReadonlySet<TreeNodeSchema> {\n\t\treturn this.lazyEvaluate.value.set;\n\t}\n\n\tpublic evaluateIdentifiers(): ReadonlySet<string> {\n\t\treturn this.lazyEvaluate.value.identifiers;\n\t}\n\n\t/**\n\t * Get the {@link SimpleAllowedTypeAttributes} version of the allowed types set.\n\t */\n\tpublic static evaluateSimpleAllowedTypes(\n\t\tannotatedAllowedTypes: AnnotatedAllowedTypes,\n\t): ReadonlyMap<string, SimpleAllowedTypeAttributes> {\n\t\tconst simpleAllowedTypes = new Map<string, SimpleAllowedTypeAttributes>();\n\t\tfor (const type of annotatedAllowedTypes.evaluate().types) {\n\t\t\tsimpleAllowedTypes.set(type.type.identifier, {\n\t\t\t\tisStaged: type.metadata.stagedSchemaUpgrade !== undefined,\n\t\t\t});\n\t\t}\n\t\treturn simpleAllowedTypes;\n\t}\n\n\tpublic static override [Symbol.hasInstance]<TThis extends { prototype: object }>(\n\t\tthis: TThis,\n\t\tvalue: unknown,\n\t): value is InstanceTypeRelaxed<TThis> & AnnotatedAllowedTypesInternal & AllowedTypesFull {\n\t\treturn ErasedTypeImplementation[Symbol.hasInstance].call(this, value);\n\t}\n\n\tpublic static override narrow<TThis extends { prototype: object }>(\n\t\tthis: TThis,\n\t\tvalue: ErasedBaseType | InstanceTypeRelaxed<TThis> | ImplicitAllowedTypes,\n\t): asserts value is InstanceTypeRelaxed<TThis> &\n\t\tAnnotatedAllowedTypesInternal &\n\t\tAllowedTypesFull {\n\t\tif (!ErasedTypeImplementation[Symbol.hasInstance].call(this, value)) {\n\t\t\tthrow new TypeError(\"Invalid AnnotatedAllowedTypes instance\");\n\t\t}\n\t}\n\n\tprivate static proxy<const T extends readonly AnnotatedAllowedType[]>(\n\t\tresult: AnnotatedAllowedTypesInternal<T>,\n\t): AnnotatedAllowedTypesInternal<T> & AllowedTypesFull<T> {\n\t\tconst proxy = new Proxy(result, {\n\t\t\tset: () => {\n\t\t\t\tthrow new UsageError(\"AnnotatedAllowedTypes is immutable\");\n\t\t\t},\n\n\t\t\tget: (target, property, receiver) => {\n\t\t\t\t// Hide common array editing methods.\n\t\t\t\tif (property === \"push\" || property === \"pop\") {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\t// Forward array lookup and array methods to the unannotated types array.\n\t\t\t\tif (property in target.unannotatedTypes) {\n\t\t\t\t\treturn Reflect.get(target.unannotatedTypes, property);\n\t\t\t\t}\n\t\t\t\t// Forward anything else to target.\n\t\t\t\treturn Reflect.get(target, property) as unknown;\n\t\t\t},\n\n\t\t\thas: (target, property) => {\n\t\t\t\tif (property in target.unannotatedTypes) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Forward anything else to target.\n\t\t\t\treturn property in target;\n\t\t\t},\n\n\t\t\townKeys: (target) => {\n\t\t\t\tconst targetKeys = Reflect.ownKeys(target);\n\t\t\t\tconst unannotatedTypesKeys = Reflect.ownKeys(target.unannotatedTypes);\n\t\t\t\treturn [...unannotatedTypesKeys, ...targetKeys];\n\t\t\t},\n\n\t\t\tgetOwnPropertyDescriptor: (target, property) => {\n\t\t\t\tif (Object.prototype.hasOwnProperty.call(target.unannotatedTypes, property)) {\n\t\t\t\t\tconst inner = Object.getOwnPropertyDescriptor(target.unannotatedTypes, property);\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...inner,\n\t\t\t\t\t\t// Since these properties are not on the target, make them non-configurable to confirm with proxy invariants.\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\twritable: false,\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tconst inner = Object.getOwnPropertyDescriptor(target, property);\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...inner,\n\t\t\t\t\t\twritable: false,\n\t\t\t\t\t\t// Allow only array entries to be enumerable.\n\t\t\t\t\t\tenumerable: false,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\treturn proxy as typeof result & UnannotateAllowedTypesList<T>;\n\t}\n\n\tpublic static create<const T extends readonly AnnotatedAllowedType[]>(\n\t\ttypes: T,\n\t\tmetadata: AllowedTypesMetadata = {},\n\t): AnnotatedAllowedTypesInternal<Readonly<T>> & AllowedTypesFull<Readonly<T>> {\n\t\tconst result = new AnnotatedAllowedTypesInternal(types, metadata);\n\t\treturn result as typeof result & UnannotateAllowedTypesList<T>;\n\t}\n\n\tpublic static createUnannotated<const T extends AllowedTypes>(\n\t\ttypes: T,\n\t\tmetadata: AllowedTypesMetadata = {},\n\t): AnnotatedAllowedTypesInternal & Readonly<T> {\n\t\tObject.freeze(types);\n\t\tconst annotatedTypes: AnnotatedAllowedType[] = types.map(normalizeToAnnotatedAllowedType);\n\t\tconst result = AnnotatedAllowedTypesInternal.create(annotatedTypes, metadata);\n\t\treturn result as typeof result & T;\n\t}\n\n\tpublic static createMixed<\n\t\tconst T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[],\n\t>(types: T, metadata: AllowedTypesMetadata = {}): AllowedTypesFullFromMixed<T> {\n\t\tObject.freeze(types);\n\t\tconst annotatedTypes: AnnotatedAllowedType[] = types.map(normalizeToAnnotatedAllowedType);\n\t\tconst result = AnnotatedAllowedTypesInternal.create(annotatedTypes, metadata);\n\t\treturn result as AllowedTypesFullFromMixed<T>;\n\t}\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 * @beta\n * @input\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\tcheckForUninitializedSchema(allowedType);\n\t// Class based schema, and lazy schema references report type \"function\": filtering them out with typeof makes narrowing based on members mostly safe\n\treturn typeof allowedType === \"object\" && \"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 * @beta\n * @input\n */\nexport interface AllowedTypeMetadata {\n\t/**\n\t * User defined metadata\n\t */\n\treadonly custom?: unknown;\n\n\t/**\n\t * If defined, indicates that an allowed type is {@link SchemaStaticsAlpha.staged | staged}.\n\t */\n\treadonly stagedSchemaUpgrade?: SchemaUpgrade;\n}\n\n/**\n * Package internal {@link SchemaUpgrade} construction API.\n */\nexport let createSchemaUpgrade: () => SchemaUpgrade;\n\n/**\n * Unique token used to upgrade schemas and determine if a particular upgrade has been completed.\n * @remarks\n * Create using {@link SchemaStaticsAlpha.staged}.\n * @privateRemarks\n * TODO:#38722 implement runtime schema upgrades.\n * Until then, the class purely behaves mostly as a placeholder.\n * TODO: Consider allowing users to store a name for the upgrade to use in error messages.\n * @sealed @beta\n */\nexport class SchemaUpgrade {\n\tprotected _typeCheck!: MakeNominal;\n\tstatic {\n\t\tcreateSchemaUpgrade = () => new SchemaUpgrade();\n\t}\n\n\tprivate constructor() {}\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 * Code reading data from this should use {@link normalizeAllowedTypes} to ensure consistent handling, caching, nice errors etc.\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 * @public\n */\nexport type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;\n\n/**\n * Removes annotations from a list of allowed types that may contain annotations.\n * @system @beta\n */\nexport type UnannotateAllowedTypesList<\n\tT extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[],\n> = {\n\t[I in keyof T]: T[I] extends AnnotatedAllowedType<infer X> ? X : T[I];\n};\n\n/**\n * Add annotations to a list of allowed types that may or may not contain annotations.\n * @system @beta\n */\nexport type AnnotateAllowedTypesList<\n\tT extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[],\n> = {\n\t[I in keyof T]: T[I] extends AnnotatedAllowedType<unknown>\n\t\t? T[I]\n\t\t: AnnotatedAllowedType<T[I]>;\n};\n\n/**\n * Normalizes an {@link ImplicitAllowedTypes} to an {@link AllowedTypesFull}.\n * @alpha\n */\nexport function normalizeAllowedTypes(types: ImplicitAllowedTypes): AllowedTypesFull {\n\treturn normalizeAllowedTypesInternal(types);\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 LazyItem<TreeNodeSchema>>(\n\ttype: T | AnnotatedAllowedType<T>,\n): AnnotatedAllowedType<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 * See note inside {@link normalizeAllowedTypesInternal}.\n */\nconst cachedNormalize = new WeakMap<ImplicitAllowedTypes, AllowedTypesFullInternal>();\n\n/**\n * Normalizes allowed types to an {@link AllowedTypesFullInternal}.\n */\nexport function normalizeAllowedTypesInternal(\n\ttype: ImplicitAllowedTypes,\n): AllowedTypesFullInternal {\n\tif (isAnnotatedAllowedTypes(type)) {\n\t\treturn type;\n\t}\n\n\t// This caching accomplishes two things:\n\t// 1. It avoids redundant computations for the same input.\n\t// 2. It provides a stable object identity for the output in case the input is normalized twice and other systems (such as unhydrated contexts) are cached based on the object identity of the output.\n\t// It is this second case which is the more important since creating the AnnotatedAllowedTypesInternal is rather cheap.\n\t// Adding this cache improved the performance of the \"large recursive union\" test (which mostly just constructs a TreeConfiguration) by ~5 times.\n\t// This cache is strictly a performance optimization: it is not required for correctness.\n\treturn getOrCreate(cachedNormalize, type, () => {\n\t\tconst inputArray = isReadonlyArray(type) ? type : [type];\n\t\tObject.freeze(inputArray);\n\t\tconst annotatedTypes: AnnotatedAllowedType[] = inputArray.map(\n\t\t\tnormalizeToAnnotatedAllowedType,\n\t\t);\n\n\t\treturn AnnotatedAllowedTypesInternal.create(annotatedTypes);\n\t});\n}\n\n/**\n * Normalizes an {@link ImplicitAllowedTypes} to an {@link AllowedTypesFullInternalEvaluated} 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 normalizeAndEvaluateAnnotatedAllowedTypes(\n\ttypes: ImplicitAllowedTypes,\n): AllowedTypesFullInternalEvaluated {\n\treturn normalizeAllowedTypesInternal(types).evaluate();\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\n\tcheckForUninitializedSchema(evaluatedSchema);\n\tmarkSchemaMostDerived(evaluatedSchema);\n\treturn evaluatedSchema;\n}\n\n/**\n * Throws a UsageError if the provided schema is undefined, most likely due to being used before it was initialized.\n */\nexport function checkForUninitializedSchema(\n\tschema: ImplicitAllowedTypes | LazyItem<TreeNodeSchema> | AnnotatedAllowedType,\n): void {\n\tif (schema === 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. Consider using a lazy schema reference (like \"() => schema\") or delaying the evaluation of the lazy reference if one is already being used.`,\n\t\t);\n\t}\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 {@link https://en.wikipedia.org/wiki/Type_variance | contravariant}) over the schema.\n * (See also {@link https://www.typescriptlang.org/docs/handbook/2/generics.html#variance-annotations | TypeScript 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 non-recursive 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 [\n\t\t\t\t\tLazyItem<infer 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}[NumberKeys<TList>];\n\n/**\n * Extracts the keys of `T` which are numbers.\n * @remarks\n * The keys are extracted as strings which can be used to index `T`.\n *\n * This handles cases like `{ x: 4 } & [5, 6]` returning `\"0\"` and `\"1\"`.\n * Such cases are difficult to handle since `keyof` includes `number` in such cases, but the type can not be indexed by `number`.\n * @system @public\n */\nexport type NumberKeys<\n\tT,\n\tTransformed = {\n\t\treadonly [Property in keyof T as number extends Property ? never : Property]: Property;\n\t},\n> = Transformed[`${number}` & keyof Transformed];\n"]}
1
+ {"version":3,"file":"allowedTypes.js","sourceRoot":"","sources":["../../../src/simple-tree/core/allowedTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uEAAsE;AACtE,kEAA2D;AAE3D,uEAGkD;AAElD,kDAK6B;AAC7B,+CAA4E;AAC5E,2DAK6B;AAC7B,yDAA2D;AA4D3D;;GAEG;AACH,SAAgB,uBAAuB,CACtC,YAAkC;IAElC,2BAA2B,CAAC,YAAY,CAAC,CAAC;IAC1C,OAAO,YAAY,YAAY,6BAA6B,CAAC;AAC9D,CAAC;AALD,0DAKC;AAiFD;;;;;GAKG;AACH,MAAa,6BAGZ,SAAQ,mCAAkD;IAgB1D,YACiB,KAAQ,EACR,WAAiC,EAAE;QAEnD,KAAK,EAAE,CAAC;QAHQ,UAAK,GAAL,KAAK,CAAG;QACR,aAAQ,GAAR,QAAQ,CAA2B;QAGnD,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAiC,CAAC;QAEvF,+FAA+F;QAC/F,wFAAwF;QACxF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAErC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1C,IAAI,IAAA,oBAAM,EAAC,IAAI,CAAC,EAAE,CAAC;gBAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACpB,CAAC;iBAAM,CAAC;gBACP,qBAAqB,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QAED,MAAM,KAAK,GAAG,6BAA6B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAExD,IAAI,CAAC,YAAY,GA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,eAAe,CAAC,CAAC;IACvC,OAAO,eAAe,CAAC;AACxB,CAAC;AARD,gDAQC;AAED;;GAEG;AACH,SAAgB,2BAA2B,CAC1C,MAA8E;IAE9E,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,qBAAU,CACnB,6PAA6P,CAC7P,CAAC;IACH,CAAC;AACF,CAAC;AARD,kEAQC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,qBAAqB,CACpC,MAAsB,EACtB,iBAAiB,GAAG,KAAK;IAEzB,kFAAkF;IAClF,IAAI,MAAM,CAAC,IAAI,KAAK,4BAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,OAAO;IACR,CAAC;IAED,MAAM,WAAW,GAAG,IAAA,wCAAqB,EAAC,MAAM,CAAC,CAAC;IAElD,IAAI,iBAAiB,EAAE,CAAC;QACvB,WAAW,CAAC,iBAAiB,EAAE,CAAC;IACjC,CAAC;SAAM,CAAC;QACP,WAAW,CAAC,eAAe,EAAE,CAAC;IAC/B,CAAC;AACF,CAAC;AAhBD,sDAgBC","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\";\nimport { Lazy } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype ErasedBaseType,\n\tErasedTypeImplementation,\n} from \"@fluidframework/core-interfaces/internal\";\n\nimport {\n\tgetOrCreate,\n\tisReadonlyArray,\n\ttype IsUnion,\n\ttype MakeNominal,\n} 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\";\nimport type { SimpleAllowedTypeAttributes } from \"../simpleSchema.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 *\n * Due to one implementation of this being {@link AllowedTypesFull}, it is not safe to assume this is an array (as determined by `Array.isArray`).\n *\n * Code reading data from this should use {@link 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 * @remarks\n * Create using APIs on {@link SchemaStaticsBeta}, like {@link SchemaStaticsBeta.staged}.\n * @privateRemarks\n * Since this is sealed, users are not supposed to create instances of it directly.\n * Making it extend ErasedType could enforce that.\n * @beta\n * @sealed\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 * {@link AllowedTypesFull} but with the lazy schema references eagerly evaluated.\n * @sealed\n * @beta\n */\nexport type AllowedTypesFullEvaluated = AllowedTypesFull<\n\treadonly AnnotatedAllowedType<TreeNodeSchema>[]\n>;\n\n/**\n * Checks if the input is an {@link AnnotatedAllowedTypes}.\n */\nexport function isAnnotatedAllowedTypes(\n\tallowedTypes: ImplicitAllowedTypes,\n): allowedTypes is AllowedTypesFullInternal {\n\tcheckForUninitializedSchema(allowedTypes);\n\treturn allowedTypes instanceof AnnotatedAllowedTypesInternal;\n}\n\n/**\n * Stores annotations for a set of allowed types.\n * @beta\n * @sealed\n */\nexport interface AnnotatedAllowedTypes<T = readonly AnnotatedAllowedType[]>\n\textends ErasedBaseType<\"tree.AnnotatedAllowedTypes\"> {\n\t/**\n\t * Annotations that apply to a set of allowed types.\n\t */\n\treadonly metadata: AllowedTypesMetadata;\n\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: T;\n\n\t/**\n\t * Get this {@link AnnotatedAllowedTypes} but with any lazy schema references eagerly evaluated.\n\t * @remarks\n\t * See {@link evaluateLazySchema} the implications of evaluating lazy schema references.\n\t */\n\tevaluate(): AllowedTypesFullEvaluated;\n\n\t/**\n\t * Get the allowed types as a set with any lazy schema references eagerly evaluated.\n\t * @remarks\n\t * See {@link evaluateLazySchema} the implications of evaluating lazy schema references.\n\t */\n\tevaluateSet(): ReadonlySet<TreeNodeSchema>;\n\n\t/**\n\t * Get the allowed types as a set of identifiers with any lazy schema references eagerly evaluated.\n\t * @remarks\n\t * See {@link evaluateLazySchema} the implications of evaluating lazy schema references.\n\t *\n\t * It is recommend to work in terms of {@link TreeNodeSchema}\n\t * rather than identifiers where possible since its more type safe and it is possible that two schema with the same identifier exist.\n\t */\n\tevaluateIdentifiers(): ReadonlySet<string>;\n}\n\n/**\n * Stores annotations for a set of allowed types.\n * @remarks\n * Most expressive form of AllowedTypes which any of the implicit types can be normalized to.\n * @beta\n * @sealed\n */\nexport type AllowedTypesFull<\n\tT extends readonly AnnotatedAllowedType[] = readonly AnnotatedAllowedType[],\n> = AnnotatedAllowedTypes<T> & UnannotateAllowedTypesList<T>;\n\n/**\n * Creates an {@link AllowedTypesFull} type from a mixed array of annotated and unannotated allowed types.\n * @system @sealed @beta\n */\nexport type AllowedTypesFullFromMixed<\n\tT extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[],\n> = UnannotateAllowedTypesList<T> & AnnotatedAllowedTypes<AnnotateAllowedTypesList<T>>;\n\n/**\n * The same as the built-in InstanceType, but works on classes with private constructors.\n * @privateRemarks\n * This is based on the trick in {@link https://stackoverflow.com/a/74657881}.\n */\ntype InstanceTypeRelaxed<TClass> = InstanceType<(new () => never) & TClass>;\n\n/**\n * {@link AllowedTypesFull} but with internal types.\n */\nexport type AllowedTypesFullInternal<\n\tT extends readonly AnnotatedAllowedType[] = readonly AnnotatedAllowedType[],\n> = AnnotatedAllowedTypesInternal<T> & UnannotateAllowedTypesList<T>;\n\ntype AllowedTypesFullInternalEvaluated = AllowedTypesFullInternal<\n\treadonly AnnotatedAllowedType<TreeNodeSchema>[]\n>;\n\n/**\n * The implementation of {@link AnnotatedAllowedTypes}. Also implements {@link AllowedTypesFull}.\n * @remarks\n * Due to TypeScript limitations, this class cannot directly state it implements {@link AllowedTypesFull}.\n * As a workaround for that, the static `create` method returns the intersection type.\n */\nexport class AnnotatedAllowedTypesInternal<\n\t\tT extends readonly AnnotatedAllowedType[] = readonly AnnotatedAllowedType[],\n\t>\n\textends ErasedTypeImplementation<AnnotatedAllowedTypes<T>>\n\timplements AnnotatedAllowedTypes<T>\n{\n\tpublic readonly unannotatedTypes: UnannotateAllowedTypesList<T>;\n\n\t/**\n\t * True if and only if there is at least one lazy schema reference in the types arrays.\n\t */\n\tprivate readonly isLazy: boolean;\n\n\tprivate readonly lazyEvaluate: Lazy<{\n\t\treadonly annotated: AllowedTypesFullInternalEvaluated;\n\t\treadonly set: ReadonlySet<TreeNodeSchema>;\n\t\treadonly identifiers: ReadonlySet<string>;\n\t}>;\n\n\tprivate constructor(\n\t\tpublic readonly types: T,\n\t\tpublic readonly metadata: AllowedTypesMetadata = {},\n\t) {\n\t\tsuper();\n\t\tthis.unannotatedTypes = types.map((type) => type.type) as typeof this.unannotatedTypes;\n\n\t\t// Since the array has been copied, mutations to it will not be handled correctly so freeze it.\n\t\t// Support for such mutations could be added at a later date by making more things lazy.\n\t\tObject.freeze(this.types);\n\t\tObject.freeze(this.unannotatedTypes);\n\n\t\tthis.isLazy = false;\n\t\tfor (const type of this.unannotatedTypes) {\n\t\t\tif (isLazy(type)) {\n\t\t\t\tthis.isLazy = true;\n\t\t\t} else {\n\t\t\t\tmarkSchemaMostDerived(type);\n\t\t\t}\n\t\t}\n\n\t\tconst proxy = AnnotatedAllowedTypesInternal.proxy(this);\n\n\t\tthis.lazyEvaluate = new Lazy(() => {\n\t\t\tconst annotated = this.isLazy\n\t\t\t\t? AnnotatedAllowedTypesInternal.create(\n\t\t\t\t\t\tthis.types.map((type) => ({\n\t\t\t\t\t\t\t...type,\n\t\t\t\t\t\t\ttype: evaluateLazySchema(type.type),\n\t\t\t\t\t\t})),\n\t\t\t\t\t\tthis.metadata,\n\t\t\t\t\t)\n\t\t\t\t: (proxy as AllowedTypesFullInternalEvaluated);\n\t\t\treturn {\n\t\t\t\tannotated,\n\t\t\t\tset: new Set(annotated.unannotatedTypes),\n\t\t\t\tidentifiers: new Set(annotated.unannotatedTypes.map((t) => t.identifier)),\n\t\t\t};\n\t\t});\n\n\t\treturn proxy;\n\t}\n\n\tpublic evaluate(): AllowedTypesFullInternalEvaluated {\n\t\treturn this.lazyEvaluate.value.annotated;\n\t}\n\n\tpublic evaluateSet(): ReadonlySet<TreeNodeSchema> {\n\t\treturn this.lazyEvaluate.value.set;\n\t}\n\n\tpublic evaluateIdentifiers(): ReadonlySet<string> {\n\t\treturn this.lazyEvaluate.value.identifiers;\n\t}\n\n\t/**\n\t * Get the {@link SimpleAllowedTypeAttributes} version of the allowed types set.\n\t */\n\tpublic static evaluateSimpleAllowedTypes(\n\t\tannotatedAllowedTypes: AnnotatedAllowedTypes,\n\t): ReadonlyMap<string, SimpleAllowedTypeAttributes> {\n\t\tconst simpleAllowedTypes = new Map<string, SimpleAllowedTypeAttributes>();\n\t\tfor (const type of annotatedAllowedTypes.evaluate().types) {\n\t\t\tsimpleAllowedTypes.set(type.type.identifier, {\n\t\t\t\tisStaged: type.metadata.stagedSchemaUpgrade !== undefined,\n\t\t\t});\n\t\t}\n\t\treturn simpleAllowedTypes;\n\t}\n\n\tpublic static override [Symbol.hasInstance]<TThis extends { prototype: object }>(\n\t\tthis: TThis,\n\t\tvalue: unknown,\n\t): value is InstanceTypeRelaxed<TThis> & AnnotatedAllowedTypesInternal & AllowedTypesFull {\n\t\treturn ErasedTypeImplementation[Symbol.hasInstance].call(this, value);\n\t}\n\n\tpublic static override narrow<TThis extends { prototype: object }>(\n\t\tthis: TThis,\n\t\tvalue: ErasedBaseType | InstanceTypeRelaxed<TThis> | ImplicitAllowedTypes,\n\t): asserts value is InstanceTypeRelaxed<TThis> &\n\t\tAnnotatedAllowedTypesInternal &\n\t\tAllowedTypesFull {\n\t\tif (!ErasedTypeImplementation[Symbol.hasInstance].call(this, value)) {\n\t\t\tthrow new TypeError(\"Invalid AnnotatedAllowedTypes instance\");\n\t\t}\n\t}\n\n\tprivate static proxy<const T extends readonly AnnotatedAllowedType[]>(\n\t\tresult: AnnotatedAllowedTypesInternal<T>,\n\t): AnnotatedAllowedTypesInternal<T> & AllowedTypesFull<T> {\n\t\tconst proxy = new Proxy(result, {\n\t\t\tset: () => {\n\t\t\t\tthrow new UsageError(\"AnnotatedAllowedTypes is immutable\");\n\t\t\t},\n\n\t\t\tget: (target, property, receiver) => {\n\t\t\t\t// Hide common array editing methods.\n\t\t\t\tif (property === \"push\" || property === \"pop\") {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\t// Forward array lookup and array methods to the unannotated types array.\n\t\t\t\tif (property in target.unannotatedTypes) {\n\t\t\t\t\treturn Reflect.get(target.unannotatedTypes, property);\n\t\t\t\t}\n\t\t\t\t// Forward anything else to target.\n\t\t\t\treturn Reflect.get(target, property) as unknown;\n\t\t\t},\n\n\t\t\thas: (target, property) => {\n\t\t\t\tif (property in target.unannotatedTypes) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Forward anything else to target.\n\t\t\t\treturn property in target;\n\t\t\t},\n\n\t\t\townKeys: (target) => {\n\t\t\t\tconst targetKeys = Reflect.ownKeys(target);\n\t\t\t\tconst unannotatedTypesKeys = Reflect.ownKeys(target.unannotatedTypes);\n\t\t\t\treturn [...unannotatedTypesKeys, ...targetKeys];\n\t\t\t},\n\n\t\t\tgetOwnPropertyDescriptor: (target, property) => {\n\t\t\t\tif (Object.prototype.hasOwnProperty.call(target.unannotatedTypes, property)) {\n\t\t\t\t\tconst inner = Object.getOwnPropertyDescriptor(target.unannotatedTypes, property);\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...inner,\n\t\t\t\t\t\t// Since these properties are not on the target, make them non-configurable to confirm with proxy invariants.\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\twritable: false,\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tconst inner = Object.getOwnPropertyDescriptor(target, property);\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...inner,\n\t\t\t\t\t\twritable: false,\n\t\t\t\t\t\t// Allow only array entries to be enumerable.\n\t\t\t\t\t\tenumerable: false,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\treturn proxy as typeof result & UnannotateAllowedTypesList<T>;\n\t}\n\n\tpublic static create<const T extends readonly AnnotatedAllowedType[]>(\n\t\ttypes: T,\n\t\tmetadata: AllowedTypesMetadata = {},\n\t): AnnotatedAllowedTypesInternal<Readonly<T>> & AllowedTypesFull<Readonly<T>> {\n\t\tconst result = new AnnotatedAllowedTypesInternal(types, metadata);\n\t\treturn result as typeof result & UnannotateAllowedTypesList<T>;\n\t}\n\n\tpublic static createUnannotated<const T extends AllowedTypes>(\n\t\ttypes: T,\n\t\tmetadata: AllowedTypesMetadata = {},\n\t): AnnotatedAllowedTypesInternal & Readonly<T> {\n\t\tObject.freeze(types);\n\t\tconst annotatedTypes: AnnotatedAllowedType[] = types.map(normalizeToAnnotatedAllowedType);\n\t\tconst result = AnnotatedAllowedTypesInternal.create(annotatedTypes, metadata);\n\t\treturn result as typeof result & T;\n\t}\n\n\tpublic static createMixed<\n\t\tconst T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[],\n\t>(types: T, metadata: AllowedTypesMetadata = {}): AllowedTypesFullFromMixed<T> {\n\t\tObject.freeze(types);\n\t\tconst annotatedTypes: AnnotatedAllowedType[] = types.map(normalizeToAnnotatedAllowedType);\n\t\tconst result = AnnotatedAllowedTypesInternal.create(annotatedTypes, metadata);\n\t\treturn result as AllowedTypesFullFromMixed<T>;\n\t}\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 * @beta\n * @input\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\tcheckForUninitializedSchema(allowedType);\n\t// Class based schema, and lazy schema references report type \"function\": filtering them out with typeof makes narrowing based on members mostly safe\n\treturn typeof allowedType === \"object\" && \"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 * @beta\n * @input\n */\nexport interface AllowedTypeMetadata {\n\t/**\n\t * User defined metadata\n\t */\n\treadonly custom?: unknown;\n\n\t/**\n\t * If defined, indicates that an allowed type is {@link SchemaStaticsBeta.staged | staged}.\n\t */\n\treadonly stagedSchemaUpgrade?: SchemaUpgrade;\n}\n\n/**\n * Package internal {@link SchemaUpgrade} construction API.\n */\nexport let createSchemaUpgrade: () => SchemaUpgrade;\n\n/**\n * Unique token used to upgrade schemas and determine if a particular upgrade has been completed.\n * @remarks\n * Create using {@link SchemaStaticsBeta.staged}.\n * @privateRemarks\n * TODO:#38722 implement runtime schema upgrades.\n * Until then, the class purely behaves mostly as a placeholder.\n * TODO: Consider allowing users to store a name for the upgrade to use in error messages.\n * @sealed @beta\n */\nexport class SchemaUpgrade {\n\tprotected _typeCheck!: MakeNominal;\n\tstatic {\n\t\tcreateSchemaUpgrade = () => new SchemaUpgrade();\n\t}\n\n\tprivate constructor() {}\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 * Code reading data from this should use {@link normalizeAllowedTypes} to ensure consistent handling, caching, nice errors etc.\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 * @public\n */\nexport type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;\n\n/**\n * Removes annotations from a list of allowed types that may contain annotations.\n * @system @beta\n */\nexport type UnannotateAllowedTypesList<\n\tT extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[],\n> = {\n\t[I in keyof T]: T[I] extends AnnotatedAllowedType<infer X> ? X : T[I];\n};\n\n/**\n * Add annotations to a list of allowed types that may or may not contain annotations.\n * @system @beta\n */\nexport type AnnotateAllowedTypesList<\n\tT extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[],\n> = {\n\t[I in keyof T]: T[I] extends AnnotatedAllowedType<unknown>\n\t\t? T[I]\n\t\t: AnnotatedAllowedType<T[I]>;\n};\n\n/**\n * Normalizes an {@link ImplicitAllowedTypes} to an {@link AllowedTypesFull}.\n * @alpha\n */\nexport function normalizeAllowedTypes(types: ImplicitAllowedTypes): AllowedTypesFull {\n\treturn normalizeAllowedTypesInternal(types);\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 LazyItem<TreeNodeSchema>>(\n\ttype: T | AnnotatedAllowedType<T>,\n): AnnotatedAllowedType<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 * See note inside {@link normalizeAllowedTypesInternal}.\n */\nconst cachedNormalize = new WeakMap<ImplicitAllowedTypes, AllowedTypesFullInternal>();\n\n/**\n * Normalizes allowed types to an {@link AllowedTypesFullInternal}.\n */\nexport function normalizeAllowedTypesInternal(\n\ttype: ImplicitAllowedTypes,\n): AllowedTypesFullInternal {\n\tif (isAnnotatedAllowedTypes(type)) {\n\t\treturn type;\n\t}\n\n\t// This caching accomplishes two things:\n\t// 1. It avoids redundant computations for the same input.\n\t// 2. It provides a stable object identity for the output in case the input is normalized twice and other systems (such as unhydrated contexts) are cached based on the object identity of the output.\n\t// It is this second case which is the more important since creating the AnnotatedAllowedTypesInternal is rather cheap.\n\t// Adding this cache improved the performance of the \"large recursive union\" test (which mostly just constructs a TreeConfiguration) by ~5 times.\n\t// This cache is strictly a performance optimization: it is not required for correctness.\n\treturn getOrCreate(cachedNormalize, type, () => {\n\t\tconst inputArray = isReadonlyArray(type) ? type : [type];\n\t\tObject.freeze(inputArray);\n\t\tconst annotatedTypes: AnnotatedAllowedType[] = inputArray.map(\n\t\t\tnormalizeToAnnotatedAllowedType,\n\t\t);\n\n\t\treturn AnnotatedAllowedTypesInternal.create(annotatedTypes);\n\t});\n}\n\n/**\n * Normalizes an {@link ImplicitAllowedTypes} to an {@link AllowedTypesFullInternalEvaluated} 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 normalizeAndEvaluateAnnotatedAllowedTypes(\n\ttypes: ImplicitAllowedTypes,\n): AllowedTypesFullInternalEvaluated {\n\treturn normalizeAllowedTypesInternal(types).evaluate();\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\n\tcheckForUninitializedSchema(evaluatedSchema);\n\tmarkSchemaMostDerived(evaluatedSchema);\n\treturn evaluatedSchema;\n}\n\n/**\n * Throws a UsageError if the provided schema is undefined, most likely due to being used before it was initialized.\n */\nexport function checkForUninitializedSchema(\n\tschema: ImplicitAllowedTypes | LazyItem<TreeNodeSchema> | AnnotatedAllowedType,\n): void {\n\tif (schema === 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. Consider using a lazy schema reference (like \"() => schema\") or delaying the evaluation of the lazy reference if one is already being used.`,\n\t\t);\n\t}\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 {@link https://en.wikipedia.org/wiki/Type_variance | contravariant}) over the schema.\n * (See also {@link https://www.typescriptlang.org/docs/handbook/2/generics.html#variance-annotations | TypeScript 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 non-recursive 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 [\n\t\t\t\t\tLazyItem<infer 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}[NumberKeys<TList>];\n\n/**\n * Extracts the keys of `T` which are numbers.\n * @remarks\n * The keys are extracted as strings which can be used to index `T`.\n *\n * This handles cases like `{ x: 4 } & [5, 6]` returning `\"0\"` and `\"1\"`.\n * Such cases are difficult to handle since `keyof` includes `number` in such cases, but the type can not be indexed by `number`.\n * @system @public\n */\nexport type NumberKeys<\n\tT,\n\tTransformed = {\n\t\treadonly [Property in keyof T as number extends Property ? never : Property]: Property;\n\t},\n> = Transformed[`${number}` & keyof Transformed];\n"]}
@@ -10,7 +10,7 @@ const internal_1 = require("@fluidframework/core-utils/internal");
10
10
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
11
11
  const treeNodeKernel_js_1 = require("./treeNodeKernel.js");
12
12
  const treeNodeSchema_js_1 = require("./treeNodeSchema.js");
13
- // eslint-disable-next-line import/no-deprecated
13
+ // eslint-disable-next-line import-x/no-deprecated
14
14
  const withType_js_1 = require("./withType.js");
15
15
  const flexList_js_1 = require("./flexList.js");
16
16
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"treeNode.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAEtE,2DAA2D;AAC3D,2DAAyE;AACzE,gDAAgD;AAChD,+CAAqF;AACrF,+CAA0C;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAsB,QAAQ;IAmEtB,MAAM,CAAC,mCAAC,MAAM,CAAC,WAAW,EAAC,CAA8B,KAAc;QAC7E,MAAM,MAAM,GAAG,IAAA,wCAAoB,EAAC,KAAK,CAAC,CAAC;QAE3C,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,4BAAQ,CAAC,IAAI,EAAE,CAAC;YAC3D,OAAO,KAAK,CAAC;QACd,CAAC;QAED,IAAA,iBAAM,EAAC,WAAW,IAAI,MAAM,EAAE,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACvE,OAAO,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;OAOG;IACH,YAAsB,KAAc;QArFpC;;;;;;;;;;;;;;;;;;;;;;;;;WAyBG;QACM,kCAAiB;QA4DzB,IAAI,KAAK,KAAK,oBAAY,EAAE,CAAC;YAC5B,MAAM,IAAI,qBAAU,CAAC,+DAA+D,CAAC,CAAC;QACvF,CAAC;IACF,CAAC;CACD;AA3FD,4BA2FC;AACD,gJAAgJ;AAChJ,IAAA,uBAAS,EAAC,QAAQ,CAAC,CAAC;AAEpB;;GAEG;AACU,QAAA,YAAY,GAAG,EAAE,CAAC;AAE/B;;;;;GAKG;AACH,kDAAkD;AAClD,SAAgB,gBAAgB,CAAC,OAAsB,EAAE,IAAY;IACpE,IAAI,QAAQ,GAAG,OAAO,CAAC;IACvB,OAAO,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC1B,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC;QACb,CAAC;QACD,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AATD,4CASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { tryGetTreeNodeSchema } from \"./treeNodeKernel.js\";\nimport { NodeKind, type TreeNodeSchemaClass } from \"./treeNodeSchema.js\";\n// eslint-disable-next-line import/no-deprecated\nimport { type WithType, typeNameSymbol, type typeSchemaSymbol } from \"./withType.js\";\nimport { markEager } from \"./flexList.js\";\n\n/**\n * A non-{@link NodeKind.Leaf|leaf} SharedTree node. Includes objects, arrays, and maps.\n *\n * @remarks\n * Base type which all nodes extend.\n *\n * This type can be used as a type to indicate/document values which should be tree nodes.\n * Runtime use of this class object (for example when used with `instanceof` or extending it), is not currently supported.\n *\n * There are three ways to get instances of TreeNode:\n *\n * 1. From a {@link TreeView} loading nodes from an existing document, or creating local copies of nodes inserted by a remote collaborator.\n * This case provides an {@link InternalTreeNode} to the constructor: subclasses must not modify how the constructor handles this case.\n *\n * 2. Explicit construction of {@link Unhydrated} nodes using either {@link TreeNodeSchemaClass} as a constructor or {@link TreeNodeSchemaNonClass|TreeNodeSchemaNonClass.create}.\n * Either way the {@link TreeNodeSchema} produced must be produced using a {@link SchemaFactory}.\n * There are also higher level APIs which wrap these, including {@link (TreeBeta:interface).create}, {@link (TreeBeta:interface).clone},\n * and import APIs like {@link (TreeBeta:interface).importConcise}, {@link (TreeAlpha:interface).importVerbose}, and {@link (TreeAlpha:interface).importCompressed}.\n *\n * 3. Implicit construction: Several APIs which logically require an unhydrated TreeNode also allow passing in a value which could be used to explicitly construct the node instead.\n * These APIs internally call the constructor with the provided value (typically behaving like {@link (TreeAlpha:interface).create}), so it's really just a special case of the above option.\n * Note that when constructing nodes, sometimes implicit construction is not allowed\n * (either at runtime due to ambiguous types or at compile time due to TypeScript limitations):\n * in such cases, explicit construction must be used.\n * @privateRemarks\n * This is a class not an interface to enable stricter type checking (see {@link TreeNode.#brand})\n * and some runtime enforcement of schema class policy (see the the validation in the constructor).\n *\n * Not all node implementations include this in their prototype chain (some hide it with a proxy),\n * and thus cause the default/built in `instanceof` to return false despite our type checking and all other APIs treating them as TreeNodes.\n * This class provides a custom `Symbol.hasInstance` to fix `instanceof` for this class and all classes extending it.\n * @sealed @public\n */\nexport abstract class TreeNode implements WithType {\n\t/**\n\t * This is added to prevent TypeScript from implicitly allowing non-TreeNode types to be used as TreeNodes.\n\t * @remarks\n\t * This field forces TypeScript to use nominal instead of structural typing,\n\t * preventing compiler error messages and tools like \"add missing properties\"\n\t * from adding the [type] field as a solution when using a non-TreeNode object where a TreeNode is required.\n\t * Instead TreeNodes must be created through the appropriate APIs, see the documentation on {@link TreeNode} for details.\n\t *\n\t * @privateRemarks\n\t * This is a JavaScript private field, so is not accessible from outside this class.\n\t * This prevents it from having name collisions with object fields.\n\t * Since this is private, the type of this field is stripped in the d.ts file.\n\t * To get matching type checking within and from outside the package, the least informative type (`unknown`) is used.\n\t * To avoid this having any runtime impact, the field is uninitialized.\n\t *\n\t * Making this field optional results in different type checking within this project than outside of it, since the d.ts file drops the optional aspect of the field.\n\t * This is extra confusing since since the tests get in-project typing for intellisense and separate project checking at build time.\n\t * To avoid all this mess, this field is required, not optional.\n\t *\n\t * Another option would be to use a symbol (possibly as a private field).\n\t * That approach ran into some strange difficulties causing SchemaFactory to fail to compile, and was not investigated further.\n\t *\n\t * The [type] symbol provides a lot of the value this private brand does, but is not all of it:\n\t * someone could manually (or via Intellisense auto-implement completion, or in response to a type error)\n\t * make an object literal with the [type] field and pass it off as a node: this private brand prevents that.\n\t */\n\treadonly #brand!: unknown;\n\n\t/**\n\t * Adds a type symbol for stronger typing.\n\t * @privateRemarks\n\t * Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.\n\t * @deprecated Use {@link typeSchemaSymbol} instead.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic abstract get [typeNameSymbol](): string;\n\n\t/**\n\t * Adds a type symbol for stronger typing.\n\t * @privateRemarks\n\t * Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.\n\t */\n\tpublic abstract get [typeSchemaSymbol](): TreeNodeSchemaClass;\n\n\t/**\n\t * Provides `instanceof` support for testing if a value is a `TreeNode`.\n\t * @remarks\n\t * For more options, like including leaf values or narrowing to collections of schema, use `is` or `schema` from {@link TreeNodeApi}.\n\t * @privateRemarks\n\t * Due to type-only export, this functionality is not available outside the package.\n\t */\n\tpublic static [Symbol.hasInstance](value: unknown): value is TreeNode;\n\n\t/**\n\t * Provides `instanceof` support for all schema classes with public constructors.\n\t * @remarks\n\t * For more options, like including leaf values or narrowing to collections of schema, use `is` or `schema` from {@link TreeNodeApi}.\n\t * @privateRemarks\n\t * Despite type-only export, this functionality is available outside the package since it is inherited by subclasses.\n\t */\n\tpublic static [Symbol.hasInstance]<\n\t\tTSchema extends abstract new (\n\t\t\t...args: any[]\n\t\t) => TreeNode,\n\t>(this: TSchema, value: unknown): value is InstanceType<TSchema>;\n\n\tpublic static [Symbol.hasInstance](this: { prototype: object }, value: unknown): boolean {\n\t\tconst schema = tryGetTreeNodeSchema(value);\n\n\t\tif (schema === undefined || schema.kind === NodeKind.Leaf) {\n\t\t\treturn false;\n\t\t}\n\n\t\tassert(\"prototype\" in schema, 0x98a /* expected class based schema */);\n\t\treturn inPrototypeChain(schema.prototype, this.prototype);\n\t}\n\n\t/**\n\t * TreeNodes must extend schema classes created by SchemaFactory, and therefore this constructor should not be invoked directly by code outside this package.\n\t * @privateRemarks\n\t * `token` must be the {@link privateToken} value, which is not package exported.\n\t * This is used to detect invalid subclasses.\n\t *\n\t * All valid subclass should use {@link TreeNodeValid}, but this code doesn't directly reference it to avoid cyclic dependencies.\n\t */\n\tprotected constructor(token: unknown) {\n\t\tif (token !== privateToken) {\n\t\t\tthrow new UsageError(\"TreeNodes must extend schema classes created by SchemaFactory\");\n\t\t}\n\t}\n}\n// Class objects are functions (callable), so we need a strong way to distinguish between `schema` and `() => schema` when used as a `LazyItem`.\nmarkEager(TreeNode);\n\n/**\n * `token` to pass to {@link TreeNode}'s constructor used to detect invalid subclasses.\n */\nexport const privateToken = {};\n\n/**\n * Check if the prototype derived's prototype chain contains `base`.\n * @param derived - prototype to check\n * @param base - prototype to search for\n * @returns true iff `base` is in the prototype chain starting at `derived`.\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport function inPrototypeChain(derived: object | null, base: object): boolean {\n\tlet checking = derived;\n\twhile (checking !== null) {\n\t\tif (base === checking) {\n\t\t\treturn true;\n\t\t}\n\t\tchecking = Reflect.getPrototypeOf(checking);\n\t}\n\treturn false;\n}\n"]}
1
+ {"version":3,"file":"treeNode.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAEtE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D,OAAO,KAAK,CAAC;AACd,CAAC;AATD,4CASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { tryGetTreeNodeSchema } from \"./treeNodeKernel.js\";\nimport { NodeKind, type TreeNodeSchemaClass } from \"./treeNodeSchema.js\";\n// eslint-disable-next-line import-x/no-deprecated\nimport { type WithType, typeNameSymbol, type typeSchemaSymbol } from \"./withType.js\";\nimport { markEager } from \"./flexList.js\";\n\n/**\n * A non-{@link NodeKind.Leaf|leaf} SharedTree node. Includes objects, arrays, and maps.\n *\n * @remarks\n * Base type which all nodes extend.\n *\n * This type can be used as a type to indicate/document values which should be tree nodes.\n * Runtime use of this class object (for example when used with `instanceof` or extending it), is not currently supported.\n *\n * There are three ways to get instances of TreeNode:\n *\n * 1. From a {@link TreeView} loading nodes from an existing document, or creating local copies of nodes inserted by a remote collaborator.\n * This case provides an {@link InternalTreeNode} to the constructor: subclasses must not modify how the constructor handles this case.\n *\n * 2. Explicit construction of {@link Unhydrated} nodes using either {@link TreeNodeSchemaClass} as a constructor or {@link TreeNodeSchemaNonClass|TreeNodeSchemaNonClass.create}.\n * Either way the {@link TreeNodeSchema} produced must be produced using a {@link SchemaFactory}.\n * There are also higher level APIs which wrap these, including {@link (TreeBeta:interface).create}, {@link (TreeBeta:interface).clone},\n * and import APIs like {@link (TreeBeta:interface).importConcise}, {@link (TreeAlpha:interface).importVerbose}, and {@link (TreeAlpha:interface).importCompressed}.\n *\n * 3. Implicit construction: Several APIs which logically require an unhydrated TreeNode also allow passing in a value which could be used to explicitly construct the node instead.\n * These APIs internally call the constructor with the provided value (typically behaving like {@link (TreeAlpha:interface).create}), so it's really just a special case of the above option.\n * Note that when constructing nodes, sometimes implicit construction is not allowed\n * (either at runtime due to ambiguous types or at compile time due to TypeScript limitations):\n * in such cases, explicit construction must be used.\n * @privateRemarks\n * This is a class not an interface to enable stricter type checking (see {@link TreeNode.#brand})\n * and some runtime enforcement of schema class policy (see the the validation in the constructor).\n *\n * Not all node implementations include this in their prototype chain (some hide it with a proxy),\n * and thus cause the default/built in `instanceof` to return false despite our type checking and all other APIs treating them as TreeNodes.\n * This class provides a custom `Symbol.hasInstance` to fix `instanceof` for this class and all classes extending it.\n * @sealed @public\n */\nexport abstract class TreeNode implements WithType {\n\t/**\n\t * This is added to prevent TypeScript from implicitly allowing non-TreeNode types to be used as TreeNodes.\n\t * @remarks\n\t * This field forces TypeScript to use nominal instead of structural typing,\n\t * preventing compiler error messages and tools like \"add missing properties\"\n\t * from adding the [type] field as a solution when using a non-TreeNode object where a TreeNode is required.\n\t * Instead TreeNodes must be created through the appropriate APIs, see the documentation on {@link TreeNode} for details.\n\t *\n\t * @privateRemarks\n\t * This is a JavaScript private field, so is not accessible from outside this class.\n\t * This prevents it from having name collisions with object fields.\n\t * Since this is private, the type of this field is stripped in the d.ts file.\n\t * To get matching type checking within and from outside the package, the least informative type (`unknown`) is used.\n\t * To avoid this having any runtime impact, the field is uninitialized.\n\t *\n\t * Making this field optional results in different type checking within this project than outside of it, since the d.ts file drops the optional aspect of the field.\n\t * This is extra confusing since since the tests get in-project typing for intellisense and separate project checking at build time.\n\t * To avoid all this mess, this field is required, not optional.\n\t *\n\t * Another option would be to use a symbol (possibly as a private field).\n\t * That approach ran into some strange difficulties causing SchemaFactory to fail to compile, and was not investigated further.\n\t *\n\t * The [type] symbol provides a lot of the value this private brand does, but is not all of it:\n\t * someone could manually (or via Intellisense auto-implement completion, or in response to a type error)\n\t * make an object literal with the [type] field and pass it off as a node: this private brand prevents that.\n\t */\n\treadonly #brand!: unknown;\n\n\t/**\n\t * Adds a type symbol for stronger typing.\n\t * @privateRemarks\n\t * Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.\n\t * @deprecated Use {@link typeSchemaSymbol} instead.\n\t */\n\t// eslint-disable-next-line import-x/no-deprecated\n\tpublic abstract get [typeNameSymbol](): string;\n\n\t/**\n\t * Adds a type symbol for stronger typing.\n\t * @privateRemarks\n\t * Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.\n\t */\n\tpublic abstract get [typeSchemaSymbol](): TreeNodeSchemaClass;\n\n\t/**\n\t * Provides `instanceof` support for testing if a value is a `TreeNode`.\n\t * @remarks\n\t * For more options, like including leaf values or narrowing to collections of schema, use `is` or `schema` from {@link TreeNodeApi}.\n\t * @privateRemarks\n\t * Due to type-only export, this functionality is not available outside the package.\n\t */\n\tpublic static [Symbol.hasInstance](value: unknown): value is TreeNode;\n\n\t/**\n\t * Provides `instanceof` support for all schema classes with public constructors.\n\t * @remarks\n\t * For more options, like including leaf values or narrowing to collections of schema, use `is` or `schema` from {@link TreeNodeApi}.\n\t * @privateRemarks\n\t * Despite type-only export, this functionality is available outside the package since it is inherited by subclasses.\n\t */\n\tpublic static [Symbol.hasInstance]<\n\t\tTSchema extends abstract new (\n\t\t\t...args: any[]\n\t\t) => TreeNode,\n\t>(this: TSchema, value: unknown): value is InstanceType<TSchema>;\n\n\tpublic static [Symbol.hasInstance](this: { prototype: object }, value: unknown): boolean {\n\t\tconst schema = tryGetTreeNodeSchema(value);\n\n\t\tif (schema === undefined || schema.kind === NodeKind.Leaf) {\n\t\t\treturn false;\n\t\t}\n\n\t\tassert(\"prototype\" in schema, 0x98a /* expected class based schema */);\n\t\treturn inPrototypeChain(schema.prototype, this.prototype);\n\t}\n\n\t/**\n\t * TreeNodes must extend schema classes created by SchemaFactory, and therefore this constructor should not be invoked directly by code outside this package.\n\t * @privateRemarks\n\t * `token` must be the {@link privateToken} value, which is not package exported.\n\t * This is used to detect invalid subclasses.\n\t *\n\t * All valid subclass should use {@link TreeNodeValid}, but this code doesn't directly reference it to avoid cyclic dependencies.\n\t */\n\tprotected constructor(token: unknown) {\n\t\tif (token !== privateToken) {\n\t\t\tthrow new UsageError(\"TreeNodes must extend schema classes created by SchemaFactory\");\n\t\t}\n\t}\n}\n// Class objects are functions (callable), so we need a strong way to distinguish between `schema` and `() => schema` when used as a `LazyItem`.\nmarkEager(TreeNode);\n\n/**\n * `token` to pass to {@link TreeNode}'s constructor used to detect invalid subclasses.\n */\nexport const privateToken = {};\n\n/**\n * Check if the prototype derived's prototype chain contains `base`.\n * @param derived - prototype to check\n * @param base - prototype to search for\n * @returns true iff `base` is in the prototype chain starting at `derived`.\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport function inPrototypeChain(derived: object | null, base: object): boolean {\n\tlet checking = derived;\n\twhile (checking !== null) {\n\t\tif (base === checking) {\n\t\t\treturn true;\n\t\t}\n\t\tchecking = Reflect.getPrototypeOf(checking);\n\t}\n\treturn false;\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  export { typeNameSymbol, typeSchemaSymbol, contentSchemaSymbol, type WithType, type TreeNodeSchema, type AnnotatedAllowedType, type AllowedTypesFullEvaluated, NodeKind, type TreeNodeSchemaClass, type TreeNodeSchemaNonClass, type TreeNodeSchemaCore, TreeNode, type Unhydrated, type InternalTreeNode, isTreeNode, tryDisposeTreeNode, HydratedContext, SimpleContextSlot, getInnerNode, getOrCreateNodeFromInnerNode, getOrCreateNodeFromInnerUnboxedNode, getKernel, type NodeFromSchema, isTreeNodeSchemaClass, type TreeNodeFromImplicitAllowedTypes, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, type AllowedTypes, type InsertableTreeNodeFromAllowedTypes, type InsertableTypedNode, type NodeBuilderData, type Input, normalizeAllowedTypes, type NodeSchemaMetadata, type ImplicitAllowedTypes, type AllowedTypesMetadata, evaluateLazySchema, type UnannotateAllowedTypesList, type AllowedTypeMetadata, type AnnotatedAllowedTypes, type SchemaUpgrade, type LazyItem, type FlexList, type FlexListToUnion, type ExtractItemType, walkNodeSchema, walkAllowedTypes, type SchemaVisitor, type SimpleNodeSchemaBase, withBufferedTreeEvents, type AnnotateAllowedTypesList, type AllowedTypesFull, type AllowedTypesFullFromMixed, AnnotatedAllowedTypesInternal, type NumberKeys, } from "./core/index.js";
6
6
  export { walkFieldSchema } from "./walkFieldSchema.js";
7
7
  export type { UnsafeUnknownSchema, Insertable } from "./unsafeUnknownSchema.js";
8
- export { type ITree, type TreeView, type ViewableTree, type TreeViewEvents, TreeViewConfiguration, TreeViewConfigurationAlpha, type ITreeViewConfiguration, type SchemaCompatibilityStatus, type ITreeConfigurationOptions, SchemaFactory, SchemaFactoryBeta, SchemaFactoryAlpha, type ObjectSchemaOptionsAlpha, type ObjectSchemaOptions, type ScopedSchemaName, type ValidateRecursiveSchema, type FixRecursiveArraySchema, adaptEnum, enumFromStrings, singletonSchema, treeNodeApi, type TreeNodeApi, type NodeChangedData, borrowCursorFromTreeNodeOrValue, exportConcise, importConcise, TreeBeta, type TreeChangeEventsBeta, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, type DirtyTreeStatus, trackDirtyNodes, type DirtyTreeMap, type JsonSchemaId, type JsonSchemaType, type JsonObjectNodeSchema, type JsonArrayNodeSchema, type JsonMapNodeSchema, type JsonLeafNodeSchema, type JsonSchemaRef, type JsonRefPath, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonTreeSchema, type JsonFieldSchema, type JsonLeafSchemaType, type JsonRecordNodeSchema, type JsonStringKeyPatternProperties, type TreeSchemaEncodingOptions, getJsonSchema, getSimpleSchema, type VerboseTreeNode, type TreeEncodingOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, SchemaCompatibilityTester, type Unenforced, type System_Unsafe, type ArrayNodeCustomizableSchemaUnsafe, type MapNodeCustomizableSchemaUnsafe, type TreeRecordNodeUnsafe, type UnannotateAllowedTypeUnsafe, type AnnotatedAllowedTypeUnsafe, type AnnotatedAllowedTypesUnsafe, type AllowedTypesFullUnsafe, type AllowedTypesFullFromMixedUnsafe, type UnannotateAllowedTypesListUnsafe, type AnnotateAllowedTypesListUnsafe, type TreeViewAlpha, type TreeViewBeta, type TreeBranch, type TreeBranchAlpha, type TreeBranchEvents, getPropertyKeyFromStoredKey, getStoredKey, tryGetSchema, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, conciseFromCursor, createFromCursor, asTreeViewAlpha, customFromCursorStored, type CustomTreeNode, type CustomTreeValue, tryStoredSchemaAsArray, type SchemaStatics, type ITreeAlpha, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, rollback, generateSchemaFromSimpleSchema, replaceConciseTreeHandles, replaceHandles, replaceVerboseTreeHandles, type HandleConverter, allowUnused, type FieldSchemaAlphaUnsafe, getIdentifierFromNode, type TreeSchema, type ValidateRecursiveSchemaTemplate, type FixRecursiveRecursionLimit, schemaStatics, type TreeChangeEvents, type NodeSchemaOptions, type NodeSchemaOptionsAlpha, type SchemaStaticsAlpha, KeyEncodingOptions, type TreeParsingOptions, incrementalSummaryHint, getShouldIncrementallySummarizeAllowedTypes, type SchemaFactory_base, } from "./api/index.js";
8
+ export { type ITree, type TreeView, type ViewableTree, type TreeViewEvents, TreeViewConfiguration, TreeViewConfigurationAlpha, type ITreeViewConfiguration, type SchemaCompatibilityStatus, type ITreeConfigurationOptions, SchemaFactory, SchemaFactoryBeta, type SchemaStaticsBeta, SchemaFactoryAlpha, type ObjectSchemaOptionsAlpha, type ObjectSchemaOptions, type ScopedSchemaName, type ValidateRecursiveSchema, type FixRecursiveArraySchema, adaptEnum, enumFromStrings, singletonSchema, treeNodeApi, type TreeNodeApi, type NodeChangedData, borrowCursorFromTreeNodeOrValue, exportConcise, importConcise, TreeBeta, type TreeChangeEventsBeta, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, type DirtyTreeStatus, trackDirtyNodes, type DirtyTreeMap, type JsonSchemaId, type JsonSchemaType, type JsonObjectNodeSchema, type JsonArrayNodeSchema, type JsonMapNodeSchema, type JsonLeafNodeSchema, type JsonSchemaRef, type JsonRefPath, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonTreeSchema, type JsonFieldSchema, type JsonLeafSchemaType, type JsonRecordNodeSchema, type JsonStringKeyPatternProperties, type TreeSchemaEncodingOptions, getJsonSchema, getSimpleSchema, type VerboseTreeNode, type TreeEncodingOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, SchemaCompatibilityTester, type Unenforced, type System_Unsafe, type ArrayNodeCustomizableSchemaUnsafe, type MapNodeCustomizableSchemaUnsafe, type TreeRecordNodeUnsafe, type UnannotateAllowedTypeUnsafe, type AnnotatedAllowedTypeUnsafe, type AnnotatedAllowedTypesUnsafe, type AllowedTypesFullUnsafe, type AllowedTypesFullFromMixedUnsafe, type UnannotateAllowedTypesListUnsafe, type AnnotateAllowedTypesListUnsafe, type TreeViewAlpha, type TreeViewBeta, type TreeBranch, type TreeBranchAlpha, type TreeBranchEvents, getPropertyKeyFromStoredKey, getStoredKey, tryGetSchema, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, conciseFromCursor, createFromCursor, asTreeViewAlpha, customFromCursorStored, type CustomTreeNode, type CustomTreeValue, tryStoredSchemaAsArray, type SchemaStatics, type ITreeAlpha, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, rollback, generateSchemaFromSimpleSchema, replaceConciseTreeHandles, replaceHandles, replaceVerboseTreeHandles, type HandleConverter, allowUnused, type FieldSchemaAlphaUnsafe, getIdentifierFromNode, type TreeSchema, type ValidateRecursiveSchemaTemplate, type FixRecursiveRecursionLimit, schemaStatics, type TreeChangeEvents, type NodeSchemaOptions, type NodeSchemaOptionsAlpha, KeyEncodingOptions, type TreeParsingOptions, incrementalSummaryHint, getShouldIncrementallySummarizeAllowedTypes, type SchemaFactory_base, } from "./api/index.js";
9
9
  export type { SimpleTreeSchema, SimpleNodeSchema, SimpleFieldSchema, SimpleLeafNodeSchema, SimpleMapNodeSchema, SimpleArrayNodeSchema, SimpleObjectNodeSchema, SimpleNodeSchemaBaseAlpha, SimpleObjectFieldSchema, SimpleRecordNodeSchema, SimpleAllowedTypeAttributes, } from "./simpleSchema.js";
10
10
  export { type ImplicitFieldSchema, type TreeFieldFromImplicitField, FieldKind, FieldSchema, FieldSchemaAlpha, type InsertableTreeFieldFromImplicitField, type DefaultProvider, type FieldProps, type FieldPropsAlpha, normalizeFieldSchema, areFieldSchemaEqual, areImplicitFieldSchemaEqual, type ApplyKind, type FieldSchemaMetadata, type InsertableField, type ApplyKindInput, type ReadableField, type ReadSchema, } from "./fieldSchema.js";
11
11
  export { tryGetTreeNodeForField } from "./getTreeNodeForField.js";
@@ -15,4 +15,5 @@ export { prepareForInsertion, prepareForInsertionContextless, } from "./prepareF
15
15
  export { toStoredSchema, getStoredSchema, convertFieldKind, toUpgradeSchema, toInitialSchema, convertField, toUnhydratedSchema, restrictiveStoredSchemaGenerationOptions, permissiveStoredSchemaGenerationOptions, } from "./toStoredSchema.js";
16
16
  export { numberSchema, stringSchema, booleanSchema, handleSchema, nullSchema, } from "./leafNodeSchema.js";
17
17
  export type { LeafSchema } from "./leafNodeSchema.js";
18
+ export { encodeSimpleSchema, decodeSimpleSchema, } from "./api/index.js";
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,UAAU,EACV,kBAAkB,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AwB,EACxB,KAAK,iBAAiB,EACtB,aAAa,EACb,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,aAAa,EACb,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,kBAAkB,EAClB,KAAK,cAAc,EACnB,QAAQ,EACR,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,gBAAgB,EAChB,KAAK,cAAc,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,gCAAgC,EAChC,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,oBAAoB,GACzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,mBAAmB,EACnB,8BAA8B,GAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,wCAAwC,EACxC,uCAAuC,GACvC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,GACV,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,g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ACf,OAAO,EACP,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,aAAa,EACb,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,aAAa,EACb,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,kBAAkB,EAClB,KAAK,cAAc,EACnB,QAAQ,EACR,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,gBAAgB,EAChB,KAAK,cAAc,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,gCAAgC,EAChC,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,oBAAoB,GACzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,mBAAmB,EACnB,8BAA8B,GAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,wCAAwC,EACxC,uCAAuC,GACvC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,GACV,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACN,kBAAkB,EAClB,kBAAkB,GAClB,MAAM,gBAAgB,CAAC"}
@@ -6,6 +6,7 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.createFromCursor = exports.conciseFromCursor = exports.verboseFromCursor = exports.cursorFromVerbose = exports.applySchemaToParserOptions = exports.tryGetSchema = exports.getStoredKey = exports.getPropertyKeyFromStoredKey = exports.SchemaCompatibilityTester = exports.comparePersistedSchema = exports.extractPersistedSchema = exports.getSimpleSchema = exports.getJsonSchema = exports.trackDirtyNodes = exports.createIdentifierIndex = exports.createSimpleTreeIndex = exports.TreeBeta = exports.importConcise = exports.exportConcise = exports.borrowCursorFromTreeNodeOrValue = exports.treeNodeApi = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.SchemaFactoryAlpha = exports.SchemaFactoryBeta = exports.SchemaFactory = exports.TreeViewConfigurationAlpha = exports.TreeViewConfiguration = exports.walkFieldSchema = exports.AnnotatedAllowedTypesInternal = exports.withBufferedTreeEvents = exports.walkAllowedTypes = exports.walkNodeSchema = exports.evaluateLazySchema = exports.normalizeAllowedTypes = exports.isTreeNodeSchemaClass = exports.getKernel = exports.getOrCreateNodeFromInnerUnboxedNode = exports.getOrCreateNodeFromInnerNode = exports.getInnerNode = exports.SimpleContextSlot = exports.HydratedContext = exports.tryDisposeTreeNode = exports.isTreeNode = exports.TreeNode = exports.NodeKind = exports.contentSchemaSymbol = exports.typeSchemaSymbol = exports.typeNameSymbol = void 0;
8
8
  exports.nullSchema = exports.handleSchema = exports.booleanSchema = exports.stringSchema = exports.numberSchema = exports.permissiveStoredSchemaGenerationOptions = exports.restrictiveStoredSchemaGenerationOptions = exports.toUnhydratedSchema = exports.convertField = exports.toInitialSchema = exports.toUpgradeSchema = exports.convertFieldKind = exports.getStoredSchema = exports.toStoredSchema = exports.prepareForInsertionContextless = exports.prepareForInsertion = exports.unhydratedFlexTreeFromInsertable = exports.RecordNodeSchema = exports.isRecordNodeSchema = exports.setField = exports.isObjectNodeSchema = exports.ObjectNodeSchema = exports.isMapNodeSchema = exports.MapNodeSchema = exports.TreeArrayNode = exports.IterableTreeArrayContent = exports.isArrayNodeSchema = exports.asIndex = exports.ArrayNodeSchema = exports.tryGetTreeNodeForField = exports.areImplicitFieldSchemaEqual = exports.areFieldSchemaEqual = exports.normalizeFieldSchema = exports.FieldSchemaAlpha = exports.FieldSchema = exports.FieldKind = exports.getShouldIncrementallySummarizeAllowedTypes = exports.incrementalSummaryHint = exports.KeyEncodingOptions = exports.schemaStatics = exports.getIdentifierFromNode = exports.allowUnused = exports.replaceVerboseTreeHandles = exports.replaceHandles = exports.replaceConciseTreeHandles = exports.generateSchemaFromSimpleSchema = exports.rollback = exports.tryStoredSchemaAsArray = exports.customFromCursorStored = exports.asTreeViewAlpha = void 0;
9
+ exports.decodeSimpleSchema = exports.encodeSimpleSchema = void 0;
9
10
  var index_js_1 = require("./core/index.js");
10
11
  Object.defineProperty(exports, "typeNameSymbol", { enumerable: true, get: function () { return index_js_1.typeNameSymbol; } });
11
12
  Object.defineProperty(exports, "typeSchemaSymbol", { enumerable: true, get: function () { return index_js_1.typeSchemaSymbol; } });
@@ -116,4 +117,7 @@ Object.defineProperty(exports, "stringSchema", { enumerable: true, get: function
116
117
  Object.defineProperty(exports, "booleanSchema", { enumerable: true, get: function () { return leafNodeSchema_js_1.booleanSchema; } });
117
118
  Object.defineProperty(exports, "handleSchema", { enumerable: true, get: function () { return leafNodeSchema_js_1.handleSchema; } });
118
119
  Object.defineProperty(exports, "nullSchema", { enumerable: true, get: function () { return leafNodeSchema_js_1.nullSchema; } });
120
+ var index_js_4 = require("./api/index.js");
121
+ Object.defineProperty(exports, "encodeSimpleSchema", { enumerable: true, get: function () { return index_js_4.encodeSimpleSchema; } });
122
+ Object.defineProperty(exports, "decodeSimpleSchema", { enumerable: true, get: function () { return index_js_4.decodeSimpleSchema; } });
119
123
  //# sourceMappingURL=index.js.map